From 4cd111df4ed29ae9dad3a8ebb5044a5b20363b01 Mon Sep 17 00:00:00 2001 From: Stefan Binder Date: Sat, 11 Nov 2023 10:01:47 +0100 Subject: [PATCH] MAINT: Bump version to 0.8.2 --- dash_vega_components/async-Vega.js | 2 +- dash_vega_components/async-Vega.js.map | 2 +- dash_vega_components/dash_vega_components.min.js | 2 +- dash_vega_components/dash_vega_components.min.js.map | 2 +- dash_vega_components/package-info.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dash_vega_components/async-Vega.js b/dash_vega_components/async-Vega.js index 8f11113..0b62d36 100644 --- a/dash_vega_components/async-Vega.js +++ b/dash_vega_components/async-Vega.js @@ -1,3 +1,3 @@ /*! For license information please see async-Vega.js.LICENSE.txt */ -(self.webpackChunkdash_vega_components=self.webpackChunkdash_vega_components||[]).push([[736],{90:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>x6});var i={};n.r(i),n.d(i,{JsonPatchError:()=>U,_areEquals:()=>Z,applyOperation:()=>V,applyPatch:()=>Y,applyReducer:()=>X,deepClone:()=>q,getValueByPointer:()=>G,validate:()=>Q,validator:()=>J});var r={};n.r(r),n.d(r,{compare:()=>ae,generate:()=>re,observe:()=>ie,unobserve:()=>ne});var o={};n.r(o),n.d(o,{aggregate:()=>Jl,bin:()=>Ql,collect:()=>Kl,compare:()=>eu,countpattern:()=>nu,cross:()=>iu,density:()=>su,dotbin:()=>du,expression:()=>hu,extent:()=>mu,facet:()=>yu,field:()=>vu,filter:()=>xu,flatten:()=>_u,fold:()=>wu,formula:()=>ku,generate:()=>Eu,impute:()=>Du,joinaggregate:()=>Su,kde:()=>Mu,key:()=>Cu,load:()=>Ou,lookup:()=>Tu,multiextent:()=>zu,multivalues:()=>Pu,params:()=>Bu,pivot:()=>ju,prefacet:()=>Iu,project:()=>Uu,proxy:()=>qu,quantile:()=>Wu,relay:()=>Hu,sample:()=>Gu,sequence:()=>Vu,sieve:()=>Yu,subflow:()=>gu,timeunit:()=>Xu,tupleindex:()=>Qu,values:()=>Zu,window:()=>ic});var a={};n.r(a),n.d(a,{interpolate:()=>Cd,interpolateArray:()=>wd,interpolateBasis:()=>cd,interpolateBasisClosed:()=>fd,interpolateCubehelix:()=>Ep,interpolateCubehelixLong:()=>Ap,interpolateDate:()=>Ed,interpolateDiscrete:()=>Ch,interpolateHcl:()=>fp,interpolateHclLong:()=>dp,interpolateHsl:()=>Uh,interpolateHslLong:()=>qh,interpolateHue:()=>Fh,interpolateLab:()=>up,interpolateNumber:()=>Ad,interpolateNumberArray:()=>xd,interpolateObject:()=>$d,interpolateRgb:()=>gd,interpolateRgbBasis:()=>vd,interpolateRgbBasisClosed:()=>bd,interpolateRound:()=>Fd,interpolateString:()=>Md,interpolateTransformCss:()=>Ph,interpolateTransformSvg:()=>Lh,interpolateZoom:()=>jh,piecewise:()=>bh,quantize:()=>$p});var s={};n.r(s),n.d(s,{bound:()=>l_,identifier:()=>f_,mark:()=>d_,overlap:()=>h_,render:()=>x_,viewlayout:()=>I_});var l={};n.r(l),n.d(l,{axisticks:()=>q_,datajoin:()=>W_,encode:()=>G_,legendentries:()=>V_,linkpath:()=>Z_,pie:()=>iw,scale:()=>aw,sortitems:()=>cw,stack:()=>mw});var u={};n.r(u),n.d(u,{contour:()=>QA,geojson:()=>e$,geopath:()=>t$,geopoint:()=>n$,geoshape:()=>i$,graticule:()=>r$,heatmap:()=>o$,isocontour:()=>IA,kde2d:()=>YA,projection:()=>s$});var c={};n.r(c),n.d(c,{force:()=>nD});var f={};n.r(f),n.d(f,{nest:()=>aS,pack:()=>dS,partition:()=>pS,stratify:()=>mS,tree:()=>vS,treelinks:()=>bS,treemap:()=>wS});var d={};n.r(d),n.d(d,{label:()=>WS});var h={};n.r(h),n.d(h,{loess:()=>GS,regression:()=>YS});var p={};n.r(p),n.d(p,{voronoi:()=>EM});var m={};n.r(m),n.d(m,{wordcloud:()=>BM});var g={};n.r(g),n.d(g,{crossfilter:()=>GM,resolvefilter:()=>VM});var y={};n.r(y),n.d(y,{Bounds:()=>qg,CanvasHandler:()=>xb,CanvasRenderer:()=>Ab,DATE:()=>Ai,DAY:()=>$i,DAYOFYEAR:()=>Di,Dataflow:()=>ws,Debug:()=>Me,Error:()=>$e,EventStream:()=>ls,Gradient:()=>Vm,GroupItem:()=>Hg,HOURS:()=>Si,Handler:()=>nb,HybridHandler:()=>vx,HybridRenderer:()=>gx,Info:()=>Se,Item:()=>Wg,MILLISECONDS:()=>Fi,MINUTES:()=>Mi,MONTH:()=>ki,Marks:()=>jv,MultiPulse:()=>vs,None:()=>Ae,Operator:()=>os,Parameters:()=>ns,Pulse:()=>ps,QUARTER:()=>wi,RenderType:()=>wx,Renderer:()=>rb,ResourceLoader:()=>Gg,SECONDS:()=>Ci,SVGHandler:()=>Db,SVGRenderer:()=>Kb,SVGStringRenderer:()=>hx,Scenegraph:()=>Yv,TIME_UNITS:()=>Oi,Transform:()=>Es,View:()=>OT,WEEK:()=>Ei,Warn:()=>De,YEAR:()=>_i,accessor:()=>ue,accessorFields:()=>fe,accessorName:()=>ce,array:()=>nt,ascending:()=>st,bandwidthNRD:()=>js,bin:()=>Is,bootstrapCI:()=>Ws,boundClip:()=>Cx,boundContext:()=>hy,boundItem:()=>Iv,boundMark:()=>qv,boundStroke:()=>Xg,changeset:()=>es,clampRange:()=>it,codegenExpression:()=>AF,compare:()=>at,constant:()=>ft,cumulativeLogNormal:()=>ol,cumulativeNormal:()=>Ks,cumulativeUniform:()=>fl,dayofyear:()=>Bi,debounce:()=>dt,defaultLocale:()=>da,definition:()=>$s,densityLogNormal:()=>rl,densityNormal:()=>Zs,densityUniform:()=>cl,domChild:()=>Zv,domClear:()=>Kv,domCreate:()=>Jv,domFind:()=>Qv,dotbin:()=>Hs,error:()=>me,expressionFunction:()=>FN,extend:()=>ht,extent:()=>pt,extentIndex:()=>mt,falsy:()=>ke,fastmap:()=>bt,field:()=>ye,flush:()=>xt,font:()=>Ov,fontFamily:()=>Fv,fontSize:()=>$v,format:()=>Ra,formatLocale:()=>ra,formats:()=>Pa,hasOwnProperty:()=>yt,id:()=>ve,identity:()=>be,inferType:()=>Ma,inferTypes:()=>Ca,ingest:()=>Ya,inherits:()=>_t,inrange:()=>wt,interpolate:()=>gm,interpolateColors:()=>hm,interpolateRange:()=>dm,intersect:()=>Ax,intersectBoxLine:()=>Ey,intersectPath:()=>xy,intersectPoint:()=>_y,intersectRule:()=>ky,isArray:()=>Fe,isBoolean:()=>kt,isDate:()=>Et,isFunction:()=>rt,isIterable:()=>At,isNumber:()=>$t,isObject:()=>Oe,isRegExp:()=>Dt,isString:()=>St,isTuple:()=>Ha,key:()=>Mt,lerp:()=>Ct,lineHeight:()=>Dv,loader:()=>ja,locale:()=>fa,logger:()=>Ce,lruCache:()=>Ot,markup:()=>Hb,merge:()=>Nt,mergeConfig:()=>Te,multiLineOffset:()=>Mv,one:()=>_e,pad:()=>zt,panLinear:()=>He,panLog:()=>Ge,panPow:()=>Ve,panSymlog:()=>Ye,parse:()=>sB,parseExpression:()=>wF,parseSelector:()=>JT,path:()=>sf,pathCurves:()=>Xm,pathEqual:()=>Nx,pathParse:()=>tg,pathRectangle:()=>Ag,pathRender:()=>dg,pathSymbols:()=>gg,pathTrail:()=>$g,peek:()=>Pe,point:()=>tb,projection:()=>MA,quantileLogNormal:()=>al,quantileNormal:()=>el,quantileUniform:()=>dl,quantiles:()=>Ls,quantizeInterpolator:()=>pm,quarter:()=>et,quartiles:()=>Bs,random:()=>Us,randomInteger:()=>Vs,randomKDE:()=>nl,randomLCG:()=>Gs,randomLogNormal:()=>sl,randomMixture:()=>ll,randomNormal:()=>tl,randomUniform:()=>hl,read:()=>Ba,regressionConstant:()=>pl,regressionExp:()=>_l,regressionLinear:()=>bl,regressionLoess:()=>Sl,regressionLog:()=>xl,regressionPoly:()=>El,regressionPow:()=>wl,regressionQuad:()=>kl,renderModule:()=>Ex,repeat:()=>Tt,resetDefaultLocale:()=>ha,resetSVGClipId:()=>Ig,resetSVGDefIds:()=>Tx,responseType:()=>La,runtimeContext:()=>IN,sampleCurve:()=>Ol,sampleLogNormal:()=>il,sampleNormal:()=>Qs,sampleUniform:()=>ul,scale:()=>nm,sceneEqual:()=>Ox,sceneFromJSON:()=>Gv,scenePickVisit:()=>zy,sceneToJSON:()=>Hv,sceneVisit:()=>Ty,sceneZOrder:()=>Ny,scheme:()=>xm,serializeXML:()=>Gb,setHybridRendererOptions:()=>mx,setRandom:()=>qs,span:()=>Rt,splitAccessPath:()=>ge,stringValue:()=>Pt,textMetrics:()=>xv,timeBin:()=>Er,timeFloor:()=>tr,timeFormatLocale:()=>ua,timeInterval:()=>sr,timeOffset:()=>cr,timeSequence:()=>hr,timeUnitSpecifier:()=>Ri,timeUnits:()=>Ti,toBoolean:()=>Lt,toDate:()=>jt,toNumber:()=>Le,toSet:()=>Ut,toString:()=>It,transform:()=>Ds,transforms:()=>As,truncate:()=>qt,truthy:()=>we,tupleid:()=>Ga,typeParsers:()=>$a,utcFloor:()=>rr,utcInterval:()=>lr,utcOffset:()=>fr,utcSequence:()=>pr,utcdayofyear:()=>Hi,utcquarter:()=>tt,utcweek:()=>Gi,version:()=>lB,visitArray:()=>Wt,week:()=>ji,writeConfig:()=>ze,zero:()=>xe,zoomLinear:()=>Je,zoomLog:()=>Qe,zoomPow:()=>Ze,zoomSymlog:()=>Ke});var v={};n.r(v),n.d(v,{accessPathDepth:()=>ij,accessPathWithDatum:()=>QB,compile:()=>C0,contains:()=>FB,deepEqual:()=>hj,deleteNestedProperty:()=>XB,duplicate:()=>AB,entries:()=>HB,every:()=>NB,fieldIntersection:()=>IB,flatAccessWithDatum:()=>ZB,getFirstDefined:()=>rj,hasIntersection:()=>BB,hash:()=>MB,internalField:()=>lj,isBoolean:()=>GB,isEmpty:()=>UB,isEqual:()=>PB,isInternalField:()=>uj,isNullOrFalse:()=>CB,isNumeric:()=>fj,keys:()=>qB,logicalExpr:()=>YB,mergeDeep:()=>TB,never:()=>$B,normalize:()=>eX,normalizeAngle:()=>cj,omit:()=>SB,pick:()=>DB,prefixGenerator:()=>jB,removePathFromField:()=>nj,replaceAll:()=>tj,replacePathInField:()=>ej,resetIdCounter:()=>sj,setEqual:()=>LB,some:()=>OB,stringify:()=>pj,titleCase:()=>JB,unique:()=>RB,uniqueId:()=>aj,vals:()=>WB,varName:()=>VB,version:()=>F0});var b={};n.r(b),n.d(b,{carbong10:()=>C1,carbong100:()=>O1,carbong90:()=>F1,carbonwhite:()=>M1,dark:()=>z0,excel:()=>P0,fivethirtyeight:()=>U0,ggplot2:()=>W0,googlecharts:()=>f1,latimes:()=>J0,powerbi:()=>E1,quartz:()=>K0,urbaninstitute:()=>s1,version:()=>N1,vox:()=>t1});var x=n(196),_=n.n(x),w=n(64),k=n.n(w);const E={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let A;const $=new Uint8Array(16);function D(){if(!A&&(A="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!A))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return A($)}const S=[];for(let e=0;e<256;++e)S.push((e+256).toString(16).slice(1));const M=function(e,t,n){if(E.randomUUID&&!t&&!e)return E.randomUUID();const i=(e=e||{}).random||(e.rng||D)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=i[e];return t}return function(e,t=0){return S[e[t+0]]+S[e[t+1]]+S[e[t+2]]+S[e[t+3]]+"-"+S[e[t+4]]+S[e[t+5]]+"-"+S[e[t+6]]+S[e[t+7]]+"-"+S[e[t+8]]+S[e[t+9]]+"-"+S[e[t+10]]+S[e[t+11]]+S[e[t+12]]+S[e[t+13]]+S[e[t+14]]+S[e[t+15]]}(i)};var C,F=(C=function(e,t){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},C(e,t)},function(e,t){function n(){this.constructor=e}C(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),O=Object.prototype.hasOwnProperty;function N(e,t){return O.call(e,t)}function T(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=48&&t<=57))return!1;n++}return!0}function P(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function L(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function B(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t0&&"constructor"==s[u-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===f&&(void 0===l[d]?f=s.slice(0,u).join("/"):u==c-1&&(f=t.path),void 0!==f&&h(t,0,e,f)),u++,Array.isArray(l)){if("-"===d)d=l.length;else{if(n&&!R(d))throw new U("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,t,e);R(d)&&(d=~~d)}if(u>=c){if(n&&"add"===t.op&&d>l.length)throw new U("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);if(!1===(a=H[t.op].call(t,l,d,e)).test)throw new U("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(u>=c){if(!1===(a=W[t.op].call(t,l,d,e)).test)throw new U("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[d],n&&u0)throw new U('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new U("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new U("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&B(e.value))throw new U("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var r=e.path.split("/").length,o=i.split("/").length;if(r!==o+1&&r!==o)throw new U("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==i)throw new U("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var a=Q([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new U("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function Q(e,t,n){try{if(!Array.isArray(e))throw new U("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Y(z(t),z(e),n||!0);else{n=n||J;for(var i=0;i0&&(e.patches=[],e.callback&&e.callback(i)),i}function oe(e,t,n,i,r){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=T(t),a=T(e),s=!1,l=a.length-1;l>=0;l--){var u=e[f=a[l]];if(!N(t,f)||void 0===t[f]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:i+"/"+P(f),value:z(u)}),n.push({op:"remove",path:i+"/"+P(f)}),s=!0):(r&&n.push({op:"test",path:i,value:e}),n.push({op:"replace",path:i,value:t}));else{var c=t[f];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?oe(u,c,n,i+"/"+P(f),r):u!==c&&(r&&n.push({op:"test",path:i+"/"+P(f),value:z(u)}),n.push({op:"replace",path:i+"/"+P(f),value:z(c)}))}}if(s||o.length!=a.length)for(l=0;lfunction(t){return t[e]},pe=e=>{const t=e.length;return function(n){for(let i=0;ii&&u(),s=i=r+1):"]"===o&&(s||me("Access path missing open bracket: "+e),s>0&&u(),s=0,i=r+1):r>i?u():i=r+1}return s&&me("Access path missing closing bracket: "+e),a&&me("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function ye(e,t,n){const i=ge(e);return e=1===i.length?i[0]:e,ue((n&&n.get||de)(i),[e],t||e)}const ve=ye("id"),be=ue((e=>e),[],"identity"),xe=ue((()=>0),[],"zero"),_e=ue((()=>1),[],"one"),we=ue((()=>!0),[],"true"),ke=ue((()=>!1),[],"false");function Ee(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const Ae=0,$e=1,De=2,Se=3,Me=4;function Ce(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ee,i=e||Ae;return{level(e){return arguments.length?(i=+e,this):i},error(){return i>=$e&&n(t||"error","ERROR",arguments),this},warn(){return i>=De&&n(t||"warn","WARN",arguments),this},info(){return i>=Se&&n(t||"log","INFO",arguments),this},debug(){return i>=Me&&n(t||"log","DEBUG",arguments),this}}}var Fe=Array.isArray;function Oe(e){return e===Object(e)}const Ne=e=>"__proto__"!==e;function Te(){for(var e=arguments.length,t=new Array(e),n=0;n{for(const n in t)if("signals"===n)e.signals=Re(e.signals,t.signals);else{const i="legend"===n?{layout:1}:"style"===n||null;ze(e,n,t[n],i)}return e}),{})}function ze(e,t,n,i){if(!Ne(t))return;let r,o;if(Oe(n)&&!Fe(n))for(r in o=Oe(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?ze(o,r,n[r]):Ne(r)&&(o[r]=n[r]);else e[t]=n}function Re(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function Pe(e){return e[e.length-1]}function Le(e){return null==e||""===e?null:+e}const Be=e=>t=>e*Math.exp(t),je=e=>t=>Math.log(e*t),Ie=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),Ue=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,qe=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function We(e,t,n,i){const r=n(e[0]),o=n(Pe(e)),a=(o-r)*t;return[i(r-a),i(o-a)]}function He(e,t){return We(e,t,Le,be)}function Ge(e,t){var n=Math.sign(e[0]);return We(e,t,je(n),Be(n))}function Ve(e,t,n){return We(e,t,qe(n),qe(1/n))}function Ye(e,t,n){return We(e,t,Ie(n),Ue(n))}function Xe(e,t,n,i,r){const o=i(e[0]),a=i(Pe(e)),s=null!=t?i(t):(o+a)/2;return[r(s+(o-s)*n),r(s+(a-s)*n)]}function Je(e,t,n){return Xe(e,t,n,Le,be)}function Qe(e,t,n){const i=Math.sign(e[0]);return Xe(e,t,n,je(i),Be(i))}function Ze(e,t,n,i){return Xe(e,t,n,qe(i),qe(1/i))}function Ke(e,t,n,i){return Xe(e,t,n,Ie(i),Ue(i))}function et(e){return 1+~~(new Date(e).getMonth()/3)}function tt(e){return 1+~~(new Date(e).getUTCMonth()/3)}function nt(e){return null!=e?Fe(e)?e:[e]:[]}function it(e,t,n){let i,r=e[0],o=e[1];return o=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-i),r+i]}function rt(e){return"function"==typeof e}const ot="descending";function at(e,t,n){n=n||{},t=nt(t)||[];const i=[],r=[],o={},a=n.comparator||lt;return nt(e).forEach(((e,a)=>{null!=e&&(i.push(t[a]===ot?-1:1),r.push(e=rt(e)?e:ye(e,null,n)),(fe(e)||[]).forEach((e=>o[e]=1)))})),0===r.length?null:ue(a(r,i),Object.keys(o))}const st=(e,t)=>(et||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0),lt=(e,t)=>1===e.length?ut(e[0],t[0]):ct(e,t,e.length),ut=(e,t)=>function(n,i){return st(e(n),e(i))*t},ct=(e,t,n)=>(t.push(0),function(i,r){let o,a=0,s=-1;for(;0===a&&++se}function dt(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout((()=>(t(i),n=null)),e)}}function ht(e){for(let t,n,i=1,r=arguments.length;io&&(o=i))}else{for(i=t(e[a]);ao&&(o=i))}return[r,o]}function mt(e,t){const n=e.length;let i,r,o,a,s,l=-1;if(null==t){for(;++l=r){i=o=r;break}if(l===n)return[-1,-1];for(a=s=l;++lr&&(i=r,a=l),o=r){i=o=r;break}if(l===n)return[-1,-1];for(a=s=l;++lr&&(i=r,a=l),oi(e)?n[e]:void 0,set(e,t){return i(e)||(++r.size,n[e]===vt&&--r.empty),n[e]=t,this},delete(e){return i(e)&&(--r.size,++r.empty,n[e]=vt),this},clear(){r.size=r.empty=0,r.object=n={}},test(e){return arguments.length?(t=e,r):t},clean(){const e={};let i=0;for(const r in n){const o=n[r];o===vt||t&&t(o)||(e[r]=o,++i)}r.size=i,r.empty=0,r.object=n=e}};return e&&Object.keys(e).forEach((t=>{r.set(t,e[t])})),r}function xt(e,t,n,i,r,o){if(!n&&0!==n)return o;const a=+n;let s,l=e[0],u=Pe(e);ua&&(r=o,o=a,a=r),i=void 0===i||i,((n=void 0===n||n)?o<=e:oe.replace(/\\(.)/g,"$1"))):nt(e));const i=e&&e.length,r=n&&n.get||de,o=e=>r(t?[e]:ge(e));let a;if(i)if(1===i){const t=o(e[0]);a=function(e){return""+t(e)}}else{const t=e.map(o);a=function(e){let n=""+t[0](e),r=0;for(;++r{t={},n={},i=0},o=(r,o)=>(++i>e&&(n=t,t={},i=1),t[r]=o);return r(),{clear:r,has:e=>yt(t,e)||yt(n,e),get:e=>yt(t,e)?t[e]:yt(n,e)?o(e,n[e]):void 0,set:(e,n)=>yt(t,e)?t[e]=n:o(e,n)}}function Nt(e,t,n,i){const r=t.length,o=n.length;if(!o)return t;if(!r)return n;const a=i||new t.constructor(r+o);let s=0,l=0,u=0;for(;s0?n[l++]:t[s++];for(;s=0;)n+=e;return n}function zt(e,t,n,i){const r=n||" ",o=e+"",a=t-o.length;return a<=0?o:"left"===i?Tt(r,a)+o:"center"===i?Tt(r,~~(a/2))+o+Tt(r,Math.ceil(a/2)):o+Tt(r,a)}function Rt(e){return e&&Pe(e)-e[0]||0}function Pt(e){return Fe(e)?"["+e.map(Pt)+"]":Oe(e)||St(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function Lt(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e||!e)}const Bt=e=>$t(e)||Et(e)?e:Date.parse(e);function jt(e,t){return t=t||Bt,null==e||""===e?null:t(e)}function It(e){return null==e||""===e?null:e+""}function Ut(e){const t={},n=e.length;for(let i=0;i=o?l=!0:(i=e.charCodeAt(a++))===Yt?u=!0:i===Xt&&(u=!0,e.charCodeAt(a)===Yt&&++a),e.slice(r+1,t-1).replace(/""/g,'"')}for(;a9999?"+"+Zt(t,6):Zt(t,4))+"-"+Zt(e.getUTCMonth()+1,2)+"-"+Zt(e.getUTCDate(),2)+(o?"T"+Zt(n,2)+":"+Zt(i,2)+":"+Zt(r,2)+"."+Zt(o,3)+"Z":r?"T"+Zt(n,2)+":"+Zt(i,2)+":"+Zt(r,2)+"Z":i||n?"T"+Zt(n,2)+":"+Zt(i,2)+"Z":"")}(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,r,o=i(e,(function(e,i){if(n)return n(e,i-1);r=e,n=t?function(e,t){var n=Jt(e);return function(i,r){return t(n(i),r,e)}}(e,t):Jt(e)}));return o.columns=r||[],o},parseRows:i,format:function(t,n){return null==n&&(n=Qt(t)),[n.map(a).join(e)].concat(r(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=Qt(e)),r(e,t).join("\n")},formatRows:function(e){return e.map(o).join("\n")},formatRow:o,formatValue:a}}function en(e){return e}function tn(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return nn(e,t)}))}:nn(e,t)}function nn(e,t){var n=t.id,i=t.bbox,r=null==t.properties?{}:t.properties,o=rn(e,t);return null==n&&null==i?{type:"Feature",properties:r,geometry:o}:null==i?{type:"Feature",id:n,properties:r,geometry:o}:{type:"Feature",id:n,bbox:i,properties:r,geometry:o}}function rn(e,t){var n=function(e){if(null==e)return en;var t,n,i=e.scale[0],r=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var l=2,u=e.length,c=new Array(u);for(c[0]=(t+=e[0])*i+o,c[1]=(n+=e[1])*r+a;l1)i=function(e,t,n){var i,r=[],o=[];function a(e){var t=e<0?~e:e;(o[t]||(o[t]=[])).push({i:e,g:i})}function s(e){e.forEach(a)}function l(e){e.forEach(s)}return function e(t){switch(i=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(l)}(t.arcs)}}(t),o.forEach(null==n?function(e){r.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&r.push(e[0].i)}),r}(0,t,n);else for(r=0,i=new Array(o=e.arcs.length);r=ln?10:o>=un?5:o>=cn?2:1;let s,l,u;return r<0?(u=Math.pow(10,-r)/a,s=Math.round(e*u),l=Math.round(t*u),s/ut&&--l,u=-u):(u=Math.pow(10,r)*a,s=Math.round(e/u),l=Math.round(t/u),s*ut&&--l),l0))return[];if((e=+e)==(t=+t))return[e];const i=t=r))return[];const s=o-r+1,l=new Array(s);if(i)if(a<0)for(let e=0;e=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function yn(e){if(!(t=gn.exec(e)))throw new Error("invalid format: "+e);var t;return new vn({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function vn(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function bn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function xn(e){return(e=bn(Math.abs(e)))?e[1]:NaN}function _n(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(xn(t)/3)))-xn(Math.abs(e)))}function wn(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,xn(t)-xn(e))+1}function kn(e){return Math.max(0,-xn(Math.abs(e)))}function En(e,t){var n=bn(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}yn.prototype=vn.prototype,vn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const An={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>En(100*e,t),r:En,s:function(e,t){var n=bn(e,t);if(!n)return e+"";var i=n[0],r=n[1],o=r-(mn=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+bn(e,Math.max(0,t+o-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function $n(e){return e}var Dn,Sn,Mn,Cn=Array.prototype.map,Fn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function On(e){var t,n,i=void 0===e.grouping||void 0===e.thousands?$n:(t=Cn.call(e.grouping,Number),n=e.thousands+"",function(e,i){for(var r=e.length,o=[],a=0,s=t[0],l=0;r>0&&s>0&&(l+s+1>i&&(s=Math.max(1,i-l)),o.push(e.substring(r-=s,r+s)),!((l+=s+1)>i));)s=t[a=(a+1)%t.length];return o.reverse().join(n)}),r=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?$n:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(Cn.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function f(e){var t=(e=yn(e)).fill,n=e.align,f=e.sign,d=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,y=e.trim,v=e.type;"n"===v?(m=!0,v="g"):An[v]||(void 0===g&&(g=12),y=!0,v="g"),(h||"0"===t&&"="===n)&&(h=!0,t="0",n="=");var b="$"===d?r:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===d?o:/[%p]/.test(v)?l:"",_=An[v],w=/[defgprs%]/.test(v);function k(e){var r,o,l,d=b,k=x;if("c"===v)k=_(e)+k,e="";else{var E=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:_(Math.abs(e),g),y&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),E&&0==+e&&"+"!==f&&(E=!1),d=(E?"("===f?f:u:"-"===f||"("===f?"":f)+d,k=("s"===v?Fn[8+mn/3]:"")+k+(E&&"("===f?")":""),w)for(r=-1,o=e.length;++r(l=e.charCodeAt(r))||l>57){k=(46===l?a+e.slice(r+1):e.slice(r))+k,e=e.slice(0,r);break}}m&&!h&&(e=i(e,1/0));var A=d.length+e.length+k.length,$=A>1)+d+e+k+$.slice(A);break;default:e=$+d+e+k}return s(e)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return e+""},k}return{format:f,formatPrefix:function(e,t){var n=f(((e=yn(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(xn(t)/3))),r=Math.pow(10,-i),o=Fn[8+i/3];return function(e){return n(r*e)+o}}}}Dn=On({thousands:",",grouping:[3],currency:["$",""]}),Sn=Dn.format,Mn=Dn.formatPrefix;const Nn=new Date,Tn=new Date;function zn(e,t,n,i){function r(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return r.floor=t=>(e(t=new Date(+t)),t),r.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),r.round=e=>{const t=r(e),n=r.ceil(e);return e-t(t(e=new Date(+e),null==n?1:Math.floor(n)),e),r.range=(n,i,o)=>{const a=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n0))return a;let s;do{a.push(s=new Date(+n)),t(n,o),e(n)}while(szn((t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)}),((e,i)=>{if(e>=e)if(i<0)for(;++i<=0;)for(;t(e,-1),!n(e););else for(;--i>=0;)for(;t(e,1),!n(e););})),n&&(r.count=(t,i)=>(Nn.setTime(+t),Tn.setTime(+i),e(Nn),e(Tn),Math.floor(n(Nn,Tn))),r.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?r.filter(i?t=>i(t)%e==0:t=>r.count(0,t)%e==0):r:null)),r}const Rn=1e3,Pn=6e4,Ln=36e5,Bn=864e5,jn=6048e5,In=31536e6,Un=zn((e=>e.setHours(0,0,0,0)),((e,t)=>e.setDate(e.getDate()+t)),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Pn)/Bn),(e=>e.getDate()-1)),qn=(Un.range,zn((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Bn),(e=>e.getUTCDate()-1))),Wn=(qn.range,zn((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Bn),(e=>Math.floor(e/Bn))));function Hn(e){return zn((t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),((e,t)=>{e.setDate(e.getDate()+7*t)}),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Pn)/jn))}Wn.range;const Gn=Hn(0),Vn=Hn(1),Yn=Hn(2),Xn=Hn(3),Jn=Hn(4),Qn=Hn(5),Zn=Hn(6);function Kn(e){return zn((t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)}),((e,t)=>(t-e)/jn))}Gn.range,Vn.range,Yn.range,Xn.range,Jn.range,Qn.range,Zn.range;const ei=Kn(0),ti=Kn(1),ni=Kn(2),ii=Kn(3),ri=Kn(4),oi=Kn(5),ai=Kn(6),si=(ei.range,ti.range,ni.range,ii.range,ri.range,oi.range,ai.range,zn((e=>{e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,t)=>{e.setFullYear(e.getFullYear()+t)}),((e,t)=>t.getFullYear()-e.getFullYear()),(e=>e.getFullYear())));si.every=e=>isFinite(e=Math.floor(e))&&e>0?zn((t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n*e)})):null,si.range;const li=zn((e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)}),((e,t)=>t.getUTCFullYear()-e.getUTCFullYear()),(e=>e.getUTCFullYear()));li.every=e=>isFinite(e=Math.floor(e))&&e>0?zn((t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null,li.range;const ui=zn((e=>{e.setDate(1),e.setHours(0,0,0,0)}),((e,t)=>{e.setMonth(e.getMonth()+t)}),((e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())),(e=>e.getMonth())),ci=(ui.range,zn((e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)}),((e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())),(e=>e.getUTCMonth()))),fi=(ci.range,zn((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Rn-e.getMinutes()*Pn)}),((e,t)=>{e.setTime(+e+t*Ln)}),((e,t)=>(t-e)/Ln),(e=>e.getHours()))),di=(fi.range,zn((e=>{e.setUTCMinutes(0,0,0)}),((e,t)=>{e.setTime(+e+t*Ln)}),((e,t)=>(t-e)/Ln),(e=>e.getUTCHours()))),hi=(di.range,zn((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Rn)}),((e,t)=>{e.setTime(+e+t*Pn)}),((e,t)=>(t-e)/Pn),(e=>e.getMinutes()))),pi=(hi.range,zn((e=>{e.setUTCSeconds(0,0)}),((e,t)=>{e.setTime(+e+t*Pn)}),((e,t)=>(t-e)/Pn),(e=>e.getUTCMinutes()))),mi=(pi.range,zn((e=>{e.setTime(e-e.getMilliseconds())}),((e,t)=>{e.setTime(+e+t*Rn)}),((e,t)=>(t-e)/Rn),(e=>e.getUTCSeconds()))),gi=(mi.range,zn((()=>{}),((e,t)=>{e.setTime(+e+t)}),((e,t)=>t-e)));function yi(e,t){return null==e||null==t?NaN:et?1:e>=t?0:NaN}function vi(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function bi(e){let t,n,i;function r(e,i,r=0,o=e.length){if(r>>1;n(e[t],i)<0?r=t+1:o=t}while(ryi(e(t),n),i=(t,n)=>e(t)-n):(t=e===yi||e===vi?e:xi,n=e,i=e),{left:r,center:function(e,t,n=0,o=e.length){const a=r(e,t,n,o-1);return a>n&&i(e[a-1],t)>-i(e[a],t)?a-1:a},right:function(e,i,r=0,o=e.length){if(r>>1;n(e[t],i)<=0?r=t+1:o=t}while(r(e=Math.floor(e),isFinite(e)&&e>0?e>1?zn((t=>{t.setTime(Math.floor(t/e)*e)}),((t,n)=>{t.setTime(+t+n*e)}),((t,n)=>(n-t)/e)):gi:null),gi.range;const _i="year",wi="quarter",ki="month",Ei="week",Ai="date",$i="day",Di="dayofyear",Si="hours",Mi="minutes",Ci="seconds",Fi="milliseconds",Oi=[_i,wi,ki,Ei,Ai,$i,Di,Si,Mi,Ci,Fi],Ni=Oi.reduce(((e,t,n)=>(e[t]=1+n,e)),{});function Ti(e){const t=nt(e).slice(),n={};return t.length||me("Missing time unit."),t.forEach((e=>{yt(Ni,e)?n[e]=1:me(`Invalid time unit: ${e}.`)})),(n[Ei]||n[$i]?1:0)+(n[wi]||n[ki]||n[Ai]?1:0)+(n[Di]?1:0)>1&&me(`Incompatible time units: ${e}`),t.sort(((e,t)=>Ni[e]-Ni[t])),t}const zi={[_i]:"%Y ",[wi]:"Q%q ",[ki]:"%b ",[Ai]:"%d ",[Ei]:"W%U ",[$i]:"%a ",[Di]:"%j ",[Si]:"%H:00",[Mi]:"00:%M",[Ci]:":%S",[Fi]:".%L",[`${_i}-${ki}`]:"%Y-%m ",[`${_i}-${ki}-${Ai}`]:"%Y-%m-%d ",[`${Si}-${Mi}`]:"%H:%M"};function Ri(e,t){const n=ht({},zi,t),i=Ti(e),r=i.length;let o,a,s="",l=0;for(l=0;ll;--o)if(a=i.slice(l,o).join("-"),null!=n[a]){s+=n[a],l=o;break}return s.trim()}const Pi=new Date;function Li(e){return Pi.setFullYear(e),Pi.setMonth(0),Pi.setDate(1),Pi.setHours(0,0,0,0),Pi}function Bi(e){return Ii(new Date(e))}function ji(e){return Ui(new Date(e))}function Ii(e){return Un.count(Li(e.getFullYear())-1,e)}function Ui(e){return Gn.count(Li(e.getFullYear())-1,e)}function qi(e){return Li(e).getDay()}function Wi(e,t,n,i,r,o,a){if(0<=e&&e<100){const s=new Date(-1,t,n,i,r,o,a);return s.setFullYear(e),s}return new Date(e,t,n,i,r,o,a)}function Hi(e){return Vi(new Date(e))}function Gi(e){return Yi(new Date(e))}function Vi(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return qn.count(t-1,e)}function Yi(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return ei.count(t-1,e)}function Xi(e){return Pi.setTime(Date.UTC(e,0,1)),Pi.getUTCDay()}function Ji(e,t,n,i,r,o,a){if(0<=e&&e<100){const e=new Date(Date.UTC(-1,t,n,i,r,o,a));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,i,r,o,a))}function Qi(e,t,n,i,r){const o=t||1,a=Pe(e),s=(e,t,r)=>function(e,t,n,i){const r=n<=1?e:i?(t,r)=>i+n*Math.floor((e(t,r)-i)/n):(t,i)=>n*Math.floor(e(t,i)/n);return t?(e,n)=>t(r(e,n),n):r}(n[r=r||e],i[r],e===a&&o,t),l=new Date,u=Ut(e),c=u[_i]?s(_i):ft(2012),f=u[ki]?s(ki):u[wi]?s(wi):xe,d=u[Ei]&&u[$i]?s($i,1,Ei+$i):u[Ei]?s(Ei,1):u[$i]?s($i,1):u[Ai]?s(Ai,1):u[Di]?s(Di,1):_e,h=u[Si]?s(Si):xe,p=u[Mi]?s(Mi):xe,m=u[Ci]?s(Ci):xe,g=u[Fi]?s(Fi):xe;return function(e){l.setTime(+e);const t=c(l);return r(t,f(l),d(l,t),h(l),p(l),m(l),g(l))}}function Zi(e,t,n){return t+7*e-(n+6)%7}const Ki={[_i]:e=>e.getFullYear(),[wi]:e=>Math.floor(e.getMonth()/3),[ki]:e=>e.getMonth(),[Ai]:e=>e.getDate(),[Si]:e=>e.getHours(),[Mi]:e=>e.getMinutes(),[Ci]:e=>e.getSeconds(),[Fi]:e=>e.getMilliseconds(),[Di]:e=>Ii(e),[Ei]:e=>Ui(e),[Ei+$i]:(e,t)=>Zi(Ui(e),e.getDay(),qi(t)),[$i]:(e,t)=>Zi(1,e.getDay(),qi(t))},er={[wi]:e=>3*e,[Ei]:(e,t)=>Zi(e,0,qi(t))};function tr(e,t){return Qi(e,t||1,Ki,er,Wi)}const nr={[_i]:e=>e.getUTCFullYear(),[wi]:e=>Math.floor(e.getUTCMonth()/3),[ki]:e=>e.getUTCMonth(),[Ai]:e=>e.getUTCDate(),[Si]:e=>e.getUTCHours(),[Mi]:e=>e.getUTCMinutes(),[Ci]:e=>e.getUTCSeconds(),[Fi]:e=>e.getUTCMilliseconds(),[Di]:e=>Vi(e),[Ei]:e=>Yi(e),[$i]:(e,t)=>Zi(1,e.getUTCDay(),Xi(t)),[Ei+$i]:(e,t)=>Zi(Yi(e),e.getUTCDay(),Xi(t))},ir={[wi]:e=>3*e,[Ei]:(e,t)=>Zi(e,0,Xi(t))};function rr(e,t){return Qi(e,t||1,nr,ir,Ji)}const or={[_i]:si,[wi]:ui.every(3),[ki]:ui,[Ei]:Gn,[Ai]:Un,[$i]:Un,[Di]:Un,[Si]:fi,[Mi]:hi,[Ci]:mi,[Fi]:gi},ar={[_i]:li,[wi]:ci.every(3),[ki]:ci,[Ei]:ei,[Ai]:qn,[$i]:qn,[Di]:qn,[Si]:di,[Mi]:pi,[Ci]:mi,[Fi]:gi};function sr(e){return or[e]}function lr(e){return ar[e]}function ur(e,t,n){return e?e.offset(t,n):void 0}function cr(e,t,n){return ur(sr(e),t,n)}function fr(e,t,n){return ur(lr(e),t,n)}function dr(e,t,n,i){return e?e.range(t,n,i):void 0}function hr(e,t,n,i){return dr(sr(e),t,n,i)}function pr(e,t,n,i){return dr(lr(e),t,n,i)}const mr=31536e6,gr=[_i,ki,Ai,Si,Mi,Ci,Fi],yr=gr.slice(0,-1),vr=yr.slice(0,-1),br=vr.slice(0,-1),xr=br.slice(0,-1),_r=[_i,ki],wr=[_i],kr=[[yr,1,1e3],[yr,5,5e3],[yr,15,15e3],[yr,30,3e4],[vr,1,6e4],[vr,5,3e5],[vr,15,9e5],[vr,30,18e5],[br,1,36e5],[br,3,108e5],[br,6,216e5],[br,12,432e5],[xr,1,864e5],[[_i,Ei],1,6048e5],[_r,1,2592e6],[_r,3,7776e6],[wr,1,mr]];function Er(e){const t=e.extent,n=e.maxbins||40,i=Math.abs(Rt(t))/n;let r,o,a=bi((e=>e[2])).right(kr,i);return a===kr.length?(r=wr,o=pn(t[0]/mr,t[1]/mr,n)):a?(a=kr[i/kr[a-1][2]=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Jo,s:Qo,S:yo,u:vo,U:bo,V:_o,w:wo,W:ko,x:null,X:null,y:Eo,Y:$o,Z:So,"%":Xo},x={a:function(e){return a[e.getUTCDay()]},A:function(e){return o[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:Mo,e:Mo,f:To,g:Ho,G:Vo,H:Co,I:Fo,j:Oo,L:No,m:zo,M:Ro,p:function(e){return r[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Jo,s:Qo,S:Po,u:Lo,U:Bo,V:Io,w:Uo,W:qo,x:null,X:null,y:Wo,Y:Go,Z:Yo,"%":Xo},_={a:function(e,t,n){var i=h.exec(t.slice(n));return i?(e.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(e,t,n){var i=f.exec(t.slice(n));return i?(e.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(e,t,n){var i=y.exec(t.slice(n));return i?(e.m=v.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(e,t,n){var i=m.exec(t.slice(n));return i?(e.m=g.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(e,n,i){return E(e,t,n,i)},d:Zr,e:Zr,f:ro,g:Yr,G:Vr,H:eo,I:eo,j:Kr,L:io,m:Qr,M:to,p:function(e,t,n){var i=u.exec(t.slice(n));return i?(e.p=c.get(i[0].toLowerCase()),n+i[0].length):-1},q:Jr,Q:ao,s:so,S:no,u:qr,U:Wr,V:Hr,w:Ur,W:Gr,x:function(e,t,i){return E(e,n,t,i)},X:function(e,t,n){return E(e,i,t,n)},y:Yr,Y:Vr,Z:Xr,"%":oo};function w(e,t){return function(n){var i,r,o,a=[],s=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=$r(Dr(o.y,0,1))).getUTCDay(),i=r>4||0===r?ti.ceil(i):ti(i),i=qn.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=Ar(Dr(o.y,0,1))).getDay(),i=r>4||0===r?Vn.ceil(i):Vn(i),i=Un.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?$r(Dr(o.y,0,1)).getUTCDay():Ar(Dr(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,$r(o)):Ar(o)}}function E(e,t,n,i){for(var r,o,a=0,s=t.length,l=n.length;a=l)return-1;if(37===(r=t.charCodeAt(a++))){if(r=t.charAt(a++),!(o=_[r in Tr?t.charAt(a++):r])||(i=o(e,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return b.x=w(n,b),b.X=w(i,b),b.c=w(t,b),x.x=w(n,x),x.X=w(i,x),x.c=w(t,x),{format:function(e){var t=w(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=w(e+="",x);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}var Mr,Cr,Fr,Or,Nr,Tr={"-":"",_:" ",0:"0"},zr=/^\s*\d+/,Rr=/^%/,Pr=/[\\^$*+?|[\]().{}]/g;function Lr(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",o=r.length;return i+(o[e.toLowerCase(),t])))}function Ur(e,t,n){var i=zr.exec(t.slice(n,n+1));return i?(e.w=+i[0],n+i[0].length):-1}function qr(e,t,n){var i=zr.exec(t.slice(n,n+1));return i?(e.u=+i[0],n+i[0].length):-1}function Wr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.U=+i[0],n+i[0].length):-1}function Hr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.V=+i[0],n+i[0].length):-1}function Gr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.W=+i[0],n+i[0].length):-1}function Vr(e,t,n){var i=zr.exec(t.slice(n,n+4));return i?(e.y=+i[0],n+i[0].length):-1}function Yr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Xr(e,t,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function Jr(e,t,n){var i=zr.exec(t.slice(n,n+1));return i?(e.q=3*i[0]-3,n+i[0].length):-1}function Qr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function Zr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function Kr(e,t,n){var i=zr.exec(t.slice(n,n+3));return i?(e.m=0,e.d=+i[0],n+i[0].length):-1}function eo(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function to(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function no(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function io(e,t,n){var i=zr.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function ro(e,t,n){var i=zr.exec(t.slice(n,n+6));return i?(e.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function oo(e,t,n){var i=Rr.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function ao(e,t,n){var i=zr.exec(t.slice(n));return i?(e.Q=+i[0],n+i[0].length):-1}function so(e,t,n){var i=zr.exec(t.slice(n));return i?(e.s=+i[0],n+i[0].length):-1}function lo(e,t){return Lr(e.getDate(),t,2)}function uo(e,t){return Lr(e.getHours(),t,2)}function co(e,t){return Lr(e.getHours()%12||12,t,2)}function fo(e,t){return Lr(1+Un.count(si(e),e),t,3)}function ho(e,t){return Lr(e.getMilliseconds(),t,3)}function po(e,t){return ho(e,t)+"000"}function mo(e,t){return Lr(e.getMonth()+1,t,2)}function go(e,t){return Lr(e.getMinutes(),t,2)}function yo(e,t){return Lr(e.getSeconds(),t,2)}function vo(e){var t=e.getDay();return 0===t?7:t}function bo(e,t){return Lr(Gn.count(si(e)-1,e),t,2)}function xo(e){var t=e.getDay();return t>=4||0===t?Jn(e):Jn.ceil(e)}function _o(e,t){return e=xo(e),Lr(Jn.count(si(e),e)+(4===si(e).getDay()),t,2)}function wo(e){return e.getDay()}function ko(e,t){return Lr(Vn.count(si(e)-1,e),t,2)}function Eo(e,t){return Lr(e.getFullYear()%100,t,2)}function Ao(e,t){return Lr((e=xo(e)).getFullYear()%100,t,2)}function $o(e,t){return Lr(e.getFullYear()%1e4,t,4)}function Do(e,t){var n=e.getDay();return Lr((e=n>=4||0===n?Jn(e):Jn.ceil(e)).getFullYear()%1e4,t,4)}function So(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Lr(t/60|0,"0",2)+Lr(t%60,"0",2)}function Mo(e,t){return Lr(e.getUTCDate(),t,2)}function Co(e,t){return Lr(e.getUTCHours(),t,2)}function Fo(e,t){return Lr(e.getUTCHours()%12||12,t,2)}function Oo(e,t){return Lr(1+qn.count(li(e),e),t,3)}function No(e,t){return Lr(e.getUTCMilliseconds(),t,3)}function To(e,t){return No(e,t)+"000"}function zo(e,t){return Lr(e.getUTCMonth()+1,t,2)}function Ro(e,t){return Lr(e.getUTCMinutes(),t,2)}function Po(e,t){return Lr(e.getUTCSeconds(),t,2)}function Lo(e){var t=e.getUTCDay();return 0===t?7:t}function Bo(e,t){return Lr(ei.count(li(e)-1,e),t,2)}function jo(e){var t=e.getUTCDay();return t>=4||0===t?ri(e):ri.ceil(e)}function Io(e,t){return e=jo(e),Lr(ri.count(li(e),e)+(4===li(e).getUTCDay()),t,2)}function Uo(e){return e.getUTCDay()}function qo(e,t){return Lr(ti.count(li(e)-1,e),t,2)}function Wo(e,t){return Lr(e.getUTCFullYear()%100,t,2)}function Ho(e,t){return Lr((e=jo(e)).getUTCFullYear()%100,t,2)}function Go(e,t){return Lr(e.getUTCFullYear()%1e4,t,4)}function Vo(e,t){var n=e.getUTCDay();return Lr((e=n>=4||0===n?ri(e):ri.ceil(e)).getUTCFullYear()%1e4,t,4)}function Yo(){return"+0000"}function Xo(){return"%"}function Jo(e){return+e}function Qo(e){return Math.floor(+e/1e3)}function Zo(e){const t={};return n=>t[n]||(t[n]=e(n))}function Ko(e){const t=Zo(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){const n=yn(e||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return function(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let o=function(e,t){let n,i=e.lastIndexOf("e");if(i>0)return i;for(i=e.length;--i>t;)if(n=e.charCodeAt(i),n>=48&&n<=57)return i+1}(i,r);const a=or;)if("0"!==i[o]){++o;break}return i.slice(0,o)+a}}(t(n),t(".1f")(1)[1])}return t(n)},formatSpan(e,i,r,o){o=yn(null==o?",f":o);const a=pn(e,i,r),s=Math.max(Math.abs(e),Math.abs(i));let l;if(null==o.precision)switch(o.type){case"s":return isNaN(l=_n(a,s))||(o.precision=l),n(o,s);case"":case"e":case"g":case"p":case"r":isNaN(l=wn(a,s))||(o.precision=l-("e"===o.type));break;case"f":case"%":isNaN(l=kn(a))||(o.precision=l-2*("%"===o.type))}return t(o)}}}let ea,ta;function na(){return ea=Ko({format:Sn,formatPrefix:Mn})}function ia(e){return Ko(On(e))}function ra(e){return arguments.length?ea=ia(e):ea}function oa(e,t,n){Oe(n=n||{})||me(`Invalid time multi-format specifier: ${n}`);const i=t(Ci),r=t(Mi),o=t(Si),a=t(Ai),s=t(Ei),l=t(ki),u=t(wi),c=t(_i),f=e(n[Fi]||".%L"),d=e(n[Ci]||":%S"),h=e(n[Mi]||"%I:%M"),p=e(n[Si]||"%I %p"),m=e(n[Ai]||n[$i]||"%a %d"),g=e(n[Ei]||"%b %d"),y=e(n[ki]||"%B"),v=e(n[wi]||"%B"),b=e(n[_i]||"%Y");return e=>(i(e)St(e)?t(e):oa(t,sr,e),utcFormat:e=>St(e)?n(e):oa(n,lr,e),timeParse:Zo(e.parse),utcParse:Zo(e.utcParse)}}function sa(){return ta=aa({format:Cr,parse:Fr,utcFormat:Or,utcParse:Nr})}function la(e){return aa(Sr(e))}function ua(e){return arguments.length?ta=la(e):ta}Mr=Sr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Cr=Mr.format,Fr=Mr.parse,Or=Mr.utcFormat,Nr=Mr.utcParse,na(),sa();const ca=(e,t)=>ht({},e,t);function fa(e,t){const n=e?ia(e):ra(),i=t?la(t):ua();return ca(n,i)}function da(e,t){const n=arguments.length;return n&&2!==n&&me("defaultLocale expects either zero or two arguments."),n?ca(ra(e),ua(t)):ca(ra(),ua())}function ha(){return na(),sa(),da()}const pa=/^(data:|([A-Za-z]+:)?\/\/)/,ma=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,ga=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,ya="file://";async function va(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t)}async function ba(e,t){t=ht({},this.options,t);const n=this.fileAccess,i={href:null};let r,o,a;const s=ma.test(e.replace(ga,""));null!=e&&"string"==typeof e&&s||me("Sanitize failure, invalid URI: "+Pt(e));const l=pa.test(e);return(a=t.baseURL)&&!l&&(e.startsWith("/")||a.endsWith("/")||(e="/"+e),e=a+e),o=(r=e.startsWith(ya))||"file"===t.mode||"http"!==t.mode&&!l&&n,r?e=e.slice(7):e.startsWith("//")&&("file"===t.defaultProtocol?(e=e.slice(2),o=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!o}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),"image"===t.context&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function xa(e){return e?t=>new Promise(((n,i)=>{e.readFile(t,((e,t)=>{e?i(e):n(t)}))})):_a}async function _a(){me("No file system access.")}function wa(e){return e?async function(t,n){const i=ht({},this.options.http,n),r=n&&n.response,o=await e(t,i);return o.ok?rt(o[r])?o[r]():o.text():me(o.status+""+o.statusText)}:ka}async function ka(){me("No HTTP fetch method available.")}const Ea=e=>null!=e&&e==e,Aa=e=>!(Number.isNaN(+e)||e instanceof Date),$a={boolean:Lt,integer:Le,number:Le,date:jt,string:It,unknown:be},Da=[e=>"true"===e||"false"===e||!0===e||!1===e,e=>Aa(e)&&Number.isInteger(+e),Aa,e=>!Number.isNaN(Date.parse(e))],Sa=["boolean","integer","number","date"];function Ma(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=Da.length,r=Da.map(((e,t)=>t+1));for(let o,a,s=0,l=0;s0===e?t:e),0)-1]}function Ca(e,t){return t.reduce(((t,n)=>(t[n]=Ma(e,n),t)),{})}function Fa(e){const t=function(t,n){const i={delimiter:e};return Oa(t,n?ht(n,i):i)};return t.responseType="text",t}function Oa(e,t){return t.header&&(e=t.header.map(Pt).join(t.delimiter)+"\n"+e),Kt(t.delimiter).parse(e+"")}function Na(e,t){const n=t&&t.property?ye(t.property):be;return!Oe(e)||(i=e,"function"==typeof Buffer&&rt(Buffer.isBuffer)&&Buffer.isBuffer(i))?n(JSON.parse(e)):function(e,t){return!Fe(e)&&At(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}(n(e),t);var i}Oa.responseType="text",Na.responseType="json";const Ta={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function za(e,t){let n,i,r,o;return e=Na(e,t),t&&t.feature?(n=tn,r=t.feature):t&&t.mesh?(n=an,r=t.mesh,o=Ta[t.filter]):me("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,o):me("Invalid TopoJSON object: "+r),i&&i.features||[i]}za.responseType="json";const Ra={dsv:Oa,csv:Fa(","),tsv:Fa("\t"),json:Na,topojson:za};function Pa(e,t){return arguments.length>1?(Ra[e]=t,this):yt(Ra,e)?Ra[e]:null}function La(e){const t=Pa(e);return t&&t.responseType||"text"}function Ba(e,t,n,i){const r=Pa((t=t||{}).type||"json");return r||me("Unknown data format type: "+t.type),e=r(e,t),t.parse&&function(e,t,n,i){if(!e.length)return;const r=ua();n=n||r.timeParse,i=i||r.utcParse;let o,a,s,l,u,c,f=e.columns||Object.keys(e[0]);"auto"===t&&(t=Ca(e,f)),f=Object.keys(t);const d=f.map((e=>{const r=t[e];let o,a;if(r&&(r.startsWith("date:")||r.startsWith("utc:")))return o=r.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1)),("utc"===o[0]?i:n)(a);if(!$a[r])throw Error("Illegal format pattern: "+e+":"+r);return $a[r]}));for(s=0,u=e.length,c=f.length;s({options:t||{},sanitize:ba,load:va,fileAccess:!1,file:xa(null),http:wa(e)})}("undefined"!=typeof fetch&&fetch);function Ia(e){const t=e||be,n=[],i={};return n.add=e=>{const r=t(e);return i[r]||(i[r]=1,n.push(e)),n},n.remove=e=>{const r=t(e);if(i[r]){i[r]=0;const t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function Ua(e,t){try{await t(e)}catch(t){e.error(t)}}const qa=Symbol("vega_id");let Wa=1;function Ha(e){return!(!e||!Ga(e))}function Ga(e){return e[qa]}function Va(e,t){return e[qa]=t,e}function Ya(e){const t=e===Object(e)?e:{data:e};return Ga(t)?t:Va(t,Wa++)}function Xa(e){return Ja(e,Ya({}))}function Ja(e,t){for(const n in e)t[n]=e[n];return t}function Qa(e,t){return Va(t,Ga(e))}function Za(e,t){return e?t?(n,i)=>e(n,i)||Ga(t(n))-Ga(t(i)):(t,n)=>e(t,n)||Ga(t)-Ga(n):null}function Ka(e){return e&&e.constructor===es}function es(){const e=[],t=[],n=[],i=[],r=[];let o=null,a=!1;return{constructor:es,insert(t){const n=nt(t),i=n.length;for(let t=0;t{p(e)&&(u[Ga(e)]=-1)}));for(f=0,d=e.length;f0&&(y(m,p,h.value),s.modifies(p));for(f=0,d=r.length;f{p(e)&&u[Ga(e)]>0&&y(e,h.field,h.value)})),s.modifies(h.field);if(a)s.mod=t.length||i.length?l.filter((e=>u[Ga(e)]>0)):l.slice();else for(g in c)s.mod.push(c[g]);return(o||null==o&&(t.length||i.length))&&s.clean(!0),s}}}const ts="_:mod:_";function ns(){Object.defineProperty(this,ts,{writable:!0,value:{}})}ns.prototype={set(e,t,n,i){const r=this,o=r[e],a=r[ts];return null!=t&&t>=0?(o[t]!==n||i)&&(o[t]=n,a[t+":"+e]=-1,a[e]=-1):(o!==n||i)&&(r[e]=n,a[e]=Fe(n)?1+n.length:-1),r},modified(e,t){const n=this[ts];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(Fe(e)){for(let t=0;t=0?t+1{a instanceof os?(a!==this&&(t&&a.targets().add(this),o.push(a)),r.push({op:a,name:e,index:n})):i.set(e,n,a)};for(a in e)if(s=e[a],"pulse"===a)nt(s).forEach((e=>{e instanceof os?e!==this&&(e.targets().add(this),o.push(e)):me("Pulse parameters must be operator instances.")})),this.source=s;else if(Fe(s))for(i.set(a,-1,Array(l=s.length)),u=0;u{const n=Date.now();return n-t>e?(t=n,1):0}))},debounce(e){const t=us();return this.targets().add(us(null,null,dt(e,(e=>{const n=e.dataflow;t.receive(e),n&&n.run&&n.run()})))),t},between(e,t){let n=!1;return e.targets().add(us(null,null,(()=>n=!0))),t.targets().add(us(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=we,this._targets=null}};const cs={skip:!0};function fs(e,t,n,i,r,o){const a=ht({},o,cs);let s,l;rt(n)||(n=ft(n)),void 0===i?s=t=>e.touch(n(t)):rt(i)?(l=new os(null,i,r,!1),s=t=>{l.evaluate(t);const i=n(t),r=l.value;Ka(r)?e.pulse(i,r,o):e.update(i,r,a)}):s=t=>e.update(n(t),i,a),t.apply(s)}function ds(e,t,n,i,r,o){if(void 0===i)t.targets().add(n);else{const a=o||{},s=new os(null,function(e,t){return t=rt(t)?t:ft(t),e?function(n,i){const r=t(n,i);return e.skip()||(e.skip(r!==this.value).value=r),r}:t}(n,i),r,!1);s.modified(a.force),s.rank=t.rank,t.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),e.connect(n,[s]))}}const hs={};function ps(e,t,n){this.dataflow=e,this.stamp=null==t?-1:t,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function ms(e,t){const n=[];return Wt(e,t,(e=>n.push(e))),n}function gs(e,t){const n={};return e.visit(t,(e=>{n[Ga(e)]=1})),e=>n[Ga(e)]?null:e}function ys(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function vs(e,t,n,i){const r=this;let o=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const e of n)if(e.stamp===t){if(e.fields){const t=r.fields||(r.fields={});for(const n in e.fields)t[n]=1}e.changed(r.ADD)&&(o|=r.ADD),e.changed(r.REM)&&(o|=r.REM),e.changed(r.MOD)&&(o|=r.MOD)}this.changes=o}function bs(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}ps.prototype={StopPropagation:hs,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(e){return new ps(this.dataflow).init(this,e)},clone(){const e=this.fork(7);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new ps(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,!e.fields||64&t||(n.fields=e.fields),1&t?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),2&t?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),4&t?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),32&t?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||7;return 1&t&&this.add.length||2&t&&this.rem.length||4&t&&this.mod.length},reflow(e){if(e)return this.fork(7).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(4,gs(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return Fe(e)?e.forEach((e=>t[e]=!0)):t[e]=!0,this},modified(e,t){const n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?Fe(e)?e.some((e=>n[e])):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=ys(n.addF,t)),2&e&&(n.remF=ys(n.remF,t)),4&e&&(n.modF=ys(n.modF,t)),16&e&&(n.srcF=ys(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=ms(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=ms(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=ms(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,i=t;if(16&e)return Wt(n.source,n.srcF,i),n;1&e&&Wt(n.add,n.addF,i),2&e&&Wt(n.rem,n.remF,i),4&e&&Wt(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||Wt(r,e?gs(n,5):n.srcF,i)}return n}},_t(vs,ps,{fork(e){const t=new ps(this.dataflow).init(this,e&this.NO_FIELDS);return void 0!==e&&(e&t.ADD&&this.visit(t.ADD,(e=>t.add.push(e))),e&t.REM&&this.visit(t.REM,(e=>t.rem.push(e))),e&t.MOD&&this.visit(t.MOD,(e=>t.mod.push(e)))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?Fe(e)?e.some((e=>n[e])):n[e]:0},filter(){me("MultiPulse does not support filtering.")},materialize(){me("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let o=0;if(e&n.SOURCE)for(;ot&&(o=n-1>>1,r=e[o],i(a,r)<0);)e[n]=r,n=o;return e[n]=a}function ws(){this.logger(Ce()),this.logLevel($e),this._clock=0,this._rank=0,this._locale=da();try{this._loader=ja()}catch(e){}this._touched=Ia(ve),this._input={},this._pulse=null,this._heap=function(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),_s(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let i;return t.length?(i=t[0],t[0]=n,function(e,t,n){const i=t,r=e.length,o=e[t];let a,s=1+(t<<1);for(;s=0&&(s=a),e[t]=e[s],s=1+((t=s)<<1);e[t]=o,_s(e,i,t,n)}(t,0,e)):i=n,i}}}(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function ks(e){return function(){return this._log[e].apply(this,arguments)}}function Es(e,t){os.call(this,e,null,t)}ws.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:ks("error"),warn:ks("warn"),info:ks("info"),debug:ks("debug"),logLevel:ks("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,o=1;return e instanceof os?r=e:e&&e.prototype instanceof os?r=new e:rt(e)?r=new os(null,e):(o=0,r=new os(e,t)),this.rank(r),o&&(i=n,n=t),n&&this.connect(r,r.parameters(n,i)),this.touch(r),r},connect:function(e,t){const n=e.rank,i=t.length;for(let r=0;r=0;)t.push(n=i[r]),n===e&&me("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||xs);const i=new ps(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return i.target=e,this._input[e.id]=t.pulse(i,r),this},touch:function(e,t){const n=t||xs;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||xs;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:es,ingest:function(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))},parse:function(e,t){const n=this.locale();return Ba(e,t,n.timeParse,n.utcParse)},preload:async function(e,t,n){const i=this,r=i._pending||function(e){let t;const n=new Promise((e=>t=e));return n.requests=0,n.done=()=>{0==--n.requests&&(e._pending=null,t(e))},e._pending=n}(i);r.requests+=1;const o=await i.request(t,n);return i.pulse(e,i.changeset().remove(we).insert(o.data||[])),r.done(),o},request:async function(e,t){const n=this;let i,r=0;try{i=await n.loader().load(e,{context:"dataflow",response:La(t&&t.type)});try{i=n.parse(i,t)}catch(t){r=-2,n.warn("Data ingestion failed",e,t)}}catch(t){r=-1,n.warn("Loading failed",e,t)}return{data:i,status:r}},events:function(e,t,n,i){const r=this,o=us(n,i),a=function(e){e.dataflow=r;try{o.receive(e)}catch(e){r.error(e)}finally{r.run()}};let s;s="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):nt(e);const l=s.length;for(let e=0;ei._enqueue(e,!0))),i._touched=Ia(ve);let a,s,l,u=0;try{for(;i._heap.size()>0;)a=i._heap.pop(),a.rank===a.qrank?(s=a.run(i._getPulse(a,e)),s.then?s=await s:s.async&&(r.push(s.async),s=hs),s!==hs&&a._targets&&a._targets.forEach((e=>i._enqueue(e))),++u):i._enqueue(a,!0)}catch(e){i._heap.clear(),l=e}if(i._input={},i._pulse=null,i.debug(`Pulse ${o}: ${u} operators`),l&&(i._postrun=[],i.error(l)),i._postrun.length){const e=i._postrun.sort(((e,t)=>t.priority-e.priority));i._postrun=[];for(let t=0;ti.runAsync(null,(()=>{e.forEach((e=>{try{e(i)}catch(e){i.error(e)}}))})))),i},run:function(e,t,n){return this._pulse?bs(this):(this.evaluate(e,t,n),this)},runAsync:async function(e,t,n){for(;this._running;)await this._running;const i=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(i,i),this._running},runAfter:function(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(e){this.error(e)}},_enqueue:function(e,t){const n=e.stampe.pulse)),t):this._input[e.id]||function(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==hs&&(e.source=t.source),e)}(this._pulse,n&&n.pulse)}},_t(Es,os,{run(e){if(e.stampthis.pulse=e)):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const As={};function $s(e){const t=Ds(e);return t&&t.Definition||null}function Ds(e){return e=e&&e.toLowerCase(),yt(As,e)?As[e]:null}function Ss(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n=r)&&(n=r)}return n}function Ms(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n>r||void 0===n&&r>=r)&&(n=r)}return n}function Cs(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(et?1:0)}function Fs(e,t,n=0,i=1/0,r){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),i=Math.floor(Math.min(e.length-1,i)),!(n<=t&&t<=i))return e;for(r=void 0===r?Cs:function(e=yi){if(e===yi)return Cs;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const i=e(t,n);return i||0===i?i:(0===e(n,n))-(0===e(t,t))}}(r);i>n;){if(i-n>600){const o=i-n+1,a=t-n+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Fs(e,t,Math.max(n,Math.floor(t-a*l/o+u)),Math.min(i,Math.floor(t+(o-a)*l/o+u)),r)}const o=e[t];let a=n,s=i;for(Os(e,n,t),r(e[i],o)>0&&Os(e,n,i);a0;)--s}0===r(e[n],o)?Os(e,n,s):(++s,Os(e,s,i)),s<=t&&(n=s+1),t<=s&&(i=s-1)}return e}function Os(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function Ns(e){return null===e?NaN:+e}function Ts(e,t,n){if(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)null!=(i=t(i,++n,e))&&(i=+i)>=i&&(yield i)}}(e,n)),(i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return Ms(e);if(t>=1)return Ss(e);var i,r=(i-1)*t,o=Math.floor(r),a=Ss(Fs(e,o).subarray(0,o+1));return a+(Ms(e.subarray(o+1))-a)*(r-o)}}function zs(e,t,n=Ns){if((i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,o=Math.floor(r),a=+n(e[o],o,e);return a+(+n(e[o+1],o+1,e)-a)*(r-o)}}function Rs(e,t){return Ts(e,.5,t)}function*Ps(e,t){if(null==t)for(let t of e)null!=t&&""!==t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)i=t(i,++n,e),null!=i&&""!==i&&(i=+i)>=i&&(yield i)}}function Ls(e,t,n){const i=Float64Array.from(Ps(e,n));return i.sort(yi),t.map((e=>zs(i,e)))}function Bs(e,t){return Ls(e,[.25,.5,.75],t)}function js(e,t){const n=e.length,i=function(e,t){const n=function(e,t){let n,i=0,r=0,o=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(n=t-r,r+=n/++i,o+=n*(t-r));else{let a=-1;for(let s of e)null!=(s=t(s,++a,e))&&(s=+s)>=s&&(n=s-r,r+=n/++i,o+=n*(s-r))}if(i>1)return o/(i-1)}(e,t);return n?Math.sqrt(n):n}(e,t),r=Bs(e,t),o=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,o)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function Is(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let o,a,s,l,u,c,f=e.extent[0],d=e.extent[1];const h=e.span||d-f||Math.abs(f)||1;if(e.step)o=e.step;else if(e.steps){for(l=h/t,u=0,c=e.steps.length;ut;)o*=n;for(u=0,c=r.length;u=s&&h/l<=t&&(o=l)}l=Math.log(o);const p=l>=0?0:1+~~(-l/i),m=Math.pow(n,-p-1);return(e.nice||void 0===e.nice)&&(l=Math.floor(f/o+m)*o,f=fe);const r=e.length,o=new Float64Array(r);let a,s=0,l=1,u=i(e[0]),c=u,f=u+t;for(;l=f){for(c=(u+c)/2;s>1);ra;)e[r--]=e[o]}o=a,a=i}return e}(o,t+t/4):o}function Gs(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}}function Vs(e,t){let n,i,r;null==t&&(t=e,e=0);const o={min(e){return arguments.length?(n=e||0,r=i-n,o):n},max(e){return arguments.length?(i=e||0,r=i-n,o):i},sample:()=>n+Math.floor(r*Us()),pdf:e=>e===Math.floor(e)&&e>=n&&e=i?1:(t-n+1)/r},icdf:e=>e>=0&&e<=1?n-1+Math.floor(e*r):NaN};return o.min(e).max(t)}const Ys=Math.sqrt(2*Math.PI),Xs=Math.SQRT2;let Js=NaN;function Qs(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,o=0;if(Js==Js)r=Js,Js=NaN;else{do{r=2*Us()-1,o=2*Us()-1,n=r*r+o*o}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,Js=o*i}return e+r*t}function Zs(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*Ys)}function Ks(e,t,n){const i=(e-(t=t||0))/(n=null==n?1:n),r=Math.abs(i);let o;if(r>37)o=0;else{const e=Math.exp(-r*r/2);let t;r<7.07106781186547?(t=.0352624965998911*r+.700383064443688,t=t*r+6.37396220353165,t=t*r+33.912866078383,t=t*r+112.079291497871,t=t*r+221.213596169931,t=t*r+220.206867912376,o=e*t,t=.0883883476483184*r+1.75566716318264,t=t*r+16.064177579207,t=t*r+86.7807322029461,t=t*r+296.564248779674,t=t*r+637.333633378831,t=t*r+793.826512519948,t=t*r+440.413735824752,o/=t):(t=r+.65,t=r+4/t,t=r+3/t,t=r+2/t,t=r+1/t,o=e/t/2.506628274631)}return i>0?1-o:o}function el(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*Xs*function(e){let t,n=-Math.log((1-e)*(1+e));return n<6.25?(n-=3.125,t=-364441206401782e-35,t=t*n-16850591381820166e-35,t=128584807152564e-32+t*n,t=11157877678025181e-33+t*n,t=t*n-1333171662854621e-31,t=20972767875968562e-33+t*n,t=6637638134358324e-30+t*n,t=t*n-4054566272975207e-29,t=t*n-8151934197605472e-29,t=26335093153082323e-28+t*n,t=t*n-12975133253453532e-27,t=t*n-5415412054294628e-26,t=1.0512122733215323e-9+t*n,t=t*n-4.112633980346984e-9,t=t*n-2.9070369957882005e-8,t=4.2347877827932404e-7+t*n,t=t*n-13654692000834679e-22,t=t*n-13882523362786469e-21,t=.00018673420803405714+t*n,t=t*n-.000740702534166267,t=t*n-.006033670871430149,t=.24015818242558962+t*n,t=1.6536545626831027+t*n):n<16?(n=Math.sqrt(n)-3.25,t=2.2137376921775787e-9,t=9.075656193888539e-8+t*n,t=t*n-2.7517406297064545e-7,t=1.8239629214389228e-8+t*n,t=15027403968909828e-22+t*n,t=t*n-4013867526981546e-21,t=29234449089955446e-22+t*n,t=12475304481671779e-21+t*n,t=t*n-47318229009055734e-21,t=6828485145957318e-20+t*n,t=24031110387097894e-21+t*n,t=t*n-.0003550375203628475,t=.0009532893797373805+t*n,t=t*n-.0016882755560235047,t=.002491442096107851+t*n,t=t*n-.003751208507569241,t=.005370914553590064+t*n,t=1.0052589676941592+t*n,t=3.0838856104922208+t*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,t=-27109920616438573e-27,t=t*n-2.555641816996525e-10,t=1.5076572693500548e-9+t*n,t=t*n-3.789465440126737e-9,t=7.61570120807834e-9+t*n,t=t*n-1.496002662714924e-8,t=2.914795345090108e-8+t*n,t=t*n-6.771199775845234e-8,t=2.2900482228026655e-7+t*n,t=t*n-9.9298272942317e-7,t=4526062597223154e-21+t*n,t=t*n-1968177810553167e-20,t=7599527703001776e-20+t*n,t=t*n-.00021503011930044477,t=t*n-.00013871931833623122,t=1.0103004648645344+t*n,t=4.849906401408584+t*n):t=1/0,t*e}(2*e-1)}function tl(e,t){let n,i;const r={mean(e){return arguments.length?(n=e||0,r):n},stdev(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>Qs(n,i),pdf:e=>Zs(e,n,i),cdf:e=>Ks(e,n,i),icdf:e=>el(e,n,i)};return r.mean(e).stdev(t)}function nl(e,t){const n=tl();let i=0;const r={data(n){return arguments.length?(e=n,i=n?n.length:0,r.bandwidth(t)):e},bandwidth(n){return arguments.length?(!(t=n)&&e&&(t=js(e)),r):t},sample:()=>e[~~(Us()*i)]+t*n.sample(),pdf(r){let o=0,a=0;for(;ail(n,i),pdf:e=>rl(e,n,i),cdf:e=>ol(e,n,i),icdf:e=>al(e,n,i)};return r.mean(e).stdev(t)}function ll(e,t){let n,i=0;const r={weights(e){return arguments.length?(n=function(e){const t=[];let n,r=0;for(n=0;n=t&&e<=n?1/(n-t):0}function fl(e,t,n){return null==n&&(n=null==t?1:t,t=0),en?1:(e-t)/(n-t)}function dl(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function hl(e,t){let n,i;const r={min(e){return arguments.length?(n=e||0,r):n},max(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>ul(n,i),pdf:e=>cl(e,n,i),cdf:e=>fl(e,n,i),icdf:e=>dl(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function pl(e,t,n){let i=0,r=0;for(const o of e){const e=n(o);null==t(o)||null==e||isNaN(e)||(i+=(e-i)/++r)}return{coef:[i],predict:()=>i,rSquared:0}}function ml(e,t,n,i){const r=i-e*e,o=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-o*e,o]}function gl(e,t,n,i){e=e.filter((e=>{let i=t(e),r=n(e);return null!=i&&(i=+i)>=i&&null!=r&&(r=+r)>=r})),i&&e.sort(((e,n)=>t(e)-t(n)));const r=e.length,o=new Float64Array(r),a=new Float64Array(r);let s,l,u,c=0,f=0,d=0;for(u of e)o[c]=s=+t(u),a[c]=l=+n(u),++c,f+=(s-f)/c,d+=(l-d)/c;for(c=0;c=r&&null!=o&&(o=+o)>=o&&i(r,o,++a)}function vl(e,t,n,i,r){let o=0,a=0;return yl(e,t,n,((e,t)=>{const n=t-r(e),s=t-i;o+=n*n,a+=s*s})),1-o/a}function bl(e,t,n){let i=0,r=0,o=0,a=0,s=0;yl(e,t,n,((e,t)=>{++s,i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const l=ml(i,r,o,a),u=e=>l[0]+l[1]*e;return{coef:l,predict:u,rSquared:vl(e,t,n,r,u)}}function xl(e,t,n){let i=0,r=0,o=0,a=0,s=0;yl(e,t,n,((e,t)=>{++s,e=Math.log(e),i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const l=ml(i,r,o,a),u=e=>l[0]+l[1]*Math.log(e);return{coef:l,predict:u,rSquared:vl(e,t,n,r,u)}}function _l(e,t,n){const[i,r,o,a]=gl(e,t,n);let s,l,u,c=0,f=0,d=0,h=0,p=0;yl(e,t,n,((e,t)=>{s=i[p++],l=Math.log(t),u=s*t,c+=(t*l-c)/p,f+=(u-f)/p,d+=(u*l-d)/p,h+=(s*u-h)/p}));const[m,g]=ml(f/a,c/a,d/a,h/a),y=e=>Math.exp(m+g*(e-o));return{coef:[Math.exp(m-g*o),g],predict:y,rSquared:vl(e,t,n,a,y)}}function wl(e,t,n){let i=0,r=0,o=0,a=0,s=0,l=0;yl(e,t,n,((e,t)=>{const n=Math.log(e),u=Math.log(t);++l,i+=(n-i)/l,r+=(u-r)/l,o+=(n*u-o)/l,a+=(n*n-a)/l,s+=(t-s)/l}));const u=ml(i,r,o,a),c=e=>u[0]*Math.pow(e,u[1]);return u[0]=Math.exp(u[0]),{coef:u,predict:c,rSquared:vl(e,t,n,s,c)}}function kl(e,t,n){const[i,r,o,a]=gl(e,t,n),s=i.length;let l,u,c,f,d=0,h=0,p=0,m=0,g=0;for(l=0;lb*(e-=o)*e+x*e+_+a;return{coef:[_-x*o+b*o*o+a,x-2*b*o,b],predict:w,rSquared:vl(e,t,n,a,w)}}function El(e,t,n,i){if(0===i)return pl(e,t,n);if(1===i)return bl(e,t,n);if(2===i)return kl(e,t,n);const[r,o,a,s]=gl(e,t,n),l=r.length,u=[],c=[],f=i+1;let d,h,p,m,g;for(d=0;dMath.abs(e[i][a])&&(a=r);for(o=i;o=i;o--)e[o][r]-=e[o][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(s=0,o=r+1;o{e-=a;let t=s+y[0]+y[1]*e+y[2]*e*e;for(d=3;d=0;--o)for(s=t[o],l=1,r[o]+=s,a=1;a<=o;++a)l*=(o+1-a)/a,r[o-a]+=s*Math.pow(n,a)*l;return r[0]+=i,r}const $l=2,Dl=1e-12;function Sl(e,t,n,i){const[r,o,a,s]=gl(e,t,n,!0),l=r.length,u=Math.max(2,~~(i*l)),c=new Float64Array(l),f=new Float64Array(l),d=new Float64Array(l).fill(1);for(let e=-1;++e<=$l;){const t=[0,u-1];for(let e=0;er[a]-n?i:a;let l=0,u=0,h=0,p=0,m=0;const g=1/Math.abs(r[s]-n||1);for(let e=i;e<=a;++e){const t=r[e],i=o[e],a=Ml(Math.abs(n-t)*g)*d[e],s=t*a;l+=a,u+=s,h+=i*a,p+=i*s,m+=t*s}const[y,v]=ml(u/l,h/l,p/l,m/l);c[e]=y+v*n,f[e]=Math.abs(o[e]-c[e]),Cl(r,e+1,t)}if(e===$l)break;const n=Rs(f);if(Math.abs(n)=1?Dl:(t=1-e*e)*t}return function(e,t,n,i){const r=e.length,o=[];let a,s=0,l=0,u=[];for(;s=e.length))for(;t>r&&e[o]-i<=i-e[r];)n[0]=++r,n[1]=o,++o}const Fl=.5*Math.PI/180;function Ol(e,t,n,i){n=n||25,i=Math.max(n,i||200);const r=t=>[t,e(t)],o=t[0],a=t[1],s=a-o,l=s/i,u=[r(o)],c=[];if(n===i){for(let e=1;e0;)c.push(r(o+e/n*s));let f=u[0],d=c[c.length-1];const h=1/s,p=function(e,t){let n=e,i=e;const r=t.length;for(let e=0;ei&&(i=r)}return 1/(i-n)}(f[1],c);for(;d;){const e=r((f[0]+d[0])/2);e[0]-f[0]>=l&&Nl(f,e,d,h,p)>Fl?c.push(e):(f=d,u.push(d),c.pop()),d=c[c.length-1]}return u}function Nl(e,t,n,i,r){const o=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),a=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(o-a)}function Tl(e,t,n){e=+e,t=+t,n=(r=arguments.length)<2?(t=e,e=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((t-e)/n)),o=new Array(r);++i{const n=t.length;let i=1,r=String(t[0](e));for(;i{},Ll={init:Pl,add:Pl,rem:Pl,idx:0},Bl={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.sum,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||void 0===e.max)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:["exponential"],idx:1}},jl=Object.keys(Bl).filter((e=>"__count__"!==e));function Il(e,t,n){return Bl[e](n,t)}function Ul(e,t){return e.idx-t.idx}function ql(){this.valid=0,this.missing=0,this._ops.forEach((e=>null==e.aggregate_param?e.init(this):e.init(this,e.aggregate_param)))}function Wl(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function Hl(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function Gl(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function Vl(e,t){const n=t||be,i=function(e){const t={};e.forEach((e=>t[e.name]=e));const n=e=>{e.req&&e.req.forEach((e=>{t[e]||n(t[e]=Bl[e]())}))};return e.forEach(n),Object.values(t).sort(Ul)}(e),r=e.slice().sort(Ul);function o(e){this._ops=i,this._out=r,this.cell=e,this.init()}return o.prototype.init=ql,o.prototype.add=Wl,o.prototype.rem=Hl,o.prototype.set=Gl,o.prototype.get=n,o.fields=e.map((e=>e.out)),o}function Yl(e){this._key=e?ye(e):Ga,this.reset()}[...jl,"__count__"].forEach((e=>{Bl[e]=function(e,t){return(n,i)=>ht({name:e,aggregate_param:i,out:n||e},Ll,t)}(e,Bl[e])}));const Xl=Yl.prototype;function Jl(e){Es.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function Ql(e){Es.call(this,null,e)}function Zl(e,t,n){const i=e;let r=t||[],o=n||[],a={},s=0;return{add:e=>o.push(e),remove:e=>a[i(e)]=++s,size:()=>r.length,data:(e,t)=>(s&&(r=r.filter((e=>!a[i(e)])),a={},s=0),t&&e&&r.sort(e),o.length&&(r=e?Nt(e,r,o.sort(e)):r.concat(o),o=[]),r)}}function Kl(e){Es.call(this,[],e)}function eu(e){os.call(this,null,tu,e)}function tu(e){return this.value&&!e.modified()?this.value:at(e.fields,e.orders)}function nu(e){Es.call(this,null,e)}function iu(e){Es.call(this,null,e)}Xl.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Xl.add=function(e){this._add.push(e)},Xl.rem=function(e){this._rem.push(e)},Xl.values=function(){if(this._get=null,0===this._rem.length)return this._add;const e=this._add,t=this._rem,n=this._key,i=e.length,r=t.length,o=Array(i-r),a={};let s,l,u;for(s=0;s=0;)i=e(t[r])+"",yt(n,i)||(n[i]=1,++o);return o},Xl.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=mt(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},Xl.argmin=function(e){return this.extent(e)[0]||{}},Xl.argmax=function(e){return this.extent(e)[1]||{}},Xl.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},Xl.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},Xl.quartile=function(e){return this._get===e&&this._q||(this._q=Bs(this.values(),e),this._get=e),this._q},Xl.q1=function(e){return this.quartile(e)[0]},Xl.q2=function(e){return this.quartile(e)[1]},Xl.q3=function(e){return this.quartile(e)[2]},Xl.ci=function(e){return this._get===e&&this._ci||(this._ci=Ws(this.values(),1e3,.05,e),this._get=e),this._ci},Xl.ci0=function(e){return this.ci(e)[0]},Xl.ci1=function(e){return this.ci(e)[1]},Jl.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:jl},{name:"aggregate_params",type:"field",null:!0,array:!0,default:[null]},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},_t(Jl,Es,{transform(e,t){const n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=i.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):Object.create(null),t.visit(t.SOURCE,(e=>n.add(e)))):(n.value=n.value||n.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),i.modifies(n._outputs),n._drop=!1!==e.drop,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter((()=>this.clean())),n.changes(i)},cross(){const e=this,t=e.value,n=e._dnames,i=n.map((()=>({}))),r=n.length;function o(e){let t,o,a,s;for(t in e)for(a=e[t].tuple,o=0;o{const t=ce(e);return r(e),n.push(t),t})),this.cellkey=e.key?e.key:zl(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=e.fields||[null],a=e.ops||["count"],s=e.aggregate_params||[null],l=e.as||[],u=o.length,c={};let f,d,h,p,m,g,y;for(u!==a.length&&me("Unmatched number of fields and aggregate ops."),y=0;yVl(e,e.field))),Object.create(null)},cellkey:zl(),cell(e,t){let n=this.value[e];return n?0===n.num&&this._drop&&n.stamp{const t=i(e);e[s]=t,e[l]=null==t?null:r+o*(1+(t-r)/o)}:e=>e[s]=i(e)),t.modifies(n?a:s)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=Is(e),i=n.step;let r,o,a=n.start,s=a+Math.ceil((n.stop-a)/i)*i;null!=(r=e.anchor)&&(o=r-(a+i*Math.floor((r-a)/i)),a+=o,s+=o);const l=function(e){let n=Le(t(e));return null==n?null:ns?1/0:(n=Math.max(a,Math.min(n,s-i)),a+i*Math.floor(1e-14+(n-a)/i))};return l.start=a,l.stop=n.stop,l.step=i,this.value=ue(l,fe(t),e.name||"bin_"+ce(t))}}),Kl.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},_t(Kl,Es,{transform(e,t){const n=t.fork(t.ALL),i=Zl(Ga,this.value,n.materialize(n.ADD).add),r=e.sort,o=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(o),this.value=n.source=i.data(Za(r),o),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),_t(eu,os),nu.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},_t(nu,Es,{transform(e,t){const n=t=>n=>{for(var i,r=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(s(n),e.case,o)||[],l=0,u=r.length;lr[e]=1+(r[e]||0))),c=n((e=>r[e]-=1));return i?t.visit(t.SOURCE,u):(t.visit(t.ADD,u),t.visit(t.REM,c)),this._finish(t,l)},_parameterCheck(e,t){let n=!1;return!e.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),!e.modified("pattern")&&this._match||(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,i=this._tuples||(this._tuples={}),r=t[0],o=t[1],a=e.fork(e.NO_SOURCE|e.NO_FIELDS);let s,l,u;for(s in n)l=i[s],u=n[s]||0,!l&&u?(i[s]=l=Ya({}),l[r]=s,l[o]=u,a.add.push(l)):0===u?(l&&a.rem.push(l),n[s]=null,i[s]=null):l[o]!==u&&(l[o]=u,a.mod.push(l));return a.modifies(t)}}),iu.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},_t(iu,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],o=i[1],a=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let s=this.value;return a?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=function(e,t,n,i){for(var r,o,a=[],s={},l=e.length,u=0;uau(e,t)))):typeof i[n]===ou&&i[n](e[n]);return i}function su(e){Es.call(this,null,e)}const lu=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],uu={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:lu},{name:"weights",type:"number",array:!0}]};function cu(e,t){return e?e.map(((e,n)=>t[n]||ce(e))):null}function fu(e,t,n){const i=[],r=e=>e(l);let o,a,s,l,u,c;if(null==t)i.push(e.map(n));else for(o={},a=0,s=e.length;at(n,e)),fe(t),ce(t))}function mu(e){Es.call(this,[void 0,void 0],e)}function gu(e,t){os.call(this,e),this.parent=t,this.count=0}function yu(e){Es.call(this,{},e),this._keys=bt();const t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,i=t.active;nye(e))):ye(e.name,e.as)}function xu(e){Es.call(this,bt(),e)}function _u(e){Es.call(this,[],e)}function wu(e){Es.call(this,[],e)}function ku(e){Es.call(this,null,e)}function Eu(e){Es.call(this,[],e)}su.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:lu.concat(uu)},{name:"as",type:"string",array:!0,default:["value","density"]}]},_t(su,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=au(e.distribution,function(e){return()=>e.materialize(e.SOURCE).source}(t)),r=e.steps||e.minsteps||25,o=e.steps||e.maxsteps||200;let a=e.method||"pdf";"pdf"!==a&&"cdf"!==a&&me("Invalid density method: "+a),e.extent||i.data||me("Missing density extent parameter."),a=i[a];const s=e.as||["value","density"],l=Ol(a,e.extent||pt(i.data()),r,o).map((e=>{const t={};return t[s[0]]=e[0],t[s[1]]=e[1],Ya(t)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),du.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]},_t(du,Es,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=fu(t.source,e.groupby,be),r=e.smooth||!1,o=e.field,a=e.step||((e,t)=>Rt(pt(e,t))/30)(n,o),s=Za(((e,t)=>o(e)-o(t))),l=e.as||"bin",u=i.length;let c,f=1/0,d=-1/0,h=0;for(;hd&&(d=t),e[++c][l]=t}return this.value={start:f,stop:d,step:a},t.reflow(!0).modifies(l)}}),_t(hu,os),mu.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},_t(mu,Es,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let o=n[0],a=n[1];if((r||null==o)&&(o=1/0,a=-1/0),t.visit(r?t.SOURCE:t.ADD,(e=>{const t=Le(i(e));null!=t&&(ta&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=ce(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),_t(gu,os,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),_t(yu,Es,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let o,a,s=yt(r,e)&&r[e];return s?s.value.stampe&&e.count>0));this.initTargets(e)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;rthis.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,(e=>{const t=Ga(e),n=o.get(t);void 0!==n&&(o.delete(t),s(n).rem(e))})),t.visit(t.ADD,(e=>{const t=i(e);o.set(Ga(e),t),s(t).add(e)})),a||t.modified(i.fields)?t.visit(t.MOD,(e=>{const t=Ga(e),n=o.get(t),r=i(e);n===r?s(r).mod(e):(o.set(t,r),s(n).rem(e),s(r).add(e))})):t.changed(t.MOD)&&t.visit(t.MOD,(e=>{s(o.get(Ga(e))).mod(e)})),a&&t.visit(t.REFLOW,(e=>{const t=Ga(e),n=o.get(t),r=i(e);n!==r&&(o.set(t,r),s(n).rem(e),s(r).add(e))})),t.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),t}}),_t(vu,os),xu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},_t(xu,Es,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),o=r.add,a=r.rem,s=r.mod,l=e.expr;let u=!0;function c(t){const n=Ga(t),r=l(t,e),c=i.get(n);r&&c?(i.delete(n),o.push(t)):r||c?u&&r&&!c&&s.push(t):(i.set(n,1),a.push(t))}return t.visit(t.REM,(e=>{const t=Ga(e);i.has(t)?i.delete(t):a.push(e)})),t.visit(t.ADD,(t=>{l(t,e)?o.push(t):i.set(Ga(t),1)})),t.visit(t.MOD,c),e.modified()&&(u=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}}),_u.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},_t(_u,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=cu(i,e.as||[]),o=e.index||null,a=r.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{const t=i.map((t=>t(e))),s=t.reduce(((e,t)=>Math.max(e,t.length)),0);let l,u,c,f=0;for(;f{for(let t,o=0;ot[i]=n(t,e)))}}),_t(Eu,Es,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r,o,a,s=this.value,l=e.size-s.length;if(l>0){for(r=[];--l>=0;)r.push(a=Ya(i(e))),s.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else o=s.slice(0,-l),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,s=s.slice(-l);return n.source=this.value=s,n}});const Au={value:"value",median:Rs,mean:function(e,t){let n=0,i=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++n,i+=t);else{let r=-1;for(let o of e)null!=(o=t(o,++r,e))&&(o=+o)>=o&&(++n,i+=o)}if(n)return i/n},min:Ms,max:Ss},$u=[];function Du(e){Es.call(this,[],e)}function Su(e){Jl.call(this,e)}function Mu(e){Es.call(this,null,e)}function Cu(e){os.call(this,null,Fu,e)}function Fu(e){return this.value&&!e.modified()?this.value:Mt(e.fields,e.flat)}function Ou(e){Es.call(this,[],e),this._pending=null}function Nu(e,t,n){n.forEach(Ya);const i=t.fork(t.NO_FIELDS&t.NO_SOURCE);return i.rem=e.value,e.value=i.source=i.add=n,e._pending=null,i.rem.length&&i.clean(!0),i}function Tu(e){Es.call(this,{},e)}function zu(e){os.call(this,null,Ru,e)}function Ru(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i,r,o=1/0,a=-1/0;for(i=0;ia&&(a=r[1]);return[o,a]}function Pu(e){os.call(this,null,Lu,e)}function Lu(e){return this.value&&!e.modified()?this.value:e.values.reduce(((e,t)=>e.concat(t)),[])}function Bu(e){Es.call(this,null,e)}function ju(e){Jl.call(this,e)}function Iu(e){yu.call(this,e)}function Uu(e){Es.call(this,null,e)}function qu(e){Es.call(this,null,e)}function Wu(e){Es.call(this,null,e)}function Hu(e){Es.call(this,null,e)}function Gu(e){Es.call(this,[],e),this.count=0}function Vu(e){Es.call(this,null,e)}function Yu(e){Es.call(this,null,e),this.modified(!0)}function Xu(e){Es.call(this,null,e)}Du.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},_t(Du,Es,{transform(e,t){var n,i,r,o,a,s,l,u,c,f,d=t.fork(t.ALL),h=function(e){var t,n=e.method||Au.value;if(null!=Au[n])return n===Au.value?(t=void 0!==e.value?e.value:0,()=>t):Au[n];me("Unrecognized imputation method: "+n)}(e),p=function(e){const t=e.field;return e=>e?t(e):NaN}(e),m=ce(e.field),g=ce(e.key),y=(e.groupby||[]).map(ce),v=function(e,t,n,i){var r,o,a,s,l,u,c,f,d=e=>e(f),h=[],p=i?i.slice():[],m={},g={};for(p.forEach(((e,t)=>m[e]=t+1)),s=0,c=e.length;sn.add(e)))):(r=n.value=n.value||this.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),n.changes(),t.visit(t.SOURCE,(e=>{ht(e,r[n.cellkey(e)].tuple)})),t.reflow(i).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,i;for(n=0,i=this._alen;n{const n=nl(t,a)[s],i=e.counts?t.length:1;Ol(n,c||pt(t),f,d).forEach((e=>{const n={};for(let e=0;e(this._pending=nt(e.data),e=>e.touch(this))));return{async:t}}return n.request(e.url,e.format).then((e=>Nu(this,t,nt(e.data))))}}),Tu.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},_t(Tu,Es,{transform(e,t){const n=e.fields,i=e.index,r=e.values,o=null==e.default?null:e.default,a=e.modified(),s=n.length;let l,u,c,f=a?t.SOURCE:t.ADD,d=t,h=e.as;return r?(u=r.length,s>1&&!h&&me('Multi-field lookup requires explicit "as" parameter.'),h&&h.length!==s*u&&me('The "as" parameter has too few output field names.'),h=h||r.map(ce),l=function(e){for(var t,a,l=0,c=0;lt.modified(e.fields))),f|=c?t.MOD:0),t.visit(f,l),d.modifies(h)}}),_t(zu,os),_t(Pu,os),_t(Bu,Es,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),ju.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:jl,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},_t(ju,Jl,{_transform:Jl.prototype.transform,transform(e,t){return this._transform(function(e,t){const n=e.field,i=e.value,r=("count"===e.op?"__count__":e.op)||"sum",o=fe(n).concat(fe(i)),a=function(e,t,n){const i={},r=[];return n.visit(n.SOURCE,(t=>{const n=e(t);i[n]||(i[n]=1,r.push(n))})),r.sort(st),t?r.slice(0,t):r}(n,e.limit||0,t);return t.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:a.map((()=>r)),fields:a.map((e=>function(e,t,n,i){return ue((i=>t(i)===e?n(i):NaN),i,e+"")}(e,n,i,o))),as:a.map((e=>e+"")),modified:e.modified.bind(e)}}(e,t),t)}}),_t(Iu,yu,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(Ga(e),n,t,e);return(e.modified("field")||i&&t.modified(fe(i)))&&me("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,(e=>{const t=r(e);i(e).forEach((e=>t.mod(e)))})),t.visit(t.ADD,(e=>{const t=r(e);i(e).forEach((e=>t.add(Ya(e))))})),t.visit(t.REM,(e=>{const t=r(e);i(e).forEach((e=>t.rem(e)))}))):(t.visit(t.MOD,(e=>r(e).mod(e))),t.visit(t.ADD,(e=>r(e).add(e))),t.visit(t.REM,(e=>r(e).rem(e)))),t.clean()&&t.runAfter((()=>this.clean())),t}}),Uu.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},_t(Uu,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=cu(e.fields,e.as||[]),o=i?(e,t)=>function(e,t,n,i){for(let r=0,o=n.length;r{const t=Ga(e);n.rem.push(a[t]),a[t]=null})),t.visit(t.ADD,(e=>{const t=o(e,Ya({}));a[Ga(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{n.mod.push(o(e,a[Ga(e)]))})),n}}),_t(qu,Es,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),Wu.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]},_t(Wu,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;const r=fu(t.materialize(t.SOURCE).source,e.groupby,e.field),o=(e.groupby||[]).map(ce),a=[],s=e.step||.01,l=e.probs||Tl(s/2,1-1e-14,s),u=l.length;return r.forEach((e=>{const t=Ls(e,l);for(let n=0;n{const t=Ga(e);n.rem.push(i[t]),i[t]=null})),t.visit(t.ADD,(e=>{const t=Xa(e);i[Ga(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{const t=i[Ga(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)}))),n}}),Gu.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},_t(Gu,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,o=this.value.reduce(((e,t)=>(e[Ga(t)]=1,e)),{});let a=this.value,s=this.count,l=0;function u(e){let t,i;a.length=l&&(t=a[i],o[Ga(t)]&&n.rem.push(t),a[i]=e)),++s}if(t.rem.length&&(t.visit(t.REM,(e=>{const t=Ga(e);o[t]&&(o[t]=-1,n.rem.push(e)),--s})),a=a.filter((e=>-1!==o[Ga(e)]))),(t.rem.length||i)&&a.length{o[Ga(e)]||u(e)})),l=-1),i&&a.length>r){const e=a.length-r;for(let t=0;t{o[Ga(e)]&&n.mod.push(e)})),t.add.length&&t.visit(t.ADD,u),(t.add.length||l<0)&&(n.add=a.filter((e=>!o[Ga(e)]))),this.count=s,this.value=n.source=a,n}}),Vu.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},_t(Vu,Es,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),i=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=Tl(e.start,e.stop,e.step||1).map((e=>{const t={};return t[i]=e,Ya(t)})),n.add=t.add.concat(this.value),n}}),_t(Yu,Es,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const Ju=["unit0","unit1"];function Qu(e){Es.call(this,bt(),e)}function Zu(e){Es.call(this,null,e)}Xu.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Oi,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:Ju}]},_t(Xu,Es,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,o=this._floor(e,t),a=(r?lr:sr)(o.unit).offset,s=e.as||Ju,l=s[0],u=s[1],c=o.step;let f=o.start||1/0,d=o.stop||-1/0,h=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(fe(n)))&&(h=(t=t.reflow(!0)).SOURCE,f=1/0,d=-1/0),t.visit(h,(e=>{const t=n(e);let r,s;null==t?(e[l]=null,i&&(e[u]=null)):(e[l]=r=s=o(t),i&&(e[u]=s=a(r,c)),rd&&(d=s))})),o.start=f,o.stop=d,t.modifies(i?s:l)},_floor(e,t){const n="utc"===e.timezone,{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:Er({extent:e.extent||pt(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),o=Ti(i),a=this.value||{},s=(n?rr:tr)(o,r);return s.unit=Pe(o),s.units=o,s.step=r,s.start=a.start,s.stop=a.stop,this.value=s}}),_t(Qu,Es,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,o=e=>r.set(i(e),e);let a=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,o)):t.changed()?(t.visit(t.REM,(e=>r.delete(i(e)))),t.visit(t.ADD,o)):a=!1,this.modified(a),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}}),_t(Zu,Es,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(Za(e.sort)):t.source).map(e.field))}});const Ku={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){const e=Ku.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,i=t.compare;let r=t.index;if(e0||me("ntile num must be greater than zero.");const n=Ku.cume_dist(),i=n.next;return{init:n.init,next:e=>Math.ceil(t*i(e))}},lag:function(e,t){return t=+t||1,{next:n=>{const i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const i=n.index+t,r=n.data;return ie(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return(t=+t)>0||me("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return it=null,next:n=>{const i=e(n.data[n.index]);return null!=i?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{const r=i.data;return i.index<=n?t:(n=function(e,t,n){for(let i=t.length;nl[e]=1))}h(e.sort),t.forEach(((e,t)=>{const l=n[t],p=i[t],m=r[t]||null,g=ce(l),y=Rl(e,g,o[t]);if(h(l),a.push(y),yt(Ku,e))s.push(function(e,t,n,i){const r=Ku[e](t,n);return{init:r.init||xe,update:function(e,t){t[i]=r.next(e)}}}(e,l,p,y));else{if(null==l&&"count"!==e&&me("Null aggregate field specified."),"count"===e)return void c.push(y);d=!1;let t=u[g];t||(t=u[g]=[],t.field=l,f.push(t)),t.push(Il(e,m,y))}})),(c.length||f.length)&&(this.cell=function(e,t,n){e=e.map((e=>Vl(e,e.field)));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,o=i.agg=Array(r),a=0;a0&&!r(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),ie.init())),this.cell&&this.cell.init()},nc.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,o=i&&i.length;let a;if(n){for(a=e.p0;athis.group(r(e));let a=this.state;a&&!n||(a=this.state=new tc(e)),n||t.modified(a.inputs)?(this.value={},t.visit(t.SOURCE,(e=>o(e).add(e)))):(t.visit(t.REM,(e=>o(e).remove(e))),t.visit(t.ADD,(e=>o(e).add(e))));for(let t=0,n=this._mlen;t0)for(var i,r=e[0],o=t[0],a=e[n]-r,s=t[n]-o,l=-1;++l<=n;)i=l/n,this._basis.point(this._beta*e[l]+(1-this._beta)*(r+i*a),this._beta*t[l]+(1-this._beta)*(o+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const hc=function e(t){function n(e){return 1===t?new lc(e):new dc(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function pc(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function mc(e,t){this._context=e,this._k=(1-t)/6}mc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:pc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:pc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const gc=function e(t){function n(e){return new mc(e,t)}return n.tension=function(t){return e(+t)},n}(0);function yc(e,t){this._context=e,this._k=(1-t)/6}yc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:pc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const vc=function e(t){function n(e){return new yc(e,t)}return n.tension=function(t){return e(+t)},n}(0);function bc(e,t){this._context=e,this._k=(1-t)/6}bc.prototype={areaStart:uc,areaEnd:uc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:pc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const xc=function e(t){function n(e){return new bc(e,t)}return n.tension=function(t){return e(+t)},n}(0),_c=Math.abs,wc=Math.atan2,kc=Math.cos,Ec=Math.max,Ac=Math.min,$c=Math.sin,Dc=Math.sqrt,Sc=1e-12,Mc=Math.PI,Cc=Mc/2,Fc=2*Mc;function Oc(e){return e>=1?Cc:e<=-1?-Cc:Math.asin(e)}function Nc(e,t,n){var i=e._x1,r=e._y1,o=e._x2,a=e._y2;if(e._l01_a>Sc){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,r=(r*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>Sc){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*u+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*u+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(i,r,o,a,e._x2,e._y2)}function Tc(e,t){this._context=e,this._alpha=t}Tc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Nc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const zc=function e(t){function n(e){return t?new Tc(e,t):new mc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Rc(e,t){this._context=e,this._alpha=t}Rc.prototype={areaStart:uc,areaEnd:uc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Nc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Pc=function e(t){function n(e){return t?new Rc(e,t):new bc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Lc(e,t){this._context=e,this._alpha=t}Lc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Nc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Bc=function e(t){function n(e){return t?new Lc(e,t):new yc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function jc(e){this._context=e}function Ic(e){return new jc(e)}function Uc(e){this._context=e}function qc(e){return e<0?-1:1}function Wc(e,t,n){var i=e._x1-e._x0,r=t-e._x1,o=(e._y1-e._y0)/(i||r<0&&-0),a=(n-e._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(qc(o)+qc(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function Hc(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Gc(e,t,n){var i=e._x0,r=e._y0,o=e._x1,a=e._y1,s=(o-i)/3;e._context.bezierCurveTo(i+s,r+s*t,o-s,a-s*n,o,a)}function Vc(e){this._context=e}function Yc(e){this._context=new Xc(e)}function Xc(e){this._context=e}function Jc(e){this._context=e}function Qc(e){var t,n,i=e.length-1,r=new Array(i),o=new Array(i),a=new Array(i);for(r[0]=0,o[0]=2,a[0]=e[0]+2*e[1],t=1;t=0;--t)r[t]=(a[t]-r[t+1])/o[t];for(o[i-1]=(e[i]+r[i-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};const ef=Math.PI,tf=2*ef,nf=1e-6,rf=tf-nf;function of(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return of;const n=10**t;return function(e){this._+=e[0];for(let t=1,i=e.length;tnf)if(Math.abs(c*s-l*u)>nf&&r){let d=n-o,h=i-a,p=s*s+l*l,m=d*d+h*h,g=Math.sqrt(p),y=Math.sqrt(f),v=r*Math.tan((ef-Math.acos((p+f-m)/(2*g*y)))/2),b=v/y,x=v/g;Math.abs(b-1)>nf&&this._append`L${e+b*u},${t+b*c}`,this._append`A${r},${r},0,0,${+(c*d>u*h)},${this._x1=e+x*s},${this._y1=t+x*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,i,r,o){if(e=+e,t=+t,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),s=n*Math.sin(i),l=e+a,u=t+s,c=1^o,f=o?i-r:r-i;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>nf||Math.abs(this._y1-u)>nf)&&this._append`L${l},${u}`,n&&(f<0&&(f=f%tf+tf),f>rf?this._append`A${n},${n},0,1,${c},${e-a},${t-s}A${n},${n},0,1,${c},${this._x1=l},${this._y1=u}`:f>nf&&this._append`A${n},${n},0,${+(f>=ef)},${c},${this._x1=e+n*Math.cos(r)},${this._y1=t+n*Math.sin(r)}`)}rect(e,t,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function sf(){return new af}function lf(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new af(t)}function uf(e){return e.innerRadius}function cf(e){return e.outerRadius}function ff(e){return e.startAngle}function df(e){return e.endAngle}function hf(e){return e&&e.padAngle}function pf(e,t,n,i,r,o,a){var s=e-n,l=t-i,u=(a?o:-o)/Dc(s*s+l*l),c=u*l,f=-u*s,d=e+c,h=t+f,p=n+c,m=i+f,g=(d+p)/2,y=(h+m)/2,v=p-d,b=m-h,x=v*v+b*b,_=r-o,w=d*m-p*h,k=(b<0?-1:1)*Dc(Ec(0,_*_*x-w*w)),E=(w*b-v*k)/x,A=(-w*v-b*k)/x,$=(w*b+v*k)/x,D=(-w*v+b*k)/x,S=E-g,M=A-y,C=$-g,F=D-y;return S*S+M*M>C*C+F*F&&(E=$,A=D),{cx:E,cy:A,x01:-c,y01:-f,x11:E*(r/_-1),y11:A*(r/_-1)}}function mf(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function gf(e){return e[0]}function yf(e){return e[1]}function vf(e,t){var n=Kc(!0),i=null,r=Ic,o=null,a=lf(s);function s(s){var l,u,c,f=(s=mf(s)).length,d=!1;for(null==i&&(o=r(c=a())),l=0;l<=f;++l)!(l=f;--d)s.point(y[d],v[d]);s.lineEnd(),s.areaEnd()}g&&(y[c]=+e(h,c,u),v[c]=+t(h,c,u),s.point(i?+i(h,c,u):y[c],n?+n(h,c,u):v[c]))}if(p)return s=null,p+""||null}function c(){return vf().defined(r).curve(a).context(o)}return e="function"==typeof e?e:void 0===e?gf:Kc(+e),t="function"==typeof t?t:Kc(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?yf:Kc(+n),u.x=function(t){return arguments.length?(e="function"==typeof t?t:Kc(+t),i=null,u):e},u.x0=function(t){return arguments.length?(e="function"==typeof t?t:Kc(+t),u):e},u.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:Kc(+e),u):i},u.y=function(e){return arguments.length?(t="function"==typeof e?e:Kc(+e),n=null,u):t},u.y0=function(e){return arguments.length?(t="function"==typeof e?e:Kc(+e),u):t},u.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:Kc(+e),u):n},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(n)},u.lineX1=function(){return c().x(i).y(t)},u.defined=function(e){return arguments.length?(r="function"==typeof e?e:Kc(!!e),u):r},u.curve=function(e){return arguments.length?(a=e,null!=o&&(s=a(o)),u):a},u.context=function(e){return arguments.length?(null==e?o=s=null:s=a(o=e),u):o},u}sf.prototype=af.prototype,Array.prototype.slice,Dc(3);const xf={draw(e,t){const n=Dc(t/Mc);e.moveTo(n,0),e.arc(0,0,n,0,Fc)}};Dc(1/3),$c(Mc/10),$c(7*Mc/10);function _f(e,t){if("undefined"!=typeof document&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}$c(Fc/10),kc(Fc/10),Dc(3),Dc(3),Dc(3),Dc(12);const wf=()=>"undefined"!=typeof Image?Image:null,kf=bi(yi),Ef=kf.right,Af=kf.left,$f=(bi(Ns).center,Ef);function Df(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Sf(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function Mf(){}var Cf=.7,Ff=1/Cf,Of="\\s*([+-]?\\d+)\\s*",Nf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Tf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zf=/^#([0-9a-f]{3,8})$/,Rf=new RegExp(`^rgb\\(${Of},${Of},${Of}\\)$`),Pf=new RegExp(`^rgb\\(${Tf},${Tf},${Tf}\\)$`),Lf=new RegExp(`^rgba\\(${Of},${Of},${Of},${Nf}\\)$`),Bf=new RegExp(`^rgba\\(${Tf},${Tf},${Tf},${Nf}\\)$`),jf=new RegExp(`^hsl\\(${Nf},${Tf},${Tf}\\)$`),If=new RegExp(`^hsla\\(${Nf},${Tf},${Tf},${Nf}\\)$`),Uf={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function qf(){return this.rgb().formatHex()}function Wf(){return this.rgb().formatRgb()}function Hf(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=zf.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Gf(t):3===n?new Jf(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Vf(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Vf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Rf.exec(e))?new Jf(t[1],t[2],t[3],1):(t=Pf.exec(e))?new Jf(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Lf.exec(e))?Vf(t[1],t[2],t[3],t[4]):(t=Bf.exec(e))?Vf(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=jf.exec(e))?nd(t[1],t[2]/100,t[3]/100,1):(t=If.exec(e))?nd(t[1],t[2]/100,t[3]/100,t[4]):Uf.hasOwnProperty(e)?Gf(Uf[e]):"transparent"===e?new Jf(NaN,NaN,NaN,0):null}function Gf(e){return new Jf(e>>16&255,e>>8&255,255&e,1)}function Vf(e,t,n,i){return i<=0&&(e=t=n=NaN),new Jf(e,t,n,i)}function Yf(e){return e instanceof Mf||(e=Hf(e)),e?new Jf((e=e.rgb()).r,e.g,e.b,e.opacity):new Jf}function Xf(e,t,n,i){return 1===arguments.length?Yf(e):new Jf(e,t,n,null==i?1:i)}function Jf(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}function Qf(){return`#${td(this.r)}${td(this.g)}${td(this.b)}`}function Zf(){const e=Kf(this.opacity);return`${1===e?"rgb(":"rgba("}${ed(this.r)}, ${ed(this.g)}, ${ed(this.b)}${1===e?")":`, ${e})`}`}function Kf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ed(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function td(e){return((e=ed(e))<16?"0":"")+e.toString(16)}function nd(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new od(e,t,n,i)}function id(e){if(e instanceof od)return new od(e.h,e.s,e.l,e.opacity);if(e instanceof Mf||(e=Hf(e)),!e)return new od;if(e instanceof od)return e;var t=(e=e.rgb()).r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),o=Math.max(t,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=t===o?(n-i)/s+6*(n0&&l<1?0:a,new od(a,s,l,e.opacity)}function rd(e,t,n,i){return 1===arguments.length?id(e):new od(e,t,n,null==i?1:i)}function od(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function ad(e){return(e=(e||0)%360)<0?e+360:e}function sd(e){return Math.max(0,Math.min(1,e||0))}function ld(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function ud(e,t,n,i,r){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*n+(1+3*e+3*o-3*a)*i+a*r)/6}function cd(e){var t=e.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[i],o=e[i+1],a=i>0?e[i-1]:2*r-o,s=i=240?e-240:e+120,r,i),ld(e,r,i),ld(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new od(ad(this.h),sd(this.s),sd(this.l),Kf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Kf(this.opacity);return`${1===e?"hsl(":"hsla("}${ad(this.h)}, ${100*sd(this.s)}%, ${100*sd(this.l)}%${1===e?")":`, ${e})`}`}}));const dd=e=>()=>e;function hd(e,t){return function(n){return e+n*t}}function pd(e,t){var n=t-e;return n?hd(e,n>180||n<-180?n-360*Math.round(n/360):n):dd(isNaN(e)?t:e)}function md(e,t){var n=t-e;return n?hd(e,n):dd(isNaN(e)?t:e)}const gd=function e(t){var n=function(e){return 1==(e=+e)?md:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}(t,n,e):dd(isNaN(t)?n:t)}}(t);function i(e,t){var i=n((e=Xf(e)).r,(t=Xf(t)).r),r=n(e.g,t.g),o=n(e.b,t.b),a=md(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=r(t),e.b=o(t),e.opacity=a(t),e+""}}return i.gamma=e,i}(1);function yd(e){return function(t){var n,i,r=t.length,o=new Array(r),a=new Array(r),s=new Array(r);for(n=0;no&&(r=t.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:Ad(n,i)})),o=Sd.lastIndex;return ot&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(a[0],a[e-1])),i=e>2?Pd:Rd,r=o=null,f}function f(t){return null==t||isNaN(t=+t)?n:(r||(r=i(a.map(e),s,l)))(e(u(t)))}return f.invert=function(n){return u(t((o||(o=i(s,a.map(e),Ad)))(n)))},f.domain=function(e){return arguments.length?(a=Array.from(e,Od),c()):a.slice()},f.range=function(e){return arguments.length?(s=Array.from(e),c()):s.slice()},f.rangeRound=function(e){return s=Array.from(e),l=Fd,c()},f.clamp=function(e){return arguments.length?(u=!!e||Td,c()):u!==Td},f.interpolate=function(e){return arguments.length?(l=e,c()):l},f.unknown=function(e){return arguments.length?(n=e,f):n},function(n,i){return e=n,t=i,c()}}function jd(){return Bd()(Td,Td)}function Id(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Ud(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}function qd(e,t,n,i){var r,o=pn(e,t,n);switch((i=yn(null==i?",f":i)).type){case"s":var a=Math.max(Math.abs(e),Math.abs(t));return null!=i.precision||isNaN(r=_n(o,a))||(i.precision=r),Mn(i,a);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=wn(o,Math.max(Math.abs(e),Math.abs(t))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=kn(o))||(i.precision=r-2*("%"===i.type))}return Sn(i)}function Wd(e){var t=e.domain;return e.ticks=function(e){var n=t();return dn(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var i=t();return qd(i[0],i[i.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var i,r,o=t(),a=0,s=o.length-1,l=o[a],u=o[s],c=10;for(u0;){if((r=hn(l,u,n))===i)return o[a]=l,o[s]=u,t(o);if(r>0)l=Math.floor(l/r)*r,u=Math.ceil(u/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,u=Math.floor(u*r)/r}i=r}return e},e}function Hd(e,t){var n,i=0,r=(e=e.slice()).length-1,o=e[i],a=e[r];return a-e(-t,n)}function Zd(e){const t=e(Gd,Vd),n=t.domain;let i,r,o=10;function a(){return i=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(o),r=function(e){return 10===e?Jd:e===Math.E?Math.exp:t=>Math.pow(e,t)}(o),n()[0]<0?(i=Qd(i),r=Qd(r),e(Yd,Xd)):e(Gd,Vd),t}return t.base=function(e){return arguments.length?(o=+e,a()):o},t.domain=function(e){return arguments.length?(n(e),a()):n()},t.ticks=e=>{const t=n();let a=t[0],s=t[t.length-1];const l=s0){for(;f<=d;++f)for(u=1;us)break;p.push(c)}}else for(;f<=d;++f)for(u=o-1;u>=1;--u)if(c=f>0?u/r(-f):u*r(f),!(cs)break;p.push(c)}2*p.length{if(null==e&&(e=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=yn(n)).precision||(n.trim=!0),n=Sn(n)),e===1/0)return n;const a=Math.max(1,o*e/t.ticks().length);return e=>{let t=e/r(Math.round(i(e)));return t*on(Hd(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function Kd(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function eh(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function th(e){return e<0?-e*e:e*e}function nh(e){var t=e(Td,Td),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(Td,Td):.5===n?e(eh,th):e(Kd(n),Kd(1/n)):n},Wd(t)}function ih(){var e=nh(Bd());return e.copy=function(){return Ld(e,ih()).exponent(e.exponent())},Id.apply(e,arguments),e}function rh(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function oh(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function ah(e){var t=1,n=e(rh(t),oh(t));return n.constant=function(n){return arguments.length?e(rh(t=+n),oh(t)):t},Wd(n)}function sh(e,t,n,i,r,o){const a=[[mi,1,Rn],[mi,5,5e3],[mi,15,15e3],[mi,30,3e4],[o,1,Pn],[o,5,3e5],[o,15,9e5],[o,30,18e5],[r,1,Ln],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,Bn],[i,2,1728e5],[n,1,jn],[t,1,2592e6],[t,3,7776e6],[e,1,In]];function s(t,n,i){const r=Math.abs(n-t)/i,o=bi((([,,e])=>e)).right(a,r);if(o===a.length)return e.every(pn(t/In,n/In,i));if(0===o)return gi.every(Math.max(pn(t,n,i),1));const[s,l]=a[r/a[o-1][2]180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:Ad(e,t)})):t&&n.push(r(n)+"rotate("+t+i)}(o.rotate,a.rotate,s,l),function(e,t,n,o){e!==t?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:Ad(e,t)}):t&&n.push(r(n)+"skewX("+t+i)}(o.skewX,a.skewX,s,l),function(e,t,n,i,o,a){if(e!==n||t!==i){var s=o.push(r(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Ad(e,n)},{i:s-2,x:Ad(t,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(e){for(var t,n=-1,i=l.length;++nZh?Math.pow(e,1/3):e/Qh+Xh}function ip(e){return e>Jh?e*e*e:Qh*(e-Xh)}function rp(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function op(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ap(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof sp)return new sp(e.h,e.c,e.l,e.opacity);if(e instanceof tp||(e=Kh(e)),0===e.a&&0===e.b)return new sp(NaN,00?i:1:0}const Sp="linear",Mp="log",Cp="pow",Fp="sqrt",Op="symlog",Np="time",Tp="utc",zp="sequential",Rp="diverging",Pp="quantile",Lp="quantize",Bp="threshold",jp="ordinal",Ip="point",Up="band",qp="bin-ordinal",Wp="continuous",Hp="discrete",Gp="discretizing",Vp="interpolating",Yp="temporal";function Xp(){const e=Mh().unknown(void 0),t=e.domain,n=e.range;let i,r,o=[0,1],a=!1,s=0,l=0,u=.5;function c(){const e=t().length,c=o[1]h+i*e));return n(c?p.reverse():p)}return delete e.unknown,e.domain=function(e){return arguments.length?(t(e),c()):t()},e.range=function(e){return arguments.length?(o=[+e[0],+e[1]],c()):o.slice()},e.rangeRound=function(e){return o=[+e[0],+e[1]],a=!0,c()},e.bandwidth=function(){return r},e.step=function(){return i},e.round=function(e){return arguments.length?(a=!!e,c()):a},e.padding=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),s=l,c()):s},e.paddingInner=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),c()):s},e.paddingOuter=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),c()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=o[1]o[1-i])?void 0:(l=Math.max(0,Ef(a,f)-1),u=f===d?l:Ef(a,d)-1,f-a[l]>r+1e-10&&++l,i&&(c=l,l=s-u,u=s-c),l>u?void 0:t().slice(l,u+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return Xp().domain(t()).range(o).round(a).paddingInner(s).paddingOuter(l).align(u)},c()}function Jp(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Jp(t())},e}var Qp=Array.prototype.map;const Zp=Array.prototype.slice,Kp=new Map,em=Symbol("vega_scale");function tm(e){return e[em]=!0,e}function nm(e,t,n){return arguments.length>1?(Kp.set(e,function(e,t,n){const i=function(){const n=t();return n.invertRange||(n.invertRange=n.invert?function(e){return function(t){let n,i=t[0],r=t[1];return r=s&&n[o]<=l&&(u<0&&(u=o),i=o);if(!(u<0))return s=e.invertExtent(n[u]),l=e.invertExtent(n[i]),[void 0===s[0]?s[1]:s[0],void 0===l[1]?l[0]:l[1]]}}(n):void 0),n.type=e,tm(n)};return i.metadata=Ut(nt(n)),i}(e,t,n)),this):im(e)?Kp.get(e):void 0}function im(e){return Kp.has(e)}function rm(e,t){const n=Kp.get(e);return n&&n.metadata[t]}function om(e){return rm(e,Wp)}function am(e){return rm(e,Hp)}function sm(e){return rm(e,Gp)}function lm(e){return rm(e,Mp)}function um(e){return rm(e,Vp)}function cm(e){return rm(e,Pp)}nm("identity",(function e(t){var n;function i(e){return null==e||isNaN(e=+e)?n:e}return i.invert=i,i.domain=i.range=function(e){return arguments.length?(t=Array.from(e,Od),i):t.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,Od):[0,1],Wd(i)})),nm(Sp,(function e(){var t=jd();return t.copy=function(){return Ld(t,e())},Id.apply(t,arguments),Wd(t)}),Wp),nm(Mp,(function e(){const t=Zd(Bd()).domain([1,10]);return t.copy=()=>Ld(t,e()).base(t.base()),Id.apply(t,arguments),t}),[Wp,Mp]),nm(Cp,ih,Wp),nm(Fp,(function(){return ih.apply(null,arguments).exponent(.5)}),Wp),nm(Op,(function e(){var t=ah(Bd());return t.copy=function(){return Ld(t,e()).constant(t.constant())},Id.apply(t,arguments)}),Wp),nm(Np,(function(){return Id.apply(ph(ch,fh,si,ui,Gn,Un,fi,hi,mi,Cr).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Wp,Yp]),nm(Tp,(function(){return Id.apply(ph(lh,uh,li,ci,ei,qn,di,pi,mi,Or).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Wp,Yp]),nm(zp,yh,[Wp,Vp]),nm(`${zp}-${Sp}`,yh,[Wp,Vp]),nm(`${zp}-${Mp}`,(function e(){var t=Zd(mh()).domain([1,10]);return t.copy=function(){return gh(t,e()).base(t.base())},Ud.apply(t,arguments)}),[Wp,Vp,Mp]),nm(`${zp}-${Cp}`,vh,[Wp,Vp]),nm(`${zp}-${Fp}`,(function(){return vh.apply(null,arguments).exponent(.5)}),[Wp,Vp]),nm(`${zp}-${Op}`,(function e(){var t=ah(mh());return t.copy=function(){return gh(t,e()).constant(t.constant())},Ud.apply(t,arguments)}),[Wp,Vp]),nm(`${Rp}-${Sp}`,(function e(){var t=Wd(xh()(Td));return t.copy=function(){return gh(t,e())},Ud.apply(t,arguments)}),[Wp,Vp]),nm(`${Rp}-${Mp}`,(function e(){var t=Zd(xh()).domain([.1,1,10]);return t.copy=function(){return gh(t,e()).base(t.base())},Ud.apply(t,arguments)}),[Wp,Vp,Mp]),nm(`${Rp}-${Cp}`,_h,[Wp,Vp]),nm(`${Rp}-${Fp}`,(function(){return _h.apply(null,arguments).exponent(.5)}),[Wp,Vp]),nm(`${Rp}-${Op}`,(function e(){var t=ah(xh());return t.copy=function(){return gh(t,e()).constant(t.constant())},Ud.apply(t,arguments)}),[Wp,Vp]),nm(Pp,(function e(){var t,n=[],i=[],r=[];function o(){var e=0,t=Math.max(1,i.length);for(r=new Array(t-1);++e0?r[t-1]:n[0],t=r?[o[r-1],i]:[o[t-1],o[t]]},s.unknown=function(e){return arguments.length?(t=e,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return e().domain([n,i]).range(a).unknown(t)},Id.apply(Wd(s),arguments)}),Gp),nm(Bp,(function e(){var t,n=[.5],i=[0,1],r=1;function o(e){return null!=e&&e<=e?i[$f(n,e,0,r)]:t}return o.domain=function(e){return arguments.length?(n=Array.from(e),r=Math.min(n.length,i.length-1),o):n.slice()},o.range=function(e){return arguments.length?(i=Array.from(e),r=Math.min(n.length,i.length-1),o):i.slice()},o.invertExtent=function(e){var t=i.indexOf(e);return[n[t-1],n[t]]},o.unknown=function(e){return arguments.length?(t=e,o):t},o.copy=function(){return e().domain(n).range(i).unknown(t)},Id.apply(o,arguments)}),Gp),nm(qp,(function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[($f(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return Qp.call(e,Le)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=Zp.call(e),i):n.slice()},i.tickFormat=function(e,n){return qd(t[0],Pe(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i}),[Hp,Gp]),nm(jp,Mh,Hp),nm(Up,Xp,Hp),nm(Ip,(function(){return Jp(Xp().paddingInner(1))}),Hp);const fm=["clamp","base","constant","exponent"];function dm(e,t){const n=t[0],i=Pe(t)-n;return function(t){return e(n+t*i)}}function hm(e,t,n){return bh(gm(t||"rgb",n),e)}function pm(e,t){const n=new Array(t),i=t+1;for(let r=0;re[t]?a[t](e[t]()):0)),a):ft(.5)}function gm(e,t){const n=a[function(e){return"interpolate"+e.toLowerCase().split("-").map((e=>e[0].toUpperCase()+e.slice(1))).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}function ym(e){const t=e.length/6|0,n=new Array(t);for(let i=0;i1?(bm[e]=t,this):bm[e]}vm({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},ym),vm({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(e=>hm(ym(e))));const _m="symbol",wm="discrete",km=e=>Fe(e)?e.map((e=>String(e))):String(e),Em=(e,t)=>e[1]-t[1],Am=(e,t)=>t[1]-e[1];function $m(e,t,n){let i;return $t(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,Math.floor(Rt(e.domain())/n||1)+1))),Oe(t)&&(i=t.step,t=t.interval),St(t)&&(t=e.type===Np?sr(t):e.type==Tp?lr(t):me("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function Dm(e,t,n){let i=e.range(),r=i[0],o=Pe(i),a=Em;if(r>o&&(i=o,o=r,r=i,a=Am),r=Math.floor(r),o=Math.ceil(o),t=t.map((t=>[t,e(t)])).filter((e=>r<=e[1]&&e[1]<=o)).sort(a).map((e=>e[0])),n>0&&t.length>1){const e=[t[0],Pe(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((e,t)=>!(t%2)));t.length<3&&(t=e)}return t}function Sm(e,t){return e.bins?Dm(e,e.bins):e.ticks?e.ticks(t):e.domain()}function Mm(e,t,n,i,r,o){const a=t.type;let s=km;if(a===Np||r===Np)s=e.timeFormat(i);else if(a===Tp||r===Tp)s=e.utcFormat(i);else if(lm(a)){const r=e.formatFloat(i);if(o||t.bins)s=r;else{const e=Cm(t,n,!1);s=t=>e(t)?r(t):""}}else if(t.tickFormat){const r=t.domain();s=e.formatSpan(r[0],r[r.length-1],n,i)}else i&&(s=e.format(i));return s}function Cm(e,t,n){const i=Sm(e,t),r=e.base(),o=Math.log(r),a=Math.max(1,r*t/i.length),s=e=>{let t=e/Math.pow(r,Math.round(Math.log(e)/o));return t*rFm[e.type]||e.bins;function zm(e,t,n,i,r,o,a){const s=Om[t.type]&&o!==Np&&o!==Tp?function(e,t,n){const i=t[Om[t.type]](),r=i.length;let o,a=r>1?i[1]-i[0]:i[0];for(o=1;o(t,n,i)=>{const r=Pm(i[n+1],Pm(i.max,1/0)),o=jm(t,e),a=jm(r,e);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Pm=(e,t)=>null!=e?e:t,Lm=e=>(t,n)=>n?e(t):null,Bm=e=>t=>e(t),jm=(e,t)=>Number.isFinite(e)?t(e):null;function Im(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=function(e,t,n,i){const r=i||t.type;return St(n)&&function(e){return rm(e,Yp)}(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==Np?n||r!==Tp?zm(e,t,5,null,n,i,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}(e,t,n.format,n.formatType);if(sm(t.type)){const e=Nm(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(am(t.type)){const e=t.domain(),n=e.length;return`${n} value${1===n?"":"s"}: ${n>i?e.slice(0,i-2).map(r).join(", ")+", ending with "+e.slice(-1).map(r):e.map(r).join(", ")}`}{const e=t.domain();return`values from ${r(e[0])} to ${r(Pe(e))}`}}let Um=0;const qm="p_";function Wm(e){return e&&e.gradient}function Hm(e,t,n){const i=e.gradient;let r=e.id,o="radial"===i?qm:"";return r||(r=e.id="gradient_"+Um++,"radial"===i?(e.x1=Gm(e.x1,.5),e.y1=Gm(e.y1,.5),e.r1=Gm(e.r1,0),e.x2=Gm(e.x2,.5),e.y2=Gm(e.y2,.5),e.r2=Gm(e.r2,.5),o=qm):(e.x1=Gm(e.x1,0),e.y1=Gm(e.y1,0),e.x2=Gm(e.x2,1),e.y2=Gm(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function Gm(e,t){return null!=e?e:t}function Vm(e,t){var n,i=[];return n={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:i,stop:function(e,t){return i.push({offset:e,color:t}),n}}}const Ym={basis:{curve:function(e){return new lc(e)}},"basis-closed":{curve:function(e){return new cc(e)}},"basis-open":{curve:function(e){return new fc(e)}},bundle:{curve:hc,tension:"beta",value:.85},cardinal:{curve:gc,tension:"tension",value:0},"cardinal-open":{curve:vc,tension:"tension",value:0},"cardinal-closed":{curve:xc,tension:"tension",value:0},"catmull-rom":{curve:zc,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Pc,tension:"alpha",value:.5},"catmull-rom-open":{curve:Bc,tension:"alpha",value:.5},linear:{curve:Ic},"linear-closed":{curve:function(e){return new Uc(e)}},monotone:{horizontal:function(e){return new Yc(e)},vertical:function(e){return new Vc(e)}},natural:{curve:function(e){return new Jc(e)}},step:{curve:function(e){return new Zc(e,.5)}},"step-after":{curve:function(e){return new Zc(e,1)}},"step-before":{curve:function(e){return new Zc(e,0)}}};function Xm(e,t,n){var i=yt(Ym,e)&&Ym[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const Jm={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Qm=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Zm=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Km=/^((\s+,?\s*)|(,\s*))/,eg=/^[01]/;function tg(e){const t=[];return(e.match(Qm)||[]).forEach((e=>{let n=e[0];const i=n.toLowerCase(),r=Jm[i],o=function(e,t,n){const i=[];for(let r=0;t&&r1&&(m=Math.sqrt(m),n*=m,i*=m);const g=d/n,y=f/n,v=-f/i,b=d/i,x=g*s+y*l,_=v*s+b*l,w=g*e+y*t,k=v*e+b*t;let E=1/((w-x)*(w-x)+(k-_)*(k-_))-.25;E<0&&(E=0);let A=Math.sqrt(E);o==r&&(A=-A);const $=.5*(x+w)-A*(k-_),D=.5*(_+k)+A*(w-x),S=Math.atan2(_-D,x-$);let M=Math.atan2(k-D,w-$)-S;M<0&&1===o?M+=rg:M>0&&0===o&&(M-=rg);const C=Math.ceil(Math.abs(M/(ig+.001))),F=[];for(let e=0;e+e}function Eg(e,t,n){return Math.max(t,Math.min(e,n))}function Ag(){var e=bg,t=xg,n=_g,i=wg,r=kg(0),o=r,a=r,s=r,l=null;function u(u,c,f){var d,h=null!=c?c:+e.call(this,u),p=null!=f?f:+t.call(this,u),m=+n.call(this,u),g=+i.call(this,u),y=Math.min(m,g)/2,v=Eg(+r.call(this,u),0,y),b=Eg(+o.call(this,u),0,y),x=Eg(+a.call(this,u),0,y),_=Eg(+s.call(this,u),0,y);if(l||(l=d=sf()),v<=0&&b<=0&&x<=0&&_<=0)l.rect(h,p,m,g);else{var w=h+m,k=p+g;l.moveTo(h+v,p),l.lineTo(w-b,p),l.bezierCurveTo(w-vg*b,p,w,p+vg*b,w,p+b),l.lineTo(w,k-_),l.bezierCurveTo(w,k-vg*_,w-vg*_,k,w-_,k),l.lineTo(h+x,k),l.bezierCurveTo(h+vg*x,k,h,k-vg*x,h,k-x),l.lineTo(h,p+v),l.bezierCurveTo(h,p+vg*v,h+vg*v,p,h+v,p),l.closePath()}if(d)return l=null,d+""||null}return u.x=function(t){return arguments.length?(e=kg(t),u):e},u.y=function(e){return arguments.length?(t=kg(e),u):t},u.width=function(e){return arguments.length?(n=kg(e),u):n},u.height=function(e){return arguments.length?(i=kg(e),u):i},u.cornerRadius=function(e,t,n,i){return arguments.length?(r=kg(e),o=null!=t?kg(t):r,s=null!=n?kg(n):r,a=null!=i?kg(i):o,u):r},u.context=function(e){return arguments.length?(l=null==e?null:e,u):l},u}function $g(){var e,t,n,i,r,o,a,s,l=null;function u(e,t,n){const i=n/2;if(r){var u=a-t,c=e-o;if(u||c){var f=Math.hypot(u,c),d=(u/=f)*s,h=(c/=f)*s,p=Math.atan2(c,u);l.moveTo(o-d,a-h),l.lineTo(e-u*i,t-c*i),l.arc(e,t,i,p-Math.PI,p),l.lineTo(o+d,a+h),l.arc(o,a,s,p,p+Math.PI)}else l.arc(e,t,i,0,rg);l.closePath()}else r=1;o=e,a=t,s=i}function c(o){var a,s,c,f=o.length,d=!1;for(null==l&&(l=c=sf()),a=0;a<=f;++a)!(ae.x||0,Mg=e=>e.y||0,Cg=e=>!(!1===e.defined),Fg=function(){var e=uf,t=cf,n=Kc(0),i=null,r=ff,o=df,a=hf,s=null,l=lf(u);function u(){var u,c,f=+e.apply(this,arguments),d=+t.apply(this,arguments),h=r.apply(this,arguments)-Cc,p=o.apply(this,arguments)-Cc,m=_c(p-h),g=p>h;if(s||(s=u=l()),dSc)if(m>Fc-Sc)s.moveTo(d*kc(h),d*$c(h)),s.arc(0,0,d,h,p,!g),f>Sc&&(s.moveTo(f*kc(p),f*$c(p)),s.arc(0,0,f,p,h,g));else{var y,v,b=h,x=p,_=h,w=p,k=m,E=m,A=a.apply(this,arguments)/2,$=A>Sc&&(i?+i.apply(this,arguments):Dc(f*f+d*d)),D=Ac(_c(d-f)/2,+n.apply(this,arguments)),S=D,M=D;if($>Sc){var C=Oc($/f*$c(A)),F=Oc($/d*$c(A));(k-=2*C)>Sc?(_+=C*=g?1:-1,w-=C):(k=0,_=w=(h+p)/2),(E-=2*F)>Sc?(b+=F*=g?1:-1,x-=F):(E=0,b=x=(h+p)/2)}var O=d*kc(b),N=d*$c(b),T=f*kc(w),z=f*$c(w);if(D>Sc){var R,P=d*kc(x),L=d*$c(x),B=f*kc(_),j=f*$c(_);if(m1?0:e<-1?Mc:Math.acos(e)}((I*q+U*W)/(Dc(I*I+U*U)*Dc(q*q+W*W)))/2),G=Dc(R[0]*R[0]+R[1]*R[1]);S=Ac(D,(f-G)/(H-1)),M=Ac(D,(d-G)/(H+1))}else S=M=0}E>Sc?M>Sc?(y=pf(B,j,O,N,d,M,g),v=pf(P,L,T,z,d,M,g),s.moveTo(y.cx+y.x01,y.cy+y.y01),MSc&&k>Sc?S>Sc?(y=pf(T,z,P,L,f,-S,g),v=pf(O,N,B,j,f,-S,g),s.lineTo(y.cx+y.x01,y.cy+y.y01),Se.startAngle||0)).endAngle((e=>e.endAngle||0)).padAngle((e=>e.padAngle||0)).innerRadius((e=>e.innerRadius||0)).outerRadius((e=>e.outerRadius||0)).cornerRadius((e=>e.cornerRadius||0)),Og=bf().x(Sg).y1(Mg).y0((e=>(e.y||0)+(e.height||0))).defined(Cg),Ng=bf().y(Mg).x1(Sg).x0((e=>(e.x||0)+(e.width||0))).defined(Cg),Tg=vf().x(Sg).y(Mg).defined(Cg),zg=Ag().x(Sg).y(Mg).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>Dg(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>Dg(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>Dg(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>Dg(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),Rg=function(e,t){let n=null,i=lf(r);function r(){let r;if(n||(n=r=i()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return e="function"==typeof e?e:Kc(e||xf),t="function"==typeof t?t:Kc(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:Kc(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:Kc(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type((e=>gg(e.shape||"circle"))).size((e=>Dg(e.size,64))),Pg=$g().x(Sg).y(Mg).defined(Cg).size((e=>e.size||1));function Lg(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Bg(e,t,n,i){return zg.context(e)(t,n,i)}var jg=1;function Ig(){jg=1}function Ug(e,t,n){var i=t.clip,r=e._defs,o=t.clip_id||(t.clip_id="clip"+jg++),a=r.clipping[o]||(r.clipping[o]={id:o});return rt(i)?a.path=i(null):Lg(n)?a.path=Bg(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function qg(e){this.clear(),e&&this.union(e)}function Wg(e){this.mark=e,this.bounds=this.bounds||new qg}function Hg(e){Wg.call(this,e),this.items=this.items||[]}function Gg(e){this._pending=0,this._loader=e||ja()}function Vg(e){e._pending+=1}function Yg(e){e._pending-=1}function Xg(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){const i=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(i+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,i):0))}return e}qg.prototype={clone(){return new qg(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:o,y2:a}=this,s=Math.cos(e),l=Math.sin(e),u=t-t*s+n*l,c=n-t*l-n*s;return[s*i-l*r+u,l*i+s*r+c,s*i-l*a+u,l*i+s*a+c,s*o-l*r+u,l*o+s*r+c,s*o-l*a+u,l*o+s*a+c]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},_t(Hg,Wg),Gg.prototype={pending(){return this._pending},sanitizeURL(e){const t=this;return Vg(t),t._loader.sanitize(e,{context:"href"}).then((e=>(Yg(t),e))).catch((()=>(Yg(t),null)))},loadImage(e){const t=this,n=wf();return Vg(t),t._loader.sanitize(e,{context:"image"}).then((e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,o=yt(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=o&&(r.crossOrigin=o),r.onload=()=>Yg(t),r.onerror=()=>Yg(t),r.src=i,r})).catch((e=>(Yg(t),{complete:!1,width:0,height:0,src:e&&e.url||""})))},ready(){const e=this;return new Promise((t=>{!function n(i){e.pending()?setTimeout((()=>{n(!0)}),10):t(i)}(!1)}))}};const Jg=rg-1e-8;let Qg,Zg,Kg,ey,ty,ny,iy,ry;const oy=(e,t)=>Qg.add(e,t),ay=(e,t)=>oy(Zg=e,Kg=t),sy=e=>oy(e,Qg.y1),ly=e=>oy(Qg.x1,e),uy=(e,t)=>ty*e+iy*t,cy=(e,t)=>ny*e+ry*t,fy=(e,t)=>oy(uy(e,t),cy(e,t)),dy=(e,t)=>ay(uy(e,t),cy(e,t));function hy(e,t){return Qg=e,t?(ey=t*ng,ty=ry=Math.cos(ey),ny=Math.sin(ey),iy=-ny):(ty=ry=1,ey=ny=iy=0),py}const py={beginPath(){},closePath(){},moveTo:dy,lineTo:dy,rect(e,t,n,i){ey?(fy(e+n,t),fy(e+n,t+i),fy(e,t+i),dy(e,t)):(oy(e+n,t+i),ay(e,t))},quadraticCurveTo(e,t,n,i){const r=uy(e,t),o=cy(e,t),a=uy(n,i),s=cy(n,i);my(Zg,r,a,sy),my(Kg,o,s,ly),ay(a,s)},bezierCurveTo(e,t,n,i,r,o){const a=uy(e,t),s=cy(e,t),l=uy(n,i),u=cy(n,i),c=uy(r,o),f=cy(r,o);gy(Zg,a,l,c,sy),gy(Kg,s,u,f,ly),ay(c,f)},arc(e,t,n,i,r,o){if(i+=ey,r+=ey,Zg=n*Math.cos(r)+e,Kg=n*Math.sin(r)+t,Math.abs(r-i)>Jg)oy(e-n,t-n),oy(e+n,t+n);else{const a=i=>oy(n*Math.cos(i)+e,n*Math.sin(i)+t);let s,l;if(a(i),a(r),r!==i)if((i%=rg)<0&&(i+=rg),(r%=rg)<0&&(r+=rg),rr;++l,s-=ig)a(s);else for(s=i-i%ig+ig,l=0;l<4&&s1e-14?(l=a*a+s*o,l>=0&&(l=Math.sqrt(l),u=(-a+l)/o,c=(-a-l)/o)):u=.5*s/a,0g)return!1;h>m&&(m=h)}else if(f>0){if(h0&&(e.globalAlpha=n,e.fillStyle=Sy(e,t,t.fill),!0)}var Cy=[];function Fy(e,t,n){var i=null!=(i=t.strokeWidth)?i:1;return!(i<=0)&&(n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=Sy(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||Cy),e.lineDashOffset=t.strokeDashOffset||0),!0)}function Oy(e,t){return e.zindex-t.zindex||e.index-t.index}function Ny(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,o=[];for(n=0,i=r.length;n=0;)if(n=t(r[i]))return n;if(r===o)for(i=(r=e.items).length;--i>=0;)if(!r[i].zindex&&(n=t(r[i])))return n;return null}function Ry(e){return function(t,n,i){Ty(n,(n=>{i&&!i.intersects(n.bounds)||Ly(e,t,n,n)}))}}function Py(e){return function(t,n,i){!n.items.length||i&&!i.intersects(n.bounds)||Ly(e,t,n.items[0],n.items)}}function Ly(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(Ay(t,n),n.fill&&My(t,n,r)&&t.fill(),n.stroke&&Fy(t,n,r)&&t.stroke()))}function By(e){return e=e||we,function(t,n,i,r,o,a){return i*=t.pixelRatio,r*=t.pixelRatio,zy(n,(n=>{const s=n.bounds;if((!s||s.contains(o,a))&&s)return e(t,n,i,r,o,a)?n:void 0}))}}function jy(e,t){return function(n,i,r,o){var a,s,l=Array.isArray(i)?i[0]:i,u=null==t?l.fill:t,c=l.stroke&&n.isPointInStroke;return c&&(a=l.strokeWidth,s=l.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!e(n,i)&&(u&&n.isPointInPath(r,o)||c&&n.isPointInStroke(r,o))}}function Iy(e){return By(jy(e))}function Uy(e,t){return"translate("+e+","+t+")"}function qy(e){return"rotate("+e+")"}function Wy(e){return Uy(e.x||0,e.y||0)}function Hy(e,t,n){function i(e,n){var i=n.x||0,r=n.y||0,o=n.angle||0;e.translate(i,r),o&&e.rotate(o*=ng),e.beginPath(),t(e,n),o&&e.rotate(-o),e.translate(-i,-r)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",function(e){return Uy(e.x||0,e.y||0)+(e.angle?" "+qy(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(hy(e,n.angle),n),Xg(e,n).translate(n.x||0,n.y||0)},draw:Ry(i),pick:Iy(i),isect:n||xy(i)}}var Gy=Hy("arc",(function(e,t){return Fg.context(e)(t)}));function Vy(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=jy(i);return{type:e,tag:"path",nested:!0,attr:function(e,n){var i=n.mark.items;i.length&&e("d",t(null,i))},bound:function(e,n){var i=n.items;return 0===i.length?e:(t(hy(e),i),Xg(e,i[0]))},draw:Py(i),pick:function(e,t,n,i,o,a){var s=t.items,l=t.bounds;return!s||!s.length||l&&!l.contains(o,a)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,s,n,i)?s[0]:null)},isect:_y,tip:n}}var Yy=Vy("area",(function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?Ng:Og).curve(Xm(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r="horizontal"===e[0].orient?t[1]:t[0],o="horizontal"===e[0].orient?"y":"x",a=e.length,s=1/0;--a>=0;)!1!==e[a].defined&&(i=Math.abs(e[a][o]-r)).5&&t<1.5?.5-Math.abs(t-1):0}function Qy(e,t){const n=Jy(t);e("d",Bg(null,t,n,n))}function Zy(e,t,n,i){const r=Jy(t);e.beginPath(),Bg(e,t,(n||0)+r,(i||0)+r)}const Ky=jy(Zy),ev=jy(Zy,!1),tv=jy(Zy,!0);var nv={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",Wy(t))},bound:function(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let t=0;t{const r=t.x||0,o=t.y||0,a=t.strokeForeground,s=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&s&&(Zy(e,t,r,o),Ay(e,t),t.fill&&My(e,t,s)&&e.fill(),t.stroke&&!a&&Fy(e,t,s)&&e.stroke()),e.save(),e.translate(r,o),t.clip&&Xy(e,t),n&&n.translate(-r,-o),Ty(t,(t=>{("group"===t.marktype||null==i||i.includes(t.marktype))&&this.draw(e,t,n,i)})),n&&n.translate(r,o),e.restore(),a&&t.stroke&&s&&(Zy(e,t,r,o),Ay(e,t),Fy(e,t,s)&&e.stroke())}))},pick:function(e,t,n,i,r,o){if(t.bounds&&!t.bounds.contains(r,o)||!t.items)return null;const a=n*e.pixelRatio,s=i*e.pixelRatio;return zy(t,(l=>{let u,c,f;const d=l.bounds;if(d&&!d.contains(r,o))return;c=l.x||0,f=l.y||0;const h=c+(l.width||0),p=f+(l.height||0),m=l.clip;if(m&&(rh||op))return;if(e.save(),e.translate(c,f),c=r-c,f=o-f,m&&Lg(l)&&!tv(e,l,a,s))return e.restore(),null;const g=l.strokeForeground,y=!1!==t.interactive;return y&&g&&l.stroke&&ev(e,l,a,s)?(e.restore(),l):(u=zy(l,(e=>function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,c,f)?this.pick(e,n,i,c,f):null)),!u&&y&&(l.fill||!g&&l.stroke)&&Ky(e,l,a,s)&&(u=l),e.restore(),u||null)}))},isect:wy,content:function(e,t,n){e("clip-path",t.clip?Ug(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),Qy(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?Qy(e,t):e("d","")}},iv={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function rv(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then((t=>{e.image=t,e.image.url=e.url}))),n}function ov(e,t){return null!=e.width?e.width:t&&t.width?!1!==e.aspect&&e.height?e.height*t.width/t.height:t.width:0}function av(e,t){return null!=e.height?e.height:t&&t.height?!1!==e.aspect&&e.width?e.width*t.height/t.width:t.height:0}function sv(e,t){return"center"===e?t/2:"right"===e?t:0}function lv(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var uv={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=rv(t,n),r=ov(t,i),o=av(t,i),a=(t.x||0)-sv(t.align,r),s=(t.y||0)-lv(t.baseline,o);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",iv["xmlns:xlink"],"xlink:href"),e("transform",Uy(a,s)),e("width",r),e("height",o),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=ov(t,n),r=av(t,n),o=(t.x||0)-sv(t.align,i),a=(t.y||0)-lv(t.baseline,r);return e.set(o,a,o+i,a+r)},draw:function(e,t,n){Ty(t,(t=>{if(n&&!n.intersects(t.bounds))return;const i=rv(t,this);let r=ov(t,i),o=av(t,i);if(0===r||0===o)return;let a,s,l,u,c=(t.x||0)-sv(t.align,r),f=(t.y||0)-lv(t.baseline,o);!1!==t.aspect&&(s=i.width/i.height,l=t.width/t.height,s==s&&l==l&&s!==l&&(l=0;)if(!1!==e[o].defined&&(n=e[o].x-t[0])*n+(i=e[o].y-t[1])*i{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&mv(e,t,i)&&(Ay(e,t),e.stroke())}}))},pick:By((function(e,t,n,i){return!!e.isPointInStroke&&mv(e,t,1)&&e.isPointInStroke(n,i)})),isect:ky},yv=Hy("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),vv=Hy("symbol",(function(e,t){return Rg.context(e)(t)}),_y);const bv=Ot();var xv={height:$v,measureWidth:Ev,estimateWidth:wv,width:wv,canvas:_v};function _v(e){xv.width=e&&vy?Ev:wv}function wv(e,t){return kv(Cv(e,t),$v(e))}function kv(e,t){return~~(.8*e.length*t)}function Ev(e,t){return $v(e)<=0||!(t=Cv(e,t))?0:Av(t,Ov(e))}function Av(e,t){const n=`(${t}) ${e}`;let i=bv.get(n);return void 0===i&&(vy.font=t,i=vy.measureText(e).width,bv.set(n,i)),i}function $v(e){return null!=e.fontSize?+e.fontSize||0:11}function Dv(e){return null!=e.lineHeight?e.lineHeight:$v(e)+2}function Sv(e){return t=e.lineBreak&&e.text&&!Fe(e.text)?e.text.split(e.lineBreak):e.text,Fe(t)?t.length>1?t:t[0]:t;var t}function Mv(e){const t=Sv(e);return(Fe(t)?t.length-1:0)*Dv(e)}function Cv(e,t){const n=null==t?"":(t+"").trim();return e.limit>0&&n.length?function(e,t){var n=+e.limit,i=function(e){if(xv.width===Ev){const t=Ov(e);return e=>Av(e,t)}if(xv.width===wv){const t=$v(e);return e=>kv(e,t)}return t=>xv.width(e,t)}(e);if(i(t)>>1,i(t.slice(r))>n?s=r+1:l=r;return o+t.slice(s)}for(;s>>1),i(t.slice(0,r))Math.max(e,xv.width(t,n))),0)):i=xv.width(t,f),"center"===o?u-=i/2:"right"===o&&(u-=i),e.set(u+=s,c+=l,u+i,c+r),t.angle&&!n)e.rotate(t.angle*ng,s,l);else if(2===n)return e.rotatedPoints(t.angle*ng,s,l);return e}var Lv={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+Nv(t),o=Rv(t),a=o.x1,s=o.y1,l=t.angle||0;e("text-anchor",Tv[t.align]||"start"),l?(n=Uy(a,s)+" "+qy(l),(i||r)&&(n+=" "+Uy(i,r))):n=Uy(a+i,s+r),e("transform",n)},bound:Pv,draw:function(e,t,n){Ty(t,(t=>{var i,r,o,a,s,l,u,c=null==t.opacity?1:t.opacity;if(!(n&&!n.intersects(t.bounds)||0===c||t.fontSize<=0||null==t.text||0===t.text.length)){if(e.font=Ov(t),e.textAlign=t.align||"left",r=(i=Rv(t)).x1,o=i.y1,t.angle&&(e.save(),e.translate(r,o),e.rotate(t.angle*ng),r=o=0),r+=t.dx||0,o+=(t.dy||0)+Nv(t),l=Sv(t),Ay(e,t),Fe(l))for(s=Dv(t),a=0;a=0;)if(!1!==e[r].defined&&(n=e[r].x-t[0])*n+(i=e[r].y-t[1])*i<(n=e[r].size||1)*n)return e[r];return null})),jv={arc:Gy,area:Yy,group:nv,image:uv,line:cv,path:dv,rect:pv,rule:gv,shape:yv,symbol:vv,text:Lv,trail:Bv};function Iv(e,t,n){var i=jv[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new qg),e,n)}var Uv={mark:null};function qv(e,t,n){var i,r,o,a,s=jv[e.marktype],l=s.bound,u=e.items,c=u&&u.length;if(s.nested)return c?o=u[0]:(Uv.mark=e,o=Uv),a=Iv(o,l,n),t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new qg,c)for(i=0,r=u.length;it;)e.removeChild(n[--i]);return e}function eb(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function tb(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function nb(e,t){this._active=null,this._handlers={},this._loader=e||ja(),this._tooltip=t||ib}function ib(e,t,n,i){e.element().setAttribute("title",i||"")}function rb(e){this._el=null,this._bgcolor=null,this._loader=new Gg(e)}Yv.prototype={toJSON(e){return Hv(this.root,e||0)},mark(e,t,n){const i=Xv(e,t=t||this.root.items[0]);return t.items[n]=i,i.zindex&&(i.group.zdirty=!0),i}},nb.prototype={initialize(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()},scene(e){return arguments.length?(this._scene=e,this):this._scene},on(){},off(){},_handlerIndex(e,t,n){for(let i=e?e.length:0;--i>=0;)if(e[i].type===t&&(!n||e[i].handler===n))return i;return-1},handlers(e){const t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(const e in t)n.push(...t[e]);return n},eventName(e){const t=e.indexOf(".");return t<0?e:e.slice(0,t)},handleHref(e,t,n){this._loader.sanitize(n,{context:"href"}).then((t=>{const n=new MouseEvent(e.type,e),i=Jv(null,"a");for(const e in t)i.setAttribute(e,t[e]);i.dispatchEvent(n)})).catch((()=>{}))},handleTooltip(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,i){var r,o,a=e&&e.mark;if(a&&(r=jv[a.marktype]).tip){for((o=tb(t,n))[0]-=i[0],o[1]-=i[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=r.tip(a.items,o)}return e}(t,e,this.canvas(),this._origin);const i=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,i)}},getItemBoundingClientRect(e){const t=this.canvas();if(!t)return;const n=t.getBoundingClientRect(),i=this._origin,r=e.bounds,o=r.width(),a=r.height();let s=r.x1+i[0]+n.left,l=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,l+=e.y||0;return{x:s,y:l,width:o,height:a,left:s,top:l,right:s+o,bottom:l+a}}},rb.prototype={initialize(e,t,n,i,r){return this._el=e,this.resize(t,n,i,r)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},background(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)},resize(e,t,n,i){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=i||1,this},dirty(){},render(e,t){const n=this;return n._call=function(){n._render(e,t)},n._call(),n._call=null,n},_render(){},renderAsync(e,t){const n=this.render(e,t);return this._ready?this._ready.then((()=>n)):Promise.resolve(n)},_load(e,t){var n=this,i=n._loader[e](t);if(!n._ready){const e=n._call;n._ready=n._loader.ready().then((t=>{t&&e(),n._ready=null}))}return i},sanitizeURL(e){return this._load("sanitizeURL",e)},loadImage(e){return this._load("loadImage",e)}};const ob="dragenter",ab="dragleave",sb="dragover",lb="pointerdown",ub="pointermove",cb="pointerout",fb="pointerover",db="click",hb="mousewheel",pb="touchstart",mb="touchmove",gb="touchend",yb=ub,vb=cb,bb=db;function xb(e,t){nb.call(this,e,t),this._down=null,this._touch=null,this._first=!0,this._events={}}function _b(e,t){(e=>e===pb||e===mb||e===gb?[pb,mb,gb]:[e])(t).forEach((t=>function(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}(e,t)))}function wb(e,t,n){return function(i){const r=this._active,o=this.pickEvent(i);o===r||(r&&r.exit||this.fire(n,i),this._active=o,this.fire(t,i)),this.fire(e,i)}}function kb(e){return function(t){this.fire(e,t),this._active=null}}_t(xb,nb,{initialize(e,t,n){return this._canvas=e&&Qv(e,"canvas"),[db,lb,ub,cb,ab].forEach((e=>_b(this,e))),nb.prototype.initialize.call(this,e,t,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",ob,ab,sb,lb,"pointerup",ub,cb,fb,db,"dblclick","wheel",hb,pb,mb,gb],DOMMouseScroll(e){this.fire(hb,e)},pointermove:wb(ub,fb,cb),dragover:wb(sb,ob,ab),pointerout:kb(cb),dragleave:kb(ab),pointerdown(e){this._down=this._active,this.fire(lb,e)},click(e){this._down===this._active&&(this.fire(db,e),this._down=null)},touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(pb,e,!0)},touchmove(e){this.fire(mb,e,!0)},touchend(e){this.fire(gb,e,!0),this._touch=null},fire(e,t,n){const i=n?this._touch:this._active,r=this._handlers[e];if(t.vegaType=e,e===bb&&i&&i.href?this.handleHref(t,i,i.href):e!==yb&&e!==vb||this.handleTooltip(t,i,e!==vb),r)for(let e=0,n=r.length;e=0&&i.splice(r,1),this},pickEvent(e){const t=tb(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])},pick(e,t,n,i,r){const o=this.context();return jv[e.marktype].pick.call(this,o,e,t,n,i,r)}});var Eb="undefined"!=typeof window&&window.devicePixelRatio||1;function Ab(e){rb.call(this,e),this._options={},this._redraw=!1,this._dirty=new qg,this._tempb=new qg}const $b=rb.prototype;function Db(e,t){nb.call(this,e,t);const n=this;n._hrefHandler=Sb(n,((e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=Sb(n,((e,t)=>{n.handleTooltip(e,t,e.type!==vb)}))}_t(Ab,rb,{initialize(e,t,n,i,r,o){return this._options=o||{},this._canvas=this._options.externalContext?null:_f(1,1,this._options.type),e&&this._canvas&&(Kv(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),$b.initialize.call(this,e,t,n,i,r)},resize(e,t,n,i){if($b.resize.call(this,e,t,n,i),this._canvas)!function(e,t,n,i,r,o){const a="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),l=a?Eb:r;e.width=t*l,e.height=n*l;for(const e in o)s[e]=o[e];a&&1!==l&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=l,s.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||me("CanvasRenderer is missing a valid canvas or context"),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},canvas(){return this._canvas},context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},dirty(e){const t=this._tempb.clear().union(e.bounds);let n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)},_render(e,t){const n=this.context(),i=this._origin,r=this._width,o=this._height,a=this._dirty,s=((e,t,n)=>(new qg).set(0,0,t,n).translate(-e[0],-e[1]))(i,r,o);n.save();const l=this._redraw||a.empty()?(this._redraw=!1,s.expand(1)):function(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(n,s.intersect(a),i);return this.clear(-i[0],-i[1],r,o),this.draw(n,e,l,t),n.restore(),a.clear(),this},draw(e,t,n,i){if("group"!==t.marktype&&null!=i&&!i.includes(t.marktype))return;const r=jv[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),rt(n)?(e.beginPath(),n(e),e.clip()):Xy(e,t.group)}(e,t),r.draw.call(this,e,t,n,i),t.clip&&e.restore()},clear(e,t,n,i){const r=this._options,o=this.context();"pdf"===r.type||r.externalContext||o.clearRect(e,t,n,i),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(e,t,n,i))}});const Sb=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)};_t(Db,nb,{initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(bb,this._hrefHandler),i.removeEventListener(yb,this._tooltipHandler),i.removeEventListener(vb,this._tooltipHandler)),this._svg=i=e&&Qv(e,"svg"),i&&(i.addEventListener(bb,this._hrefHandler),i.addEventListener(yb,this._tooltipHandler),i.addEventListener(vb,this._tooltipHandler)),nb.prototype.initialize.call(this,e,t,n)},canvas(){return this._svg},on(e,t){const n=this.eventName(e),i=this._handlers;if(this._handlerIndex(i[n],e,t)<0){const r={type:e,handler:t,listener:Sb(this,t)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this}});const Mb="aria-hidden",Cb="aria-label",Fb="role",Ob="aria-roledescription",Nb="graphics-object",Tb="graphics-symbol",zb=(e,t,n)=>({[Fb]:e,[Ob]:t,[Cb]:n||void 0}),Rb=Ut(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Pb={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?Ub(e):null,r=e.context,o=r.scales[t.scale].value,a=r.dataflow.locale(),s=o.type;return`${"left"===n||"right"===n?"Y":"X"}-axis`+(i?` titled '${i}'`:"")+` for a ${am(s)?"discrete":s} scale`+` with ${Im(a,o,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?Ub(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,o=Object.keys(r),a=e.context,s=a.scales[r[o[0]]].value,l=a.dataflow.locale();return((u=i).length?u[0].toUpperCase()+u.slice(1):u)+(n?` titled '${n}'`:"")+` for ${function(e){return(e=e.map((e=>e+("fill"===e||"stroke"===e?" color":"")))).length<2?e[0]:e.slice(0,-1).join(", ")+" and "+Pe(e)}(o)}`+` with ${Im(l,s,e)}`;var u}},"title-text":{desc:"title",caption:e=>`Title text '${Ib(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${Ib(e)}'`}},Lb={ariaRole:Fb,ariaRoleDescription:Ob,description:Cb};function Bb(e,t){const n=!1===t.aria;if(e(Mb,n||void 0),n||null==t.description)for(const t in Lb)e(Lb[t],void 0);else{const n=t.mark.marktype;e(Cb,t.description),e(Fb,t.ariaRole||("group"===n?Nb:Tb)),e(Ob,t.ariaRoleDescription||`${n} mark`)}}function jb(e){return!1===e.aria?{[Mb]:!0}:Rb[e.role]?null:Pb[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return zb(t.role||Tb,t.desc,n.description||i(n))}catch(e){return null}}(e,Pb[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some((e=>null!=e.description&&!1!==e.aria));return zb(n?Nb:Tb,`${t} mark container`,e.description)}(e)}function Ib(e){return nt(e.text).join(" ")}function Ub(e){try{return nt(Pe(e.items).items[0].text).join(" ")}catch(e){return null}}const qb=e=>(e+"").replace(/&/g,"&").replace(//g,">"),Wb=e=>qb(e).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ");function Hb(){let e="",t="",n="";const i=[],r=()=>t=n="",o=(e,n)=>(null!=n&&(t+=` ${e}="${Wb(n)}"`),a),a={open(s){(o=>{t&&(e+=`${t}>${n}`,r()),i.push(o)})(s),t="<"+s;for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c${n}`:"/>"):``,r(),a},attr:o,text:e=>(n+=qb(e),a),toString:()=>e};return a}const Gb=e=>Vb(Hb(),e)+"";function Vb(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let t=0;t1&&e.previousSibling!=t}(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}_t(Kb,rb,{initialize(e,t,n,i,r){return this._defs={},this._clearDefs(),e&&(this._svg=Zv(e,0,"svg",Zb),this._svg.setAttributeNS(Qb,"xmlns",Zb),this._svg.setAttributeNS(Qb,"xmlns:xlink",iv["xmlns:xlink"]),this._svg.setAttribute("version",iv.version),this._svg.setAttribute("class","marks"),Kv(e,1),this._root=Zv(this._svg,0,"g",Zb),cx(this._root,Jb),Kv(this._svg,1)),this.background(this._bgcolor),ex.initialize.call(this,e,t,n,i,r)},background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),ex.background.apply(this,arguments)},resize(e,t,n,i){return ex.resize.call(this,e,t,n,i),this._svg&&(cx(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this},canvas(){return this._svg},svg(){const e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute("style"),n=Zv(e,0,"rect",Zb),cx(n,{width:this._width,height:this._height,fill:t}));const i=Gb(e);return t&&(e.removeChild(n),this._svg.style.setProperty("background-color",t)),i},_render(e,t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e,void 0,t),Kv(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;const e=this._dirty;if(!e.length||!this._dirtyID)return!0;const t=++this._dirtyID;let n,i,r,o,a,s,l;for(a=0,s=e.length;a{e.dirty=t}))),i.zdirty||(n.exit?(o.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(o,l._svg,l)):n._svg&&(l=n._svg.parentNode,l&&l.removeChild(n._svg)),n._svg=null):(n=o.nested?i.items[0]:n,n._update!==t&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,tx(n,t)),n._update=t)));return!this._dirtyAll},mark(e,t,n,i){if(!this.isDirty(t))return t._svg;const r=this._svg,o=t.marktype,a=jv[o],s=!1===t.interactive?"none":null,l="g"===a.tag,u=rx(t,e,n,"g",r);if("group"!==o&&null!=i&&!i.includes(o))return Kv(u,0),t._svg;u.setAttribute("class",eb(t));const c=jb(t);for(const e in c)fx(u,e,c[e]);l||fx(u,"pointer-events",s),fx(u,"clip-path",t.clip?Ug(this,t,t.group):null);let f=null,d=0;const h=e=>{const t=this.isDirty(e),n=rx(e,u,f,a.tag,r);t&&(this._update(a,n,e),l&&function(e,t,n,i){t=t.lastChild.previousSibling;let r,o=0;Ty(n,(n=>{r=e.mark(t,n,r,i),++o})),Kv(t,1+o)}(this,n,e,i)),f=n,++d};return a.nested?t.items.length&&h(t.items[0]):Ty(t,h),Kv(u,d),u},_update(e,t,n){ox=t,ax=t.__values__,Bb(lx,n),e.attr(lx,n,this);const i=sx[e.type];i&&i.call(this,e,t,n),ox&&this.style(ox,n)},style(e,t){if(null!=t){for(const n in Yb){let i="font"===n?Fv(t):t[n];if(i===ax[n])continue;const r=Yb[n];null==i?e.removeAttribute(r):(Wm(i)&&(i=Hm(i,this._defs.gradient,dx())),e.setAttribute(r,i+"")),ax[n]=i}for(const n in Xb)ux(e,Xb[n],t[n])}},defs(){const e=this._svg,t=this._defs;let n=t.el,i=0;for(const r in t.gradient)n||(t.el=n=Zv(e,1,"defs",Zb)),i=nx(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=Zv(e,1,"defs",Zb)),i=ix(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):Kv(n,i))},_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}});let ox=null,ax=null;const sx={group(e,t,n){const i=ox=t.childNodes[2];ax=i.__values__,e.foreground(lx,n,this),ax=t.__values__,ox=t.childNodes[1],e.content(lx,n,this);const r=ox=t.childNodes[0];e.background(lx,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==ax.events&&(fx(i,"pointer-events",o),fx(r,"pointer-events",o),ax.events=o),n.strokeForeground&&n.stroke){const e=n.fill;fx(i,"display",null),this.style(r,n),fx(r,"stroke",null),e&&(n.fill=null),ax=i.__values__,this.style(i,n),e&&(n.fill=e),ox=null}else fx(i,"display","none")},image(e,t,n){!1===n.smooth?(ux(t,"image-rendering","optimizeSpeed"),ux(t,"image-rendering","pixelated")):ux(t,"image-rendering",null)},text(e,t,n){const i=Sv(n);let r,o,a,s;Fe(i)?(o=i.map((e=>Cv(n,e))),r=o.join("\n"),r!==ax.text&&(Kv(t,0),a=t.ownerDocument,s=Dv(n),o.forEach(((e,i)=>{const r=Jv(a,"tspan",Zb);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",s)),t.appendChild(r)})),ax.text=r)):(o=Cv(n,i),o!==ax.text&&(t.textContent=o,ax.text=o)),fx(t,"font-family",Fv(n)),fx(t,"font-size",$v(n)+"px"),fx(t,"font-style",n.fontStyle),fx(t,"font-variant",n.fontVariant),fx(t,"font-weight",n.fontWeight)}};function lx(e,t,n){t!==ax[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(ox,e,t,n):fx(ox,e,t),ax[e]=t)}function ux(e,t,n){n!==ax[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),ax[t]=n)}function cx(e,t){for(const n in t)fx(e,n,t[n])}function fx(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function dx(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function hx(e){rb.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}_t(hx,rb,{svg(){return this._text},_render(e){const t=Hb();t.open("svg",ht({},iv,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&t.open("rect",{width:this._width,height:this._height,fill:n}).close(),t.open("g",Jb,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this},mark(e,t){const n=jv[t.marktype],i=n.tag,r=[Bb,n.attr];e.open("g",{class:eb(t),"clip-path":t.clip?Ug(this,t,t.group):null},jb(t),{"pointer-events":"g"!==i&&!1===t.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&e.open("a",a),e.open(i,this.attr(t,o,r,"g"!==i?i:null)),"text"===i){const t=Sv(o);if(Fe(t)){const n={x:0,dy:Dv(o)};for(let i=0;ithis.mark(e,t))),e.close(),i&&a?(r&&(o.fill=null),o.stroke=a,e.open("path",this.attr(t,o,n.foreground,"bgrect")).close(),r&&(o.fill=r)):e.open("path",this.attr(t,o,n.foreground,"bgfore")).close()}e.close(),a&&e.close()};return n.nested?t.items&&t.items.length&&o(t.items[0]):Ty(t,o),e.close()},href(e){const t=e.href;let n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then((e=>{e["xlink:href"]=e.href,e.href=null,(this._hrefs||(this._hrefs={}))[t]=e}))}return null},attr(e,t,n,i){const r={},o=(e,t,n,i)=>{r[i||e]=t};return Array.isArray(n)?n.forEach((e=>e(o,t,this))):n(o,t,this),i&&function(e,t,n,i,r){let o;if(null==t)return e;if("bgrect"===i&&!1===n.interactive&&(e["pointer-events"]="none"),"bgfore"===i&&(!1===n.interactive&&(e["pointer-events"]="none"),e.display="none",null!==t.fill))return e;"image"===i&&!1===t.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),"text"===i&&(e["font-family"]=Fv(t),e["font-size"]=$v(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const n in Yb){let i=t[n];const o=Yb[n];("transparent"!==i||"fill"!==o&&"stroke"!==o)&&null!=i&&(Wm(i)&&(i=Hm(i,r.gradient,"")),e[o]=i)}for(const e in Xb){const n=t[e];null!=n&&(o=o||[],o.push(`${Xb[e]}: ${n};`))}o&&(e.style=o.join(" "))}(r,t,e,i,this._defs),r},defs(e){const t=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(t).length+Object.keys(n).length){e.open("defs");for(const n in t){const i=t[n],r=i.stops;"radial"===i.gradient?(e.open("pattern",{id:qm+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),e.close(),e.open("radialGradient",{id:n,fx:i.x1,fy:i.y1,fr:i.r1,cx:i.x2,cy:i.y2,r:i.r2})):e.open("linearGradient",{id:n,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2});for(let t=0;t!px.svgMarkTypes.includes(e)));this._svgRenderer.render(e,px.svgMarkTypes),this._canvasRenderer.render(e,n)},resize(e,t,n,i){return yx.resize.call(this,e,t,n,i),this._svgRenderer.resize(e,t,n,i),this._canvasRenderer.resize(e,t,n,i),this},background(e){return px.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}}),_t(vx,xb,{initialize(e,t,n){const i=Zv(Zv(e,0,"div"),px.svgOnTop?0:1,"div");return xb.prototype.initialize.call(this,i,t,n)}});const bx="canvas",xx="hybrid",_x="none",wx={Canvas:bx,PNG:"png",SVG:"svg",Hybrid:xx,None:_x},kx={};function Ex(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(kx[e]=t,this):kx[e]}function Ax(e,t,n){const i=[],r=(new qg).union(t),o=e.marktype;return o?$x(e,r,n,i):"group"===o?Dx(e,r,n,i):me("Intersect scene must be mark node or group item.")}function $x(e,t,n,i){if(function(e,t,n){return e.bounds&&t.intersects(e.bounds)&&("group"===e.marktype||!1!==e.interactive&&(!n||n(e)))}(e,t,n)){const r=e.items,o=e.marktype,a=r.length;let s=0;if("group"===o)for(;s=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(!Ox(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function Nx(e,t){return Ox(tg(e),tg(t))}function Tx(){Ig(),Um=0}const zx="top",Rx="left",Px="right",Lx="bottom",Bx="start",jx="middle",Ix="end",Ux="x",qx="y",Wx="group",Hx="axis",Gx="title",Vx="legend",Yx="row-header",Xx="row-footer",Jx="row-title",Qx="column-header",Zx="column-footer",Kx="column-title",e_="fit-x",t_="fit-y",n_="none",i_="all",r_="each",o_="flush",a_="column",s_="row";function l_(e){Es.call(this,null,e)}function u_(e,t,n){return t(e.bounds.clear(),e,n)}_t(l_,Es,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,o=jv[r],a=o.bound;let s,l=i.bounds;if(o.nested)i.items.length&&n.dirty(i.items[0]),l=u_(i,a),i.items.forEach((e=>{e.bounds.clear().union(l)}));else if(r===Wx||e.modified())switch(t.visit(t.MOD,(e=>n.dirty(e))),l.clear(),i.items.forEach((e=>l.union(u_(e,a)))),i.role){case Hx:case Vx:case Gx:t.reflow()}else s=t.changed(t.REM),t.visit(t.ADD,(e=>{l.union(u_(e,a))})),t.visit(t.MOD,(e=>{s=s||l.alignsWith(e.bounds),n.dirty(e),l.union(u_(e,a))})),s&&(l.clear(),i.items.forEach((e=>l.union(e.bounds))));return Cx(i),t.modifies("bounds")}});const c_=":vega_identifier:";function f_(e){Es.call(this,0,e)}function d_(e){Es.call(this,null,e)}function h_(e){Es.call(this,null,e)}f_.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},_t(f_,Es,{transform(e,t){const n=(r=t.dataflow)._signals[c_]||(r._signals[c_]=r.add(0)),i=e.as;var r;let o=n.value;return t.visit(t.ADD,(e=>e[i]=e[i]||++o)),n.set(this.value=o),t}}),_t(d_,Es,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,function(e){const t=e.groups,n=e.parent;return t&&1===t.size?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const i=n.marktype===Wx?Hg:Wg;return t.visit(t.ADD,(e=>i.call(e,n))),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});const p_={parity:e=>e.filter(((e,t)=>t%2?e.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((e,i)=>i&&m_(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)))}},m_=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),g_=(e,t)=>{for(var n,i=1,r=e.length,o=e[0].bounds;i{const t=e.bounds;return t.width()>1&&t.height()>1},v_=e=>(e.forEach((e=>e.opacity=1)),e),b_=(e,t)=>e.reflow(t.modified()).modifies("opacity");function x_(e){Es.call(this,null,e)}_t(h_,Es,{transform(e,t){const n=p_[e.method]||p_.parity,i=e.separation||0;let r,o,a=t.materialize(t.SOURCE).source;if(!a||!a.length)return;if(!e.method)return e.modified("method")&&(v_(a),t=b_(t,e)),t;if(a=a.filter(y_),!a.length)return;if(e.sort&&(a=a.slice().sort(e.sort)),r=v_(a),t=b_(t,e),r.length>=3&&g_(r,i)){do{r=n(r,i)}while(r.length>=3&&g_(r,i));r.length<3&&!Pe(a).opacity&&(r.length>1&&(Pe(r).opacity=0),Pe(a).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=((e,t,n)=>{var i=e.range(),r=new qg;return t===zx||t===Lx?r.set(i[0],-1/0,i[1],1/0):r.set(-1/0,i[0],1/0,i[1]),r.expand(n||1),e=>r.encloses(e.bounds)})(e.boundScale,e.boundOrient,+e.boundTolerance),a.forEach((e=>{o(e)||(e.opacity=0)})));const s=r[0].mark.bounds.clear();return a.forEach((e=>{e.opacity&&s.union(e.bounds)})),t}}),_t(x_,Es,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,(e=>n.dirty(e))),t.fields&&t.fields.zindex){const e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}});const __=new qg;function w_(e,t,n){return e[t]===n?0:(e[t]=n,1)}function k_(e){var t=e.items[0].orient;return t===Rx||t===Px}function E_(e,t,n,i){var r,o,a=t.items[0],s=a.datum,l=null!=a.translate?a.translate:.5,u=a.orient,c=function(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(s),f=a.range,d=a.offset,h=a.position,p=a.minExtent,m=a.maxExtent,g=s.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,b=g&&Mv(g),x=0,_=0;switch(__.clear().union(v),v.clear(),(r=c[0])>-1&&v.union(a.items[r].bounds),(r=c[1])>-1&&v.union(a.items[r].bounds),u){case zx:x=h||0,_=-d,o=Math.max(p,Math.min(m,-v.y1)),v.add(0,-o).add(f,0),g&&A_(e,g,o,y,b,0,-1,v);break;case Rx:x=-d,_=h||0,o=Math.max(p,Math.min(m,-v.x1)),v.add(-o,0).add(0,f),g&&A_(e,g,o,y,b,1,-1,v);break;case Px:x=n+d,_=h||0,o=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(o,f),g&&A_(e,g,o,y,b,1,1,v);break;case Lx:x=h||0,_=i+d,o=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,o),g&&A_(e,g,o,y,0,0,1,v);break;default:x=a.x,_=a.y}return Xg(v.translate(x,_),a),w_(a,"x",x+l)|w_(a,"y",_+l)&&(a.bounds=__,e.dirty(a),a.bounds=v,e.dirty(a)),a.mark.bounds.clear().union(v)}function A_(e,t,n,i,r,o,a,s){const l=t.bounds;if(t.auto){const s=a*(n+r+i);let u=0,c=0;e.dirty(t),o?u=(t.x||0)-(t.x=s):c=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(l.translate(-u,-c)),e.dirty(t)}s.union(l)}const $_=(e,t)=>Math.floor(Math.min(e,t)),D_=(e,t)=>Math.ceil(Math.max(e,t));function S_(e){return(new qg).set(0,0,e.width||0,e.height||0)}function M_(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function C_(e,t,n){const i=Oe(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function F_(e){return e<0?Math.ceil(-e):0}function O_(e,t,n){var i,r,o,a,s,l,u,c,f,d,h,p=!n.nodirty,m=n.bounds===o_?S_:M_,g=__.set(0,0,0,0),y=C_(n.align,a_),v=C_(n.align,s_),b=C_(n.padding,a_),x=C_(n.padding,s_),_=n.columns||t.length,w=_<=0?1:Math.ceil(t.length/_),k=t.length,E=Array(k),A=Array(_),$=0,D=Array(k),S=Array(w),M=0,C=Array(k),F=Array(k),O=Array(k);for(r=0;r<_;++r)A[r]=0;for(r=0;r1)for(r=0;r0&&(C[r]+=f/2);if(v&&C_(n.center,s_)&&1!==_)for(r=0;r0&&(F[r]+=d/2);for(r=0;rr&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),E+=o,m=0,y=t.length;m=0&&null==(x=n[g]);g-=d);s?(_=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),w=E):(_=E,w=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),v.union(b.bounds.translate(_-(b.x||0),w-(b.y||0))),b.x=_,b.y=w,e.dirty(b),A=a(A,v[u])}return A}function R_(e,t,n,i,r,o){if(t){e.dirty(t);var a=n,s=n;i?a=Math.round(r.x1+o*r.width()):s=Math.round(r.y1+o*r.height()),t.bounds.translate(a-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=a,t.y=s,e.dirty(t)}}function P_(e,t,n,i,r,o,a){const s=function(e,t){const n=e[t]||{};return(t,i)=>null!=n[t]?n[t]:null!=e[t]?e[t]:i}(n,t),l=function(e,t){let n=-1/0;return e.forEach((e=>{null!=e.offset&&(n=Math.max(n,e.offset))})),n>-1/0?n:t}(e,s("offset",0)),u=s("anchor",Bx),c=u===Ix?1:u===jx?.5:0,f={align:r_,bounds:s("bounds",o_),columns:"vertical"===s("direction")?1:e.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(t){case Rx:f.anchor={x:Math.floor(i.x1)-l,column:Ix,y:c*(a||i.height()+2*i.y1),row:u};break;case Px:f.anchor={x:Math.ceil(i.x2)+l,y:c*(a||i.height()+2*i.y1),row:u};break;case zx:f.anchor={y:Math.floor(r.y1)-l,row:Ix,x:c*(o||r.width()+2*r.x1),column:u};break;case Lx:f.anchor={y:Math.ceil(r.y2)+l,x:c*(o||r.width()+2*r.x1),column:u};break;case"top-left":f.anchor={x:l,y:l};break;case"top-right":f.anchor={x:o-l,y:l,column:Ix};break;case"bottom-left":f.anchor={x:l,y:a-l,row:Ix};break;case"bottom-right":f.anchor={x:o-l,y:a-l,column:Ix,row:Ix}}return f}function L_(e,t){var n,i,r=t.items[0],o=r.datum,a=r.orient,s=r.bounds,l=r.x,u=r.y;return r._bounds?r._bounds.clear().union(s):r._bounds=s.clone(),s.clear(),function(e,t,n){var i=t.padding,r=i-n.x,o=i-n.y;if(t.datum.title){var a=t.items[1].items[0],s=a.anchor,l=t.titlePadding||0,u=i-a.x,c=i-a.y;switch(a.orient){case Rx:r+=Math.ceil(a.bounds.width())+l;break;case Px:case Lx:break;default:o+=a.bounds.height()+l}switch((r||o)&&j_(e,n,r,o),a.orient){case Rx:c+=B_(t,n,a,s,1,1);break;case Px:u+=B_(t,n,a,Ix,0,0)+l,c+=B_(t,n,a,s,1,1);break;case Lx:u+=B_(t,n,a,s,0,0),c+=B_(t,n,a,Ix,-1,0,1)+l;break;default:u+=B_(t,n,a,s,0,0)}(u||c)&&j_(e,a,u,c),(u=Math.round(a.bounds.x1-i))<0&&(j_(e,n,-u,0),j_(e,a,-u,0))}else(r||o)&&j_(e,n,r,o)}(e,r,r.items[0].items[0]),s=function(e,t){return e.items.forEach((e=>t.union(e.bounds))),t.x1=e.padding,t.y1=e.padding,t}(r,s),n=2*r.padding,i=2*r.padding,s.empty()||(n=Math.ceil(s.width()+n),i=Math.ceil(s.height()+i)),"symbol"===o.type&&function(e){const t=e.reduce(((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e)),{});e.forEach((e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y}))}(r.items[0].items[0].items[0].items),a!==n_&&(r.x=l=0,r.y=u=0),r.width=n,r.height=i,Xg(s.set(l,u,l+n,u+i),r),r.mark.bounds.clear().union(s),r}function B_(e,t,n,i,r,o,a){const s="symbol"!==e.datum.type,l=n.datum.vgrad,u=(!s||!o&&l||a?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,c=l&&o?u:0,f=l&&o?0:u,d=r<=0?0:Mv(n);return Math.round(i===Bx?c:i===Ix?f-d:.5*(u-d))}function j_(e,t,n,i){t.x+=n,t.y+=i,t.bounds.translate(n,i),t.mark.bounds.translate(n,i),e.dirty(t)}function I_(e){Es.call(this,null,e)}function U_(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function q_(e){Es.call(this,null,e)}function W_(e){Es.call(this,null,e)}function H_(){return Ya({})}function G_(e){Es.call(this,null,e)}function V_(e){Es.call(this,[],e)}_t(I_,Es,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach((t=>{e.layout&&function(e,t,n){var i,r,o,a,s,l,u,c=function(e){var t,n,i=e.items,r=i.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o{(o=e.orient||Px)!==n_&&(t[o]||(t[o]=[])).push(e)}));for(const i in t){const r=t[i];O_(e,r,P_(r,i,n.legends,d,h,u,c))}p.forEach((t=>{const i=t.bounds;if(i.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=i,e.dirty(t)),!n.autosize||"fit"!==n.autosize.type&&n.autosize.type!==e_&&n.autosize.type!==t_)f.union(i);else switch(t.orient){case Rx:case Px:f.add(i.x1,0).add(i.x2,0);break;case zx:case Lx:f.add(0,i.y1).add(0,i.y2)}}))}f.union(d).union(h),i&&f.union(function(e,t,n,i,r){var o,a=t.items[0],s=a.frame,l=a.orient,u=a.anchor,c=a.offset,f=a.padding,d=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],p=l===Rx||l===Px?i:n,m=0,g=0,y=0,v=0,b=0;if(s!==Wx?l===Rx?(m=r.y2,p=r.y1):l===Px?(m=r.y1,p=r.y2):(m=r.x1,p=r.x2):l===Rx&&(m=i,p=0),o=u===Bx?m:u===Ix?p:(m+p)/2,h&&h.text){switch(l){case zx:case Lx:b=d.bounds.height()+f;break;case Rx:v=d.bounds.width()+f;break;case Px:v=-d.bounds.width()-f}__.clear().union(h.bounds),__.translate(v-(h.x||0),b-(h.y||0)),w_(h,"x",v)|w_(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(__),h.mark.bounds.clear().union(__),e.dirty(h)),__.clear().union(h.bounds)}else __.clear();switch(__.union(d.bounds),l){case zx:g=o,y=r.y1-__.height()-c;break;case Rx:g=r.x1-__.width()-c,y=o;break;case Px:g=r.x2+__.width()+c,y=o;break;case Lx:g=o,y=r.y2+c;break;default:g=a.x,y=a.y}return w_(a,"x",g)|w_(a,"y",y)&&(__.translate(g,y),e.dirty(a),a.bounds.clear().union(__),t.bounds.clear().union(__),e.dirty(a)),a.bounds}(e,i,u,c,f)),t.clip&&f.set(0,0,t.width||0,t.height||0),function(e,t,n,i){const r=i.autosize||{},o=r.type;if(e._autosize<1||!o)return;let a=e._width,s=e._height,l=Math.max(0,t.width||0),u=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-l)),h=Math.max(0,Math.ceil(n.y2-c));if("padding"===r.contains){const t=e.padding();a-=t.left+t.right,s-=t.top+t.bottom}o===n_?(u=0,f=0,l=a,c=s):"fit"===o?(l=Math.max(0,a-u-d),c=Math.max(0,s-f-h)):o===e_?(l=Math.max(0,a-u-d),s=c+f+h):o===t_?(a=l+u+d,c=Math.max(0,s-f-h)):"pad"===o&&(a=l+u+d,s=c+f+h),e._resizeView(a,s,l,c,[u,f],r.resize)}(e,t,f,n)}(n,t,e)})),function(e){return e&&"legend-entry"!==e.mark.role}(e.mark.group)?t.reflow():t}}),_t(q_,Es,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,o=e.scale,a=$m(o,null==e.count?e.values?e.values.length:10:e.count,e.minstep),s=e.format||Mm(n,o,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?Dm(o,e.values,a):Sm(o,a);return r&&(i.rem=r),r=l.map(((e,t)=>Ya({index:t/(l.length-1||1),value:e,label:s(e)}))),e.extra&&r.length&&r.push(Ya({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),_t(W_,Es,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||H_,o=e.key||Ga,a=this.value;return Fe(i.encode)&&(i.encode=null),a&&(e.modified("key")||t.modified(o))&&me("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=function(e){const t=bt().test((e=>e.exit));return t.lookup=n=>t.get(e(n)),t}(o)),t.visit(t.ADD,(e=>{const t=o(e);let n=a.get(t);n?n.exit?(a.empty--,i.add.push(n)):i.mod.push(n):(n=r(e),a.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1})),t.visit(t.MOD,(e=>{const t=o(e),n=a.get(t);n&&(n.datum=e,i.mod.push(n))})),t.visit(t.REM,(e=>{const t=o(e),n=a.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++a.empty)})),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),i}}),_t(G_,Es,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,o=t.encode;if(Fe(o)){if(!n.changed()&&!o.every((e=>r[e])))return t.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,s=r.update||ke,l=r.enter||ke,u=r.exit||ke,c=(o&&!a?r[o]:s)||ke;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{l(t,e),s(t,e)})),n.modifies(l.output),n.modifies(s.output),c!==ke&&c!==s&&(t.visit(t.ADD,(t=>{c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&u!==ke&&(t.visit(t.REM,(t=>{u(t,e)})),n.modifies(u.output)),a||c!==ke){const r=t.MOD|(e.modified()?t.REFLOW:0);a?(t.visit(r,(t=>{const r=l(t,e)||i;(c(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(l.output)):t.visit(r,(t=>{(c(t,e)||i)&&n.mod.push(t)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}}),_t(V_,Es,{transform(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,i,r,o,a,s=t.dataflow.locale(),l=t.fork(t.NO_SOURCE|t.NO_FIELDS),u=this.value,c=e.type||_m,f=e.scale,d=+e.limit,h=$m(f,null==e.count?5:e.count,e.minstep),p=!!e.values||c===_m,m=e.format||zm(s,f,h,c,e.formatSpecifier,e.formatType,p),g=e.values||Nm(f,h);return u&&(l.rem=u),c===_m?(d&&g.length>d?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),u=g.slice(0,d-1),a=!0):u=g,rt(r=e.size)?(e.values||0!==f(u[0])||(u=u.slice(1)),o=u.reduce(((t,n)=>Math.max(t,r(n,e))),0)):r=ft(o=r||8),u=u.map(((t,n)=>Ya({index:n,label:m(t,n,u),value:t,offset:o,size:r(t,e)}))),a&&(a=g[u.length],u.push(Ya({index:u.length,label:`…${g.length-u.length} entries`,value:a,offset:o,size:r(a,e)})))):"gradient"===c?(n=f.domain(),i=mm(f,n[0],Pe(n)),g.length<3&&!e.values&&n[0]!==Pe(n)&&(g=[n[0],Pe(n)]),u=g.map(((e,t)=>Ya({index:t,label:m(e,t,g),value:e,perc:i(e)})))):(r=g.length-1,i=function(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+Pe(t),o=r-i;if(e.type===Bp){const e=n?o/n:.1;i-=e,r+=e,o=r-i}return e=>(e-i)/o}(f),u=g.map(((e,t)=>Ya({index:t,label:m(e,t,g),value:e,perc:t?i(e):0,perc2:t===r?1:i(g[t+1])})))),l.source=u,l.add=u,this.value=u,l}});const Y_=e=>e.source.x,X_=e=>e.source.y,J_=e=>e.target.x,Q_=e=>e.target.y;function Z_(e){Es.call(this,{},e)}Z_.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},_t(Z_,Es,{transform(e,t){var n=e.sourceX||Y_,i=e.sourceY||X_,r=e.targetX||J_,o=e.targetY||Q_,a=e.as||"path",s=e.orient||"vertical",l=e.shape||"line",u=nw.get(l+"-"+s)||nw.get(l);return u||me("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[a]=u(n(e),i(e),r(e),o(e))})),t.reflow(e.modified()).modifies(a)}});const K_=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,ew=(e,t,n,i)=>{var r=n-e,o=i-t,a=Math.hypot(r,o)/2;return"M"+e+","+t+"A"+a+","+a+" "+180*Math.atan2(o,r)/Math.PI+" 0 1 "+n+","+i},tw=(e,t,n,i)=>{const r=n-e,o=i-t,a=.2*(r+o),s=.2*(o-r);return"M"+e+","+t+"C"+(e+a)+","+(t+s)+" "+(n+s)+","+(i-a)+" "+n+","+i},nw=bt({line:K_,"line-radial":(e,t,n,i)=>K_(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:ew,"arc-radial":(e,t,n,i)=>ew(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:tw,"curve-radial":(e,t,n,i)=>tw(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),"orthogonal-horizontal":(e,t,n,i)=>"M"+e+","+t+"V"+i+"H"+n,"orthogonal-vertical":(e,t,n,i)=>"M"+e+","+t+"H"+n+"V"+i,"orthogonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n);return"M"+t*r+","+t*o+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*a+","+t*s+"L"+i*a+","+i*s},"diagonal-horizontal":(e,t,n,i)=>{const r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+i+" "+n+","+i},"diagonal-vertical":(e,t,n,i)=>{const r=(t+i)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+i},"diagonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),l=(t+i)/2;return"M"+t*r+","+t*o+"C"+l*r+","+l*o+" "+l*a+","+l*s+" "+i*a+","+i*s}});function iw(e){Es.call(this,null,e)}iw.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},_t(iw,Es,{transform(e,t){var n,i,r,o=e.as||["startAngle","endAngle"],a=o[0],s=o[1],l=e.field||_e,u=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(l),h=d.length,p=u,m=(c-u)/U_(d),g=Tl(h);for(e.sort&&g.sort(((e,t)=>d[e]-d[t])),n=0;ne+(t<0?-1:t>0?1:0)),0))!==t.length&&n.warn("Log scale domain includes zero: "+Pt(t)));return t}function lw(e,t,n){return rt(e)&&(t||n)?dm(e,uw(t||[0,1],n)):e}function uw(e,t){return t?e.slice().reverse():e}function cw(e){Es.call(this,null,e)}_t(aw,Es,{transform(e,t){var n=t.dataflow,i=this.value,r=function(e){var t,n=e.type,i="";return n===zp?zp+"-"+Sp:(function(e){const t=e.type;return om(t)&&t!==Np&&t!==Tp&&(e.scheme||e.range&&e.range.length&&e.range.every(St))}(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?zp+"-":3===t?Rp+"-":""),(i+n||Sp).toLowerCase())}(e);for(r in i&&r===i.type||(this.value=i=nm(r)()),e)if(!ow[r]){if("padding"===r&&rw(i.type))continue;rt(i[r])?i[r](e[r]):n.warn("Unsupported scale property: "+r)}return function(e,t,n){var i=e.type,r=t.round||!1,o=t.range;if(null!=t.rangeStep)o=function(e,t,n){e!==Up&&e!==Ip&&me("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===Ip?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*Dp(n,r,i)]}(i,t,n);else if(t.scheme&&(o=function(e,t,n){var i,r=t.schemeExtent;return Fe(t.scheme)?i=hm(t.scheme,t.interpolate,t.interpolateGamma):(i=xm(t.scheme.toLowerCase()))||me(`Unrecognized scheme name: ${t.scheme}`),n=e===Bp?n+1:e===qp?n-1:e===Pp||e===Lp?+t.schemeCount||5:n,um(e)?lw(i,r,t.reverse):rt(i)?pm(lw(i,r),n):e===jp?i:i.slice(0,n)}(i,t,n),rt(o))){if(e.interpolator)return e.interpolator(o);me(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&um(i))return e.interpolator(hm(uw(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(gm(t.interpolate,t.interpolateGamma)):rt(e.round)?e.round(r):rt(e.rangeRound)&&e.interpolate(r?Fd:Cd),o&&e.range(uw(o,t.reverse))}(i,e,function(e,t,n){let i=t.bins;if(i&&!Fe(i)){const t=e.domain(),n=t[0],r=Pe(t),o=i.step;let a=null==i.start?n:i.start,s=null==i.stop?r:i.stop;o||me("Scale bins parameter missing step property."),ar&&(s=o*Math.floor(r/o)),i=Tl(a,s+o/2,o)}return i?e.bins=i:e.bins&&delete e.bins,e.type===qp&&(i?t.domain||t.domainRaw||(e.domain(i),n=i.length):e.bins=e.domain()),n}(i,e,function(e,t,n){const i=function(e,t,n){return t?(e.domain(sw(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(i>-1)return i;var r,o,a=t.domain,s=e.type,l=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===Sp||t===Cp||t===Fp)}(e);if(!a)return 0;if(rw(s)&&t.padding&&a[0]!==Pe(a)&&(a=function(e,t,n,i,r,o){var a=Math.abs(Pe(n)-n[0]),s=a/(a-2*i),l=e===Mp?Qe(t,null,s):e===Fp?Ze(t,null,s,.5):e===Cp?Ze(t,null,s,r||1):e===Op?Ke(t,null,s,o||1):Je(t,null,s);return(t=t.slice())[0]=l[0],t[t.length-1]=l[1],t}(s,a,t.range,t.padding,t.exponent,t.constant)),(l||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(r=(a=a.slice()).length-1||1,l&&(a[0]>0&&(a[0]=0),a[r]<0&&(a[r]=0)),null!=t.domainMin&&(a[0]=t.domainMin),null!=t.domainMax&&(a[r]=t.domainMax),null!=t.domainMid)){const e=(o=t.domainMid)>a[r]?r+1:oe(l);if(null==t)h.push(e.slice());else for(r={},o=0,a=e.length;od&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,u,c),i=0,r=n.length,o=n.max;ie;function xw(e,t){e&&ww.hasOwnProperty(e.type)&&ww[e.type](e,t)}var _w={Feature:function(e,t){xw(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i0){for(o=e[--r];r>0&&(t=o,n=e[--r],o=t+n,i=n-(o-t),!i););r>0&&(i<0&&e[r-1]<0||i>0&&e[r-1]>0)&&(n=2*i,t=o+n,n==t-o&&(o=t))}return o}}var Dw=1e-6,Sw=1e-12,Mw=Math.PI,Cw=Mw/2,Fw=Mw/4,Ow=2*Mw,Nw=180/Mw,Tw=Mw/180,zw=Math.abs,Rw=Math.atan,Pw=Math.atan2,Lw=Math.cos,Bw=Math.ceil,jw=Math.exp,Iw=(Math.floor,Math.hypot),Uw=Math.log,qw=Math.pow,Ww=Math.sin,Hw=Math.sign||function(e){return e>0?1:e<0?-1:0},Gw=Math.sqrt,Vw=Math.tan;function Yw(e){return e>1?0:e<-1?Mw:Math.acos(e)}function Xw(e){return e>1?Cw:e<-1?-Cw:Math.asin(e)}function Jw(){}var Qw,Zw,Kw,ek,tk=new $w,nk=new $w,ik={point:Jw,lineStart:Jw,lineEnd:Jw,polygonStart:function(){ik.lineStart=rk,ik.lineEnd=sk},polygonEnd:function(){ik.lineStart=ik.lineEnd=ik.point=Jw,tk.add(zw(nk)),nk=new $w},result:function(){var e=tk/2;return tk=new $w,e}};function rk(){ik.point=ok}function ok(e,t){ik.point=ak,Qw=Kw=e,Zw=ek=t}function ak(e,t){nk.add(ek*e-Kw*t),Kw=e,ek=t}function sk(){ak(Qw,Zw)}const lk=ik;var uk=1/0,ck=uk,fk=-uk,dk=fk,hk={point:function(e,t){efk&&(fk=e),tdk&&(dk=t)},lineStart:Jw,lineEnd:Jw,polygonStart:Jw,polygonEnd:Jw,result:function(){var e=[[uk,ck],[fk,dk]];return fk=dk=-(ck=uk=1/0),e}};const pk=hk;var mk,gk,yk,vk,bk=0,xk=0,_k=0,wk=0,kk=0,Ek=0,Ak=0,$k=0,Dk=0,Sk={point:Mk,lineStart:Ck,lineEnd:Nk,polygonStart:function(){Sk.lineStart=Tk,Sk.lineEnd=zk},polygonEnd:function(){Sk.point=Mk,Sk.lineStart=Ck,Sk.lineEnd=Nk},result:function(){var e=Dk?[Ak/Dk,$k/Dk]:Ek?[wk/Ek,kk/Ek]:_k?[bk/_k,xk/_k]:[NaN,NaN];return bk=xk=_k=wk=kk=Ek=Ak=$k=Dk=0,e}};function Mk(e,t){bk+=e,xk+=t,++_k}function Ck(){Sk.point=Fk}function Fk(e,t){Sk.point=Ok,Mk(yk=e,vk=t)}function Ok(e,t){var n=e-yk,i=t-vk,r=Gw(n*n+i*i);wk+=r*(yk+e)/2,kk+=r*(vk+t)/2,Ek+=r,Mk(yk=e,vk=t)}function Nk(){Sk.point=Mk}function Tk(){Sk.point=Rk}function zk(){Pk(mk,gk)}function Rk(e,t){Sk.point=Pk,Mk(mk=yk=e,gk=vk=t)}function Pk(e,t){var n=e-yk,i=t-vk,r=Gw(n*n+i*i);wk+=r*(yk+e)/2,kk+=r*(vk+t)/2,Ek+=r,Ak+=(r=vk*e-yk*t)*(yk+e),$k+=r*(vk+t),Dk+=3*r,Mk(yk=e,vk=t)}const Lk=Sk;function Bk(e){this._context=e}Bk.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Ow)}},result:Jw};var jk,Ik,Uk,qk,Wk,Hk=new $w,Gk={point:Jw,lineStart:function(){Gk.point=Vk},lineEnd:function(){jk&&Yk(Ik,Uk),Gk.point=Jw},polygonStart:function(){jk=!0},polygonEnd:function(){jk=null},result:function(){var e=+Hk;return Hk=new $w,e}};function Vk(e,t){Gk.point=Yk,Ik=qk=e,Uk=Wk=t}function Yk(e,t){qk-=e,Wk-=t,Hk.add(Gw(qk*qk+Wk*Wk)),qk=e,Wk=t}const Xk=Gk;let Jk,Qk,Zk,Kk;class eE{constructor(e){this._append=null==e?tE:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return tE;if(t!==Jk){const e=10**t;Jk=t,Qk=function(t){let n=1;this._+=t[0];for(const i=t.length;n=0))throw new RangeError(`invalid digits: ${e}`);r=t}return null===t&&(i=new eE(r)),a},a.projection(e).digits(r).context(t)}function iE(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:Jw,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function rE(e,t){return zw(e[0]-t[0])=0;--o)r.point((c=u[o])[0],c[1]);else i(d.x,d.p.x,-1,r);d=d.p}u=(d=d.o).z,h=!h}while(!d.v);r.lineEnd()}}}function sE(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i=0?1:-1,$=A*E,D=$>Mw,S=g*w;if(l.add(Pw(S*A*Ww($),y*k+S*Lw($))),a+=D?E+A*Ow:E,D^p>=n^x>=n){var M=fE(uE(h),uE(b));pE(M);var C=fE(o,M);pE(C);var F=(D^E>=0?-1:1)*Xw(C[2]);(i>F||i===F&&(M[0]||M[1]))&&(s+=D^E>=0?1:-1)}}return(a<-Dw||a0){for(f||(r.polygonStart(),f=!0),r.lineStart(),e=0;e1&&2&l&&d.push(d.pop().concat(d.shift())),a.push(d.filter(vE))}return d}}function vE(e){return e.length>1}function bE(e,t){return((e=e.x)[0]<0?e[1]-Cw-Dw:Cw-e[1])-((t=t.x)[0]<0?t[1]-Cw-Dw:Cw-t[1])}const xE=yE((function(){return!0}),(function(e){var t,n=NaN,i=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?Mw:-Mw,l=zw(o-n);zw(l-Mw)0?Cw:-Cw),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(o,i),t=0):r!==s&&l>=Mw&&(zw(n-r)Dw?Rw((Ww(t)*(o=Lw(i))*Ww(n)-Ww(i)*(r=Lw(t))*Ww(e))/(r*o*a)):(t+i)/2}(n,i,o,a),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),t=0),e.point(n=o,i=a),r=s},lineEnd:function(){e.lineEnd(),n=i=NaN},clean:function(){return 2-t}}}),(function(e,t,n,i){var r;if(null==e)r=n*Cw,i.point(-Mw,r),i.point(0,r),i.point(Mw,r),i.point(Mw,0),i.point(Mw,-r),i.point(0,-r),i.point(-Mw,-r),i.point(-Mw,0),i.point(-Mw,r);else if(zw(e[0]-t[0])>Dw){var o=e[0]0)do{u.point(0===c||3===c?e:n,c>1?i:t)}while((c=(c+s+4)%4)!==f);else u.point(o[0],o[1])}function a(i,r){return zw(i[0]-e)0?0:3:zw(i[0]-n)0?2:1:zw(i[1]-t)0?1:0:r>0?3:2}function s(e,t){return l(e.x,t.x)}function l(e,t){var n=a(e,1),i=a(t,1);return n!==i?n-i:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){var l,u,c,f,d,h,p,m,g,y,v,b=a,x=iE(),_={point:w,lineStart:function(){_.point=k,u&&u.push(c=[]),y=!0,g=!1,p=m=NaN},lineEnd:function(){l&&(k(f,d),h&&g&&x.rejoin(),l.push(x.result())),_.point=w,g&&b.lineEnd()},polygonStart:function(){b=x,l=[],u=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,r=u.length;ni&&(d-o)*(i-a)>(h-a)*(e-o)&&++t:h<=i&&(d-o)*(i-a)<(h-a)*(e-o)&&--t;return t}(),n=v&&t,r=(l=gE(l)).length;(n||r)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),r&&aE(l,s,t,o,a),a.polygonEnd()),b=a,l=u=c=null}};function w(e,t){r(e,t)&&b.point(e,t)}function k(o,a){var s=r(o,a);if(u&&c.push([o,a]),y)f=o,d=a,h=s,y=!1,s&&(b.lineStart(),b.point(o,a));else if(s&&g)b.point(o,a);else{var l=[p=Math.max(kE,Math.min(wE,p)),m=Math.max(kE,Math.min(wE,m))],x=[o=Math.max(kE,Math.min(wE,o)),a=Math.max(kE,Math.min(wE,a))];!function(e,t,n,i,r,o){var a,s=e[0],l=e[1],u=0,c=1,f=t[0]-s,d=t[1]-l;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>c)return;a>u&&(u=a)}if(a=r-s,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>u&&(u=a)}else if(f>0){if(a0)){if(a/=d,d<0){if(a0){if(a>c)return;a>u&&(u=a)}if(a=o-l,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>u&&(u=a)}else if(d>0){if(a0&&(e[0]=s+u*f,e[1]=l+u*d),c<1&&(t[0]=s+c*f,t[1]=l+c*d),!0}}}}}(l,x,e,t,n,i)?s&&(b.lineStart(),b.point(o,a),v=!1):(g||(b.lineStart(),b.point(l[0],l[1])),b.point(x[0],x[1]),s||b.lineEnd(),v=!1)}p=o,m=a,g=s}return _}}function AE(e,t){function n(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,i){return(n=t.invert(n,i))&&e.invert(n[0],n[1])}),n}function $E(e,t){return zw(e)>Mw&&(e-=Math.round(e/Ow)*Ow),[e,t]}function DE(e,t,n){return(e%=Ow)?t||n?AE(ME(e),CE(t,n)):ME(e):t||n?CE(t,n):$E}function SE(e){return function(t,n){return zw(t+=e)>Mw&&(t-=Math.round(t/Ow)*Ow),[t,n]}}function ME(e){var t=SE(e);return t.invert=SE(-e),t}function CE(e,t){var n=Lw(e),i=Ww(e),r=Lw(t),o=Ww(t);function a(e,t){var a=Lw(t),s=Lw(e)*a,l=Ww(e)*a,u=Ww(t),c=u*n+s*i;return[Pw(l*r-c*o,s*n-u*i),Xw(c*r+l*o)]}return a.invert=function(e,t){var a=Lw(t),s=Lw(e)*a,l=Ww(e)*a,u=Ww(t),c=u*r-l*o;return[Pw(l*r+u*o,s*n+c*i),Xw(c*n-s*i)]},a}function FE(e){return function(t){var n=new OE;for(var i in e)n[i]=e[i];return n.stream=t,n}}function OE(){}function NE(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),Aw(n,e.stream(pk)),t(pk.result()),null!=i&&e.clipExtent(i),e}function TE(e,t,n){return NE(e,(function(n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],o=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),a=+t[0][0]+(i-o*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(r-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,s])}),n)}function zE(e,t,n){return TE(e,[[0,0],t],n)}function RE(e,t,n){return NE(e,(function(n){var i=+t,r=i/(n[1][0]-n[0][0]),o=(i-r*(n[1][0]+n[0][0]))/2,a=-r*n[0][1];e.scale(150*r).translate([o,a])}),n)}function PE(e,t,n){return NE(e,(function(n){var i=+t,r=i/(n[1][1]-n[0][1]),o=-r*n[0][0],a=(i-r*(n[1][1]+n[0][1]))/2;e.scale(150*r).translate([o,a])}),n)}$E.invert=$E,OE.prototype={constructor:OE,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var LE=16,BE=Lw(30*Tw);function jE(e,t){return+t?function(e,t){function n(i,r,o,a,s,l,u,c,f,d,h,p,m,g){var y=u-i,v=c-r,b=y*y+v*v;if(b>4*t&&m--){var x=a+d,_=s+h,w=l+p,k=Gw(x*x+_*_+w*w),E=Xw(w/=k),A=zw(zw(w)-1)t||zw((y*M+v*C)/b-.5)>.3||a*d+s*h+l*p0,r=zw(t)>Dw;function o(e,n){return Lw(e)*Lw(n)>t}function a(e,n,i){var r=[1,0,0],o=fE(uE(e),uE(n)),a=cE(o,o),s=o[0],l=a-s*s;if(!l)return!i&&e;var u=t*a/l,c=-t*s/l,f=fE(r,o),d=hE(r,u);dE(d,hE(o,c));var h=f,p=cE(d,h),m=cE(h,h),g=p*p-m*(cE(d,d)-1);if(!(g<0)){var y=Gw(g),v=hE(h,(-p-y)/m);if(dE(v,d),v=lE(v),!i)return v;var b,x=e[0],_=n[0],w=e[1],k=n[1];_0^v[1]<(zw(v[0]-x)Mw^(x<=v[0]&&v[0]<=_)){var $=hE(h,(-p+y)/m);return dE($,d),[v,lE($)]}}}function s(t,n){var r=i?e:Mw-e,o=0;return t<-r?o|=1:t>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return yE(o,(function(e){var t,n,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,d){var h,p=[f,d],m=o(f,d),g=i?m?0:s(f,d):m?s(f+(f<0?Mw:-Mw),d):0;if(!t&&(u=l=m)&&e.lineStart(),m!==l&&(!(h=a(t,p))||rE(t,h)||rE(p,h))&&(p[2]=1),m!==l)c=0,m?(e.lineStart(),h=a(p,t),e.point(h[0],h[1])):(h=a(t,p),e.point(h[0],h[1],2),e.lineEnd()),t=h;else if(r&&t&&i^m){var y;g&n||!(y=a(p,t,!0))||(c=0,i?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||t&&rE(t,p)||e.point(p[0],p[1]),t=p,l=m,n=g},lineEnd:function(){l&&e.lineEnd(),t=null},clean:function(){return c|(u&&l)<<1}}}),(function(t,i,r,o){!function(e,t,n,i,r,o){if(n){var a=Lw(t),s=Ww(t),l=i*n;null==r?(r=t+i*Ow,o=t-l/2):(r=_E(a,r),o=_E(a,o),(i>0?ro)&&(r+=i*Ow));for(var u,c=r;i>0?c>o:c2?e[2]%360*Tw:0,M()):[g*Nw,y*Nw,v*Nw]},D.angle=function(e){return arguments.length?(b=e%360*Tw,M()):b*Nw},D.reflectX=function(e){return arguments.length?(x=e?-1:1,M()):x<0},D.reflectY=function(e){return arguments.length?(_=e?-1:1,M()):_<0},D.precision=function(e){return arguments.length?(a=jE(s,$=e*e),C()):Gw($)},D.fitExtent=function(e,t){return TE(D,e,t)},D.fitSize=function(e,t){return zE(D,e,t)},D.fitWidth=function(e,t){return RE(D,e,t)},D.fitHeight=function(e,t){return PE(D,e,t)},function(){return t=e.apply(this,arguments),D.invert=t.invert&&S,M()}}function HE(e){var t=0,n=Mw/3,i=WE(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*Tw,n=e[1]*Tw):[t*Nw,n*Nw]},r}function GE(e,t){var n=Ww(e),i=(n+Ww(t))/2;if(zw(i)2?e[2]*Tw:0),t.invert=function(t){return(t=e.invert(t[0]*Tw,t[1]*Tw))[0]*=Nw,t[1]*=Nw,t},t}(r.rotate()).invert([0,0]));return l(null==u?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:e===KE?[[Math.max(s[0]-o,u),t],[Math.min(s[0]+o,n),i]]:[[u,Math.max(s[1]-o,t)],[n,Math.min(s[1]+o,i)]])}return r.scale=function(e){return arguments.length?(a(e),c()):a()},r.translate=function(e){return arguments.length?(s(e),c()):s()},r.center=function(e){return arguments.length?(o(e),c()):o()},r.clipExtent=function(e){return arguments.length?(null==e?u=t=n=i=null:(u=+e[0][0],t=+e[0][1],n=+e[1][0],i=+e[1][1]),c()):null==u?null:[[u,t],[n,i]]},c()}function tA(e){return Vw((Cw+e)/2)}function nA(e,t){var n=Lw(e),i=e===t?Ww(e):Uw(n/Lw(t))/Uw(tA(t)/tA(e)),r=n*qw(tA(e),i)/i;if(!i)return KE;function o(e,t){r>0?t<-Cw+Dw&&(t=-Cw+Dw):t>Cw-Dw&&(t=Cw-Dw);var n=r/qw(tA(t),i);return[n*Ww(i*e),r-n*Lw(i*e)]}return o.invert=function(e,t){var n=r-t,o=Hw(i)*Gw(e*e+n*n),a=Pw(e,zw(n))*Hw(n);return n*i<0&&(a-=Mw*Hw(e)*Hw(n)),[a/i,2*Rw(qw(r/o,1/i))-Cw]},o}function iA(e,t){return[e,t]}function rA(e,t){var n=Lw(e),i=e===t?Ww(e):(n-Lw(t))/(t-e),r=n/i+e;if(zw(i)Dw&&--r>0);return[e/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},hA.invert=JE(Xw),pA.invert=JE((function(e){return 2*Rw(e)})),mA.invert=function(e,t){return[-t,2*Rw(jw(e))-Cw]};var gA=Math.abs,yA=(Math.atan,Math.atan2,Math.ceil,Math.cos),vA=(Math.exp,Math.floor,Math.log,Math.max,Math.min,Math.pow,Math.round,Math.sign,Math.sin),bA=(Math.tan,1e-6),xA=Math.PI,_A=xA/2,wA=(Math.SQRT1_2,EA(2));function kA(e){return e>1?_A:e<-1?-_A:Math.asin(e)}function EA(e){return e>0?Math.sqrt(e):0}function AA(e,t){var n,i=e*vA(t),r=30;do{t-=n=(t+vA(t)-i)/(1+yA(t))}while(gA(n)>bA&&--r>0);return t/2}EA(xA);var $A=function(e,t,n){function i(i,r){return[e*i*yA(r=AA(n,r)),t*vA(r)]}return i.invert=function(i,r){return r=kA(r/t),[i/(e*yA(r)),kA((2*r+vA(2*r))/n)]},i}(wA/_A,wA,xA);const DA=nE(),SA=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function MA(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(FA[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=nE().projection(i),i.copy=i.copy||function(){const e=n();return SA.forEach((t=>{i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},tm(i)}}(e,t),this):FA[e]||null}function CA(e){return e&&e.path||DA}const FA={albers:YE,albersusa:function(){var e,t,n,i,r,o,a=YE(),s=VE().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=VE().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(e,t){o=[e,t]}};function c(e){var t=e[0],a=e[1];return o=null,n.point(t,a),o||(i.point(t,a),o)||(r.point(t,a),o)}function f(){return e=t=null,c}return c.invert=function(e){var t=a.scale(),n=a.translate(),i=(e[0]-n[0])/t,r=(e[1]-n[1])/t;return(r>=.12&&r<.234&&i>=-.425&&i<-.214?s:r>=.166&&r<.234&&i>=-.214&&i<-.115?l:a).invert(e)},c.stream=function(n){return e&&t===n?e:(i=[a.stream(t=n),s.stream(n),l.stream(n)],r=i.length,e={point:function(e,t){for(var n=-1;++n2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)}};for(const e in FA)MA(e,FA[e]);function OA(e,t,n){var i=Tl(e,t-Dw,n).concat(t);return function(e){return i.map((function(t){return[e,t]}))}}function NA(e,t,n){var i=Tl(e,t-Dw,n).concat(t);return function(e){return i.map((function(t){return[t,e]}))}}function TA(){}const zA=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function RA(){var e=1,t=1,n=a;function i(e,t){return t.map((t=>r(e,t)))}function r(i,r){var a=[],s=[];return function(n,i,r){var a,s,l,u,c,f,d=new Array,h=new Array;for(a=s=-1,u=n[0]>=i,zA[u<<1].forEach(p);++a=i,zA[l|u<<1].forEach(p);for(zA[u<<0].forEach(p);++s=i,c=n[s*e]>=i,zA[u<<1|c<<2].forEach(p);++a=i,f=c,c=n[s*e+a+1]>=i,zA[l|u<<1|c<<2|f<<3].forEach(p);zA[u|c<<3].forEach(p)}for(a=-1,c=n[s*e]>=i,zA[c<<2].forEach(p);++a=i,zA[c<<2|f<<3].forEach(p);function p(e){var t,n,i=[e[0][0]+a,e[0][1]+s],l=[e[1][0]+a,e[1][1]+s],u=o(i),c=o(l);(t=h[u])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(l),r(t.ring)):d[t.start]=h[n.end]={start:t.start,end:n.end,ring:t.ring.concat(n.ring)}):(delete h[t.end],t.ring.push(l),h[t.end=c]=t):(t=d[c])?(n=h[u])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(l),r(t.ring)):d[n.start]=h[t.end]={start:n.start,end:t.end,ring:n.ring.concat(t.ring)}):(delete d[t.start],t.ring.unshift(i),d[t.start=u]=t):d[u]=h[c]={start:u,end:c,ring:[i,l]}}zA[c<<3].forEach(p)}(i,r,(e=>{n(e,i,r),function(e){for(var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t0?a.push([e]):s.push(e)})),s.forEach((e=>{for(var t,n=0,i=a.length;n{var o,a=n[0],s=n[1],l=0|a,u=0|s,c=i[u*e+l];a>0&&a0&&s=0&&o>=0||me("invalid size"),e=r,t=o,i},i.smooth=function(e){return arguments.length?(n=e?a:TA,i):n===a},i}function PA(e,t){for(var n,i=-1,r=t.length;++ii!=h>i&&n<(d-u)*(i-c)/(h-c)+u&&(r=-r)}return r}function BA(e,t,n){var i,r,o,a;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])==(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&(r=e[i=+(e[0]===t[0])],o=n[i],a=t[i],r<=o&&o<=a||a<=o&&o<=r)}function jA(e,t,n){return function(i){var r=pt(i),o=n?Math.min(r[0],0):r[0],a=r[1],s=a-o,l=t?pn(o,a,e):s/(e+1);return Tl(o+l,a,l)}}function IA(e){Es.call(this,null,e)}function UA(e,t,n,i,r){const o=e.x1||0,a=e.y1||0,s=t*n<0;function l(e){e.forEach(u)}function u(e){s&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-o)*t+i,e[1]=(e[1]-a)*n+r}return function(e){return e.coordinates.forEach(l),e}}function qA(e,t,n){const i=e>=0?e:js(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function WA(e){return rt(e)?e:ft(+e)}function HA(){var e=e=>e[0],t=e=>e[1],n=_e,i=[-1,-1],r=960,o=500,a=2;function s(s,l){const u=qA(i[0],s,e)>>a,c=qA(i[1],s,t)>>a,f=u?u+2:0,d=c?c+2:0,h=2*f+(r>>a),p=2*d+(o>>a),m=new Float32Array(h*p),g=new Float32Array(h*p);let y=m;s.forEach((i=>{const r=f+(+e(i)>>a),o=d+(+t(i)>>a);r>=0&&r=0&&o0&&c>0?(GA(h,p,m,g,u),VA(h,p,g,m,c),GA(h,p,m,g,u),VA(h,p,g,m,c),GA(h,p,m,g,u),VA(h,p,g,m,c)):u>0?(GA(h,p,m,g,u),GA(h,p,g,m,u),GA(h,p,m,g,u),y=g):c>0&&(VA(h,p,m,g,c),VA(h,p,g,m,c),VA(h,p,m,g,c),y=g);const v=l?Math.pow(2,-2*a):1/U_(y);for(let e=0,t=h*p;e>a),y2:d+(o>>a)}}return s.x=function(t){return arguments.length?(e=WA(t),s):e},s.y=function(e){return arguments.length?(t=WA(e),s):t},s.weight=function(e){return arguments.length?(n=WA(e),s):n},s.size=function(e){if(!arguments.length)return[r,o];var t=+e[0],n=+e[1];return t>=0&&n>=0||me("invalid size"),r=t,o=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||me("invalid cell size"),a=Math.floor(Math.log(e)/Math.LN2),s):1<=r&&(t>=o&&(s-=n[t-o+a*e]),i[t-r+a*e]=s/Math.min(t+1,e-1+o-t,o))}function VA(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a=r&&(s>=o&&(l-=n[a+(s-o)*e]),i[a+(s-r)*e]=l/Math.min(s+1,t-1+o-s,o))}function YA(e){Es.call(this,null,e)}IA.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},_t(IA,Es,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=e.field||be,o=RA().smooth(!1!==e.smooth),a=e.thresholds||function(e,t,n){const i=jA(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map((e=>Ss(t(e).values))))}(i,r,e),s=null===e.as?null:e.as||"contour",l=[];return i.forEach((t=>{const n=r(t),i=o.size([n.width,n.height])(n.values,Fe(a)?a:a(n.values));!function(e,t,n,i){let r=i.scale||t.scale,o=i.translate||t.translate;if(rt(r)&&(r=r(n,i)),rt(o)&&(o=o(n,i)),(1===r||null==r)&&!o)return;const a=($t(r)?r:r[0])||1,s=($t(r)?r:r[1])||1,l=o&&o[0]||0,u=o&&o[1]||0;e.forEach(UA(t,a,s,l,u))}(i,n,t,e),i.forEach((e=>{l.push(Ja(t,Ya(null!=s?{[s]:e}:e)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=l,n}}),YA.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const XA=["x","y","weight","size","cellSize","bandwidth"];function JA(e,t){return XA.forEach((n=>null!=t[n]?e[n](t[n]):0)),e}function QA(e){Es.call(this,null,e)}_t(YA,Es,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=function(e,t){var n,i,r,o,a,s,l=[],u=e=>e(o);if(null==t)l.push(e);else for(n={},i=0,r=e.length;iYa(function(e,t){for(let n=0;nDw})).map(l)).concat(Tl(Bw(o/h)*h,r,h).filter((function(e){return zw(e%m)>Dw})).map(u))}return y.lines=function(){return v().map((function(e){return{type:"LineString",coordinates:e}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(i).concat(f(a).slice(1),c(n).reverse().slice(1),f(s).reverse().slice(1))]}},y.extent=function(e){return arguments.length?y.extentMajor(e).extentMinor(e):y.extentMinor()},y.extentMajor=function(e){return arguments.length?(i=+e[0][0],n=+e[1][0],s=+e[0][1],a=+e[1][1],i>n&&(e=i,i=n,n=e),s>a&&(e=s,s=a,a=e),y.precision(g)):[[i,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],r=+n[1][1],t>e&&(n=t,t=e,e=n),o>r&&(n=o,o=r,r=n),y.precision(g)):[[t,o],[e,r]]},y.step=function(e){return arguments.length?y.stepMajor(e).stepMinor(e):y.stepMinor()},y.stepMajor=function(e){return arguments.length?(p=+e[0],m=+e[1],y):[p,m]},y.stepMinor=function(e){return arguments.length?(d=+e[0],h=+e[1],y):[d,h]},y.precision=function(d){return arguments.length?(g=+d,l=OA(o,r,90),u=NA(t,e,g),c=OA(s,a,90),f=NA(i,n,g),y):g},y.extentMajor([[-180,-90+Dw],[180,90-Dw]]).extentMinor([[-180,-80-Dw],[180,80+Dw]])}()}function o$(e){Es.call(this,null,e)}function a$(e){if(!rt(e))return!1;const t=Ut(fe(e));return t.$x||t.$y||t.$value||t.$max}function s$(e){Es.call(this,null,e),this.modified(!0)}function l$(e,t,n){rt(e[t])&&e[t](n)}function u$(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o,a,s,l,u,c,f,d,h=e._root,p={data:i},m=e._x0,g=e._y0,y=e._x1,v=e._y1;if(!h)return e._root=p,e;for(;h.length;)if((u=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a,r=h,!(h=h[f=c<<1|u]))return r[f]=p,e;if(s=+e._x.call(null,h.data),l=+e._y.call(null,h.data),t===s&&n===l)return p.next=h,r?r[f]=p:e._root=p,e;do{r=r?r[f]=new Array(4):e._root=new Array(4),(u=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a}while((f=c<<1|u)==(d=(l>=a)<<1|s>=o));return r[d]=h,r[f]=p,e}function c$(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function f$(e){return e[0]}function d$(e){return e[1]}function h$(e,t,n){var i=new p$(null==t?f$:t,null==n?d$:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function p$(e,t,n,i,r,o){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function m$(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}e$.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},_t(e$,Es,{transform(e,t){var n,i=this._features,r=this._points,o=e.fields,a=o&&o[0],s=o&&o[1],l=e.geojson||!o&&be,u=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(fe(l))||a&&t.modified(fe(a))||s&&t.modified(fe(s)),this.value&&!n||(u=t.SOURCE,this._features=i=[],this._points=r=[]),l&&t.visit(u,(e=>i.push(l(e)))),a&&s&&(t.visit(u,(e=>{var t=a(e),n=s(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])})),i=i.concat({type:ZA,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:KA,features:i}}}),t$.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},_t(t$,Es,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||be,o=e.as||"path",a=n.SOURCE;!i||e.modified()?(this.value=i=CA(e.projection),n.materialize().reflow()):a=r===be||t.modified(r.fields)?n.ADD_MOD:n.ADD;const s=function(e,t){const n=e.pointRadius();return e.context(null),null!=t&&e.pointRadius(t),n}(i,e.pointRadius);return n.visit(a,(e=>e[o]=i(r(e)))),i.pointRadius(s),n.modifies(o)}}),n$.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},_t(n$,Es,{transform(e,t){var n,i=e.projection,r=e.fields[0],o=e.fields[1],a=e.as||["x","y"],s=a[0],l=a[1];function u(e){const t=i([r(e),o(e)]);t?(e[s]=t[0],e[l]=t[1]):(e[s]=void 0,e[l]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,u):(n=t.modified(r.fields)||t.modified(o.fields),t.visit(n?t.ADD_MOD:t.ADD,u)),t.modifies(a)}}),i$.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},_t(i$,Es,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",o=n.ADD;return i&&!e.modified()||(this.value=i=function(e,t,n){const i=null==n?n=>e(t(n)):i=>{var r=e.pointRadius(),o=e.pointRadius(n)(t(i));return e.pointRadius(r),o};return i.context=t=>(e.context(t),i),i}(CA(e.projection),e.field||ye("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(e=>e[r]=i)),n.modifies(r)}}),r$.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},_t(r$,Es,{transform(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(const t in e)rt(r[t])&&r[t](e[t]);return n=r(),i.length?t.mod.push(Qa(i[0],n)):t.add.push(Ya(n)),i[0]=n,t}}),o$.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},_t(o$,Es,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i="shared"===e.resolve,r=e.field||be,o=function(e,t){let n;return rt(e)?(n=n=>e(n,t),n.dep=a$(e)):e?n=ft(e):(n=e=>e.$value/e.$max||0,n.dep=!0),n}(e.opacity,e),a=function(e,t){let n;return rt(e)?(n=n=>Xf(e(n,t)),n.dep=a$(e)):n=ft(Xf(e||"#888")),n}(e.color,e),s=e.as||"image",l={$x:0,$y:0,$value:0,$max:i?Ss(n.map((e=>Ss(r(e).values)))):0};return n.forEach((e=>{const t=r(e),n=ht({},e,l);i||(n.$max=Ss(t.values||[])),e[s]=function(e,t,n,i){const r=e.width,o=e.height,a=e.x1||0,s=e.y1||0,l=e.x2||r,u=e.y2||o,c=e.values,f=c?e=>c[e]:xe,d=_f(l-a,u-s),h=d.getContext("2d"),p=h.getImageData(0,0,l-a,u-s),m=p.data;for(let e=s,o=0;e{null!=e[t]&&l$(n,t,e[t])}))):SA.forEach((t=>{e.modified(t)&&l$(n,t,e[t])})),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&function(e,t){const n=function(e){return 1===(e=nt(e)).length?e[0]:{type:KA,features:e.reduce(((e,t)=>e.concat(function(e){return e.type===KA?e.features:nt(e).filter((e=>null!=e)).map((e=>e.type===ZA?e:{type:ZA,geometry:e}))}(t))),[])}}(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});var g$=h$.prototype=p$.prototype;function y$(e){return function(){return e}}function v$(e){return 1e-6*(e()-.5)}function b$(e){return e.x+e.vx}function x$(e){return e.y+e.vy}g$.copy=function(){var e,t,n=new p$(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=m$(i),n;for(e=[{source:i,target:n._root=new Array(4)}];i=e.pop();)for(var r=0;r<4;++r)(t=i.source[r])&&(t.length?e.push({source:t,target:i.target[r]=new Array(4)}):i.target[r]=m$(t));return n},g$.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return u$(this.cover(t,n),t,n,e)},g$.addAll=function(e){var t,n,i,r,o=e.length,a=new Array(o),s=new Array(o),l=1/0,u=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=i),rf&&(f=r));if(l>c||u>f)return this;for(this.cover(l,u).cover(c,f),n=0;ne||e>=r||i>t||t>=o;)switch(s=(td||(o=l.y0)>h||(a=l.x1)=y)<<1|e>=g)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=l)}else{var v=e-+this._x.call(null,m.data),b=t-+this._y.call(null,m.data),x=v*v+b*b;if(x=(s=(p+g)/2))?p=s:g=s,(c=a>=(l=(m+y)/2))?m=l:y=l,t=h,!(h=h[f=c<<1|u]))return this;if(!h.length)break;(t[f+1&3]||t[f+2&3]||t[f+3&3])&&(n=t,d=f)}for(;h.data!==e;)if(i=h,!(h=h.next))return this;return(r=h.next)&&delete h.next,i?(r?i.next=r:delete i.next,this):t?(r?t[f]=r:delete t[f],(h=t[0]||t[1]||t[2]||t[3])&&h===(t[3]||t[2]||t[1]||t[0])&&!h.length&&(n?n[d]=h:this._root=h),this):(this._root=r,this)},g$.removeAll=function(e){for(var t=0,n=e.length;t{}};function w$(){for(var e,t=0,n=arguments.length,i={};t=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!i.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a0)for(var n,i,r=new Array(n),o=0;o=0&&t._call.call(void 0,e),t=t._next;--M$}()}finally{M$=0,function(){for(var e,t,n=D$,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:D$=t);S$=e,W$(i)}(),T$=0}}function q$(){var e=R$.now(),t=e-N$;t>O$&&(z$-=t,N$=e)}function W$(e){M$||(C$&&(C$=clearTimeout(C$)),e-T$>24?(e<1/0&&(C$=setTimeout(U$,e-R$.now()-z$)),F$&&(F$=clearInterval(F$))):(F$||(N$=R$.now(),F$=setInterval(q$,O$)),M$=1,P$(U$)))}j$.prototype=I$.prototype={constructor:j$,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?L$():+n)+(null==t?0:+t),this._next||S$===this||(S$?S$._next=this:D$=this,S$=this),this._call=e,this._time=n,W$()},stop:function(){this._call&&(this._call=null,this._time=1/0,W$())}};const H$=4294967296;function G$(e){return e.x}function V$(e){return e.y}var Y$=Math.PI*(3-Math.sqrt(5));function X$(e){return e.index}function J$(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}const Q$={center:function(e,t){var n,i=1;function r(){var r,o,a=n.length,s=0,l=0;for(r=0;ru+p||oc+p||al.index){var m=u-s.x-s.vx,g=c-s.y-s.vy,y=m*m+g*g;ye.r&&(e.r=e[t].r)}function l(){if(t){var i,r,o=t.length;for(n=new Array(o),i=0;i=s)){(e.data!==t||e.next)&&(0===f&&(p+=(f=v$(n))*f),0===d&&(p+=(d=v$(n))*d),p[s(e,t,i),e])));for(a=0,r=new Array(u);at(e,n):t)}function sD(e){var t=0,n=e.children,i=n&&n.length;if(i)for(;--i>=0;)t+=n[i].value;else t=1;e.value=t}function lD(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=cD)):void 0===t&&(t=uD);for(var n,i,r,o,a,s=new hD(e),l=[s];n=l.pop();)if((r=t(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)l.push(i=r[o]=new hD(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(dD)}function uD(e){return e.children}function cD(e){return Array.isArray(e)?e[1]:null}function fD(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function dD(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function hD(e){this.data=e,this.depth=this.height=0,this.parent=null}function pD(e){return null==e?null:mD(e)}function mD(e){if("function"!=typeof e)throw new Error;return e}function gD(){return 0}function yD(e){return function(){return e}}nD.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:tD}]},_t(nD,Es,{transform(e,t){var n,i,r=this.value,o=t.changed(t.ADD_REM),a=e.modified(K$),s=e.iterations||300;if(r?(o&&(t.modifies("index"),r.nodes(t.source)),(a||t.changed(t.MOD))&&iD(r,e,0,t)):(this.value=r=function(e,t){const n=function(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,l=I$(f),u=$$("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%H$)/H$}();function f(){d(),u.call("tick",t),n1?(null==n?s.delete(e):s.set(e,p(n)),t):s.get(e)},find:function(t,n,i){var r,o,a,s,l,u=0,c=e.length;for(null==i?i=1/0:i*=i,u=0;u1?(u.on(e,n),t):u.on(e)}}}(e),i=n.stop,r=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,r()),n.stop=()=>(o=!0,i()),iD(n,t,!0).on("end",(()=>o=!0))}(t.source,e),r.on("tick",(n=t.dataflow,i=this,()=>n.touch(i).run())),e.static||(o=!0,r.tick()),t.modifies("index")),a||o||e.modified(eD)||t.changed()&&e.restart)if(r.alpha(Math.max(r.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(r.alphaMin(),1/s)),e.static)for(r.stop();--s>=0;)r.tick();else if(r.stopped()&&r.restart(),!o)return t.StopPropagation;return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let e,t=this._argops,s=0,l=t.length;s=0;--i)o.push(n[i]);return this},find:function(e,t){let n=-1;for(const i of this)if(e.call(t,i,++n,this))return i},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,i=t.children,r=i&&i.length;--r>=0;)n+=i[r].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),i=t.ancestors(),r=null;for(e=n.pop(),t=i.pop();e===t;)r=e,e=n.pop(),t=i.pop();return r}(t,e),i=[t];t!==n;)t=t.parent,i.push(t);for(var r=i.length;e!==n;)i.splice(r,0,e),e=e.parent;return i},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return lD(this).eachBefore(fD)},[Symbol.iterator]:function*(){var e,t,n,i,r=this,o=[r];do{for(e=o.reverse(),o=[];r=e.pop();)if(yield r,t=r.children)for(n=0,i=t.length;n0&&n*n>i*i+r*r}function wD(e,t){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*$*S))/(2*$):S/D);return{x:i+w+k*M,y:r+E+A*M,r:M}}function $D(e,t,n){var i,r,o,a,s=e.x-t.x,l=e.y-t.y,u=s*s+l*l;u?(r=t.r+n.r,r*=r,a=e.r+n.r,r>(a*=a)?(i=(u+a-r)/(2*u),o=Math.sqrt(Math.max(0,a/u-i*i)),n.x=e.x-i*s-o*l,n.y=e.y-i*l+o*s):(i=(u+r-a)/(2*u),o=Math.sqrt(Math.max(0,r/u-i*i)),n.x=t.x+i*s-o*l,n.y=t.y+i*l+o*s)):(n.x=t.x+n.r,n.y=t.y)}function DD(e,t){var n=e.r+t.r-1e-6,i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function SD(e){var t=e._,n=e.next._,i=t.r+n.r,r=(t.x*n.r+n.x*t.r)/i,o=(t.y*n.r+n.y*t.r)/i;return r*r+o*o}function MD(e){this._=e,this.next=null,this.previous=null}function CD(e,t){if(!(o=(e=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(e)).length))return 0;var n,i,r,o,a,s,l,u,c,f,d;if((n=e[0]).x=0,n.y=0,!(o>1))return n.r;if(i=e[1],n.x=-i.r,i.x=n.r,i.y=0,!(o>2))return n.r+i.r;$D(i,n,r=e[2]),n=new MD(n),i=new MD(i),r=new MD(r),n.next=r.previous=i,i.next=n.previous=r,r.next=i.previous=n;e:for(l=3;lfunction(e){let t=(e=`${e}`).length;return WD(e,t-1)&&!WD(e,t-2)&&(e=e.slice(0,-1)),"/"===e[0]?e:`/${e}`}(e(t,n,i)))),n=t.map(qD),r=new Set(t).add("");for(const e of n)r.has(e)||(r.add(e),t.push(e),n.push(qD(e)),d.push(BD));h=(e,n)=>t[n],p=(e,t)=>n[t]}for(a=0,r=d.length;a=0&&(u=d[e]).data===BD;--e)u.data=null}if(s.parent=PD,s.eachBefore((function(e){e.depth=e.parent.depth+1,--r})).eachBefore(dD),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(e){return arguments.length?(t=pD(e),i):t},i.parentId=function(e){return arguments.length?(n=pD(e),i):n},i.path=function(t){return arguments.length?(e=pD(t),i):e},i}function qD(e){let t=e.length;if(t<2)return"";for(;--t>1&&!WD(e,t););return e.slice(0,t)}function WD(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(0==(1&n))return!0}return!1}function HD(e,t){return e.parent===t.parent?1:2}function GD(e){var t=e.children;return t?t[0]:e.t}function VD(e){var t=e.children;return t?t[t.length-1]:e.t}function YD(e,t,n){var i=n/(t.i-e.i);t.c-=i,t.s+=n,e.c+=i,t.z+=n,t.m+=n}function XD(e,t,n){return e.a.parent===t.parent?e.a:n}function JD(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function QD(e,t){return e.parent===t.parent?1:2}function ZD(e,t){return e+t.x}function KD(e,t){return Math.max(e,t.y)}function eS(e,t,n,i,r){for(var o,a=e.children,s=-1,l=a.length,u=e.value&&(r-n)/e.value;++sd&&(d=s),g=c*c*m,(h=Math.max(d/g,g/f))>p){c-=s;break}p=h}y.push(a={value:c,dice:l1?t:1)},n}(tS),rS=function e(t){function n(e,n,i,r,o){if((a=e._squarify)&&a.ratio===t)for(var a,s,l,u,c,f=-1,d=a.length,h=e.value;++f1?t:1)},n}(tS);function oS(e,t,n){const i={};return e.each((e=>{const r=e.data;n(r)&&(i[t(r)]=e)})),e.lookup=i,e}function aS(e){Es.call(this,null,e)}aS.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const sS=e=>e.values;function lS(){const e=[],t={entries:e=>i(n(e,0),0),key:n=>(e.push(n),t)};function n(t,i){if(i>=e.length)return t;const r=t.length,o=e[i++],a={},s={};let l,u,c,f=-1;for(;++fe.length)return t;const r=[];for(const e in t)r.push({key:e,values:i(t[e],n)});return r}return t}function uS(e){Es.call(this,null,e)}_t(aS,Es,{transform(e,t){t.source||me("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),r=t.clone(),o=this.value;return(!o||i||t.changed())&&(o&&o.each((e=>{e.children&&Ha(e.data)&&r.rem.push(e.data)})),this.value=o=lD({values:nt(e.keys).reduce(((e,t)=>(e.key(t),e)),lS()).entries(r.source)},sS),n&&o.each((e=>{e.children&&(e=Ya(e.data),r.add.push(e),r.source.push(e))})),oS(o,Ga,Ga)),r.source.root=o,r}});const cS=(e,t)=>e.parent===t.parent?1:2;_t(uS,Es,{transform(e,t){t.source&&t.source.root||me(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,o=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(Za(e.sort,(e=>e.data))),function(e,t,n){for(let i,r=0,o=t.length;rfunction(e,t,n){const i=e.data,r=t.length-1;for(let o=0;o(e=(1664525*e+1013904223)%vD)/vD}();return r.x=t/2,r.y=n/2,e?r.eachBefore(OD(e)).eachAfter(ND(i,.5,o)).eachBefore(TD(1)):r.eachBefore(OD(FD)).eachAfter(ND(gD,1,o)).eachAfter(ND(i,r.r/Math.min(t,n),o)).eachBefore(TD(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=pD(t),r):e},r.size=function(e){return arguments.length?(t=+e[0],n=+e[1],r):[t,n]},r.padding=function(e){return arguments.length?(i="function"==typeof e?e:yD(+e),r):i},r},params:["radius","size","padding"],fields:fS});const hS=["x0","y0","x1","y1","depth","children"];function pS(e){uS.call(this,e)}function mS(e){Es.call(this,null,e)}pS.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:hS.length,default:hS}]},_t(pS,uS,{layout:function(){var e=1,t=1,n=0,i=!1;function r(r){var o=r.height+1;return r.x0=r.y0=n,r.x1=e,r.y1=t/o,r.eachBefore(function(e,t){return function(i){i.children&&RD(i,i.x0,e*(i.depth+1)/t,i.x1,e*(i.depth+2)/t);var r=i.x0,o=i.y0,a=i.x1-n,s=i.y1-n;a=0;--r)s.push(n=t.children[r]=new JD(i[r],r)),n.parent=t;return(a.parent=new JD(null,0)).children=[a],a}(r);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),i)r.eachBefore(s);else{var u=r,c=r,f=r;r.eachBefore((function(e){e.xc.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=u===c?1:e(u,c)/2,h=d-u.x,p=t/(c.x+d+h),m=n/(f.depth||1);r.eachBefore((function(e){e.x=(e.x+h)*p,e.y=e.depth*m}))}return r}function o(t){var n=t.children,i=t.parent.children,r=t.i?i[t.i-1]:null;if(n){!function(e){for(var t,n=0,i=0,r=e.children,o=r.length;--o>=0;)(t=r[o]).z+=n,t.m+=n,n+=t.s+(i+=t.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+e(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+e(t._,r._));t.parent.A=function(t,n,i){if(n){for(var r,o=t,a=t,s=n,l=o.parent.children[0],u=o.m,c=a.m,f=s.m,d=l.m;s=VD(s),o=GD(o),s&&o;)l=GD(l),(a=VD(a)).a=t,(r=s.z+f-o.z-u+e(s._,o._))>0&&(YD(XD(s,t,i),t,r),u+=r,c+=r),f+=s.m,u+=o.m,d+=l.m,c+=a.m;s&&!VD(a)&&(a.t=s,a.m+=f-c),o&&!GD(l)&&(l.t=o,l.m+=u-d,i=t)}return i}(t,r,t.parent.A||i[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=t,e.y=e.depth*n}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r},cluster:function(){var e=QD,t=1,n=1,i=!1;function r(r){var o,a=0;r.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(ZD,0)/e.length}(n),t.y=function(e){return 1+e.reduce(KD,0)}(n)):(t.x=o?a+=e(t,o):0,t.y=0,o=t)}));var s=function(e){for(var t;t=e.children;)e=t[0];return e}(r),l=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(r),u=s.x-e(s,l)/2,c=l.x+e(l,s)/2;return r.eachAfter(i?function(e){e.x=(e.x-r.x)*t,e.y=(r.y-e.y)*n}:function(e){e.x=(e.x-u)/(c-u)*t,e.y=(1-(r.y?e.y/r.y:1))*n})}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r}},yS=["x","y","depth","children"];function vS(e){uS.call(this,e)}function bS(e){Es.call(this,[],e)}vS.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:yS.length,default:yS}]},_t(vS,uS,{layout(e){const t=e||"tidy";if(yt(gS,t))return gS[t]();me("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:yS}),bS.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},_t(bS,Es,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),o={};return i||me("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(e=>o[Ga(e)]=1)),i.each((e=>{const t=e.data,n=e.parent&&e.parent.data;n&&o[Ga(t)]&&o[Ga(n)]&&r.add.push(Ya({source:n,target:t}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(e=>o[Ga(e)]=1)),n.forEach((e=>{(o[Ga(e.source)]||o[Ga(e.target)])&&r.mod.push(e)}))),r}});const xS={binary:function(e,t,n,i,r){var o,a,s=e.children,l=s.length,u=new Array(l+1);for(u[0]=a=o=0;o=n-1){var c=s[t];return c.x0=r,c.y0=o,c.x1=a,void(c.y1=l)}for(var f=u[t],d=i/2+f,h=t+1,p=n-1;h>>1;u[m]l-o){var v=i?(r*y+a*g)/i:a;e(t,h,g,r,o,v,l),e(h,n,y,v,o,a,l)}else{var b=i?(o*y+l*g)/i:l;e(t,h,g,r,o,a,b),e(h,n,y,r,b,a,l)}}(0,l,e.value,t,n,i,r)},dice:RD,slice:eS,slicedice:function(e,t,n,i,r){(1&e.depth?eS:RD)(e,t,n,i,r)},squarify:iS,resquarify:rS},_S=["x0","y0","x1","y1","depth","children"];function wS(e){uS.call(this,e)}wS.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:_S.length,default:_S}]},_t(wS,uS,{layout(){const e=function(){var e=iS,t=!1,n=1,i=1,r=[0],o=gD,a=gD,s=gD,l=gD,u=gD;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(f),r=[0],t&&e.eachBefore(zD),e}function f(t){var n=r[t.depth],i=t.x0+n,c=t.y0+n,f=t.x1-n,d=t.y1-n;f{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{yt(xS,t)?e.tile(xS[t]):me("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:_S});const kS=4278190080;function ES(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function AS(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach((t=>{t.items.forEach((t=>AS(e,t.items,n)))})):jv[i].draw(e,{items:n?t.map($S):t})}function $S(e){const t=Ja(e,{});return t.stroke&&0!==t.strokeOpacity||t.fill&&0!==t.fillOpacity?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const DS=5,SS=31,MS=32,CS=new Uint32Array(MS+1),FS=new Uint32Array(MS+1);FS[0]=0,CS[0]=~FS[0];for(let e=1;e<=MS;++e)FS[e]=FS[e-1]<<1|1,CS[e]=~FS[e];function OS(e,t,n,i,r,o){let a=n/2;return e-a<0||e+a>r||t-(a=i/2)<0||t+a>o}function NS(e,t,n,i,r,o,a,s){const l=r*o/(2*i),u=e(t-l),c=e(t+l),f=e(n-(o/=2)),d=e(n+o);return a.outOfBounds(u,f,c,d)||a.getRange(u,f,c,d)||s&&s.getRange(u,f,c,d)}const TS=[-1,-1,1,1],zS=[-1,1,-1,1],RS=["right","center","left"],PS=["bottom","middle","top"];function LS(e,t,n,i,r,o,a,s,l,u,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&o||r).getRange(e,n,t,i))}const BS={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},jS={naive:function(e,t,n,i){const r=e.width,o=e.height;return function(e){const t=e.datum.datum.items[i].items,n=t.length,a=e.datum.fontSize,s=xv.width(e.datum,e.datum.text);let l,u,c,f,d,h,p,m=0;for(let i=0;i=m&&(m=p,e.x=d,e.y=h);return d=s/2,h=a/2,l=e.x-d,u=e.x+d,c=e.y-h,f=e.y+h,e.align="center",l<0&&u<=r?e.align="left":0<=l&&r=1;)d=(h+p)/2,NS(e,c,f,u,l,d,a,s)?p=d:h=d;if(h>i)return[c,f,h,!0]}}return function(t){const s=t.datum.datum.items[i].items,u=s.length,c=t.datum.fontSize,f=xv.width(t.datum,t.datum.text);let d,h,p,m,g,y,v,b,x,_,w,k,E,A,$,D,S,M=n?c:0,C=!1,F=!1,O=0;for(let i=0;ih&&(S=d,d=h,h=S),p>m&&(S=p,p=m,m=S),x=e(d),w=e(h),_=~~((x+w)/2),k=e(p),A=e(m),E=~~((k+A)/2),v=_;v>=x;--v)for(b=E;b>=k;--b)D=l(v,b,M,f,c),D&&([t.x,t.y,M,C]=D);for(v=_;v<=w;++v)for(b=E;b<=A;++b)D=l(v,b,M,f,c),D&&([t.x,t.y,M,C]=D);C||n||($=Math.abs(h-d+m-p),g=(d+h)/2,y=(p+m)/2,$>=O&&!OS(g,y,f,c,r,o)&&!NS(e,g,y,c,f,c,a,null)&&(O=$,t.x=g,t.y=y,F=!0))}return!(!C&&!F||(g=f/2,y=c/2,a.setRange(e(t.x-g),e(t.y-y),e(t.x+g),e(t.y+y)),t.align="center",t.baseline="middle",0))}},floodfill:function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],l=e.bitmap();return function(t){const u=t.datum.datum.items[i].items,c=u.length,f=t.datum.fontSize,d=xv.width(t.datum,t.datum.text),h=[];let p,m,g,y,v,b,x,_,w,k,E,A,$=n?f:0,D=!1,S=!1,M=0;for(let i=0;i=1;)E=(w+k)/2,NS(e,v,b,f,d,E,a,s)?k=E:w=E;w>$&&(t.x=v,t.y=b,$=w,D=!0)}}D||n||(A=Math.abs(m-p+y-g),v=(p+m)/2,b=(g+y)/2,A>=M&&!OS(v,b,d,f,r,o)&&!NS(e,v,b,f,d,f,a,null)&&(M=A,t.x=v,t.y=b,S=!0))}return!(!D&&!S||(v=d/2,b=f/2,a.setRange(e(t.x-v),e(t.y-b),e(t.x+v),e(t.y+b)),t.align="center",t.baseline="middle",0))}}};function IS(e,t,n,i,r,o,a,s,l,u,c){if(!e.length)return e;const f=Math.max(i.length,r.length),d=function(e,t){const n=new Float64Array(t),i=e.length;for(let t=0;t[e.x,e.x,e.x,e.y,e.y,e.y];return e?"line"===e||"area"===e?e=>r(e.datum):"line"===t?e=>{const t=e.datum.items[i].items;return r(t.length?t["start"===n?0:t.length-1]:{x:NaN,y:NaN})}:e=>{const t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:r}(p,m,s,l),v=null===u||u===1/0,b=g&&"naive"===c;var x;let _=-1,w=-1;const k=e.map((e=>{const t=v?xv.width(e,e.text):void 0;return _=Math.max(_,t),w=Math.max(w,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(e),textWidth:t}}));u=null===u||u===1/0?Math.max(_,w)+Math.max(...i):u;const E=function(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),o=~~((t+2*n+i)/i),a=e=>~~((e+n)/i);return a.invert=e=>e*i-n,a.bitmap=()=>function(e,t){const n=new Uint32Array(~~((e*t+MS)/MS));function i(e,t){n[e]|=t}function r(e,t){n[e]&=t}return{array:n,get:(t,i)=>{const r=i*e+t;return n[r>>>DS]&1<<(r&SS)},set:(t,n)=>{const r=n*e+t;i(r>>>DS,1<<(r&SS))},clear:(t,n)=>{const i=n*e+t;r(i>>>DS,~(1<<(i&SS)))},getRange:(t,i,r,o)=>{let a,s,l,u,c=o;for(;c>=i;--c)if(a=c*e+t,s=c*e+r,l=a>>>DS,u=s>>>DS,l===u){if(n[l]&CS[a&SS]&FS[1+(s&SS)])return!0}else{if(n[l]&CS[a&SS])return!0;if(n[u]&FS[1+(s&SS)])return!0;for(let e=l+1;e{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+r,l=a>>>DS,u=s>>>DS,l===u)i(l,CS[a&SS]&FS[1+(s&SS)]);else for(i(l,CS[a&SS]),i(u,FS[1+(s&SS)]),c=l+1;c{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+i,l=a>>>DS,u=s>>>DS,l===u)r(l,FS[a&SS]|CS[1+(s&SS)]);else for(r(l,FS[a&SS]),r(u,CS[1+(s&SS)]),c=l+1;cn<0||i<0||o>=t||r>=e}}(r,o),a.ratio=i,a.padding=n,a.width=e,a.height=t,a}(t[0],t[1],u);let A;if(!b){n&&k.sort(((e,t)=>n(e.datum,t.datum)));let t=!1;for(let e=0;ee.datum));A=o.length||i?function(e,t,n,i,r){const o=e.width,a=e.height,s=i||r,l=_f(o,a).getContext("2d"),u=_f(o,a).getContext("2d"),c=s&&_f(o,a).getContext("2d");n.forEach((e=>AS(l,e,!1))),AS(u,t,!1),s&&AS(c,t,!0);const f=ES(l,o,a),d=ES(u,o,a),h=s&&ES(c,o,a),p=e.bitmap(),m=s&&e.bitmap();let g,y,v,b,x,_,w,k;for(y=0;yn.set(e(t.boundary[0]),e(t.boundary[3])))),[n,void 0]}(E,a&&k)}const $=g?jS[c](E,A,a,l):function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],l=i.length;return function(t){const u=t.boundary,c=t.datum.fontSize;if(u[2]<0||u[5]<0||u[0]>r||u[3]>o)return!1;let f,d,h,p,m,g,y,v,b,x,_,w,k,E,A,$=t.textWidth??0;for(let r=0;r>>2&3)-1,h=0===f&&0===d||i[r]<0,p=f&&d?Math.SQRT1_2:1,m=i[r]<0?-1:1,g=u[1+f]+i[r]*f*p,_=u[4+d]+m*c*d/2+i[r]*d*p,v=_-c/2,b=_+c/2,w=e(g),E=e(v),A=e(b),!$){if(!LS(w,w,E,A,a,s,0,0,0,0,0,h))continue;$=xv.width(t.datum,t.datum.text)}if(x=g+m*$*f/2,g=x-$/2,y=x+$/2,w=e(g),k=e(y),LS(w,k,E,A,a,s,0,0,0,0,0,h))return t.x=f?f*m<0?y:g:x,t.y=d?d*m<0?b:v:_,t.align=RS[f*m+1],t.baseline=PS[d*m+1],a.setRange(w,E,k,A),!0}return!1}}(E,A,h,d);return k.forEach((e=>e.opacity=+$(e))),k}const US=["x","y","opacity","align","baseline"],qS=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function WS(e){Es.call(this,null,e)}function HS(e,t){var n,i,r,o,a,s,l=[],u=function(e){return e(o)};if(null==t)l.push(e);else for(n={},i=0,r=e.length;i{const t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline})),t.reflow(n).modifies(i)}}),GS.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},_t(GS,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=HS(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(ce),o=r.length,a=e.as||[ce(e.x),ce(e.y)],s=[];i.forEach((t=>{Sl(t,e.x,e.y,e.bandwidth||.3).forEach((e=>{const n={};for(let e=0;e"poly"===e?t:"quad"===e?2:1)(o,a),l=e.as||[ce(e.x),ce(e.y)],u=VS[o],c=[];let f=e.extent;yt(VS,o)||me("Invalid regression method: "+o),null!=f&&"log"===o&&f[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),f=null),i.forEach((n=>{if(n.length<=s)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const i=u(n,e.x,e.y,a);if(e.params)return void c.push(Ya({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const d=f||pt(n,e.x),h=e=>{const t={};for(let e=0;eh([e,i.predict(e)]))):Ol(i.predict,d,25,200).forEach(h)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=c}return n}});const XS=134217729;function JS(e,t,n,i,r){let o,a,s,l,u=t[0],c=i[0],f=0,d=0;c>u==c>-u?(o=u,u=t[++f]):(o=c,c=i[++d]);let h=0;if(fu==c>-u?(a=u+o,s=o-(a-u),u=t[++f]):(a=c+o,s=o-(a-c),c=i[++d]),o=a,0!==s&&(r[h++]=s);fu==c>-u?(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++f]):(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=i[++d]),o=a,0!==s&&(r[h++]=s);for(;f=33306690738754716e-32*u?l:-function(e,t,n,i,r,o,a){let s,l,u,c,f,d,h,p,m,g,y,v,b,x,_,w,k,E;const A=e-r,$=n-r,D=t-o,S=i-o;x=A*S,d=XS*A,h=d-(d-A),p=A-h,d=XS*S,m=d-(d-S),g=S-m,_=p*g-(x-h*m-p*m-h*g),w=D*$,d=XS*D,h=d-(d-D),p=D-h,d=XS*$,m=d-(d-$),g=$-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,ZS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,ZS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,ZS[2]=v-(E-f)+(y-f),ZS[3]=E;let M=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,ZS),C=22204460492503146e-32*a;if(M>=C||-M>=C)return M;if(f=e-A,s=e-(A+f)+(f-r),f=n-$,u=n-($+f)+(f-r),f=t-D,l=t-(D+f)+(f-o),f=i-S,c=i-(S+f)+(f-o),0===s&&0===l&&0===u&&0===c)return M;if(C=11093356479670487e-47*a+33306690738754706e-32*Math.abs(M),M+=A*c+S*s-(D*u+$*l),M>=C||-M>=C)return M;x=s*S,d=XS*s,h=d-(d-s),p=s-h,d=XS*S,m=d-(d-S),g=S-m,_=p*g-(x-h*m-p*m-h*g),w=l*$,d=XS*l,h=d-(d-l),p=l-h,d=XS*$,m=d-(d-$),g=$-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,nM[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,nM[1]=b-(y+f)+(f-w),E=v+y,f=E-v,nM[2]=v-(E-f)+(y-f),nM[3]=E;const F=JS(4,ZS,4,nM,KS);x=A*c,d=XS*A,h=d-(d-A),p=A-h,d=XS*c,m=d-(d-c),g=c-m,_=p*g-(x-h*m-p*m-h*g),w=D*u,d=XS*D,h=d-(d-D),p=D-h,d=XS*u,m=d-(d-u),g=u-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,nM[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,nM[1]=b-(y+f)+(f-w),E=v+y,f=E-v,nM[2]=v-(E-f)+(y-f),nM[3]=E;const O=JS(F,KS,4,nM,eM);x=s*c,d=XS*s,h=d-(d-s),p=s-h,d=XS*c,m=d-(d-c),g=c-m,_=p*g-(x-h*m-p*m-h*g),w=l*u,d=XS*l,h=d-(d-l),p=l-h,d=XS*u,m=d-(d-u),g=u-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,nM[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,nM[1]=b-(y+f)+(f-w),E=v+y,f=E-v,nM[2]=v-(E-f)+(y-f),nM[3]=E;const N=JS(O,eM,4,nM,tM);return tM[N-1]}(e,t,n,i,r,o,u)}QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(8),QS(8),QS(8),QS(4),QS(8),QS(8),QS(8),QS(12),QS(192),QS(192),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(8),QS(8),QS(8),QS(8),QS(8),QS(8),QS(8),QS(8),QS(8),QS(4),QS(4),QS(4),QS(8),QS(16),QS(16),QS(16),QS(32),QS(32),QS(48),QS(64),QS(1152),QS(1152),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(4),QS(24),QS(24),QS(24),QS(24),QS(24),QS(24),QS(24),QS(24),QS(24),QS(24),QS(1152),QS(1152),QS(1152),QS(1152),QS(1152),QS(2304),QS(2304),QS(3456),QS(5760),QS(8),QS(8),QS(8),QS(16),QS(24),QS(48),QS(48),QS(96),QS(192),QS(384),QS(384),QS(384),QS(768),QS(96),QS(96),QS(96),QS(1152);const rM=Math.pow(2,-52),oM=new Uint32Array(512);class aM{static from(e,t=dM,n=hM){const i=e.length,r=new Float64Array(2*i);for(let o=0;o>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:i,_hullHash:r}=this,o=e.length>>1;let a=1/0,s=1/0,l=-1/0,u=-1/0;for(let t=0;tl&&(l=n),i>u&&(u=i),this._ids[t]=t}const c=(a+l)/2,f=(s+u)/2;let d,h,p,m=1/0;for(let t=0;t0&&(h=t,m=n)}let v=e[2*h],b=e[2*h+1],x=1/0;for(let t=0;ti&&(t[n++]=r,i=this._dists[r])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(iM(g,y,v,b,_,w)<0){const e=h,t=v,n=b;h=p,v=_,b=w,p=e,_=t,w=n}const k=function(e,t,n,i,r,o){const a=n-e,s=i-t,l=r-e,u=o-t,c=a*a+s*s,f=l*l+u*u,d=.5/(a*u-s*l);return{x:e+(u*c-s*f)*d,y:t+(a*f-l*c)*d}}(g,y,v,b,_,w);this._cx=k.x,this._cy=k.y;for(let t=0;t0&&Math.abs(u-o)<=rM&&Math.abs(c-a)<=rM)continue;if(o=u,a=c,l===d||l===h||l===p)continue;let f=0;for(let e=0,t=this._hashKey(u,c);e=0;)if(g=m,g===f){g=-1;break}if(-1===g)continue;let y=this._addTriangle(g,l,n[g],-1,-1,i[g]);i[l]=this._legalize(y+2),i[g]=y,E++;let v=n[g];for(;m=n[v],iM(u,c,e[2*v],e[2*v+1],e[2*m],e[2*m+1])<0;)y=this._addTriangle(v,l,m,i[l],-1,i[v]),i[l]=this._legalize(y+2),n[v]=v,E--,v=m;if(g===f)for(;m=t[g],iM(u,c,e[2*m],e[2*m+1],e[2*g],e[2*g+1])<0;)y=this._addTriangle(m,l,g,-1,i[g],i[m]),this._legalize(y+2),i[m]=y,n[g]=g,E--,g=m;this._hullStart=t[l]=g,n[g]=t[v]=l,n[l]=v,r[this._hashKey(u,c)]=l,r[this._hashKey(e[2*g],e[2*g+1])]=g}this.hull=new Uint32Array(E);for(let e=0,t=this._hullStart;e0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const a=n[e],s=e-e%3;if(o=s+(e+2)%3,-1===a){if(0===r)break;e=oM[--r];continue}const l=a-a%3,u=s+(e+1)%3,c=l+(a+2)%3,f=t[o],d=t[e],h=t[u],p=t[c];if(lM(i[2*f],i[2*f+1],i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1])){t[e]=p,t[a]=f;const i=n[c];if(-1===i){let t=this._hullStart;do{if(this._hullTri[t]===c){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,i),this._link(a,n[o]),this._link(o,c);const s=l+(a+1)%3;r=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=i}else{let r=n+1,o=i;fM(e,n+i>>1,r),t[e[n]]>t[e[i]]&&fM(e,n,i),t[e[r]]>t[e[i]]&&fM(e,r,i),t[e[n]]>t[e[r]]&&fM(e,n,r);const a=e[r],s=t[a];for(;;){do{r++}while(t[e[r]]s);if(o=o-n?(cM(e,t,r,i),cM(e,t,n,o-1)):(cM(e,t,n,o-1),cM(e,t,r,i))}}function fM(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function dM(e){return e[0]}function hM(e){return e[1]}const pM=1e-6;class mM{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){const i=(e=+e)+(n=+n),r=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${i},${r}`:(Math.abs(this._x1-i)>pM||Math.abs(this._y1-r)>pM)&&(this._+="L"+i+","+r),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=i},${this._y1=r}`)}rect(e,t,n,i){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+i}h${-n}Z`}value(){return this._||null}}class gM{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}class yM{constructor(e,[t,n,i,r]=[0,0,960,500]){if(!((i=+i)>=(t=+t)&&(r=+r)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=i,this.xmin=t,this.ymax=r,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:i}=this;let r,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let i,s,l=0,u=0,c=n.length;l1;)r-=2;for(let e=2;e0){if(t>=this.ymax)return null;(r=(this.ymax-t)/i)0){if(e>=this.xmax)return null;(r=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t2&&function(e){const{triangles:t,coords:n}=e;for(let e=0;e1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},((e,t)=>t)).sort(((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]));const e=this.collinear[0],n=this.collinear[this.collinear.length-1],i=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],r=1e-8*Math.hypot(i[3]-i[1],i[2]-i[0]);for(let e=0,n=t.length/2;e0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,2===i.length&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(e){return new yM(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:i,halfedges:r,triangles:o,collinear:a}=this;if(a){const t=a.indexOf(e);return t>0&&(yield a[t-1]),void(t=0&&r!==n&&r!==i;)n=r;return r}_step(e,t,n){const{inedges:i,hull:r,_hullIndex:o,halfedges:a,triangles:s,points:l}=this;if(-1===i[e]||!l.length)return(e+1)%(l.length>>1);let u=e,c=bM(t-l[2*e],2)+bM(n-l[2*e+1],2);const f=i[e];let d=f;do{let i=s[d];const f=bM(t-l[2*i],2)+bM(n-l[2*i+1],2);if(f>5<<5,l=~~Math.max(Math.abs(v+b),Math.abs(v-b))}else a=a+31>>5<<5;if(l>h&&(h=l),f+a>=SM<<5&&(f=0,d+=h,h=0),d+l>=MM)break;r.translate((f+(a>>1))/o,(d+(l>>1))/o),t.rotate&&r.rotate(t.rotate*DM),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=a,t.height=l,t.xoff=f,t.yoff=d,t.x1=a>>1,t.y1=l>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=a}for(var _=r.getImageData(0,0,(SM<<5)/o,MM/o).data,w=[];--i>=0;)if((t=n[i]).hasText){for(s=(a=t.width)>>5,l=t.y1-t.y0,u=0;u>5),$=_[(d+c)*(SM<<5)+(f+u)<<2]?1<<31-u%32:0;w[A]|=$,k|=$}k?E=c:(t.y0++,l--,c--,d++)}t.y1=t.y0+E,t.sprite=w.slice(0,(t.y1-t.y0)*s)}}}function FM(e,t,n){n>>=5;for(var i,r=e.sprite,o=e.width>>5,a=e.x-(o<<4),s=127&a,l=32-s,u=e.y1-e.y0,c=(e.y+e.y0)*n+(a>>5),f=0;f>>s:0))&t[c+d])return!0;c+=n}return!1}function OM(e,t){var n=e[0],i=e[1];t.x+t.x0i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function NM(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0=f));)if(t.x=a+r,t.y=u+o,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>s[0]||t.y+t.y1>s[1])&&(!n||!FM(t,e,s[0]))&&(!n||NM(t,n))){for(var m,g=t.sprite,y=t.width>>5,v=s[0]>>5,b=t.x-(y<<4),x=127&b,_=32-x,w=t.y1-t.y0,k=(t.y+t.y0)*v+(b>>5),E=0;E>>x:0);k+=v}return t.sprite=null,!0}return!1}return f.layout=function(){for(var l=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=(SM<<5)/t,e.height=MM/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(_f()),f=function(e){for(var t=[],n=-1;++n>5)*s[1]),h=null,p=u.length,m=-1,g=[],y=u.map((s=>({text:e(s),font:t(s),style:i(s),weight:r(s),rotate:o(s),size:~~(n(s)+1e-14),padding:a(s),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:s}))).sort(((e,t)=>t.size-e.size));++m>1,v.y=s[1]*(c()+.5)>>1,CM(l,v,y,m),v.hasText&&d(f,v,h)&&(g.push(v),h?OM(h,v):h=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=s[0]>>1,v.y-=s[1]>>1)}return g},f.words=function(e){return arguments.length?(u=e,f):u},f.size=function(e){return arguments.length?(s=[+e[0],+e[1]],f):s},f.font=function(e){return arguments.length?(t=zM(e),f):t},f.fontStyle=function(e){return arguments.length?(i=zM(e),f):i},f.fontWeight=function(e){return arguments.length?(r=zM(e),f):r},f.rotate=function(e){return arguments.length?(o=zM(e),f):o},f.text=function(t){return arguments.length?(e=zM(t),f):e},f.spiral=function(e){return arguments.length?(l=RM[e]||e,f):l},f.fontSize=function(e){return arguments.length?(n=zM(e),f):n},f.padding=function(e){return arguments.length?(a=zM(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f}(),e)}BM.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:PM}]},_t(BM,Es,{transform(e,t){!e.size||e.size[0]&&e.size[1]||me("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||LM.some((function(n){const i=e[n];return rt(i)&&t.modified(i.fields)}))))return;const i=t.materialize(t.SOURCE).source,r=this.value,o=e.as||PM;let a,s=e.fontSize||14;if(rt(s)?a=e.fontSizeRange:s=ft(s),a){const e=s,t=nm("sqrt")().domain(pt(i,e)).range(a);s=n=>t(e(n))}i.forEach((e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0}));const l=r.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(s).random(Us).layout(),u=r.size(),c=u[0]>>1,f=u[1]>>1,d=l.length;for(let e,t,n=0;nnew Uint8Array(e),IM=e=>new Uint16Array(e),UM=e=>new Uint32Array(e);function qM(e,t,n){const i=(t<257?jM:t<65537?IM:UM)(e);return n&&i.set(n),i}function WM(e,t,n){const i=1<{const i=e[t],r=e[n];return ir?1:0})),function(e,t){return Array.from(t,(t=>e[t]))}(e,t)}(d,l),a)u=t,c=e,t=Array(a+s),e=UM(a+s),function(e,t,n,i,r,o,a,s,l){let u,c=0,f=0;for(u=0;c0)for(f=0;fe,size:()=>n}}function GM(e){Es.call(this,function(){let e=8,t=[],n=UM(0),i=qM(0,e),r=qM(0,e);return{data:()=>t,seen:()=>n=function(e,t,n){return e.length>=t?e:((n=n||new e.constructor(t)).set(e),n)}(n,t.length),add(e){for(let n,i=0,r=t.length,o=e.length;it.length,curr:()=>i,prev:()=>r,reset:e=>r[e]=i[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){i[e]|=t},clear(e,t){i[e]&=~t},resize(t,n){(t>i.length||n>e)&&(e=Math.max(n,e),i=qM(t,e,i),r=qM(t,e))}}}(),e),this._indices=null,this._dims=null}function VM(e){Es.call(this,null,e)}GM.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},_t(GM,Es,{transform(e,t){return this._dims?e.modified("fields")||e.fields.some((e=>t.modified(e.fields)))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){const n=e.fields,i=e.query,r=this._indices={},o=this._dims=[],a=i.length;let s,l,u=0;for(;u{const e=r.remove(t,n);for(const t in i)i[t].reindex(e)}))},update(e,t,n){const i=this._dims,r=e.query,o=t.stamp,a=i.length;let s,l,u=0;for(n.filters=0,l=0;lh)for(g=h,y=Math.min(f,p);gp)for(g=Math.max(f,p),y=d;gc)for(h=c,p=Math.min(l,f);hf)for(h=Math.max(l,f),p=u;hs[e]&n?null:a[e];return o.filter(o.MOD,u),r&r-1?(o.filter(o.ADD,(e=>{const t=s[e]&n;return!t&&t^l[e]&n?a[e]:null})),o.filter(o.REM,(e=>{const t=s[e]&n;return!t||t^t^l[e]&n?null:a[e]}))):(o.filter(o.ADD,u),o.filter(o.REM,(e=>(s[e]&n)===r?a[e]:null))),o.filter(o.SOURCE,(e=>u(e._index)))}});const YM="Literal",XM="CallExpression";function JM(e){this.type=e}var QM,ZM,KM,eC,tC;JM.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case"ArrayExpression":return e.elements;case"BinaryExpression":case"LogicalExpression":return[e.left,e.right];case XM:return[e.callee].concat(e.arguments);case"ConditionalExpression":return[e.test,e.consequent,e.alternate];case"MemberExpression":return[e.object,e.property];case"ObjectExpression":return e.properties;case"Property":return[e.key,e.value];case"UnaryExpression":return[e.argument];default:return[]}}(this),n=0,i=t.length;n",QM[rC]="Identifier",QM[oC]="Keyword",QM[aC]="Null",QM[sC]="Numeric",QM[lC]="Punctuator",QM[uC]="String",QM[9]="RegularExpression";var cC="ArrayExpression",fC="BinaryExpression",dC="CallExpression",hC="ConditionalExpression",pC="Identifier",mC="Literal",gC="LogicalExpression",yC="MemberExpression",vC="ObjectExpression",bC="Property",xC="UnaryExpression",_C="Unexpected token %0",wC="Unexpected number",kC="Unexpected string",EC="Unexpected identifier",AC="Unexpected reserved word",$C="Unexpected end of input",DC="Invalid regular expression",SC="Invalid regular expression: missing /",MC="Octal literals are not allowed in strict mode.",CC="Duplicate data property in object literal not allowed in strict mode",FC="ILLEGAL",OC="Disabled.",NC=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5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\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),TC=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-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-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function zC(e,t){if(!e)throw new Error("ASSERT: "+t)}function RC(e){return e>=48&&e<=57}function PC(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function LC(e){return"01234567".indexOf(e)>=0}function BC(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function jC(e){return 10===e||13===e||8232===e||8233===e}function IC(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&NC.test(String.fromCharCode(e))}function UC(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&TC.test(String.fromCharCode(e))}const qC={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function WC(){for(;KM1114111||"}"!==e)&&oF({},_C,FC),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function VC(){var e,t;for(e=ZM.charCodeAt(KM++),t=String.fromCharCode(e),92===e&&(117!==ZM.charCodeAt(KM)&&oF({},_C,FC),++KM,(e=HC("u"))&&"\\"!==e&&IC(e.charCodeAt(0))||oF({},_C,FC),t=e);KM>>="===(i=ZM.substr(KM,4))?{type:lC,value:i,start:r,end:KM+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:lC,value:n,start:r,end:KM+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===t?{type:lC,value:t,start:r,end:KM+=2}:("//"===t&&oF({},_C,FC),"<>=!+-*%&|^/".indexOf(a)>=0?(++KM,{type:lC,value:a,start:r,end:KM}):void oF({},_C,FC))}function XC(){var e,t,n;if(zC(RC((n=ZM[KM]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=KM,e="","."!==n){if(e=ZM[KM++],n=ZM[KM],"0"===e){if("x"===n||"X"===n)return++KM,function(e){let t="";for(;KM=eC)return{type:iC,start:KM,end:KM};const e=ZM.charCodeAt(KM);return IC(e)?function(){var e,t;return e=KM,t=92===ZM.charCodeAt(KM)?VC():function(){var e,t;for(e=KM++;KM=0&&KM(zC(t=0&&oF({},DC,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";oF({},DC)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){oF({},DC)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:KM}}()),ZC()):aF(QC())}return n}function pF(){const e=[];if(sF("("),!lF(")"))for(;KM":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function xF(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,l,u;if(e=tC,l=vF(),0===(r=bF(i=tC)))return l;for(i.prec=r,QC(),t=[e,tC],o=[l,i,a=vF()];(r=bF(tC))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,l=o.pop(),t.pop(),n=KC(s,l,a),o.push(n);(i=QC()).prec=r,o.push(i),t.push(tC),n=vF(),o.push(n)}for(n=o[u=o.length-1],t.pop();u>1;)t.pop(),n=KC(o[u-1].value,o[u-2],n),u-=2;return n}(),lF("?")&&(QC(),t=xF(),sF(":"),e=function(e,t,n){const i=new JM(hC);return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,xF())),e}function _F(){const e=xF();if(lF(","))throw new Error(OC);return e}function wF(e){KM=0,eC=(ZM=e).length,tC=null,ZC();const t=_F();if(tC.type!==iC)throw new Error("Unexpect token after expression.");return t}var kF={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function EF(e){function t(t,n,i){return r=>function(t,n,i,r){let o=e(n[0]);return i&&(o=i+"("+o+")",0===i.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+t+(r<0?"":0===r?"()":"("+n.slice(1).map(e).join(",")+")")}(t,r,n,i)}const n="new Date",i="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(t){t.length<3&&me("Missing arguments to clamp function."),t.length>3&&me("Too many arguments to clamp function.");const n=t.map(e);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",i,0),lower:t("toLowerCase",i,0),substring:t("substring",i),split:t("split",i),trim:t("trim",i,0),regexp:r,test:t("test",r),if:function(t){t.length<3&&me("Missing arguments to if function."),t.length>3&&me("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function AF(e){const t=(e=e||{}).allowed?Ut(e.allowed):{},n=e.forbidden?Ut(e.forbidden):{},i=e.constants||kF,r=(e.functions||EF)(f),o=e.globalvar,a=e.fieldvar,s=rt(o)?o:e=>`${o}["${e}"]`;let l={},u={},c=0;function f(e){if(St(e))return e;const t=d[e.type];return null==t&&me("Unsupported type: "+e.type),t(e)}const d={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return c>0?r:yt(n,r)?me("Illegal identifier: "+r):yt(i,r)?i[r]:yt(t,r)?r:(l[r]=1,s(r))},MemberExpression:e=>{const t=!e.computed,n=f(e.object);t&&(c+=1);const i=f(e.property);return n===a&&(u[function(e){const t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(i)]=1),t&&(c-=1),n+(t?"."+i:"["+i+"]")},CallExpression:e=>{"Identifier"!==e.callee.type&&me("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=yt(r,t)&&r[t];return i||me("Unrecognized function: "+t),rt(i)?i(n):i+"("+n.map(f).join(",")+")"},ArrayExpression:e=>"["+e.elements.map(f).join(",")+"]",BinaryExpression:e=>"("+f(e.left)+" "+e.operator+" "+f(e.right)+")",UnaryExpression:e=>"("+e.operator+f(e.argument)+")",ConditionalExpression:e=>"("+f(e.test)+"?"+f(e.consequent)+":"+f(e.alternate)+")",LogicalExpression:e=>"("+f(e.left)+e.operator+f(e.right)+")",ObjectExpression:e=>"{"+e.properties.map(f).join(",")+"}",Property:e=>{c+=1;const t=f(e.key);return c-=1,t+":"+f(e.value)}};function h(e){const t={code:f(e),globals:Object.keys(l),fields:Object.keys(u)};return l={},u={},t}return h.functions=r,h.constants=i,h}var $F,DF,SF,MF,CF,FF,OF,NF,TF,zF,RF,PF,LF,BF,jF,IF,UF=new $w,qF=new $w,WF={point:Jw,lineStart:Jw,lineEnd:Jw,polygonStart:function(){UF=new $w,WF.lineStart=HF,WF.lineEnd=GF},polygonEnd:function(){var e=+UF;qF.add(e<0?Ow+e:e),this.lineStart=this.lineEnd=this.point=Jw},sphere:function(){qF.add(Ow)}};function HF(){WF.point=VF}function GF(){YF($F,DF)}function VF(e,t){WF.point=YF,$F=e,DF=t,SF=e*=Tw,MF=Lw(t=(t*=Tw)/2+Fw),CF=Ww(t)}function YF(e,t){var n=(e*=Tw)-SF,i=n>=0?1:-1,r=i*n,o=Lw(t=(t*=Tw)/2+Fw),a=Ww(t),s=CF*a,l=MF*o+s*Lw(r),u=s*i*Ww(r);UF.add(Pw(u,l)),SF=e,MF=o,CF=a}var XF,JF,QF,ZF,KF,eO,tO,nO,iO,rO,oO,aO,sO,lO,uO,cO,fO={point:dO,lineStart:pO,lineEnd:mO,polygonStart:function(){fO.point=gO,fO.lineStart=yO,fO.lineEnd=vO,BF=new $w,WF.polygonStart()},polygonEnd:function(){WF.polygonEnd(),fO.point=dO,fO.lineStart=pO,fO.lineEnd=mO,UF<0?(FF=-(NF=180),OF=-(TF=90)):BF>Dw?TF=90:BF<-Dw&&(OF=-90),IF[0]=FF,IF[1]=NF},sphere:function(){FF=-(NF=180),OF=-(TF=90)}};function dO(e,t){jF.push(IF=[FF=e,NF=e]),tTF&&(TF=t)}function hO(e,t){var n=uE([e*Tw,t*Tw]);if(LF){var i=fE(LF,n),r=fE([i[1],-i[0],0],i);pE(r),r=lE(r);var o,a=e-zF,s=a>0?1:-1,l=r[0]*Nw*s,u=zw(a)>180;u^(s*zFTF&&(TF=o):u^(s*zF<(l=(l+360)%360-180)&&lTF&&(TF=t)),u?ebO(FF,NF)&&(NF=e):bO(e,NF)>bO(FF,NF)&&(FF=e):NF>=FF?(eNF&&(NF=e)):e>zF?bO(FF,e)>bO(FF,NF)&&(NF=e):bO(e,NF)>bO(FF,NF)&&(FF=e)}else jF.push(IF=[FF=e,NF=e]);tTF&&(TF=t),LF=n,zF=e}function pO(){fO.point=hO}function mO(){IF[0]=FF,IF[1]=NF,fO.point=dO,LF=null}function gO(e,t){if(LF){var n=e-zF;BF.add(zw(n)>180?n+(n>0?360:-360):n)}else RF=e,PF=t;WF.point(e,t),hO(e,t)}function yO(){WF.lineStart()}function vO(){gO(RF,PF),WF.lineEnd(),zw(BF)>Dw&&(FF=-(NF=180)),IF[0]=FF,IF[1]=NF,LF=null}function bO(e,t){return(t-=e)<0?t+360:t}function xO(e,t){return e[0]-t[0]}function _O(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tt.indexOf(e)>=0)):t},R_union:function(e,t){var n=Le(t[0]),i=Le(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]i&&(n=t[1],i=t[0]),e.length?ii&&(e[1]=i),e):[n,i]}};function GO(e,t,n,i){t[0].type!==YM&&me("First argument to selection functions must be a string literal.");const r=t[0].value,o="unit",a="@"+o,s=":"+r;(t.length>=2&&Pe(t).value)!==RO||yt(i,a)||(i[a]=n.getData(r).indataRef(n,o)),yt(i,s)||(i[s]=n.getData(r).tuplesRef())}function VO(e){const t=this.context.data[e];return t?t.values.value:[]}const YO=e=>function(t,n){return this.context.dataflow.locale()[e](n)(t)},XO=YO("format"),JO=YO("timeFormat"),QO=YO("utcFormat"),ZO=YO("timeParse"),KO=YO("utcParse"),eN=new Date(2e3,0,1);function tN(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(eN.setYear(2e3),eN.setMonth(e),eN.setDate(t),JO.call(this,eN,n)):""}const nN="%",iN="$";function rN(e,t,n,i){t[0].type!==YM&&me("First argument to data functions must be a string literal.");const r=t[0].value,o=":"+r;if(!yt(o,i))try{i[o]=n.getData(r).tuplesRef()}catch(e){}}function oN(e,t,n,i){if(t[0].type===YM)aN(n,i,t[0].value);else for(e in n.scales)aN(n,i,e)}function aN(e,t,n){const i=nN+n;if(!yt(t,i))try{t[i]=e.scaleRef(n)}catch(e){}}function sN(e,t){if(rt(e))return e;if(St(e)){const i=t.scales[e];return i&&((n=i.value)&&!0===n[em])?i.value:void 0}var n}function lN(e,t){return function(n,i,r){if(n){const t=sN(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const uN=lN("area",(function(e){return qF=new $w,Aw(e,WF),2*qF})),cN=lN("bounds",(function(e){var t,n,i,r,o,a,s;if(TF=NF=-(FF=OF=1/0),jF=[],Aw(e,fO),n=jF.length){for(jF.sort(xO),t=1,o=[i=jF[0]];tbO(i[0],i[1])&&(i[1]=r[1]),bO(r[0],i[1])>bO(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(a=-1/0,t=0,i=o[n=o.length-1];t<=n;i=r,++t)r=o[t],(s=bO(i[1],r[0]))>a&&(a=s,FF=r[0],NF=i[1])}return jF=IF=null,FF===1/0||OF===1/0?[[NaN,NaN],[NaN,NaN]]:[[FF,OF],[NF,TF]]})),fN=lN("centroid",(function(e){XF=JF=QF=ZF=KF=eO=tO=nO=0,iO=new $w,rO=new $w,oO=new $w,Aw(e,wO);var t=+iO,n=+rO,i=+oO,r=Iw(t,n,i);return rgN(e,t)}const vN={};function bN(e){return Fe(e)||ArrayBuffer.isView(e)?e:null}function xN(e){return bN(e)||(St(e)?e:null)}const _N=e=>e.data;function wN(e,t){const n=VO.call(t,e);return n.root&&n.root.lookup||{}}const kN=()=>"undefined"!=typeof window&&window||null;function EN(e,t,n){if(!e)return[];const[i,r]=e,o=(new qg).set(i[0],i[1],r[0],r[1]);return Ax(n||this.context.dataflow.scenegraph().root,o,function(e){let t=null;if(e){const n=nt(e.marktype),i=nt(e.markname);t=e=>(!n.length||n.some((t=>e.marktype===t)))&&(!i.length||i.some((t=>e.name===t)))}return t}(t))}const AN={random:()=>Us(),cumulativeNormal:Ks,cumulativeLogNormal:ol,cumulativeUniform:fl,densityNormal:Zs,densityLogNormal:rl,densityUniform:cl,quantileNormal:el,quantileLogNormal:al,quantileUniform:dl,sampleNormal:Qs,sampleLogNormal:il,sampleUniform:ul,isArray:Fe,isBoolean:kt,isDate:Et,isDefined:e=>void 0!==e,isNumber:$t,isObject:Oe,isRegExp:Dt,isString:St,isTuple:Ha,isValid:e=>null!=e&&e==e,toBoolean:Lt,toDate:e=>jt(e),toNumber:Le,toString:It,indexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;ipt(e),inScope:function(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:EN,clampRange:it,pinchDistance:function(e){const t=e.touches,n=t[0].clientX-t[1].clientX,i=t[0].clientY-t[1].clientY;return Math.hypot(n,i)},pinchAngle:function(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){const e=kN();return e?e.screen:{}},containerSize:function(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){const e=kN();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return Dp(e||0,t||0,n||0)},setdata:function(e,t){const n=this.context.dataflow,i=this.context.data[e].input;return n.pulse(i,n.changeset().remove(we).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?dg(n,t=t||tg(e)):e}},panLinear:He,panLog:Ge,panPow:Ve,panSymlog:Ye,zoomLinear:Je,zoomLog:Qe,zoomPow:Ze,zoomSymlog:Ke,encode:function(e,t,n){if(e){const n=this.context.dataflow,i=e.mark.source;n.pulse(i,n.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,i,r,o){const a=this.context.dataflow,s=this.context.data[e],l=s.input,u=a.stamp();let c,f,d=s.changes;if(!1===a._trigger||!(l.value.length||t||i))return 0;if((!d||d.stamp{s.modified=!0,a.pulse(l,d).run()}),!0,1)),n&&(c=!0===n?we:Fe(n)||Ha(n)?n:yN(n),d.remove(c)),t&&d.insert(t),i&&(c=yN(i),l.value.some(c)?d.remove(c):d.insert(i)),r)for(f in o)d.modify(r,f,o[f]);return 1},lassoAppend:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const r=(e=nt(e))[e.length-1];return void 0===r||Math.hypot(r[0]-t,r[1]-n)>i?[...e,[t,n]]:e},lassoPath:function(e){return nt(e).reduce(((t,n,i)=>{let[r,o]=n;return t+(0==i?`M ${r},${o} `:i===e.length-1?" Z":`L ${r},${o} `)}),"")},intersectLasso:function(e,t,n){const{x:i,y:r,mark:o}=n,a=(new qg).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[e,n]of t)ea.x2&&(a.x2=e),na.y2&&(a.y2=n);return a.translate(i,r),EN([[a.x1,a.y1],[a.x2,a.y2]],e,o).filter((e=>function(e,t,n){let i=0;for(let r=0,o=n.length-1;rt!=s>t&&e<(a-l)*(t-u)/(s-u)+l&&i++}return 1&i}(e.x,e.y,t)))}},$N=["view","item","group","xy","x","y"],DN="this.",SN={},MN={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${Pt(iN+e)}]`,functions:function(e){const t=EF(e);$N.forEach((e=>t[e]="event.vega."+e));for(const e in AN)t[e]=DN+e;return ht(t,function(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=oN,n._range=oN,n._scale=oN;const i=t=>"_["+(t.type===YM?Pt(nN+t.value):Pt(nN)+"+"+e(t))+"]";return{_bandwidth:e=>`this.__bandwidth(${i(e[0])})`,_range:e=>`${i(e[0])}.range()`,_scale:t=>`${i(t[0])}(${e(t[1])})`}}(e,AN,SN)),t},constants:kF,visitors:SN},CN=AF(MN);function FN(e,t,n){return 1===arguments.length?AN[e]:(AN[e]=t,n&&(SN[e]=n),CN&&(CN.functions[e]=DN+e),this)}function ON(e,t){const n={};let i;try{i=wF(e=St(e)?e:Pt(e)+"")}catch(t){me("Expression parse error: "+e)}i.visit((e=>{if(e.type!==XM)return;const i=e.callee.name,r=MN.visitors[i];r&&r(i,e.arguments,t,n)}));const r=CN(i);return r.globals.forEach((e=>{const i=iN+e;!yt(n,i)&&t.getSignal(e)&&(n[i]=t.signalRef(e))})),{$expr:ht({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}FN("bandwidth",(function(e,t){const n=sN(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),oN),FN("copy",(function(e,t){const n=sN(e,(t||this).context);return n?n.copy():void 0}),oN),FN("domain",(function(e,t){const n=sN(e,(t||this).context);return n?n.domain():[]}),oN),FN("range",(function(e,t){const n=sN(e,(t||this).context);return n&&n.range?n.range():[]}),oN),FN("invert",(function(e,t,n){const i=sN(e,(n||this).context);return i?Fe(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}),oN),FN("scale",(function(e,t,n){const i=sN(e,(n||this).context);return i?i(t):void 0}),oN),FN("gradient",(function(e,t,n,i,r){e=sN(e,(r||this).context);const o=Vm(t,n);let a=e.domain(),s=a[0],l=Pe(a),u=be;return l-s?u=mm(e,s,l):e=(e.interpolator?nm("sequential")().interpolator(e.interpolator()):nm("linear")().interpolate(e.interpolate()).range(e.range())).domain([s=0,l=1]),e.ticks&&(a=e.ticks(+i||15),s!==a[0]&&a.unshift(s),l!==Pe(a)&&a.push(l)),a.forEach((t=>o.stop(u(t),e(t)))),o}),oN),FN("geoArea",uN,oN),FN("geoBounds",cN,oN),FN("geoCentroid",fN,oN),FN("geoShape",(function(e,t,n){const i=sN(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}}),oN),FN("geoScale",(function(e,t){const n=sN(e,(t||this).context);return n&&n.scale()}),oN),FN("indata",(function(e,t,n){const i=this.context.data[e]["index:"+t],r=i?i.value.get(n):void 0;return r?r.count:r}),(function(e,t,n,i){t[0].type!==YM&&me("First argument to indata must be a string literal."),t[1].type!==YM&&me("Second argument to indata must be a string literal.");const r=t[0].value,o=t[1].value,a="@"+o;yt(a,i)||(i[a]=n.getData(r).indataRef(n,o))})),FN("data",VO,rN),FN("treePath",(function(e,t,n){const i=wN(e,this),r=i[t],o=i[n];return r&&o?r.path(o).map(_N):void 0}),rN),FN("treeAncestors",(function(e,t){const n=wN(e,this)[t];return n?n.ancestors().map(_N):void 0}),rN),FN("vlSelectionTest",(function(e,t,n){for(var i,r,o,a,s,l=this.context.data[e],u=l?l.values.value:[],c=l?l[jO]&&l[jO].value:void 0,f=n===RO,d=u.length,h=0;h(e[o[n].field]=t,e)),{}))}else l=LO,u=BO(r),(f=(c=v[l]||(v[l]={}))[s]||(c[s]=[])).push(u),n&&(f=b[s]||(b[s]=[])).push({[LO]:u});return t=t||PO,v[LO]?v[LO]=HO[`${LO}_${t}`](...Object.values(v[LO])):Object.keys(v).forEach((e=>{v[e]=Object.keys(v[e]).map((t=>v[e][t])).reduce(((n,i)=>void 0===n?i:HO[`${x[e]}_${t}`](n,i)))})),y=Object.keys(b),n&&y.length&&(v[i?"vlPoint":"vlMulti"]=t===PO?{or:y.reduce(((e,t)=>(e.push(...b[t]),e)),[])}:{and:y.map((e=>({or:b[e]})))}),v}),GO),FN("vlSelectionTuples",(function(e,t){return e.map((e=>ht(t.fields?{values:t.fields.map((t=>zO(t)(e.datum)))}:{[LO]:BO(e.datum)},t)))}));const NN=Ut(["rule"]),TN=Ut(["group","image","rect"]);function zN(e){return(e+"").toLowerCase()}function RN(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var PN={operator:(e,t)=>RN(e,["_"],t.code),parameter:(e,t)=>RN(e,["datum","_"],t.code),event:(e,t)=>RN(e,["event"],t.code),handler:(e,t)=>RN(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{const{marktype:n,channels:i}=t;let r="var o=item,datum=o.datum,m=0,$;";for(const e in i){const t="o["+Pt(e)+"]";r+=`$=${i[e].code};if(${t}!==$)${t}=$,m=1;`}return r+=function(e,t){let n="";return NN[t]||(e.x2&&(e.x?(TN[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(TN[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(i,n),r+="return m;",RN(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(Pt).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const i=Function("a","b","var u, v; return "+e.map(((e,i)=>{const r=t[i];let o,a;return e.path?(o=`a${e.path}`,a=`b${e.path}`):((n=n||{})["f"+i]=e,o=`this.f${i}(a)`,a=`this.f${i}(b)`),function(e,t,n,i){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${i}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${i} : `}(o,a,-r,r)})).join("")+"0;");return n?i.bind(n):i}}};function LN(e,t,n){if(!e||!Oe(e))return e;for(let i,r=0,o=BN.length;re&&e.$tupleid?Ga:e));return t.fn[n]||(t.fn[n]=at(i,e.$order,t.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const n=e.$subflow;return function(e,i,r){const o=t.fork().parse(n),a=o.get(n.operators[0].id),s=o.signals.parent;return s&&s.set(r),a.detachSubflow=()=>t.detach(o),a}}},{key:"$tupleid",parse:function(){return Ga}}];const jN={skip:!0};function IN(e,t,n,i){return new UN(e,t,n,i)}function UN(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||PN,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function qN(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}function WN(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}UN.prototype=qN.prototype={fork(){const e=new qN(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter((t=>t!==e));const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,i=n.dataflow,r=e.value;if(n.set(e.id,t),"collect"===zN(e.type)&&r&&(r.$ingest?i.ingest(t,r.$ingest,r.$format):r.$request?i.preload(t,r.$request,r.$format):i.pulse(t,i.changeset().insert(r))),e.root&&(n.root=t),e.parent){let r=n.get(e.parent.$ref);r?(i.connect(r,[t]),t.targets().add(r)):(n.unresolved=n.unresolved||[]).push((()=>{r=n.get(e.parent.$ref),i.connect(r,[t]),t.targets().add(r)}))}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const i in e.data){const r=n.data[i]||(n.data[i]={});e.data[i].forEach((e=>r[e]=t))}},resolve(){return(this.unresolved||[]).forEach((e=>e())),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[zN(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,i,r){this.dataflow.on(t,n,i,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach((e=>t.parseOperator(e))),n.forEach((e=>t.parseOperatorParameters(e))),(e.streams||[]).forEach((e=>t.parseStream(e))),(e.updates||[]).forEach((e=>t.parseUpdate(e))),t.resolve()},parseOperator:function(e){const t=this;"operator"!==zN(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const t=this;if(e.params){const n=t.get(e.id);n||me("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,t){t=t||{};const n=this;for(const i in e){const r=e[i];t[i]=Fe(r)?r.map((e=>LN(e,n,t))):LN(r,n,t)}return t},parseStream:function(e){var t,n=this,i=null!=e.filter?n.eventExpression(e.filter):void 0,r=null!=e.stream?n.get(e.stream):void 0;e.source?r=n.events(e.source,e.type,i):e.merge&&(r=(t=e.merge.map((e=>n.get(e))))[0].merge.apply(t[0],t.slice(1))),e.between&&(t=e.between.map((e=>n.get(e))),r=r.between(t[0],t[1])),e.filter&&(r=r.filter(i)),null!=e.throttle&&(r=r.throttle(+e.throttle)),null!=e.debounce&&(r=r.debounce(+e.debounce)),null==r&&me("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,i=Oe(i=e.source)?i.$ref:i,r=n.get(i),o=e.update,a=void 0;r||me("Source not defined: "+e.source),t=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(e,r,t,o,a)},getState:function(e){var t=this,n={};if(e.signals){var i=n.signals={};Object.keys(t.signals).forEach((n=>{const r=t.signals[n];e.signals(n,r)&&(i[n]=r.value)}))}if(e.data){var r=n.data={};Object.keys(t.data).forEach((n=>{const i=t.data[n];e.data(n,i)&&(r[n]=i.input.value)}))}return t.subcontext&&!1!==e.recurse&&(n.subcontext=t.subcontext.map((t=>t.getState(e)))),n},setState:function(e){var t=this,n=t.dataflow,i=e.data,r=e.signals;Object.keys(r||{}).forEach((e=>{n.update(t.signals[e],r[e],jN)})),Object.keys(i||{}).forEach((e=>{n.pulse(t.data[e].input,n.changeset().remove(we).insert(i[e]))})),(e.subcontext||[]).forEach(((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)}))}};const HN="default";function GN(e,t){const n=e.globalCursor()?"undefined"!=typeof document&&document.body:e.container();if(n)return null==t?n.style.removeProperty("cursor"):n.style.cursor=t}function VN(e,t){var n=e._runtime.data;return yt(n,t)||me("Unrecognized data set: "+t),n[t]}function YN(e,t){Ka(t)||me("Second argument to changes must be a changeset.");const n=VN(this,e);return n.modified=!0,this.pulse(n.input,t)}function XN(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function JN(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function QN(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}const ZN="view",KN={trap:!1};function eT(e,t,n,i){e._eventListeners.push({type:n,sources:nt(t),handler:i})}function tT(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||Oe(i)&&!i[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function nT(e){return e.item}function iT(e){return e.item.mark.source}function rT(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function oT(e,t,n){const i=document.createElement(e);for(const e in t)i.setAttribute(e,t[e]);return null!=n&&(i.textContent=n),i}const aT="vega-bind-radio";function sT(e,t,n,i){const r=n.event||"input",o=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,o),eT(i,t,r,o),e.set=e=>{t.value=e,t.dispatchEvent(function(e){return"undefined"!=typeof Event?new Event(e):{type:e}}(r))}}function lT(e,t,n,i){const r=i.signal(n.signal),o=oT("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(oT("label"));a.appendChild(oT("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(o);let s=uT;switch(n.input){case"checkbox":s=cT;break;case"select":s=fT;break;case"radio":s=dT;break;case"range":s=hT}s(e,a,n,r)}function uT(e,t,n,i){const r=oT("input");for(const e in n)"signal"!==e&&"element"!==e&&r.setAttribute("input"===e?"type":e,n[e]);r.setAttribute("name",n.signal),r.value=i,t.appendChild(r),r.addEventListener("input",(()=>e.update(r.value))),e.elements=[r],e.set=e=>r.value=e}function cT(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const o=oT("input",r);t.appendChild(o),o.addEventListener("change",(()=>e.update(o.checked))),e.elements=[o],e.set=e=>o.checked=!!e||null}function fT(e,t,n,i){const r=oT("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((e,t)=>{const n={value:e};pT(e,i)&&(n.selected=!0),r.appendChild(oT("option",n,(o[t]||e)+""))})),t.appendChild(r),r.addEventListener("change",(()=>{e.update(n.options[r.selectedIndex])})),e.elements=[r],e.set=e=>{for(let t=0,i=n.options.length;t{const s={type:"radio",name:n.signal,value:t};pT(t,i)&&(s.checked=!0);const l=oT("input",s);l.addEventListener("change",(()=>e.update(t)));const u=oT("label",{},(o[a]||t)+"");return u.prepend(l),r.appendChild(u),l})),e.set=t=>{const n=e.elements,i=n.length;for(let e=0;e{l.textContent=s.value,e.update(+s.value)};s.addEventListener("input",u),s.addEventListener("change",u),e.elements=[s],e.set=e=>{s.value=e,l.textContent=e}}function pT(e,t){return e===t||e+""==t+""}function mT(e,t,n,i,r,o){return(t=t||new i(e.loader())).initialize(n,XN(e),JN(e),QN(e),r,o).background(e.background())}function gT(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function yT(e,t,n){if("string"==typeof t){if("undefined"==typeof document)return e.error("DOM document instance not found."),null;if(!(t=document.querySelector(t)))return e.error("Signal bind element not found: "+t),null}if(t&&n)try{t.textContent=""}catch(n){t=null,e.error(n)}return t}const vT=e=>+e||0;function bT(e){return Oe(e)?{top:vT(e.top),bottom:vT(e.bottom),left:vT(e.left),right:vT(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(vT(e))}async function xT(e,t,n,i){const r=Ex(t),o=r&&r.headless;return o||me("Unrecognized renderer type: "+t),await e.runAsync(),mT(e,null,null,o,n,i).renderAsync(e._scenegraph.root)}var _T="width",wT="height",kT="padding",ET={skip:!0};function AT(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===kT?i.left+i.right:0)}function $T(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===kT?i.top+i.bottom:0)}function DT(e,t){return t.modified&&Fe(t.input.value)&&e.indexOf("_:vega:_")}function ST(e,t){return!("parent"===e||t instanceof As.proxy)}function MT(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":Fe(e)?CT(e):Oe(e)&&!Et(e)?(t=e,Object.keys(t).map((e=>{const n=t[e];return e+": "+(Fe(n)?CT(n):FT(n))})).join("\n")):e+"";var t}(i))}function CT(e){return"["+e.map(FT).join(", ")+"]"}function FT(e){return Fe(e)?"[…]":Oe(e)&&!Et(e)?"{…}":e}function OT(e,t){const n=this;if(t=t||{},ws.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),null!=t.logLevel&&n.logLevel(t.logLevel),t.locale||e.locale){const i=ht({},e.locale,t.locale);n.locale(fa(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||wx.Canvas,n._scenegraph=new Yv;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||MT,n._redraw=!0,n._handler=(new xb).scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=ht({defaults:{}},e),n=(e,t)=>{t.forEach((t=>{Fe(e[t])&&(e[t]=Ut(e[t]))}))};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const r=function(e,t,n){return IN(e,As,AN,n).parse(t)}(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((e=>({state:null,param:ht({},e)}))),r.root&&r.root.set(i),i.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(i.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=AT(n,n._width),n._viewHeight=$T(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[_T],i=t[wT],r=t[kT];function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(t=>{e._width=t.size,e._viewWidth=AT(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(t=>{e._height=t.size,e._viewHeight=$T(e,t.size),o()}),{size:i});const a=e.add(null,o,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,a.rank=r.rank+1}(n),function(e){e.add(null,(t=>(e._background=t.bg,e._resize=1,t.bg)),{bg:e._signals.background})}(n),function(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:HN,item:null}));e.on(e.events("view","mousemove"),t,((e,n)=>{const i=t.value,r=i?St(i)?i:i.user:HN,o=n.item&&n.item.cursor||null;return i&&r===i.user&&o==i.item?i:{user:r,item:o}})),e.add(null,(function(t){let n=t.cursor,i=this.value;return St(n)||(i=n.item,n=n.user),GN(e,n&&n!==HN?n:i||n),i}),{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind)}function NT(e,t){return yt(e._signals,t)?e._signals[t]:me("Unrecognized signal name: "+Pt(t))}function TT(e,t){const n=(e._targets||[]).filter((e=>e._update&&e._update.handler===t));return n.length?n[0]:null}function zT(e,t,n,i){let r=TT(n,i);return r||(r=gT(e,(()=>i(t,n.value))),r.handler=i,e.on(n,null,r)),e}function RT(e,t,n){const i=TT(t,n);return i&&t._targets.remove(i),e}_t(OT,ws,{async evaluate(e,t,n){if(await ws.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,r=QN(i=this),o=XN(i),a=JN(i),i._renderer.background(i.background()),i._renderer.resize(o,a,r),i._handler.origin(r),i._resizeListeners.forEach((e=>{try{e(o,a)}catch(e){i.error(e)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}var i,r,o,a;return n&&Ua(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=null!=e?e+"":null;return t!==this._desc&&WN(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const i=NT(this,e);return 1===arguments.length?i.value:this.update(i,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",bT(e)):bT(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(Ex(e)||me("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(ws.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(NT(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,n,i,r,o){this.runAfter((a=>{let s=0;a._autosize=0,a.width()!==n&&(s=1,a.signal(_T,n,ET),a._resizeWidth.skip(!0)),a.height()!==i&&(s=1,a.signal(wT,i,ET),a._resizeHeight.skip(!0)),a._viewWidth!==e&&(a._resize=1,a._viewWidth=e),a._viewHeight!==t&&(a._resize=1,a._viewHeight=t),a._origin[0]===r[0]&&a._origin[1]===r[1]||(a._resize=1,a._origin=r),s&&a.run("enter"),o&&a.runAfter((e=>e.resize()))}),!1,1)},addEventListener(e,t,n){let i=t;return n&&!1===n.trap||(i=gT(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n,i,r=this._handler.handlers(e),o=r.length;--o>=0;)if(i=r[o].type,n=r[o].handler,e===i&&(t===n||t===n.raw)){this._handler.off(i,n);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.indexOf(e)<0&&t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return zT(this,e,NT(this,e),t)},removeSignalListener(e,t){return RT(this,NT(this,e),t)},addDataListener(e,t){return zT(this,e,VN(this,e).values,t)},removeDataListener(e,t){return RT(this,VN(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=GN(this,null);this._globalCursor=!!e,t&&GN(this,t)}return this}return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:function(e,t){this._timers.push(function(e,t,n){var i=new j$,r=t;return null==t?(i.restart(e,t,n),i):(i._restart=i.restart,i.restart=function(e,t,n){t=+t,n=null==n?L$():+n,i._restart((function o(a){a+=r,i._restart(o,r+=t,n),e(a)}),t,n)},i.restart(e,t,n),i)}((function(t){e({timestamp:Date.now(),elapsed:t})}),t))},events:function(e,t,n){var i,r=this,o=new ls(n),a=function(n,i){r.runAsync(null,(()=>{e===ZN&&function(e,t){var n=e._eventConfig.defaults,i=n.prevent,r=n.allow;return!1!==i&&!0!==r&&(!0===i||!1===r||(i?i[t]:r?!r[t]:e.preventDefault()))}(r,t)&&n.preventDefault(),o.receive(function(e,t,n){var i,r,o=e._renderer,a=o&&o.canvas();return a&&(r=QN(e),(i=tb(t.changedTouches?t.changedTouches[0]:t,a))[0]-=r[0],i[1]-=r[1]),t.dataflow=e,t.item=n,t.vega=function(e,t,n){const i=t?"group"===t.mark.marktype?t:t.mark.group:null;function r(e){var n,r=i;if(e)for(n=t;n;n=n.mark.group)if(n.mark.name===e){r=n;break}return r&&r.mark&&r.mark.interactive?r:{}}function o(e){if(!e)return n;St(e)&&(e=r(e));const t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:ft(e),item:ft(t||{}),group:r,xy:o,x:e=>o(e)[0],y:e=>o(e)[1]}}(e,n,i),t}(r,n,i))}))};if("timer"===e)tT(r,"timer",t)&&r.timer(a,t);else if(e===ZN)tT(r,"view",t)&&r.addEventListener(t,a,KN);else if("window"===e?tT(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&tT(r,"selector",t)&&(i=Array.from(document.querySelectorAll(e))),i){for(var s=0,l=i.length;s=0;)r[e].stop();for(e=o.length;--e>=0;)for(t=(n=o[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);return i&&i.call(this,this._handler,null,null,null),this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",nT),iT,rT(e)),this.on(this.events("view","mouseout",nT),iT,rT(t)),this},data:function(e,t){return arguments.length<2?VN(this,e).values.value:YN.call(this,e,es().remove(we).insert(t))},change:YN,insert:function(e,t){return YN.call(this,e,es().insert(t))},remove:function(e,t){return YN.call(this,e,es().remove(t))},scale:function(e){var t=this._runtime.scales;return yt(t,e)||me("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,o=Ex(i);e=n._el=e?yT(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),WN(t,e.description()))}(n),o||n.error("Unrecognized renderer type: "+i);const a=o.handler||xb,s=e?o.renderer:o.headless;return n._renderer=s?mT(n,n._renderer,e,s):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),gT(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,QN(e),e);return t&&t.handlers().forEach((e=>{r.on(e.type,e.handler)})),r}(n,n._handler,e,a),n._redraw=!0,e&&"none"!==r&&(t=t?n._elBind=yT(n,t,!0):e.appendChild(oT("form",{class:"vega-bindings"})),n._bind.forEach((e=>{e.param.element&&"container"!==r&&(e.element=yT(n,e.param.element,!!e.param.input))})),n._bind.forEach((e=>{!function(e,t,n){if(!t)return;const i=n.param;let r=n.state;r||(r=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(i.signal)&&e.runAsync(null,(()=>{r.source=!0,e.signal(i.signal,t)}))}},i.debounce&&(r.update=dt(i.debounce,r.update))),(null==i.input&&i.element?sT:lT)(r,t,i,e),r.active||(e.on(e._signals[i.signal],null,(()=>{r.source?r.source=!1:r.set(e.signal(i.signal))})),r.active=!0)}(n,e.element||t,e)}))),n},toImageURL:async function(e,t){e!==wx.Canvas&&e!==wx.SVG&&e!==wx.PNG&&me("Unrecognized image type: "+e);const n=await xT(this,e,t);return e===wx.SVG?function(e,t){const n=new Blob([e],{type:"image/svg+xml"});return window.URL.createObjectURL(n)}(n.svg()):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await xT(this,wx.Canvas,e,t)).canvas()},toSVG:async function(e){return(await xT(this,wx.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:DT,signals:ST,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(e=>{e._trigger=!0})),this}});const PT="view",LT="[",BT="]",jT="{",IT="}",UT=":",qT=",",WT="@",HT=">",GT=/[[\]{}]/,VT={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let YT,XT;function JT(e,t,n){return YT=t||PT,XT=n||VT,ZT(e.trim()).map(KT)}function QT(e,t,n,i,r){const o=e.length;let a,s=0;for(;t=0?--s:i&&i.indexOf(a)>=0&&++s}return t}function ZT(e){const t=[],n=e.length;let i=0,r=0;for(;r' after between selector: "+e;n=n.map(KT);const r=KT(e.slice(1).trim());return r.between?{between:n,stream:r}:(r.between=n,r)}(e):function(e){const t={source:YT},n=[];let i,r,o=[0,0],a=0,s=0,l=e.length,u=0;if(e[l-1]===IT){if(u=e.lastIndexOf(jT),!(u>=0))throw"Unmatched right brace: "+e;try{o=function(e){const t=e.split(qT);if(!e.length||t.length>2)throw e;return t.map((t=>{const n=+t;if(n!=n)throw e;return n}))}(e.substring(u+1,l-1))}catch(t){throw"Invalid throttle specification: "+e}l=(e=e.slice(0,u).trim()).length,u=0}if(!l)throw e;if(e[0]===WT&&(a=++u),i=QT(e,u,UT),i1?(t.type=n[1],a?t.markname=n[0].slice(1):(c=n[0],XT[c]?t.marktype=n[0]:t.source=n[0])):t.type=n[0],"!"===t.type.slice(-1)&&(t.consume=!0,t.type=t.type.slice(0,-1)),null!=r&&(t.filter=r),o[0]&&(t.throttle=o[0]),o[1]&&(t.debounce=o[1]),t}(e)}function ez(e){return Oe(e)?e:{type:e||"pad"}}const tz=e=>+e||0,nz=e=>({top:e,bottom:e,left:e,right:e});function iz(e){return Oe(e)?e.signal?e:{top:tz(e.top),bottom:tz(e.bottom),left:tz(e.left),right:tz(e.right)}:nz(tz(e))}const rz=e=>Oe(e)&&!Fe(e)?ht({},e):{value:e};function oz(e,t,n,i){return null!=n?(Oe(n)&&!Fe(n)||Fe(n)&&n.length&&Oe(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1):0}function az(e,t,n){for(const n in t)oz(e,n,t[n]);for(const t in n)oz(e,t,n[t],"update")}function sz(e,t,n){for(const i in t)n&&yt(n,i)||(e[i]=ht(e[i]||{},t[i]));return e}function lz(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const uz="mark",cz="frame",fz="scope",dz="axis",hz="axis-domain",pz="axis-grid",mz="axis-label",gz="axis-tick",yz="axis-title",vz="legend",bz="legend-band",xz="legend-entry",_z="legend-gradient",wz="legend-label",kz="legend-symbol",Ez="legend-title",Az="title",$z="title-text",Dz="title-subtitle";function Sz(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const Mz=e=>St(e)?Pt(e):e.signal?`(${e.signal})`:Nz(e);function Cz(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map((e=>null==e?null:Pt(e)));for(;t.length&&null==Pe(t);)t.pop();return t.unshift(Mz(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?Fz("hcl",e.h,e.c,e.l):e.h||e.s?Fz("hsl",e.h,e.s,e.l):e.l||e.a?Fz("lab",e.l,e.a,e.b):e.r||e.g||e.b?Fz("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?Nz(e.field):void 0!==e.value?Pt(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=Mz(e.scale);return 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?"":"*"+Oz(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0")),t}(e,t)),void 0===t&&(t=null),null!=e.exponent&&(t=`pow(${t},${Oz(e.exponent)})`),null!=e.mult&&(t+=`*${Oz(e.mult)}`),null!=e.offset&&(t+=`+${Oz(e.offset)}`),e.round&&(t=`round(${t})`),t}const Fz=(e,t,n,i)=>`(${e}(${[t,n,i].map(Cz).join(",")})+'')`;function Oz(e){return Oe(e)?"("+Cz(e)+")":e}function Nz(e){return Tz(Oe(e)?e:{datum:e})}function Tz(e){let t,n,i;if(e.signal)t="datum",i=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(i=e.parent,t+=".datum"):i=e.group}else e.datum?(t="datum",i=e.datum):me("Invalid field reference: "+Pt(e));return e.signal||(i=St(i)?ge(i).map(Pt).join("]["):Tz(i)),t+"["+i+"]"}function zz(e,t,n,i,r,o){const a={};(o=o||{}).encoders={$encode:a},e=function(e,t,n,i,r){const o={},a={};let s,l,u,c;for(l in l="lineBreak","text"!==t||null==r[l]||lz(l,e)||Sz(o,l,r[l]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===cz?r.group:n===uz?ht({},r.mark,r[t]):null,c)u=lz(l,e)||("fill"===l||"stroke"===l)&&(lz("fill",e)||lz("stroke",e)),u||Sz(o,l,c[l]);for(l in nt(i).forEach((t=>{const n=r.style&&r.style[t];for(const t in n)lz(t,e)||Sz(o,t,n[t])})),e=ht({},e),o)c=o[l],c.signal?(s=s||{})[l]=c:a[l]=c;return e.enter=ht(a,e.enter),s&&(e.update=ht(s,e.update)),e}(e,t,n,i,r.config);for(const n in e)a[n]=Rz(e[n],t,o,r);return o}function Rz(e,t,n,i){const r={},o={};for(const t in e)null!=e[t]&&(r[t]=Pz((a=e[t],Fe(a)?function(e){let t="";return e.forEach((e=>{const n=Cz(e);t+=e.test?`(${e.test})?${n}:`:n})),":"===Pe(t)&&(t+="null"),t}(a):Cz(a)),i,n,o));var a;return{$expr:{marktype:t,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function Pz(e,t,n,i){const r=ON(e,t);return r.$fields.forEach((e=>i[e]=1)),ht(n,r.$params),r.$expr}const Lz="outer",Bz=["value","update","init","react","bind"];function jz(e,t){me(e+' for "outer" push: '+Pt(t))}function Iz(e,t){const n=e.name;if(e.push===Lz)t.signals[n]||jz("No prior signal definition",n),Bz.forEach((t=>{void 0!==e[t]&&jz("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 Uz(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function qz(e,t,n,i){return new Uz(e,t,n,i)}function Wz(e,t){return qz("operator",e,t)}function Hz(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Gz(e,t){return t?{$field:e,$name:t}:{$field:e}}const Vz=Gz("key");function Yz(e,t){return{$compare:e,$order:t}}function Xz(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const Jz="scope",Qz="view";function Zz(e){return e&&e.signal}function Kz(e){if(Zz(e))return!0;if(Oe(e))for(const t in e)if(Kz(e[t]))return!0;return!1}function eR(e,t){return null!=e?e:t}function tR(e){return e&&e.signal||e}const nR="timer";function iR(e,t){return(e.merge?rR:e.stream?oR:e.type?aR:me("Invalid stream specification: "+Pt(e)))(e,t)}function rR(e,t){const n=sR({merge:e.merge.map((e=>iR(e,t)))},e,t);return t.addStream(n).id}function oR(e,t){const n=sR({stream:iR(e.stream,t)},e,t);return t.addStream(n).id}function aR(e,t){let n;var i;e.type===nR?(n=t.event(nR,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===Jz?Qz:i||Qz,e.type);const r=sR({stream:n},e,t);return 1===Object.keys(r).length?n:t.addStream(r).id}function sR(e,t,n){let i=t.between;return i&&(2!==i.length&&me('Stream "between" parameter must have 2 entries: '+Pt(t)),e.between=[iR(i[0],n),iR(i[1],n)]),i=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&i.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+"'":"")}(t.marktype,t.markname,t.markrole)),t.source===Jz&&i.push("inScope(event.item)"),i.length&&(e.filter=ON("("+i.join(")&&(")+")",n).$expr),null!=(i=t.throttle)&&(e.throttle=+i),null!=(i=t.debounce)&&(e.debounce=+i),t.consume&&(e.consume=!0),e}const lR={code:"_.$value",ast:{type:"Identifier",value:"value"}};function uR(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}const cR=e=>(t,n,i)=>qz(e,n,t||void 0,i),fR=cR("aggregate"),dR=cR("axisticks"),hR=cR("bound"),pR=cR("collect"),mR=cR("compare"),gR=cR("datajoin"),yR=cR("encode"),vR=cR("expression"),bR=cR("facet"),xR=cR("field"),_R=cR("key"),wR=cR("legendentries"),kR=cR("load"),ER=cR("mark"),AR=cR("multiextent"),$R=cR("multivalues"),DR=cR("overlap"),SR=cR("params"),MR=cR("prefacet"),CR=cR("projection"),FR=cR("proxy"),OR=cR("relay"),NR=cR("render"),TR=cR("scale"),zR=cR("sieve"),RR=cR("sortitems"),PR=cR("viewlayout"),LR=cR("values");let BR=0;const jR={min:"min",max:"max",count:"sum"};function IR(e,t){const n=t.getScale(e.name).params;let i;for(i in n.domain=HR(e.domain,e,t),null!=e.range&&(n.range=KR(e,t,n)),null!=e.interpolate&&function(e,t){t.interpolate=UR(e.type||e),null!=e.gamma&&(t.interpolateGamma=UR(e.gamma))}(e.interpolate,n),null!=e.nice&&(n.nice=function(e){return Oe(e)?{interval:UR(e.interval),step:UR(e.step)}:UR(e)}(e.nice)),null!=e.bins&&(n.bins=function(e,t){return e.signal||Fe(e)?qR(e,t):t.objectProperty(e)}(e.bins,t)),e)yt(n,i)||"name"===i||(n[i]=UR(e[i],t))}function UR(e,t){return Oe(e)?e.signal?t.signalRef(e.signal):me("Unsupported object: "+Pt(e)):e}function qR(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>UR(e,t)))}function WR(e){me("Can not find data set: "+Pt(e))}function HR(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(Fe(e)?GR:e.fields?YR:VR)(e,t,n);null==t.domainMin&&null==t.domainMax||me("No scale domain defined for domainMin/domainMax to override.")}function GR(e,t,n){return e.map((e=>UR(e,n)))}function VR(e,t,n){const i=n.getData(e.data);return i||WR(e.data),am(t.type)?i.valuesRef(n,e.field,JR(e.sort,!1)):cm(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function YR(e,t,n){const i=e.data,r=e.fields.reduce(((e,t)=>(t=St(t)?{data:i,field:t}:Fe(t)||t.signal?function(e,t){const n="_:vega:_"+BR++,i=pR({});if(Fe(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+Pt(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,zR({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e)),[]);return(am(t.type)?XR:cm(t.type)?QR:ZR)(e,n,r)}function XR(e,t,n){const i=JR(e.sort,!0);let r,o;const a=n.map((e=>{const n=t.getData(e.data);return n||WR(e.data),n.countsRef(t,e.field,i)})),s={groupby:Vz,pulse:a};i&&(r=i.op||"count",o=i.field?Xz(r,i.field):"count",s.ops=[jR[r]],s.fields=[t.fieldRef(o)],s.as=[o]),r=t.add(fR(s));const l=t.add(pR({pulse:Hz(r)}));return o=t.add(LR({field:Vz,sort:t.sortRef(i),pulse:Hz(l)})),Hz(o)}function JR(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!jR[e.op]&&me("Multiple domain scales can not be sorted using "+e.op):me("No field provided for sort aggregate op: "+e.op):Oe(e)?e.field="key":e={field:"key"}),e}function QR(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||WR(e.data),n.domainRef(t,e.field)}));return Hz(t.add($R({values:i})))}function ZR(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||WR(e.data),n.extentRef(t,e.field)}));return Hz(t.add(AR({extents:i})))}function KR(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(St(r)){if(i&&yt(i,r))return KR(e=ht({},e,{range:i[r]}),t,n);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=am(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:me("Unrecognized scale range value: "+Pt(r))}else{if(r.scheme)return n.scheme=Fe(r.scheme)?qR(r.scheme,t):UR(r.scheme,t),r.extent&&(n.schemeExtent=qR(r.extent,t)),void(r.count&&(n.schemeCount=UR(r.count,t)));if(r.step)return void(n.rangeStep=UR(r.step,t));if(am(e.type)&&!Fe(r))return HR(r,e,t);Fe(r)||me("Unsupported range type: "+Pt(r))}return r.map((e=>(Fe(e)?qR:UR)(e,t)))}function eP(e,t,n){return Fe(e)?e.map((e=>eP(e,t,n))):Oe(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:me("Unsupported parameter object: "+Pt(e)):e}const tP="top",nP="left",iP="right",rP="bottom",oP="center",aP="vertical",sP="start",lP="end",uP="index",cP="label",fP="offset",dP="perc",hP="perc2",pP="value",mP="guide-label",gP="guide-title",yP="group-title",vP="group-subtitle",bP="symbol",xP="gradient",_P="discrete",wP="size",kP=[wP,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],EP={name:1,style:1,interactive:1},AP={value:0},$P={value:1},DP="group",SP="rect",MP="rule",CP="symbol",FP="text";function OP(e){return e.type=DP,e.interactive=e.interactive||!1,e}function NP(e,t){const n=(n,i)=>eR(e[n],eR(t[n],i));return n.isVertical=n=>aP===eR(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>eR(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>eR(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>eR(e.columns,eR(t.columns,+n.isVertical(!0))),n}function TP(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 zP(e,t,n){return`item.anchor === '${sP}' ? ${e} : item.anchor === '${lP}' ? ${t} : ${n}`}const RP=zP(Pt(nP),Pt(iP),Pt(oP));function PP(e,t){return t?e?Oe(e)?Object.assign({},e,{offset:PP(e.offset,t)}):{value:e,offset:t}:t:e}function LP(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=sz(e.encode,t,EP)):e.interactive=!1,e}function BP(e,t,n,i){const r=NP(e,n),o=r.isVertical(),a=r.gradientThickness(),s=r.gradientLength();let l,u,c,f,d;o?(u=[0,1],c=[0,0],f=a,d=s):(u=[0,0],c=[1,0],f=s,d=a);const h={enter:l={opacity:AP,x:AP,y:AP,width:rz(f),height:rz(d)},update:ht({},l,{opacity:$P,fill:{gradient:t,start:u,stop:c}}),exit:{opacity:AP}};return az(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),LP({type:SP,role:_z,encode:h},i)}function jP(e,t,n,i,r){const o=NP(e,n),a=o.isVertical(),s=o.gradientThickness(),l=o.gradientLength();let u,c,f,d,h="";a?(u="y",f="y2",c="x",d="width",h="1-"):(u="x",f="x2",c="y",d="height");const p={opacity:AP,fill:{scale:t,field:pP}};p[u]={signal:h+"datum."+dP,mult:l},p[c]=AP,p[f]={signal:h+"datum."+hP,mult:l},p[d]=rz(s);const m={enter:p,update:ht({},p,{opacity:$P}),exit:{opacity:AP}};return az(m,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),LP({type:SP,role:bz,key:pP,from:r,encode:m},i)}const IP=`datum.${dP}<=0?"${nP}":datum.${dP}>=1?"${iP}":"${oP}"`,UP=`datum.${dP}<=0?"${rP}":datum.${dP}>=1?"${tP}":"middle"`;function qP(e,t,n,i){const r=NP(e,t),o=r.isVertical(),a=rz(r.gradientThickness()),s=r.gradientLength();let l,u,c,f,d=r("labelOverlap"),h="";const p={enter:l={opacity:AP},update:u={opacity:$P,text:{field:cP}},exit:{opacity:AP}};return az(p,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:eR(e.labelLimit,t.gradientLabelLimit)}),o?(l.align={value:"left"},l.baseline=u.baseline={signal:UP},c="y",f="x",h="1-"):(l.align=u.align={signal:IP},l.baseline={value:"top"},c="x",f="y"),l[c]=u[c]={signal:h+"datum."+dP,mult:s},l[f]=u[f]=a,a.offset=eR(e.labelOffset,t.gradientLabelOffset)||0,d=d?{separation:r("labelSeparation"),method:d,order:"datum."+uP}:void 0,LP({type:FP,role:wz,style:mP,key:pP,from:i,encode:p,overlap:d},n)}function WP(e,t,n,i,r){const o=NP(e,t),a=n.entries,s=!(!a||!a.interactive),l=a?a.name:void 0,u=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.${fP} : datum.${wP}`,h=u?rz(u):{field:wP},p=`datum.${uP}`,m=`max(1, ${r})`;let g,y,v,b,x;h.mult=.5,g={enter:y={opacity:AP,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:$P,x:y.x,y:y.y},exit:{opacity:AP}};let _=null,w=null;e.fill||(_=t.symbolBaseFillColor,w=t.symbolBaseStrokeColor),az(g,{fill:o("symbolFillColor",_),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",w),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),kP.forEach((t=>{e[t]&&(v[t]=y[t]={scale:e[t],field:pP})}));const k=LP({type:CP,role:kz,key:pP,from:f,clip:!!u||void 0,encode:g},n.symbols),E=rz(c);E.offset=o("labelOffset"),g={enter:y={opacity:AP,x:{signal:d,offset:E},y:h},update:v={opacity:$P,text:{field:cP},x:y.x,y:y.y},exit:{opacity:AP}},az(g,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const A=LP({type:FP,role:wz,style:mP,key:pP,from:f,encode:g},n.labels);return g={enter:{noBound:{value:!u},width:AP,height:u?rz(u):AP,opacity:AP},exit:{opacity:AP},update:v={opacity:$P,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(b=`ceil(item.mark.items.length / ${m})`,v.row.signal=`${p}%${b}`,v.column.signal=`floor(${p} / ${b})`,x={field:["row",p]}):(v.row.signal=`floor(${p} / ${m})`,v.column.signal=`${p} % ${m}`,x={field:p}),v.column.signal=`(${r})?${v.column.signal}:${p}`,OP({role:fz,from:i={facet:{data:i,name:"value",groupby:uP}},encode:sz(g,a,EP),marks:[k,A],name:l,interactive:s,sort:x})}const HP='item.orient === "left"',GP='item.orient === "right"',VP=`(${HP} || ${GP})`,YP=`datum.vgrad && ${VP}`,XP=zP('"top"','"bottom"','"middle"'),JP=`datum.vgrad && ${GP} ? (${zP('"right"','"left"','"center"')}) : (${VP} && !(datum.vgrad && ${HP})) ? "left" : ${RP}`,QP=`item._anchor || (${VP} ? "middle" : "start")`,ZP=`${YP} ? (${HP} ? -90 : 90) : 0`,KP=`${VP} ? (datum.vgrad ? (${GP} ? "bottom" : "top") : ${XP}) : "top"`;function eL(e,t){let n;return Oe(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+tL(e.path)+")":e.sphere&&(n="geoShape("+tL(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function tL(e){return Oe(e)&&e.signal?e.signal:Pt(e)}function nL(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===DP?fz:t||uz:t}function iL(e){return{marktype:e.type,name:e.name||void 0,role:e.role||nL(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function rL(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function oL(e,t){const n=$s(e.type);n||me("Unrecognized transform type: "+Pt(e.type));const i=qz(n.type.toLowerCase(),null,aL(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function aL(e,t,n){const i={},r=e.params.length;for(let o=0;ouL(e,t,n)))):uL(e,i,n)}(e,t,n):"projection"===i?n.projectionRef(t[e.name]):e.array&&!Zz(r)?r.map((t=>lL(e,t,n))):lL(e,r,n):void(e.required&&me("Missing required "+Pt(t.type)+" parameter: "+Pt(e.name)))}function lL(e,t,n){const i=e.type;if(Zz(t))return hL(i)?me("Expression references can not be signals."):pL(i)?n.fieldRef(t):mL(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||pL(i);return r&&cL(t)?n.exprRef(t.expr,t.as):r&&fL(t)?Gz(t.field,t.as):hL(i)?ON(t,n):dL(i)?Hz(n.getData(t).values):pL(i)?Gz(t):mL(i)?n.compareRef(t):t}}function uL(e,t,n){const i=e.params.length;let r;for(let n=0;ne&&e.expr,fL=e=>e&&e.field,dL=e=>"data"===e,hL=e=>"expr"===e,pL=e=>"field"===e,mL=e=>"compare"===e;function gL(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:Hz(t.getData(e.data).output)}function yL(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function vL(e){return St(e)?e:null}function bL(e,t,n){const i=Xz(n.op,n.field);let r;if(t.ops){for(let e=0,n=t.as.length;enull==e?"null":e)).join(",")+"),0)",t);l.update=u.$expr,l.params=u.$params}function wL(e,t){const n=nL(e),i=e.type===DP,r=e.from&&e.from.facet,o=e.overlap;let a,s,l,u,c,f,d,h=e.layout||n===fz||n===cz;const p=n===uz||h||r,m=function(e,t,n){let i,r,o,a,s;return e?(i=e.facet)&&(t||me("Only group marks can be faceted."),null!=i.field?a=s=gL(i,n):(e.data?s=Hz(n.getData(e.data).aggregate):(o=oL(ht({type:"aggregate",groupby:nt(i.groupby)},i.aggregate),n),o.params.key=n.keyRef(i.groupby),o.params.pulse=gL(i,n),a=s=Hz(n.add(o))),r=n.keyRef(i.groupby,!0))):a=Hz(n.add(pR(null,[{}]))),a||(a=gL(e,n)),{key:r,pulse:a,parent:s}}(e.from,i,t);s=t.add(gR({key:m.key||(e.key?Gz(e.key):void 0),pulse:m.pulse,clean:!i}));const g=Hz(s);s=l=t.add(pR({pulse:g})),s=t.add(ER({markdef:iL(e),interactive:rL(e.interactive,t),clip:eL(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:Hz(s)}));const y=Hz(s);s=u=t.add(yR(zz(e.encode,e.type,n,e.style,t,{mod:!1,pulse:y}))),s.params.parent=t.encode(),e.transform&&e.transform.forEach((e=>{const n=oL(e,t),i=n.metadata;(i.generates||i.changes)&&me("Mark transforms should not generate new data."),i.nomod||(u.params.mod=!0),n.params.pulse=Hz(s),t.add(s=n)})),e.sort&&(s=t.add(RR({sort:t.compareRef(e.sort),pulse:Hz(s)})));const v=Hz(s);(r||h)&&(h=t.add(PR({layout:t.objectProperty(e.layout),legends:t.legends,mark:y,pulse:v})),f=Hz(h));const b=t.add(hR({mark:y,pulse:f||v}));d=Hz(b),i&&(p&&(a=t.operators,a.pop(),h&&a.pop()),t.pushState(v,f||d,g),r?function(e,t,n){const i=e.from.facet,r=i.name,o=gL(i,t);let a;i.name||me("Facet must have a name: "+Pt(i)),i.data||me("Facet must reference a data set: "+Pt(i)),i.field?a=t.add(MR({field:t.fieldRef(i.field),pulse:o})):i.groupby?a=t.add(bR({key:t.keyRef(i.groupby),group:Hz(t.proxy(n.parent)),pulse:o})):me("Facet must specify groupby or field: "+Pt(i));const s=t.fork(),l=s.add(pR()),u=s.add(zR({pulse:Hz(l)}));s.addData(r,new yL(s,l,l,u)),s.addSignal("parent",null),a.params.subflow={$subflow:s.parse(e).toRuntime()}}(e,t,m):p?function(e,t,n){const i=t.add(MR({pulse:n.pulse})),r=t.fork();r.add(zR()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}(e,t,m):t.parse(e),t.popState(),p&&(h&&a.push(h),a.push(b))),o&&(d=function(e,t,n){const i=e.method,r=e.bound,o=e.separation,a={separation:Zz(o)?n.signalRef(o.signal):o,method:Zz(i)?n.signalRef(i.signal):i,pulse:t};if(e.order&&(a.sort=n.compareRef({field:e.order})),r){const e=r.tolerance;a.boundTolerance=Zz(e)?n.signalRef(e.signal):+e,a.boundScale=n.scaleRef(r.scale),a.boundOrient=r.orient}return Hz(n.add(DR(a)))}(o,d,t));const x=t.add(NR({pulse:d})),_=t.add(zR({pulse:Hz(x)},void 0,t.parent()));null!=e.name&&(c=e.name,t.addData(c,new yL(t,l,x,_)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&me("Marks only support modify triggers."),_L(e,t,c)})))}function kL(e,t,n){const i={enter:{},update:{}};return az(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 EL(e,t,n){return t[e]?`scale("${t[e]}",datum)`:TP(e,n[0].encode)}yL.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let o=t[0],a=null,s=1;for(o&&"load"===o.type&&(o=t[1]),e.add(t[0]);se===rP||e===tP,CL=(e,t,n)=>Zz(e)?PL(e.signal,t,n):e===nP||e===tP?t:n,FL=(e,t,n)=>Zz(e)?zL(e.signal,t,n):ML(e)?t:n,OL=(e,t,n)=>Zz(e)?RL(e.signal,t,n):ML(e)?n:t,NL=(e,t,n)=>Zz(e)?LL(e.signal,t,n):e===tP?{value:t}:{value:n},TL=(e,t,n)=>Zz(e)?BL(e.signal,t,n):e===iP?{value:t}:{value:n},zL=(e,t,n)=>jL(`${e} === '${tP}' || ${e} === '${rP}'`,t,n),RL=(e,t,n)=>jL(`${e} !== '${tP}' && ${e} !== '${rP}'`,t,n),PL=(e,t,n)=>UL(`${e} === '${nP}' || ${e} === '${tP}'`,t,n),LL=(e,t,n)=>UL(`${e} === '${tP}'`,t,n),BL=(e,t,n)=>UL(`${e} === '${iP}'`,t,n),jL=(e,t,n)=>(t=null!=t?rz(t):t,n=null!=n?rz(n):n,IL(t)&&IL(n)?{signal:`${e} ? (${t=t?t.signal||Pt(t.value):null}) : (${n=n?n.signal||Pt(n.value):null})`}:[ht({test:e},t)].concat(n||[])),IL=e=>null==e||1===Object.keys(e).length,UL=(e,t,n)=>({signal:`${e} ? (${WL(t)}) : (${WL(n)})`}),qL=(e,t,n,i,r)=>({signal:(null!=i?`${e} === '${nP}' ? (${WL(i)}) : `:"")+(null!=n?`${e} === '${rP}' ? (${WL(n)}) : `:"")+(null!=r?`${e} === '${iP}' ? (${WL(r)}) : `:"")+(null!=t?`${e} === '${tP}' ? (${WL(t)}) : `:"")+"(null)"}),WL=e=>Zz(e)?e.signal:null==e?null:Pt(e),HL=(e,t)=>0===t?0:Zz(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},GL=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function VL(e,t,n,i){let r;if(t&&yt(t,e))return t[e];if(yt(n,e))return n[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 i[gP][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i[mP][r]}return null}function YL(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function XL(e,t){return{scale:e.scale,range:t}}function JL(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function QL(e,t){const n=function(e,t){var n,i,r,o=t.config,a=o.style,s=o.axis,l="band"===t.scaleType(e.scale)&&o.axisBand,u=e.orient;if(Zz(u)){const e=YL([o.axisX,o.axisY]),t=YL([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(r of(n={},e))n[r]=FL(u,VL(r,o.axisX,s,a),VL(r,o.axisY,s,a));for(r of(i={},t))i[r]=qL(u.signal,VL(r,o.axisTop,s,a),VL(r,o.axisBottom,s,a),VL(r,o.axisLeft,s,a),VL(r,o.axisRight,s,a))}else n=u===tP||u===rP?o.axisX:o.axisY,i=o["axis"+u[0].toUpperCase()+u.slice(1)];return n||i||l?ht({},s,n,i,l):s}(e,t),i=e.encode||{},r=i.axis||{},o=r.name||void 0,a=r.interactive,s=r.style,l=NP(e,n),u=function(e){const t=e("tickBand");let n,i,r=e("tickOffset");return t?t.signal?(n={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},Oe(r)||(r={signal:`(${t.signal}) === 'extent' ? 0 : ${r}`})):"extent"===t?(n=1,i=!0,r=0):(n=.5,i=!1):(n=e("bandPosition"),i=e("tickExtra")),{extra:i,band:n,offset:r}}(l),c={scale:e.scale,ticks:!!l("ticks"),labels:!!l("labels"),grid:!!l("grid"),domain:!!l("domain"),title:null!=e.title},f=Hz(t.add(pR({},[c]))),d=Hz(t.add(dR({scale:t.scaleRef(e.scale),extra:t.property(u.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),h=[];let p;return c.grid&&h.push(function(e,t,n,i,r){const o=NP(e,t),a=e.orient,s=e.gridScale,l=CL(a,1,-1),u=function(e,t){if(1===t);else if(Oe(e)){let n=e=ht({},e);for(;null!=n.mult;){if(!Oe(n.mult))return n.mult=Zz(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=ht({},n.mult)}n.mult=t}else e=Zz(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,l);let c,f,d;const h={enter:c={opacity:AP},update:d={opacity:$P},exit:f={opacity:AP}};az(h,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:e.scale,field:pP,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},m=FL(a,{signal:"height"},{signal:"width"}),g=s?{scale:s,range:0,mult:l,offset:u}:{value:0,offset:u},y=s?{scale:s,range:1,mult:l,offset:u}:ht(m,{mult:l,offset:u});return c.x=d.x=FL(a,p,g),c.y=d.y=OL(a,p,g),c.x2=d.x2=OL(a,y),c.y2=d.y2=FL(a,y),f.x=FL(a,p),f.y=OL(a,p),LP({type:MP,role:pz,key:pP,from:i,encode:h},n)}(e,n,i.grid,d,u)),c.ticks&&(p=l("tickSize"),h.push(function(e,t,n,i,r,o){const a=NP(e,t),s=e.orient,l=CL(s,-1,1);let u,c,f;const d={enter:u={opacity:AP},update:f={opacity:$P},exit:c={opacity:AP}};az(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=rz(r);h.mult=l;const p={scale:e.scale,field:pP,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=u.y=FL(s,AP,p),f.y2=u.y2=FL(s,h),c.x=FL(s,p),f.x=u.x=OL(s,AP,p),f.x2=u.x2=OL(s,h),c.y=OL(s,p),LP({type:MP,role:gz,key:pP,from:i,encode:d},n)}(e,n,i.ticks,d,p,u))),c.labels&&(p=c.ticks?p:0,h.push(function(e,t,n,i,r,o){const a=NP(e,t),s=e.orient,l=e.scale,u=CL(s,-1,1),c=tR(a("labelFlush")),f=tR(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let p,m=0===c||!!c;const g=rz(r);g.mult=u,g.offset=rz(a("labelPadding")||0),g.offset.mult=u;const y={scale:l,field:pP,band:.5,offset:PP(o.offset,a("labelOffset"))},v=FL(s,m?JL(l,c,'"left"','"right"','"center"'):{value:"center"},TL(s,"left","right")),b=FL(s,NL(s,"bottom","top"),m?JL(l,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=JL(l,c,`-(${f})`,f,0);m=m&&f;const _={opacity:AP,x:FL(s,y,g),y:OL(s,y,g)},w={enter:_,update:p={opacity:$P,text:{field:cP},x:_.x,y:_.y,align:v,baseline:b},exit:{opacity:AP,x:_.x,y:_.y}};az(w,{dx:!d&&m?FL(s,x):null,dy:!h&&m?OL(s,x):null}),az(w,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:d,baseline:h});const k=a("labelBound");let E=a("labelOverlap");return E=E||k?{separation:a("labelSeparation"),method:E,order:"datum.index",bound:k?{scale:l,orient:s,tolerance:k}:null}:void 0,p.align!==v&&(p.align=GL(p.align,v)),p.baseline!==b&&(p.baseline=GL(p.baseline,b)),LP({type:FP,role:mz,style:mP,key:pP,from:i,encode:w,overlap:E},n)}(e,n,i.labels,d,p,u))),c.domain&&h.push(function(e,t,n,i){const r=NP(e,t),o=e.orient;let a,s;const l={enter:a={opacity:AP},update:s={opacity:$P},exit:{opacity:AP}};az(l,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const u=XL(e,0),c=XL(e,1);return a.x=s.x=FL(o,u,AP),a.x2=s.x2=FL(o,c),a.y=s.y=OL(o,u,AP),a.y2=s.y2=OL(o,c),LP({type:MP,role:hz,from:i,encode:l},n)}(e,n,i.domain,f)),c.title&&h.push(function(e,t,n,i){const r=NP(e,t),o=e.orient,a=CL(o,-1,1);let s,l;const u={enter:s={opacity:AP,anchor:rz(r("titleAnchor",null)),align:{signal:RP}},update:l=ht({},s,{opacity:$P,text:rz(e.title)}),exit:{opacity:AP}},c={signal:`lerp(range("${e.scale}"), ${zP(0,1,.5)})`};return l.x=FL(o,c),l.y=OL(o,c),s.angle=FL(o,AP,HL(a,90)),s.baseline=FL(o,NL(o,rP,tP),{value:rP}),l.angle=s.angle,l.baseline=s.baseline,az(u,{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 r=(e,t)=>null!=e?(n.update[t]=GL(rz(e),n.update[t]),!1):!lz(t,i),o=r(e("titleX"),"x"),a=r(e("titleY"),"y");n.enter.auto=a===o?rz(a):FL(t,rz(a),rz(o))}(r,o,u,n),u.update.align=GL(u.update.align,s.align),u.update.angle=GL(u.update.angle,s.angle),u.update.baseline=GL(u.update.baseline,s.baseline),LP({type:FP,role:yz,style:gP,from:i,encode:u},n)}(e,n,i.title,f)),wL(OP({role:dz,from:f,encode:sz(ZL(l,e),r,EP),marks:h,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:o,interactive:a,style:s}),t)}function ZL(e,t){const n={enter:{},update:{}};return az(n,{orient:e("orient"),offset:e("offset")||0,position:eR(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 KL(e,t,n){const i=nt(e.signals),r=nt(e.scales);return n||i.forEach((e=>Iz(e,t))),nt(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const n in e)"name"!==n&&(i[n]=eP(e[n],n,t));for(const e in n)null==i[e]&&(i[e]=eP(n[e],e,t));t.addProjection(e.name,i)}(e,t))),r.forEach((e=>function(e,t){const n=e.type||"linear";im(n)||me("Unrecognized scale type: "+Pt(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t))),nt(e.data).forEach((e=>function(e,t){const n=[];e.transform&&e.transform.forEach((e=>{n.push(oL(e,t))})),e.on&&e.on.forEach((n=>{_L(n,t,e.name)})),t.addDataPipeline(e.name,function(e,t,n){const i=[];let r,o,a,s,l,u=null,c=!1,f=!1;for(e.values?Zz(e.values)||Kz(e.format)?(i.push(SL(t,e)),i.push(u=DL())):i.push(u=DL({$ingest:e.values,$format:e.format})):e.url?Kz(e.url)||Kz(e.format)?(i.push(SL(t,e)),i.push(u=DL())):i.push(u=DL({$request:e.url,$format:e.format})):e.source&&(u=r=nt(e.source).map((e=>Hz(t.getData(e).output))),i.push(null)),o=0,a=n.length;oIR(e,t))),(n||i).forEach((e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?me("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=ON(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach((e=>function(e,t,n){const i=e.encode,r={target:n};let o=e.events,a=e.update,s=[];o||me("Signal update missing events specification."),St(o)&&(o=JT(o,t.isSubscope()?Jz:Qz)),o=nt(o).filter((e=>e.signal||e.scale?(s.push(e),0):1)),s.length>1&&(s=[uR(s)]),o.length&&s.push(o.length>1?{merge:o}:o[0]),null!=i&&(a&&me("Signal encode and update are mutually exclusive."),a="encode(item(),"+Pt(i)+")"),r.update=St(a)?ON(a,t):null!=a.expr?ON(a.expr,t):null!=a.value?a.value:null!=a.signal?{$expr:lR,$params:{$value:t.signalRef(a.signal)}}:me("Invalid signal update specification."),e.force&&(r.options={force:!0}),s.forEach((e=>t.addUpdate(ht(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):iR(e,t)}}(e,t),r))))}(e,t,n.id)))}(e,t))),nt(e.axes).forEach((e=>QL(e,t))),nt(e.marks).forEach((e=>wL(e,t))),nt(e.legends).forEach((e=>function(e,t){const n=t.config.legend,i=e.encode||{},r=NP(e,n),o=i.legend||{},a=o.name||void 0,s=o.interactive,l=o.style,u={};let c,f,d,h=0;kP.forEach((t=>e[t]?(u[t]=e[t],h=h||e[t]):0)),h||me("Missing valid scale for legend.");const p=function(e,t){let n=e.type||bP;return e.type||1!==function(e){return kP.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=om(t)?xP:sm(t)?_P:bP),n!==xP?n:sm(t)?_P:xP}(e,t.scaleType(h)),m={title:null!=e.title,scales:u,type:p,vgrad:"symbol"!==p&&r.isVertical()},g=Hz(t.add(pR(null,[m]))),y=Hz(t.add(wR(f={type:p,scale:t.scaleRef(h),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return p===xP?(d=[BP(e,h,n,i.gradient),qP(e,n,i.labels,y)],f.count=f.count||t.signalRef(`max(2,2*floor((${tR(r.gradientLength())})/100))`)):p===_P?d=[jP(e,h,n,i.gradient,y),qP(e,n,i.labels,y)]:(c=function(e,t){const n=NP(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),d=[WP(e,n,i,y,tR(c.columns))],f.size=function(e,t,n){const i=tR(EL("size",e,n)),r=tR(EL("strokeWidth",e,n)),o=tR(function(e,t,n){return TP("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i.fontSize}(0,t,n)}(n[1].encode,t,mP));return ON(`max(ceil(sqrt(${i})+${r}),${o})`,t)}(e,t,d[0].marks)),d=[OP({role:xz,from:g,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:c,interactive:s})],m.title&&d.push(function(e,t,n,i){const r=NP(e,t),o={enter:{opacity:AP},update:{opacity:$P,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:AP}};return az(o,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:QP},angle:{signal:ZP},align:{signal:JP},baseline:{signal:KP},text:e.title,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"),baseline:r("titleBaseline")}),LP({type:FP,role:Ez,style:gP,from:i,encode:o},n)}(e,n,i.title,g)),wL(OP({role:vz,from:g,encode:sz(kL(r,e,n),o,EP),marks:d,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:a,interactive:s,style:l}),t)}(e,t))),e.title&&function(e,t){const n=NP(e=St(e)?{text:e}:e,t.config.title),i=e.encode||{},r=i.group||{},o=r.name||void 0,a=r.interactive,s=r.style,l=[],u=Hz(t.add(pR(null,[{}])));l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return az(o,{text:e.text,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")}),LP({type:FP,role:$z,style:yP,from:i,encode:o},n)}(e,n,function(e){const t=e.encode;return t&&t.title||ht({name:e.name,interactive:e.interactive,style:e.style},t)}(e),u)),e.subtitle&&l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return az(o,{text:e.subtitle,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")}),LP({type:FP,role:Dz,style:vP,from:i,encode:o},n)}(e,n,i.subtitle,u)),wL(OP({role:Az,from:u,encode:$L(n,r),marks:l,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:a,style:s}),t)}(e.title,t),t.parseLambdas(),t}const eB=e=>sz({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function tB(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function nB(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 iB(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 rB(e){return(Fe(e)?oB:aB)(e)}function oB(e){const t=e.length;let n="[";for(let i=0;i0?",":"")+(Oe(t)?t.signal||rB(t):Pt(t))}return n+"]"}function aB(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+Pt(t)+":"+(Oe(n)?n.signal||rB(n):Pt(n));return i+"}"}function sB(e,t,n){return Oe(e)||me("Input Vega specification must be an object."),t=Te(function(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",r="#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:r},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:r,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:r,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"]}}}(),t,e.config),function(e,t){const n=t.config,i=Hz(t.root=t.add(Wz())),r=function(e,t){const n=n=>eR(e[n],t[n]),i=[tB("background",n("background")),tB("autosize",ez(n("autosize"))),tB("padding",iz(n("padding"))),tB("width",n("width")||0),tB("height",n("height")||0)],r=i.reduce(((e,t)=>(e[t.name]=t,e)),{}),o={};return nt(e.signals).forEach((e=>{yt(r,e.name)?e=ht(r[e.name],e):i.push(e),o[e.name]=e})),nt(t.signals).forEach((e=>{yt(o,e.name)||yt(r,e.name)||i.push(e)})),i}(e,n);r.forEach((e=>Iz(e,t))),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const o=t.add(pR()),a=t.add(yR(zz(eB(e.encode),DP,cz,e.style,t,{pulse:Hz(o)}))),s=t.add(PR({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:Hz(a)}));t.operators.pop(),t.pushState(Hz(a),Hz(s),null),KL(e,t,r),t.operators.push(s);let l=t.add(hR({mark:i,pulse:Hz(s)}));return l=t.add(NR({pulse:Hz(l)})),l=t.add(zR({pulse:Hz(l)})),t.addData("root",new yL(t,o,o,l)),t}(e,new nB(t,n)).toRuntime()}nB.prototype=iB.prototype={parse(e){return KL(e,this)},fork(){return new iB(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 Uz?Hz(e):e;return this.add(FR({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,r;e&&(i=e.data||(e.data={}),r=i[t]||(i[t]=[]),r.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(Hz(this.add(zR({pulse:e})))),this._parent.push(t),this._lookup.push(n?Hz(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return Pe(this._parent)},encode(){return Pe(this._encode)},lookup(){return Pe(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(St(e))return Gz(e,t);e.signal||me("Unsupported field reference: "+Pt(e));const n=e.signal;let i=this.field[n];if(!i){const e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=i=Hz(this.add(xR(e)))}return i},compareRef(e){let t=!1;const n=e=>Zz(e)?(t=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(t=!0,this.exprRef(e.expr)):e,i=nt(e.field).map(n),r=nt(e.order).map(n);return t?Hz(this.add(mR({fields:i,orders:r}))):Yz(i,r)},keyRef(e,t){let n=!1;const i=this.signals;return e=nt(e).map((e=>Zz(e)?(n=!0,Hz(i[e.signal])):e)),n?Hz(this.add(_R({fields:e,flat:t}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,t)},sortRef(e){if(!e)return e;const t=Xz(e.op,e.field),n=e.order||"ascending";return n.signal?Hz(this.add(mR({fields:t,orders:this.signalRef(n.signal)}))):Yz(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 yt(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&me("Duplicate signal name: "+Pt(e));const n=t instanceof Uz?t:this.add(Wz(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||me("Unrecognized signal name: "+Pt(e)),this.signals[e]},signalRef(e){return this.signals[e]?Hz(this.signals[e]):(yt(this.lambdas,e)||(this.lambdas[e]=this.add(Wz(null))),Hz(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;te*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},fB={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const dB=Array.prototype.slice,hB=(e,t,n)=>{const i=n?n(t[0]):t[0];return i[e].apply(i,dB.call(t,1))};var pB={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:(e,t,n,i,r,o,a)=>new Date(e,t||0,null!=n?n:1,i||0,r||0,o||0,a||0),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return hB("join",arguments)},indexof:function(){return hB("indexOf",arguments)},lastindexof:function(){return hB("lastIndexOf",arguments)},slice:function(){return hB("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return hB("substring",arguments,String)},split:function(){return hB("split",arguments,String)},replace:function(){return hB("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const mB=["view","item","group","xy","x","y"],gB=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&gB.add(setImmediate);const yB={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:"datum"===n?e.datum:"event"===n?e.event:"item"===n?e.item:uB[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,i=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);if(n&&(e.memberDepth-=1),!gB.has(i[r]))return i[r];console.error(`Prevented interpretation of member "${r}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let i=t.callee.name;return i.startsWith("_")&&(i=i.slice(1)),"if"===i?e(n[0])?e(n[1]):e(n[2]):(e.fn[i]||pB[i]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>cB[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>fB[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>"&&"===t.operator?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce(((t,n)=>{e.memberDepth+=1;const i=e(n.key);return e.memberDepth-=1,gB.has(e(n.value))?console.error(`Prevented interpretation of property "${i}" which could lead to insecure code execution`):t[i]=e(n.value),t}),{})};function vB(e,t,n,i,r,o){const a=e=>yB[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=i,a.event=r,a.item=o,mB.forEach((e=>a.fn[e]=function(){return r.vega[e](...arguments)})),a(e)}var bB={operator(e,t){const n=t.ast,i=e.functions;return e=>vB(n,i,e)},parameter(e,t){const n=t.ast,i=e.functions;return(e,t)=>vB(n,i,t,e)},event(e,t){const n=t.ast,i=e.functions;return e=>vB(n,i,void 0,void 0,e)},handler(e,t){const n=t.ast,i=e.functions;return(e,t)=>{const r=t.item&&t.item.datum;return vB(n,i,e,r,t)}},encode(e,t){const{marktype:n,channels:i}=t,r=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,l=0;for(const n in i)s=vB(i[n].ast,r,t,a,void 0,e),e[n]!==s&&(e[n]=s,l=1);return"rule"!==n&&function(e,t,n){let i;t.x2&&(t.x?(n&&e.x>e.x2&&(i=e.x,e.x=e.x2,e.x2=i),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(i=e.y,e.y=e.y2,e.y2=i),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,i,o),l}}};function xB(e){return!!e.or}function _B(e){return!!e.and}function wB(e){return!!e.not}function kB(e,t){if(wB(e))kB(e.not,t);else if(_B(e))for(const n of e.and)kB(n,t);else if(xB(e))for(const n of e.or)kB(n,t);else t(e)}function EB(e,t){return wB(e)?{not:EB(e.not,t)}:_B(e)?{and:e.and.map((e=>EB(e,t)))}:xB(e)?{or:e.or.map((e=>EB(e,t)))}:t(e)}const AB=structuredClone;function $B(e){throw new Error(e)}function DB(e,t){const n={};for(const i of t)yt(e,i)&&(n[i]=e[i]);return n}function SB(e,t){const n={...e};for(const e of t)delete n[e];return n}function MB(e){if($t(e))return e;const t=St(e)?e:pj(e);if(t.length<250)return t;let n=0;for(let e=0;e0===t?e:`[${e}]`)),i=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const e of i)t.add(e)}return t}function IB(e,t){return void 0===e||void 0===t||BB(jB(e),jB(t))}function UB(e){return 0===qB(e).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>pj(e))).join(",")})`};const qB=Object.keys,WB=Object.values,HB=Object.entries;function GB(e){return!0===e||!1===e}function VB(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function YB(e,t){return wB(e)?`!(${YB(e.not,t)})`:_B(e)?`(${e.and.map((e=>YB(e,t))).join(") && (")})`:xB(e)?`(${e.or.map((e=>YB(e,t))).join(") || (")})`:t(e)}function XB(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&XB(e[n],t)&&delete e[n],UB(e)}function JB(e){return e.charAt(0).toUpperCase()+e.substr(1)}function QB(e,t="datum"){const n=ge(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map(Pt).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function ZB(e,t="datum"){return`${t}[${Pt(ge(e).join("."))}]`}function KB(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function ej(e){return`${ge(e).map(KB).join("\\.")}`}function tj(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function nj(e){return`${ge(e).join(".")}`}function ij(e){return e?ge(e).length:0}function rj(...e){for(const t of e)if(void 0!==t)return t}let oj=42;function aj(e){const t=++oj;return e?String(e)+t:t}function sj(){oj=42}function lj(e){return uj(e)?e:`__${e}`}function uj(e){return e.startsWith("__")}function cj(e){if(void 0!==e)return(e%360+360)%360}function fj(e){return!!$t(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const dj=Object.getPrototypeOf(structuredClone({}));function hj(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(!hj(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;for(i of e.entries())if(!hj(i[1],t.get(i[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==dj.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==dj.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;0!=i--;){const n=r[i];if(!hj(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function pj(e){const t=[];return function e(n){if(n&&n.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===n)return;if("number"==typeof n)return isFinite(n)?""+n:"null";if("object"!=typeof n)return JSON.stringify(n);let i,r;if(Array.isArray(n)){for(r="[",i=0;iSU(e[t])?VB(`_${t}_${HB(e[t])}`):VB(`_${t}_${e[t]}`))).join("")}function AU(e){return!0===e||DU(e)&&!e.binned}function $U(e){return"binned"===e||DU(e)&&!0===e.binned}function DU(e){return Oe(e)}function SU(e){return e?.param}function MU(e){switch(e){case mj:case gj:case Rj:case Oj:case Nj:case Tj:case Ij:case Lj:case Bj:case jj:case zj:return 6;case Uj:return 4;default:return 10}}function CU(e){return!!e?.expr}function FU(e){const t=qB(e||{}),n={};for(const i of t)n[i]=IU(e[i]);return n}function OU(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:l,subtitleFont:u,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:p,...m}=e,g={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},y={...l?{subtitleColor:l}:{},...u?{subtitleFont:u}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:DB(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function NU(e){return St(e)||Fe(e)&&St(e[0])}function TU(e){return!!e?.signal}function zU(e){return!!e.step}function RU(e){return!Fe(e)&&"field"in e&&"data"in e}const PU=qB({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),LU={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},BU=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function jU(e){const t=Fe(e.condition)?e.condition.map(UU):UU(e.condition);return{...IU(e),condition:t}}function IU(e){if(CU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function UU(e){if(CU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function qU(e){if(CU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return TU(e)?e:void 0!==e?{value:e}:void 0}function WU(e){return TU(e)?e.signal:Pt(e)}function HU(e){return TU(e)?e.signal:Pt(e.value)}function GU(e){return TU(e)?e.signal:null==e?null:Pt(e)}function VU(e,t,n){for(const i of n){const n=JU(i,t.markDef,t.config);void 0!==n&&(e[i]=qU(n))}return e}function YU(e){return[].concat(e.type,e.style??[])}function XU(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&void 0!==t[r]?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?JU(e,t,n,i):void 0}function JU(e,t,n,{vgChannel:i}={}){return rj(i?QU(e,t,n.style):void 0,QU(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function QU(e,t,n){return ZU(e,YU(t),n)}function ZU(e,t,n){let i;t=nt(t);for(const r of t){const t=n[r];t&&void 0!==t[e]&&(i=t[e])}return i}function KU(e,t){return nt(e).reduce(((e,n)=>(e.field.push(mG(n,t)),e.order.push(n.sort??"ascending"),e)),{field:[],order:[]})}function eq(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(hj(t,e))return;n.push(e)})),n}function tq(e,t){return hj(e,t)||!t?e:e?[...nt(e),...nt(t)].join(", "):t}function nq(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((NU(n)||TU(n))&&(NU(i)||TU(i)))return{explicit:e.explicit,value:tq(n,i)};if(NU(n)||TU(n))return{explicit:e.explicit,value:n};if(NU(i)||TU(i))return{explicit:e.explicit,value:i};if(!(NU(n)||TU(n)||NU(i)||TU(i)))return{explicit:e.explicit,value:eq(n,i)};throw new Error("It should never reach here")}function iq(e){return`Invalid specification ${pj(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const rq='Autosize "fit" only works for single views and layered views.';function oq(e){return("width"==e?"Width":"Height")+' "container" only works for single views and layered views.'}function aq(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function sq(e){return e?`Dropping "fit-${e}" because spec has discrete ${kI(e)}.`:'Dropping "fit" because spec has discrete size.'}function lq(e){return`Unknown field for ${e}. Cannot calculate view size.`}function uq(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function cq(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function fq(e){return`Selection not supported for ${e} yet.`}function dq(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function hq(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function pq(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function mq(e){return`${e}Offset dropped because ${e} is continuous`}function gq(e){return`Invalid field type "${e}".`}function yq(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function vq(e,t){return`Dropping ${pj(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function bq(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function xq(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function _q(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function wq(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function kq(e){return`Using unaggregated domain with raw field has no effect (${pj(e)}).`}function Eq(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function Aq(e){return`Unaggregated domain is currently unsupported for log scale (${pj(e)}).`}function $q(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function Dq(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const Sq="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function Mq(e,t){return`Invalid ${e}: ${pj(t)}.`}function Cq(e){return`1D error band does not support ${e}.`}function Fq(e){return`Channel ${e} is required for "binned" bin.`}const Oq=Ce(De);let Nq=Oq;function Tq(...e){Nq.warn(...e)}function zq(e){if(e&&Oe(e))for(const t of qq)if(t in e)return!0;return!1}new WeakMap;const Rq=["january","february","march","april","may","june","july","august","september","october","november","december"],Pq=Rq.map((e=>e.substr(0,3))),Lq=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Bq=Lq.map((e=>e.substr(0,3)));function jq(e,t){const n=[];if(t&&void 0!==e.day&&qB(e).length>1&&(Tq(function(e){return`Dropping day from datetime ${pj(e)} as day cannot be combined with other units.`}(e)),delete(e=AB(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(fj(e)&&(e=+e),$t(e))return e-1;{const t=e.toLowerCase(),n=Rq.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Pq.indexOf(i);if(-1!==r)return r;throw new Error(Mq("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(fj(e)&&(e=+e),$t(e))return e>4&&Tq(Mq("quarter",e)),e-1;throw new Error(Mq("quarter",e))}(e.quarter):e.quarter;n.push($t(i)?3*i:`${i}*3`)}else n.push(0);if(void 0!==e.date)n.push(e.date);else if(void 0!==e.day){const i=t?function(e){if(fj(e)&&(e=+e),$t(e))return e%7;{const t=e.toLowerCase(),n=Lq.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Bq.indexOf(i);if(-1!==r)return r;throw new Error(Mq("day",e))}}(e.day):e.day;n.push($t(i)?i+1:`${i}+1`)}else n.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const i=e[t];n.push(void 0===i?0:i)}return n}function Iq(e){const t=jq(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const Uq={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},qq=qB(Uq);function Wq(e){return Oe(e)?e.binned:Hq(e)}function Hq(e){return e&&e.startsWith("binned")}function Gq(e){return e.startsWith("utc")}const Vq={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Yq(e){return qq.filter((t=>Jq(e,t)))}function Xq(e){const t=Yq(e);return t[t.length-1]}function Jq(e,t){const n=e.indexOf(t);return!(n<0||n>0&&"seconds"===t&&"i"===e.charAt(n-1)||e.length>n+3&&"day"===t&&"o"===e.charAt(n+3)||n>0&&"year"===t&&"f"===e.charAt(n-1))}function Qq(e){if(e)return`timeUnitSpecifier(${pj(Yq(e))}, ${pj(Vq)})`}function Zq(e){if(!e)return;let t;return St(e)?t=Hq(e)?{unit:e.substring(6),binned:!0}:{unit:e}:Oe(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),Gq(t.unit)&&(t.utc=!0,t.unit=function(e){return e.substring(3)}(t.unit)),t}function Kq(e,t=(e=>e)){const n=Zq(e),i=Xq(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:r,part:o}=tW(i,n.step);return`${t(Iq({...e,[o]:+e[o]+r}))} - ${t(Iq(e))}`}}const eW={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function tW(e,t=1){if(function(e){return!!eW[e]}(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:3*t};case"week":return{part:"date",step:7*t}}}function nW(e){return!!e?.field&&void 0!==e.equal}function iW(e){return!!e?.field&&void 0!==e.lt}function rW(e){return!!e?.field&&void 0!==e.lte}function oW(e){return!!e?.field&&void 0!==e.gt}function aW(e){return!!e?.field&&void 0!==e.gte}function sW(e){if(e?.field){if(Fe(e.range)&&2===e.range.length)return!0;if(TU(e.range))return!0}return!1}function lW(e){return!!e?.field&&(Fe(e.oneOf)||Fe(e.in))}function uW(e){return lW(e)||nW(e)||sW(e)||iW(e)||oW(e)||rW(e)||aW(e)}function cW(e,t){return OG(e,{timeUnit:t,wrapTime:!0})}function fW(e,t=!0){const{field:n}=e,i=Zq(e.timeUnit),{unit:r,binned:o}=i||{},a=mG(e,{expr:"datum"}),s=r?`time(${o?a:function(e,t,{end:n}={end:!1}){const i=QB(t),r=Gq(e)?"utc":"";let o;const a={};for(const t of qq)Jq(e,t)&&(a[t]="quarter"===(s=t)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=t);var s;return n&&(a[o]+="+1"),function(e){const t=jq(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}(r,n)})`:a;if(nW(e))return`${s}===${cW(e.equal,r)}`;if(iW(e))return`${s}<${cW(e.lt,r)}`;if(oW(e))return`${s}>${cW(e.gt,r)}`;if(rW(e))return`${s}<=${cW(e.lte,r)}`;if(aW(e))return`${s}>=${cW(e.gte,r)}`;if(lW(e))return`indexof([${function(e,t){return e.map((e=>cW(e,t)))}(e.oneOf,r).join(",")}], ${s}) !== -1`;if(function(e){return!!e?.field&&void 0!==e.valid}(e))return dW(s,e.valid);if(sW(e)){const{range:n}=e,i=TU(n)?{signal:`${n.signal}[0]`}:n[0],o=TU(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==o&&t)return"inrange("+s+", ["+cW(i,r)+", "+cW(o,r)+"])";const a=[];return null!==i&&a.push(`${s} >= ${cW(i,r)}`),null!==o&&a.push(`${s} <= ${cW(o,r)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${pj(e)}`)}function dW(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function hW(e){return uW(e)&&e.timeUnit?{...e,timeUnit:Zq(e.timeUnit)}:e}const pW={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function mW(e){return"ordinal"===e||"nominal"===e}const gW=pW.quantitative,yW=pW.ordinal,vW=pW.temporal,bW=pW.nominal,xW=pW.geojson;qB(pW);const _W={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},wW={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function kW(e,t){const n=wW[e],i=wW[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}qB(wW);const EW={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function AW(e){return EW[e]}const $W=new Set(["linear","log","pow","sqrt","symlog"]),DW=new Set([...$W,"time","utc"]);function SW(e){return $W.has(e)}const MW=new Set(["quantile","quantize","threshold"]),CW=new Set([...DW,...MW,"sequential","identity"]),FW=new Set(["ordinal","bin-ordinal","point","band"]);function OW(e){return FW.has(e)}function NW(e){return CW.has(e)}function TW(e){return DW.has(e)}function zW(e){return MW.has(e)}function RW(e){return e?.param}new Set(["time","utc"]);const PW={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},{type:LW,domain:BW,range:jW,rangeMax:IW,rangeMin:UW,scheme:qW,...WW}=(qB(PW),PW),HW=qB(WW);function GW(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return TW(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return TW(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return TW(e);case"nice":return TW(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return NW(e)&&!FB(["log","time","utc","threshold","quantile"],e)}}function VW(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return rI(e)?void 0:`Cannot use the scale property "${t}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const YW={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},XW=YW.arc,JW=YW.area,QW=YW.bar,ZW=YW.image,KW=YW.line,eH=YW.point,tH=YW.rect,nH=YW.rule,iH=YW.text,rH=YW.tick,oH=YW.trail,aH=YW.circle,sH=YW.square,lH=YW.geoshape;function uH(e){return["line","area","trail"].includes(e)}function cH(e){return["rect","bar","image","arc"].includes(e)}const fH=new Set(qB(YW));function dH(e){return e.type}const hH=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],pH=qB({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),mH=qB({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function gH(e){return e&&null!=e.band}const yH={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]};function vH(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,a=kH(e);return tG(n)&&!_U(n.aggregate)&&r&&TW(r.get("type"))?function({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(uH(n.type))return i;return null===XU("invalid",n,r)?[bH(e,t),i]:i}({fieldDef:n,channel:t,markDef:i,ref:a,config:o}):a}function bH(e,t){return{test:xH(e,!0),..."y"===xI(t)?{field:{group:"height"}}:{value:0}}}function xH(e,t=!0){return dW(St(e)?e:mG(e,{expr:"datum"}),!t)}function _H(e,t,n,i){const r={};if(t&&(r.scale=t),iG(e)){const{datum:t}=e;zq(t)?r.signal=Iq(t):TU(t)?r.signal=t.signal:CU(t)?r.signal=t.expr:r.value=t}else r.field=mG(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function wH({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,endSuffix:o="end",bandPosition:a=.5}){const s=!TU(a)&&0VB(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+qB(n).map((e=>VB(`_${e}_${n[e]}`))).join("")}(l),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}i&&(n=n?`${i}_${n}`:i)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?nj(n):t.expr?ZB(n,t.expr)+o:ej(n)+o}function gG(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return tG(e)&&!!e.bin;case"temporal":return!1}throw new Error(gq(e.type))}const yG=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(vU(t))return`${r} for argmax(${t.argmax})`;if(yU(t))return`${r} for argmin(${t.argmin})`;const o=i&&!Wq(i)?Zq(i):void 0,a=t||o?.unit||o?.maxbins&&"timeunit"||AU(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if("count"===o)return t.countTitle;if(AU(i))return`${n} (binned)`;if(r&&!Wq(r)){const e=Zq(r)?.unit;if(e)return`${n} (${Yq(e).join("-")})`}else if(o)return vU(o)?`${n} for max ${o.argmax}`:yU(o)?`${n} for min ${o.argmin}`:`${JB(o)} of ${n}`;return n}(e,t)}};let vG=yG;function bG(e){vG=e}function xG(e,t,{allowDisabling:n,includeDefault:i=!0}){const r=_G(e)?.title;if(!tG(e))return r??e.title;const o=e,a=i?wG(o,t):void 0;return n?rj(r,o.title,a):r??o.title??a}function _G(e){return fG(e)&&e.axis?e.axis:dG(e)&&e.legend?e.legend:WH(e)&&e.header?e.header:void 0}function wG(e,t){return vG(e,t)}function kG(e){if(hG(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=_G(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function EG(e){return tG(e)?e:KH(e)?e.condition:void 0}function AG(e){return sG(e)?e:eG(e)?e.condition:void 0}function $G(e,t,n,i={}){return St(e)||$t(e)||kt(e)?(Tq(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${pj(n)}}.`}(t,St(e)?"string":$t(e)?"number":"boolean",e)),{value:e}):sG(e)?DG(e,t,n,i):eG(e)?{...e,condition:DG(e.condition,t,n,i)}:e}function DG(e,t,n,i){if(hG(e)){const{format:r,formatType:o,...a}=e;if(AH(o)&&!n.customFormatTypes)return Tq(pq(t)),DG(a,t,n,i)}else{const r=fG(e)?"axis":dG(e)?"legend":WH(e)?"header":null;if(r&&e[r]){const{format:o,formatType:a,...s}=e[r];if(AH(a)&&!n.customFormatTypes)return Tq(pq(t)),DG({...e,[r]:s},t,n,i)}}return tG(e)?SG(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=$t(n)?"quantitative":St(n)?"nominal":zq(n)?"temporal":void 0,{...e,type:t}}(e)}function SG(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:a}=e,s={...e};if(n||!i||bU(i)||vU(i)||yU(i)||(Tq(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete s.aggregate),r&&(s.timeUnit=Zq(r)),a&&(s.field=`${a}`),AU(o)&&(s.bin=MG(o,t)),$U(o)&&!GI(t)&&Tq(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),lG(s)){const{type:e}=s,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case gW:return"quantitative";case"t":case vW:return"temporal";case"o":case yW:return"ordinal";case"n":case bW:return"nominal";case xW:return"geojson"}}(e);e!==t&&(s.type=t),"quantitative"!==e&&_U(i)&&(Tq(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),s.type="quantitative")}else if(!bI(t)){const e=function(e,t){switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(VH(e)&&Fe(e.sort))return"ordinal";const{aggregate:n,bin:i,timeUnit:r}=e;if(r)return"temporal";if(i||n&&!vU(n)&&!yU(n))return"quantitative";if(cG(e)&&e.scale?.type)switch(wW[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(s,t);s.type=e}if(lG(s)){const{compatible:e,warning:n}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case mj:case gj:case yj:return gG(e)?CG:{compatible:!1,warning:xq(t)};case vj:case bj:case wj:case kj:case Oj:case Nj:case Tj:case qj:case Hj:case Gj:case Vj:case Yj:case Xj:case Pj:case $j:case Ej:case Jj:return CG;case Mj:case Fj:case Sj:case Cj:return n!==gW?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:CG;case Lj:case Bj:case jj:case Ij:case Rj:case Dj:case Aj:case xj:case _j:return"nominal"!==n||e.sort?CG:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case zj:case Uj:return gG(e)||function(e){return cG(e)&&zW(e.scale?.type)}(e)?CG:{compatible:!1,warning:_q(t)};case Wj:return"nominal"!==e.type||"sort"in e?CG:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(s,t)||{};!1===e&&Tq(n)}if(VH(s)&&St(s.sort)){const{sort:e}=s;if(BH(e))return{...s,sort:{encoding:e}};const t=e.substr(1);if("-"===e.charAt(0)&&BH(t))return{...s,sort:{encoding:t,order:"descending"}}}if(WH(s)){const{header:e}=s;if(e){const{orient:t,...n}=e;if(t)return{...s,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return s}function MG(e,t){return kt(e)?{maxbins:MU(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:MU(t)}}const CG={compatible:!0};function FG(e){const{formatType:t}=kG(e);return"time"===t||!t&&function(e){return e&&("temporal"===e.type||tG(e)&&!!e.timeUnit)}(e)}function OG(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){const o=t&&Zq(t)?.unit;let a,s=o||"temporal"===n;return CU(e)?a=e.expr:TU(e)?a=e.signal:zq(e)?(s=!0,a=Iq(e)):(St(e)||$t(e))&&s&&(a=`datetime(${pj(e)})`,function(e){return!!Uq[e]}(o)&&($t(e)&&e<1e4||St(e)&&isNaN(Date.parse(e)))&&(a=Iq({[o]:e}))),a?i&&s?`time(${a})`:a:r?void 0:pj(e)}function NG(e,t){const{type:n}=e;return t.map((t=>{const i=OG(t,{timeUnit:tG(e)&&!Wq(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function TG(e,t){return AU(e.bin)?cU(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const zG={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function RG(e){return e?.condition}const PG=["domain","grid","labels","ticks","title"],LG={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},BG={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},jG={...BG,style:1,labelExpr:1,encoding:1};function IG(e){return!!jG[e]}qB(jG);const UG=qB({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function qG(e){return"mark"in e}class WG{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!qG(e)&&function(e){return dH(e)?e.type:e}(e.mark)===this.name}}function HG(e,t){const n=e&&e[t];return!!n&&(Fe(n)?OB(n,(e=>!!e.field)):tG(n)||KH(n))}function GG(e,t){const n=e&&e[t];return!!n&&(Fe(n)?OB(n,(e=>!!e.field)):tG(n)||iG(n)||eG(n))}function VG(e,t){if(GI(t)){const n=e[t];if((tG(n)||iG(n))&&(mW(n.type)||tG(n)&&n.timeUnit))return GG(e,AI(t))}return!1}function YG(e){return OB(lI,(t=>{if(HG(e,t)){const n=e[t];if(Fe(n))return OB(n,(e=>!!e.aggregate));{const e=EG(n);return e&&!!e.aggregate}}return!1}))}function XG(e,t){const n=[],i=[],r=[],o=[],a={};return ZG(e,((s,l)=>{if(tG(s)){const{field:u,aggregate:c,bin:f,timeUnit:d,...h}=s;if(c||d||f){const e=_G(s),p=e?.title;let m=mG(s,{forAs:!0});const g={...p?[]:{title:xG(s,t,{allowDisabling:!0})},...h,field:m};if(c){let e;if(vU(c)?(e="argmax",m=mG({op:"argmax",field:c.argmax},{forAs:!0}),g.field=`${m}.${u}`):yU(c)?(e="argmin",m=mG({op:"argmin",field:c.argmin},{forAs:!0}),g.field=`${m}.${u}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:m};u&&(t.field=u),o.push(t)}}else if(n.push(m),lG(s)&&AU(f)){if(i.push({bin:f,field:u,as:m}),n.push(mG(s,{binSuffix:"end"})),TG(s,l)&&n.push(mG(s,{binSuffix:"range"})),GI(l)){const e={field:`${m}_end`};a[`${l}2`]=e}g.bin="binned",bI(l)||(g.type=gW)}else if(d&&!Wq(d)){r.push({timeUnit:d,field:u,as:m});const e=lG(s)&&s.type!==vW&&"time";e&&(l===qj||l===Vj?g.formatType=e:function(e){return!!UI[e]}(l)?g.legend={formatType:e,...g.legend}:GI(l)&&(g.axis={formatType:e,...g.axis}))}a[l]=g}else n.push(u),a[l]=e[l]}else a[l]=e[l]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function JG(e,t,n){const i=function(e,t){return function(e){switch(e){case Oj:case Nj:case Tj:case Jj:case Hj:case Gj:case Vj:case Yj:case Wj:case Lj:case Bj:case jj:case Ij:case yj:case mj:case gj:return fU;case vj:case bj:case wj:case kj:case Sj:case Mj:return hU;case xj:case _j:case Cj:case Fj:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Rj:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Uj:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case zj:return{point:"always",geoshape:"always"};case qj:return{text:"always"};case Pj:return{point:"always",square:"always",text:"always"};case Xj:return{image:"always"};case $j:case Ej:return{text:"always",arc:"always"};case Dj:case Aj:return{arc:"always"}}}(e)[t]}(t,n);if(!i)return!1;if("binned"===i){const n=e[t===xj?vj:bj];return!!(tG(n)&&tG(e[t])&&$U(n.bin))}return!0}function QG(e,t){const n={};for(const i of qB(e)){const r=$G(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function ZG(e,t,n){if(e)for(const i of qB(e)){const r=e[i];if(Fe(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function KG(e,t){return qB(t).reduce(((n,i)=>{switch(i){case vj:case bj:case Yj:case Jj:case Xj:case xj:case _j:case wj:case kj:case $j:case Dj:case Ej:case Aj:case Sj:case Mj:case Cj:case Fj:case qj:case zj:case Pj:case Vj:return n;case Wj:if("line"===e||"trail"===e)return n;case Hj:case Gj:{const e=t[i];if(Fe(e)||tG(e))for(const t of nt(e))t.aggregate||n.push(mG(t,{}));return n}case Rj:if("trail"===e)return n;case Oj:case Nj:case Tj:case Lj:case Bj:case jj:case Uj:case Ij:{const e=EG(t[i]);return e&&!e.aggregate&&n.push(mG(e,{})),n}}}),[])}function eV(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};const r=e.map((({fieldPrefix:e,titlePrefix:n})=>{const r=i?` of ${tV(t)}`:"";return{field:e+t.field,type:t.type,title:TU(n)?{signal:`${n}"${escape(r)}"`}:n+r}})),o=function(e){const t=[];for(const n of qB(e))if(HG(e,n)){const i=nt(e[n]);for(const e of i)tG(e)?t.push(e):KH(e)&&t.push(e.condition)}return t}(n).map(pG);return{tooltip:[...r,...RB(o,MB)]}}function tV(e){const{title:t,field:n}=e;return rj(t,n)}function nV(e,t,n,i,r){const{scale:o,axis:a}=n;return({partName:s,mark:l,positionPrefix:u,endPositionPrefix:c,extraEncoding:f={}})=>{const d=tV(n);return iV(e,s,r,{mark:l,encoding:{[t]:{field:`${u}_${n.field}`,type:n.type,...void 0!==d?{title:d}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...St(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function iV(e,t,n,i){const{clip:r,color:o,opacity:a}=e,s=e.type;return e[t]||void 0===e[t]&&n[t]?[{...i,mark:{...n[t],...r?{clip:r}:{},...o?{color:o}:{},...a?{opacity:a}:{},...dH(i.mark)?i.mark:{type:i.mark},style:`${s}-${String(t)}`,...kt(e[t])?{}:e[t]}}]:[]}function rV(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],l=i[`${r}Error2`];return{continuousAxisChannelDef:oV(o,n),continuousAxisChannelDef2:oV(a,n),continuousAxisChannelDefError:oV(s,n),continuousAxisChannelDefError2:oV(l,n),continuousAxis:r}}function oV(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&Tq(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function aV(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(dH(n)&&n.orient)return n.orient;if(rG(r)){if(rG(o)){const e=tG(r)&&r.aggregate,n=tG(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return FG(o)&&!FG(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(rG(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const sV="boxplot",lV=new WG(sV,cV);function uV(e){return $t(e)?"tukey":e}function cV(e,{config:t}){e={...e,encoding:QG(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:o,...a}=e,s=dH(n)?n:{type:n};r&&Tq(fq("boxplot"));const l=s.extent??t.boxplot.extent,u=XU("size",s,t),c=s.invalid,f=uV(l),{bins:d,timeUnits:h,transform:p,continuousAxisChannelDef:m,continuousAxis:g,groupby:y,aggregate:v,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:_,customTooltipWithoutAggregatedField:w}=function(e,t,n){const i=aV(e,sV),{continuousAxisChannelDef:r,continuousAxis:o}=rV(e,i,sV),a=r.field,s=uV(t),l=[...fV(a),{op:"median",field:a,as:`mid_box_${a}`},{op:"min",field:a,as:("min-max"===s?"lower_whisker_":"min_")+a},{op:"max",field:a,as:("min-max"===s?"upper_whisker_":"max_")+a}],u="min-max"===s||"tukey"===s?[]:[{calculate:`datum["upper_box_${a}"] - datum["lower_box_${a}"]`,as:`iqr_${a}`},{calculate:`min(datum["upper_box_${a}"] + datum["iqr_${a}"] * ${t}, datum["max_${a}"])`,as:`upper_whisker_${a}`},{calculate:`max(datum["lower_box_${a}"] - datum["iqr_${a}"] * ${t}, datum["min_${a}"])`,as:`lower_whisker_${a}`}],{[o]:c,...f}=e.encoding,{customTooltipWithoutAggregatedField:d,filteredEncoding:h}=function(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(Fe(t)){for(const e of t)e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return Fe(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(f),{bins:p,timeUnits:m,aggregate:g,groupby:y,encoding:v}=XG(h,n),b="vertical"===i?"horizontal":"vertical",x=i;return{bins:p,timeUnits:m,transform:[...p,...m,{aggregate:[...g,...l],groupby:y},...u],groupby:y,aggregate:g,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:v,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:d}}(e,l,t),{color:k,size:E,...A}=b,$=e=>nV(s,g,m,e,t.boxplot),D=$(A),S=$(b),M=$({...A,...E?{size:E}:{}}),C=eV([{fieldPrefix:"min-max"===f?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===f?"lower_whisker_":"min_",titlePrefix:"Min"}],m,b),F={type:"tick",color:"black",opacity:1,orient:x,invalid:c,aria:!1},O="min-max"===f?C:eV([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],m,b),N=[...D({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:O}),...D({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:O}),...D({partName:"ticks",mark:F,positionPrefix:"lower_whisker",extraEncoding:O}),...D({partName:"ticks",mark:F,positionPrefix:"upper_whisker",extraEncoding:O})],T=[..."tukey"!==f?N:[],...S({partName:"box",mark:{type:"bar",...u?{size:u}:{},orient:_,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:C}),...M({partName:"median",mark:{type:"tick",invalid:c,...Oe(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...u?{size:u}:{},orient:x,aria:!1},positionPrefix:"mid_box",extraEncoding:C})];if("min-max"===f)return{...a,transform:(a.transform??[]).concat(p),layer:T};const z=`datum["lower_box_${m.field}"]`,R=`datum["upper_box_${m.field}"]`,P=`(${R} - ${z})`,L=`${z} - ${l} * ${P}`,B=`${R} + ${l} * ${P}`,j=`datum["${m.field}"]`,I={joinaggregate:fV(m.field),groupby:y},U={transform:[{filter:`(${L} <= ${j}) && (${j} <= ${B})`},{aggregate:[{op:"min",field:m.field,as:`lower_whisker_${m.field}`},{op:"max",field:m.field,as:`upper_whisker_${m.field}`},{op:"min",field:`lower_box_${m.field}`,as:`lower_box_${m.field}`},{op:"max",field:`upper_box_${m.field}`,as:`upper_box_${m.field}`},...v],groupby:y}],layer:N},{tooltip:q,...W}=A,{scale:H,axis:G}=m,V=tV(m),Y=SB(G,["title"]),X=iV(s,"outliers",t.boxplot,{transform:[{filter:`(${j} < ${L}) || (${j} > ${B})`}],mark:"point",encoding:{[g]:{field:m.field,type:m.type,...void 0!==V?{title:V}:{},...void 0!==H?{scale:H}:{},...UB(Y)?{}:{axis:Y}},...W,...k?{color:k}:{},...w?{tooltip:w}:{}}})[0];let J;const Q=[...d,...h,I];return X?J={transform:Q,layer:[X,U]}:(J=U,J.transform.unshift(...Q)),{...a,layer:[J,{transform:p,layer:T}]}}function fV(e){return[{op:"q1",field:e,as:`lower_box_${e}`},{op:"q3",field:e,as:`upper_box_${e}`}]}const dV="errorbar",hV=new WG(dV,pV);function pV(e,{config:t}){e={...e,encoding:QG(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:l,tooltipEncoding:u}=mV(e,dV,t);delete o.size;const c=nV(s,r,i,o,t.errorbar),f=s.thickness,d=s.size,h={type:"tick",orient:a,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},p=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:u}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return{...l,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function mV(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,l=dH(i)?i:{type:i};o&&Tq(fq(t));const{orient:u,inputType:c}=function(e,t){const{encoding:n}=e;if(function(e){return(sG(e.x)||sG(e.y))&&!sG(e.x2)&&!sG(e.y2)&&!sG(e.xError)&&!sG(e.xError2)&&!sG(e.yError)&&!sG(e.yError2)}(n))return{orient:aV(e,t),inputType:"raw"};const i=function(e){return sG(e.x2)||sG(e.y2)}(n),r=function(e){return sG(e.xError)||sG(e.xError2)||sG(e.yError)||sG(e.yError2)}(n),o=n.x,a=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const e=n.x2,i=n.y2;if(sG(e)&&sG(i))throw new Error(`${t} cannot have both x2 and y2`);if(sG(e)){if(rG(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(sG(i)){if(rG(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,s=n.yError2;if(sG(i)&&!sG(e))throw new Error(`${t} cannot have xError2 without xError`);if(sG(s)&&!sG(r))throw new Error(`${t} cannot have yError2 without yError`);if(sG(e)&&sG(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(sG(e)){if(rG(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(sG(r)){if(rG(a))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=rV(e,u,t),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let l=[],u=[];const c=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":s.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&Tq(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)l=[{op:n,field:c,as:`extent_${c}`},{op:t,field:c,as:`center_${c}`}],u=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:`upper_${c}`},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:JB(t)},{fieldPrefix:"upper_",titlePrefix:gV(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:gV(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),l=[{op:t,field:c,as:`lower_${c}`},{op:i,field:c,as:`upper_${c}`},{op:e,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:xG({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:xG({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:xG({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Tq(function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}(e.center,e.extent)),"aggregated-upper-lower"===o?(f=[],u=[{calculate:`datum["${n.field}"]`,as:`upper_${c}`},{calculate:`datum["${c}"]`,as:`lower_${c}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],u=[{calculate:`datum["${c}"] + datum["${i.field}"]`,as:`upper_${c}`}],r?u.push({calculate:`datum["${c}"] + datum["${r.field}"]`,as:`lower_${c}`}):u.push({calculate:`datum["${c}"] - datum["${i.field}"]`,as:`lower_${c}`}));for(const e of u)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:tj(tj(e.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:u,errorBarSpecificAggregate:l,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,f,d,h,p,c,t,n),{[m]:x,["x"===m?"x2":"y2"]:_,["x"===m?"xError":"yError"]:w,["x"===m?"xError2":"yError2"]:k,...E}=r,{bins:A,timeUnits:$,aggregate:D,groupby:S,encoding:M}=XG(E,n),C=[...D,...g],F="raw"!==c?[]:S,O=eV(v,f,M,b);return{transform:[...s.transform??[],...A,...$,...0===C.length?[]:[{aggregate:C,groupby:F}],...y],groupby:F,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:M,ticksOrient:"vertical"===u?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:O}}function gV(e,t,n){return`${JB(e)} ${n} ${t}`}const yV="errorband",vV=new WG(yV,bV);function bV(e,{config:t}){e={...e,encoding:QG(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:l}=mV(e,yV,t),u=a,c=nV(u,r,i,o,t.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const p={...u.interpolate?{interpolate:u.interpolate}:{},...u.tension&&u.interpolate?{tension:u.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):u.interpolate?Tq(Cq("interpolate")):u.tension&&Tq(Cq("tension")),{...s,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:l})]}}const xV={};function _V(e,t,n){const i=new WG(e,t);xV[e]={normalizer:i,parts:n}}_V(sV,cV,["box","median","outliers","rule","ticks"]),_V(dV,pV,["ticks","rule"]),_V(yV,bV,["band","borders"]);const wV=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],kV={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},EV={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},AV=qB(kV),$V=qB(EV),DV=qB({header:1,headerRow:1,headerColumn:1,headerFacet:1}),SV=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],MV={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},CV=(qB(MV),"_vgsid_"),FV={point:{on:"click",fields:[CV],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function OV(e){return"legend"===e||!!e?.legend}function NV(e){return OV(e)&&Oe(e)}function TV(e){return!!e?.select}function zV(e){const t=[];for(const n of e||[]){if(TV(n))continue;const{expr:e,bind:i,...r}=n;if(i&&e){const n={...r,bind:i,init:e};t.push(n)}else{const n={...r,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function RV(e){return"concat"in e}function PV(e){return"vconcat"in e}function LV(e){return"hconcat"in e}function BV({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function jV(e){return Oe(e)&&void 0!==e.step}function IV(e){return e.view||e.width||e.height}const UV=qB({align:1,bounds:1,center:1,columns:1,spacing:1});function qV(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function WV(e,t){const n=HV(e,t);return jV(n)?n.step:GV}function HV(e,t){return rj(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const GV=20,VV={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:GV},mark:{color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},arc:{},area:{},bar:{binSpacing:1,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},circle:{},geoshape:{},image:{},line:{},point:{},rect:{binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:FV,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},YV=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],XV={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},JV={blue:YV[0],orange:YV[1],red:YV[2],teal:YV[3],green:YV[4],yellow:YV[5],purple:YV[6],pink:YV[7],brown:YV[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function QV(e){const t=qB(e||{}),n={};for(const i of t){const t=e[i];n[i]=RG(t)?jU(t):IU(t)}return n}const ZV=[...mH,...UG,...DV,"background","padding","legend","lineBreak","scale","style","title","view"];function KV(e={}){const{color:t,font:n,fontSize:i,selection:r,...o}=e,a=Te({},AB(VV),n?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(n):{},t?function(e={}){return{signals:[{name:"color",value:Oe(e)?{...JV,...e}:JV}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(t):{},i?function(e){return{signals:[{name:"fontSize",value:Oe(e)?{...XV,...e}:XV}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(i):{},o||{});r&&ze(a,"selection",r,!0);const s=SB(a,ZV);for(const e of["background","lineBreak","padding"])a[e]&&(s[e]=IU(a[e]));for(const e of mH)a[e]&&(s[e]=FU(a[e]));for(const e of UG)a[e]&&(s[e]=QV(a[e]));for(const e of DV)a[e]&&(s[e]=FU(a[e]));return a.legend&&(s.legend=FU(a.legend)),a.scale&&(s.scale=FU(a.scale)),a.style&&(s.style=function(e){const t=qB(e),n={};for(const i of t)n[i]=QV(e[i]);return n}(a.style)),a.title&&(s.title=FU(a.title)),a.view&&(s.view=FU(a.view)),s}const eY=new Set(["view",...fH]),tY=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],nY={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],line:["point"],tick:["bandSize","thickness"]};function iY(e,t,n,i){"view"===t&&(n="cell");const r={...i?e[t][i]:e[t],...e.style[n??t]};UB(r)||(e.style[n??t]=r),i||delete e[t]}function rY(e){return"layer"in e}class oY{map(e,t){return HH(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):LV(e)?this.mapHConcat(e,t):PV(e)?this.mapVConcat(e,t):RV(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(rY(e))return this.mapLayer(e,t);if(qG(e))return this.mapUnit(e,t);throw new Error(iq(e))}mapLayer(e,t){return{...e,layer:e.layer.map((e=>this.mapLayerOrUnit(e,t)))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map((e=>this.map(e,t)))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map((e=>this.map(e,t)))}}mapConcat(e,t){const{concat:n,...i}=e;return{...i,concat:n.map((e=>this.map(e,t)))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}}const aY={zero:1,center:1,normalize:1},sY=new Set([XW,QW,JW,nH,eH,aH,sH,KW,iH,rH]),lY=new Set([QW,JW,XW]);function uY(e){return tG(e)&&"quantitative"===nG(e)&&!e.bin}function cY(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",o="x"===t&&["bar","area"].includes(i),a=e[t],s=e[r];if(tG(a)&&tG(s))if(uY(a)&&uY(s)){if(a.stack)return t;if(s.stack)return r;const e=tG(a)&&!!a.aggregate;if(e!==(tG(s)&&!!s.aggregate))return e?t:r;if(o){if("vertical"===n)return r;if("horizontal"===n)return t}}else{if(uY(a))return t;if(uY(s))return r}else{if(uY(a)){if(o&&"vertical"===n)return;return t}if(uY(s)){if(o&&"horizontal"===n)return;return r}}}function fY(e,t){const n=dH(e)?e:{type:e},i=n.type;if(!sY.has(i))return null;const r=cY(t,"x",n)||cY(t,"theta",n);if(!r)return null;const o=t[r],a=tG(o)?mG(o,{}):void 0,s=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(r),l=[],u=new Set;if(t[s]){const e=t[s],n=tG(e)?mG(e,{}):void 0;n&&n!==a&&(l.push(s),u.add(n))}const c="x"===s?"xOffset":"yOffset",f=t[c],d=tG(f)?mG(f,{}):void 0;d&&d!==a&&(l.push(c),u.add(d));const h=qI.reduce(((e,n)=>{if("tooltip"!==n&&HG(t,n)){const i=t[n];for(const t of nt(i)){const i=EG(t);if(i.aggregate)continue;const r=mG(i,{});r&&u.has(r)||e.push({channel:n,fieldDef:i})}}return e}),[]);let p;return void 0!==o.stack?p=kt(o.stack)?o.stack?"zero":null:o.stack:lY.has(i)&&(p="zero"),p&&p in aY?YG(t)&&0===h.length?null:o?.scale?.type&&o?.scale?.type!==_W.LINEAR?(o?.stack&&Tq(function(e){return`Cannot stack non-linear scale (${e}).`}(o.scale.type)),null):sG(t[wI(r)])?(void 0!==o.stack&&Tq(`Cannot stack "${m=r}" if there is already "${m}2".`),null):(tG(o)&&o.aggregate&&!wU.has(o.aggregate)&&Tq(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannels:l,groupbyFields:u,fieldChannel:r,impute:null!==o.impute&&uH(i),stackBy:h,offset:p}):null;var m}function dY(e,t,n){const i=FU(e),r=XU("orient",i,n);if(i.orient=function(e,t,n){switch(e){case eH:case aH:case sH:case iH:case tH:case ZW:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case QW:if(tG(i)&&($U(i.bin)||tG(r)&&r.aggregate&&!i.aggregate))return"vertical";if(tG(r)&&($U(r.bin)||tG(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(tG(i)&&i.type===gW&&!AU(i.bin)||aG(i))&&tG(r)&&$U(r.bin)?"horizontal":"vertical";if(!a)return(tG(r)&&r.type===gW&&!AU(r.bin)||aG(r))&&tG(i)&&$U(i.bin)?"vertical":"horizontal"}case nH:if(o&&(!tG(i)||!$U(i.bin))&&a&&(!tG(r)||!$U(r.bin)))return;case JW:if(a)return tG(r)&&$U(r.bin)?"horizontal":"vertical";if(o)return tG(i)&&$U(i.bin)?"vertical":"horizontal";if(e===nH){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case KW:case rH:{const t=oG(i),o=oG(r);if(n)return n;if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o)return"vertical";{const e=lG(i)&&i.type===vW,t=lG(r)&&r.type===vW;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&Tq(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=XU("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:yH[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}return void 0===XU("opacity",i,n)&&(i.opacity=function(e,t){if(FB([eH,rH,aH,sH],e)&&!YG(t))return.7}(i.type,t)),void 0===XU("cursor",i,n)&&(i.cursor=function(e,t,n){return t.href||e.href||XU("href",e,n)?"pointer":e.cursor}(i,t,n)),i}function hY(e){const{point:t,line:n,...i}=e;return qB(i).length>1?i:i.type}function pY(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:SB(e[t],["point","line"])});return e}function mY(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?Oe(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?Oe(t.point)?t.point:{}:void 0}function gY(e,t={}){return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class yY{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(qG(e)){const{mark:n,encoding:i}=e,r=dH(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!mY(r,t[r.type],i);case"area":return!!mY(r,t[r.type],i)||!!gY(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:l,...u}=e,c=QG(l,i),f=dH(a)?a:{type:a},d=mY(f,i[f.type],c),h="area"===f.type&&gY(f,i[f.type]),p=[{name:s,...r?{params:r}:{},mark:hY({..."area"===f.type&&void 0===f.opacity&&void 0===f.fillOpacity?{opacity:.7}:{},...f}),encoding:SB(c,["shape"])}],m=fY(dY(f,c,i),c);let g=c;if(m){const{fieldChannel:e,offset:t}=m;g={...c,[e]:{...c[e],...t?{stack:t}:{}}}}return g=SB(g,["y2","x2"]),h&&p.push({...o?{projection:o}:{},mark:{type:"line",...DB(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&p.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...DB(f,["clip","tooltip"]),...d},encoding:g}),n({...u,layer:p},{...t,config:pY(i)})}}function vY(e,t){return t?qH(e)?EY(e,t):_Y(e,t):e}function bY(e,t){return t?EY(e,t):e}function xY(e,t,n){const i=t[e];return function(e){return e&&!St(e)&&"repeat"in e}(i)?i.repeat in n?{...t,[e]:n[i.repeat]}:void Tq(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t}function _Y(e,t){if(void 0!==(e=xY("field",e,t))){if(null===e)return null;if(VH(e)&&IH(e.sort)){const n=xY("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function wY(e,t){if(tG(e))return _Y(e,t);{const n=xY("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function kY(e,t){if(!sG(e)){if(eG(e)){const n=wY(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=wY(e,t);if(n)return n;if(ZH(e))return{condition:e.condition}}}function EY(e,t){const n={};for(const i in e)if(yt(e,i)){const r=e[i];if(Fe(r))n[i]=r.map((e=>kY(e,t))).filter((e=>e));else{const e=kY(r,t);void 0!==e&&(n[i]=e)}}return n}class AY{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(qG(e)){const{encoding:t,mark:n}=e;if("line"===n||dH(n)&&"line"===n.type)for(const e of vI){const n=t[xI(e)];if(t[e]&&(tG(n)&&!$U(n.bin)||iG(n)))return!0}}return!1}run(e,t,n){const{encoding:i,mark:r}=e;var o,a;return Tq((o=!!i.x2,a=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${o&&a?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),n({...e,mark:Oe(r)?{...r,type:"rule"}:"rule"},t)}}function $Y({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...qB(e),...qB(t)]);for(const o of r){const r=t[o],a=e[o];if(sG(r)){const e={...a,...r};i[o]=e}else eG(r)?i[o]={...r,condition:{...a,...r.condition}}:r||null===r?i[o]=r:(n||uG(a)||TU(a)||sG(a)||Fe(a))&&(i[o]=a)}}else i=t;return!i||UB(i)?void 0:i}function DY(e){const{parentProjection:t,projection:n}=e;return t&&n&&Tq(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${pj(t)} is overridden by a child projection ${pj(n)}.`}({parentProjection:t,projection:n})),n??t}function SY(e){return"filter"in e}function MY(e){return void 0!==e?.stop}function CY(e){return"lookup"in e}function FY(e){return"pivot"in e}function OY(e){return"density"in e}function NY(e){return"quantile"in e}function TY(e){return"regression"in e}function zY(e){return"loess"in e}function RY(e){return"sample"in e}function PY(e){return"window"in e}function LY(e){return"joinaggregate"in e}function BY(e){return"flatten"in e}function jY(e){return"calculate"in e}function IY(e){return"bin"in e}function UY(e){return"impute"in e}function qY(e){return"timeUnit"in e}function WY(e){return"aggregate"in e}function HY(e){return"stack"in e}function GY(e){return"fold"in e}function VY(e){return"extent"in e&&!("density"in e)}function YY(e,t){const{transform:n,...i}=e;if(n){const e=n.map((e=>{if(SY(e))return{filter:QY(e,t)};if(IY(e)&&DU(e.bin))return{...e,bin:JY(e.bin)};if(CY(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}));return{...i,transform:e}}return e}function XY(e,t){const n=AB(e);if(tG(n)&&DU(n.bin)&&(n.bin=JY(n.bin)),cG(n)&&n.scale?.domain?.selection){const{selection:e,...t}=n.scale.domain;n.scale.domain={...t,...e?{param:e}:{}}}if(ZH(n))if(Fe(n.condition))n.condition=n.condition.map((e=>{const{selection:n,param:i,test:r,...o}=e;return i?e:{...o,test:QY(e,t)}}));else{const{selection:e,param:i,test:r,...o}=XY(n.condition,t);n.condition=i?n.condition:{...o,test:QY(n.condition,t)}}return n}function JY(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function QY(e,t){const n=e=>EB(e,(e=>{var n;const i={param:e,empty:t.emptySelections[e]??!0};return(n=t.selectionPredicates)[e]??(n[e]=[]),t.selectionPredicates[e].push(i),i}));return e.selection?n(e.selection):EB(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class ZY extends oY{map(e,t){const n=t.selections??[];if(e.params&&!qG(e)){const t=[];for(const i of e.params)TV(i)?n.push(i):t.push(i);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,t){const n=t.selections;if(!n||!n.length)return e;const i=(t.path??[]).concat(e.name),r=[];for(const t of n)if(t.views&&t.views.length)for(const n of t.views)(St(n)&&(n===e.name||i.includes(n))||Fe(n)&&n.map((e=>i.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&r.push(t);else r.push(t);return r.length&&(e.params=r),e}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=ZY.prototype[e];ZY.prototype[e]=function(e,n){return t.call(this,e,KY(e,n))}}function KY(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function eX(e,t){void 0===t&&(t=KV(e.config));const n=function(e,t={}){const n={config:t};return iX.map(tX.map(nX.map(e,n),n),n)}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=qG(e)||rY(e),a={};o?"container"==i&&"container"==r?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==r&&(a.type="fit-y",a.contains="padding"):("container"==i&&(Tq(oq("width")),i=void 0),"container"==r&&(Tq(oq("height")),r=void 0));const s={type:"pad",...a,...n?rX(n.autosize):{},...rX(e.autosize)};if("fit"!==s.type||o||(Tq(rq),s.type="pad"),"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&Tq(aq("width")),"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&Tq(aq("height")),!hj(s,{type:"pad"}))return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const tX=new class extends oY{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[lV,hV,vV,new yY,new AY]}map(e,t){if(qG(e)){const n=HG(e.encoding,mj),i=HG(e.encoding,gj),r=HG(e.encoding,yj);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=bY(e.encoding,t.repeater),o={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{},...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const a=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,a);return o}mapRepeat(e,t){return function(e){return!Fe(e.repeat)&&e.repeat.layer}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:o,column:a,layer:s}=n,{repeater:l={},repeaterPrefix:u=""}=t;return o||a?this.mapRepeat({...e,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map((e=>{const n={...l,layer:e},r=`${(i.name?`${i.name}_`:"")+u}child__layer_${VB(e)}`,o=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return o.name=r,o}))}}mapNonLayerRepeat(e,t){const{repeat:n,spec:i,data:r,...o}=e;!Fe(n)&&e.columns&&(e=SB(e,["columns"]),Tq(dq("repeat")));const a=[],{repeater:s={},repeaterPrefix:l=""}=t,u=!Fe(n)&&n.row||[s?s.row:null],c=!Fe(n)&&n.column||[s?s.column:null],f=Fe(n)&&n||[s?s.repeat:null];for(const e of f)for(const r of u)for(const o of c){const u={repeat:e,row:r,column:o,layer:s.layer},c=(i.name?`${i.name}_`:"")+l+"child__"+(Fe(n)?`${VB(e)}`:(n.row?`row_${VB(r)}`:"")+(n.column?`column_${VB(o)}`:"")),f=this.map(i,{...t,repeater:u,repeaterPrefix:c});f.name=c,a.push(SB(f,["data"]))}const d=Fe(n)?e.columns:n.column?n.column.length:1;return{data:i.data??r,align:"all",...o,columns:d,concat:a}}mapFacet(e,t){const{facet:n}=e;return qH(n)&&e.columns&&(e=SB(e,["columns"]),Tq(dq("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=DY({parentProjection:o,projection:i}),l=$Y({parentEncoding:r,encoding:bY(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...l?{encoding:l}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:l,height:u,view:c,params:f,encoding:d,...h}=e,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),g=bY(o,t.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...u?{height:u}:{},...c?{view:c}:{},...l?{projection:l}:{},mark:a,encoding:g,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&Tq(`Facet encoding dropped as ${(o=[...n?[mj]:[],...i?[gj]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[mj,gj]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...l}=i;t[n]=l;for(const e of["align","center","spacing"])void 0!==i[e]&&(a[e]??(a[e]={}),a[e][n]=i[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:vY(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...o?{columns:o}:{}}}}var o}mapLayer(e,{parentEncoding:t,parentProjection:n,...i}){const{encoding:r,projection:o,...a}=e,s={...i,parentEncoding:$Y({parentEncoding:t,encoding:r,layer:!0}),parentProjection:DY({parentProjection:n,projection:o})};return super.mapLayer({...a,...e.name?{name:[s.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},s)}},nX=new class extends oY{map(e,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),e=YY(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=YY(e,t)).encoding){const n={};for(const[i,r]of HB(e.encoding))n[i]=XY(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:HB(n).map((([e,n])=>{const{init:i,bind:r,empty:o,...a}=n;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),t.emptySelections[e]="none"!==o;for(const n of WB(t.selectionPredicates[e]??{}))n.empty="none"!==o;return{name:e,value:i,select:a,bind:r}}))}:e}},iX=new ZY;function rX(e){return St(e)?{type:e}:e??{}}const oX=["background","padding"];function aX(e,t){const n={};for(const t of oX)e&&void 0!==e[t]&&(n[t]=IU(e[t]));return t&&(n.params=e.params),n}class sX{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new sX(AB(this.explicit),AB(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return rj(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,{value:t,explicit:n}){void 0!==t&&this.set(e,t,n)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){void 0!==t[e]?this.set(e,t[e],!0):void 0!==n[e]&&this.set(e,n[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of qB(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function lX(e){return{explicit:!0,value:e}}function uX(e){return{explicit:!1,value:e}}function cX(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:fX(t,n,i,r)}}function fX(e,t,n,i){return e.explicit&&t.explicit&&Tq(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${pj(n)} and ${pj(i)}). Using ${pj(n)}.`}(n,i,e.value,t.value)),e}function dX(e,t,n,i,r=fX){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:hj(e.value,t.value)?e:r(e,t,n,i)}class hX extends sX{constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function pX(e){return"url"in e}function mX(e){return"values"in e}function gX(e){return"name"in e&&!pX(e)&&!mX(e)&&!yX(e)}function yX(e){return e&&(vX(e)||bX(e)||xX(e))}function vX(e){return"sequence"in e}function bX(e){return"sphere"in e}function xX(e){return"graticule"in e}var _X;function wX(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=ej(r.field),r}function kX(e,t=!0,n=be){if(Fe(e)){const i=e.map((e=>kX(e,t,n)));return t?`[${i.join(", ")}]`:i}return zq(e)?n(t?Iq(e):function(e){const t=jq(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(pj(e)):e}function EX(e,t){for(const n of WB(e.component.selection??{})){const i=n.name;let r=`${i}${XJ}, ${"global"===n.resolve?"true":`{unit: ${KJ(e)}}`}`;for(const i of ZJ)i.defined(n)&&(i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(r=i.modifyExpr(e,n,r)));t.push({name:i+JJ,on:[{events:{signal:n.name+XJ},update:`modify(${Pt(n.name+YJ)}, ${r})`}]})}return DX(t)}function AX(e,t){if(e.component.selection&&qB(e.component.selection).length){const n=Pt(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:JT("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return DX(t)}function $X(e,t){for(const n of WB(e.component.selection??{}))for(const i of ZJ)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function DX(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}!function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup"}(_X||(_X={}));class SX{constructor(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.includes(e)?Tq("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class MX extends SX{clone(){const e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${aj()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function CX(e){return void 0!==e.as}function FX(e){return`${e}_end`}class OX extends SX{clone(){return new OX(null,AB(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{const{field:r,timeUnit:o}=n;if(o){let a;if(Wq(o)){if(FK(t)){const{mark:e,markDef:i,config:s}=t,l=YH({fieldDef:n,markDef:i,config:s});(cH(e)||l)&&(a={timeUnit:Zq(o),field:r})}}else a={as:mG(n,{forAs:!0}),field:r,timeUnit:o};if(FK(t)){const{mark:e,markDef:r,config:o}=t,s=YH({fieldDef:n,markDef:r,config:o});cH(e)&&GI(i)&&.5!==s&&(a.rectBandPosition=s)}a&&(e[MB(a)]=a)}return e}),{});return UB(n)?null:new OX(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:Zq(n)};return new OX(e,{[MB(r)]:r})}merge(e){this.timeUnits={...this.timeUnits};for(const t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of HB(this.timeUnits)){const r=CX(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.timeUnits=t}producedFields(){return new Set(WB(this.timeUnits).map((e=>CX(e)?e.as:FX(e.field))))}dependentFields(){return new Set(WB(this.timeUnits).map((e=>e.field)))}hash(){return`TimeUnit ${MB(this.timeUnits)}`}assemble(){const e=[];for(const t of WB(this.timeUnits)){const{rectBandPosition:n}=t,i=Zq(t.timeUnit);if(CX(t)){const{field:r,as:o}=t,{unit:a,utc:s,...l}=i,u=[o,`${o}_end`];e.push({field:ej(r),type:"timeunit",...a?{units:Yq(a)}:{},...s?{timezone:"utc"}:{},...l,as:u}),e.push(...RX(u,n,i))}else if(t){const{field:r}=t,o=r.replaceAll("\\.","."),a=zX({timeUnit:i,field:o}),s=FX(o);e.push({type:"formula",expr:a,as:s}),e.push(...RX([o,s],n,i))}}return e}}const NX="offsetted_rect_start",TX="offsetted_rect_end";function zX({timeUnit:e,field:t,reverse:n}){const{unit:i,utc:r}=e,o=Xq(i),{part:a,step:s}=tW(o,e.step);return`${r?"utcOffset":"timeOffset"}('${a}', datum['${t}'], ${n?-s:s})`}function RX([e,t],n,i){if(void 0!==n&&.5!==n){const r=`datum['${e}']`,o=`datum['${t}']`;return[{type:"formula",expr:PX([zX({timeUnit:i,field:e,reverse:!0}),r],n+.5),as:`${e}_${NX}`},{type:"formula",expr:PX([r,o],n+.5),as:`${e}_${TX}`}]}return[]}function PX([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const LX="_tuple_fields";class BX{constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const jX={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??(t.project=new BX),o={},a={},s=new Set,l=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=VB(`${i}_${n}`);for(let e=1;s.has(r);e++)r=VB(`${i}_${n}_${e}`);return s.add(r),{[t]:r}},u=t.type,c=e.config.selection[u],f=void 0!==n.value?nt(n.value):null;let{fields:d,encodings:h}=Oe(n.select)?n.select:{};if(!d&&!h&&f)for(const e of f)if(Oe(e))for(const t of qB(e))gI[t]?(h||(h=[])).push(t):"interval"===u?(Tq('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),h=c.encodings):(d??(d=[])).push(t);d||h||(h=c.encodings,"fields"in c&&(d=c.fields));for(const t of h??[]){const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){Tq(cq(t,n.aggregate));continue}if(!i){Tq(uq(t));continue}if(n.timeUnit&&!Wq(n.timeUnit)){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};a[MB(r)]=r}if(!o[i]){const a={field:i,channel:t,type:"interval"===u&&cU(t)&&NW(e.getScaleComponent(t).get("type"))?"R":n.bin?"R-RE":"E",index:r.items.length};a.signals={...l(a,"data"),...l(a,"visual")},r.items.push(o[i]=a),r.hasField[i]=o[i],r.hasSelectionId=r.hasSelectionId||i===CV,tI(t)?(a.geoChannel=t,a.channel=eI(t),r.hasChannel[a.channel]=o[i]):r.hasChannel[t]=o[i]}}else Tq(uq(t))}for(const e of d??[]){if(r.hasField[e])continue;const t={type:"E",field:e,index:r.items.length};t.signals={...l(t,"data")},r.items.push(t),r.hasField[e]=t,r.hasSelectionId=r.hasSelectionId||e===CV}f&&(t.init=f.map((e=>r.items.map((t=>Oe(e)?void 0!==e[t.geoChannel||t.channel]?e[t.geoChannel||t.channel]:e[t.field]:e))))),UB(a)||(r.timeUnit=new OX(null,a))},signals:(e,t,n)=>{const i=t.name+LX;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(wX)})}},IX=jX,UX={defined:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!cU(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;o&&NW(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):Tq("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter((e=>0===n.filter((t=>t.name===e.signals.data)).length));if(!e.parent||HX(e)||0===i.length)return n;const r=n.filter((e=>e.name===t.name))[0];let o=r.update;if(o.indexOf(QJ)>=0)r.update=`{${i.map((e=>`${Pt(ej(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of i){const t=`${Pt(ej(e.field))}: ${e.signals.data}`;o.includes(t)||(o=`${o.substring(0,o.length-1)}, ${t}}`)}r.update=o}return n.concat(i.map((e=>({name:e.signals.data}))))},signals:(e,t,n)=>{if(e.parent&&!HX(e))for(const e of t.scales){const t=n.filter((t=>t.name===e.signals.data))[0];t.push="outer",delete t.value,delete t.update}return n}},qX=UX;function WX(e,t){return`domain(${Pt(e.scaleName(t))})`}function HX(e){return e.parent&&TK(e.parent)&&(!e.parent.parent??HX(e.parent.parent))}const GX="_brush",VX="_scale_trigger",YX="geo_interval_init_tick",XX="_init",JX={defined:e=>"interval"===e.type,parse:(e,t,n)=>{var i;if(e.hasProjection){const e={...Oe(n.select)?n.select:{}};e.fields=[CV],e.encodings||(e.encodings=n.value?qB(n.value):[Mj,Sj]),n.select={type:"interval",...e}}if(t.translate&&!qX.defined(t)){const e=`!event.item || event.item.mark.name !== ${Pt(t.name+GX)}`;for(const n of t.events){if(!n.between){Tq(`${n} is not an ordered event stream for interval selections.`);continue}const t=nt((i=n.between[0]).filter??(i.filter=[]));t.indexOf(e)<0&&t.push(e)}}},signals:(e,t,n)=>{const i=t.name,r=i+XJ,o=WB(t.project.hasChannel).filter((e=>e.channel===vj||e.channel===bj)),a=t.init?t.init[0]:null;if(n.push(...o.reduce(((n,i)=>n.concat(function(e,t,n,i){const r=!e.hasProjection,o=n.channel,a=n.signals.visual,s=Pt(r?e.scaleName(o):e.projectionName()),l=e=>`scale(${s}, ${e})`,u=e.getSizeSignalRef(o===vj?"width":"height").signal,c=`${o}(unit)`,f=t.events.reduce(((e,t)=>[...e,{events:t.between[0],update:`[${c}, ${c}]`},{events:t,update:`[${a}[0], clamp(${c}, 0, ${u})]`}]),[]);if(r){const r=n.signals.data,u=qX.defined(t),c=e.getScaleComponent(o),d=c?c.get("type"):void 0,h=i?{init:kX(i,!0,l)}:{value:[]};return f.push({events:{signal:t.name+VX},update:NW(d)?`[${l(`${r}[0]`)}, ${l(`${r}[1]`)}]`:"[0, 0]"}),u?[{name:r,on:[]}]:[{name:a,...h,on:f},{name:r,...i?{init:kX(i)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${s}, ${a})`}]}]}{const e=o===vj?0:1,n=t.name+XX;return[{name:a,...i?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:f}]}}(e,t,i,a&&a[i.index]))),[])),e.hasProjection){const s=Pt(e.projectionName()),l=e.projectionName()+"_center",{x:u,y:c}=t.project.hasChannel,f=u&&u.signals.visual,d=c&&c.signals.visual,h=u?a&&a[u.index]:`${l}[0]`,p=c?a&&a[c.index]:`${l}[1]`,m=t=>e.getSizeSignalRef(t).signal,g=`[[${f?f+"[0]":"0"}, ${d?d+"[0]":"0"}],[${f?f+"[1]":m("width")}, ${d?d+"[1]":m("height")}]]`;if(a&&(n.unshift({name:i+XX,init:`[scale(${s}, [${u?h[0]:h}, ${c?p[0]:p}]), scale(${s}, [${u?h[1]:h}, ${c?p[1]:p}])]`}),!u||!c)){n.find((e=>e.name===l))||n.unshift({name:l,update:`invert(${s}, [${m("width")}/2, ${m("height")}/2])`})}const y=`vlSelectionTuples(intersect(${g}, {markname: ${Pt(e.getName("marks"))}}, unit.mark), {unit: ${KJ(e)}})`,v=o.map((e=>e.signals.visual));return n.concat({name:r,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...a?[{signal:YX}]:[]],update:y}]})}{if(!qX.defined(t)){const t=i+VX,r=o.map((t=>{const n=t.channel,{data:i,visual:r}=t.signals,o=Pt(e.scaleName(n)),a=NW(e.getScaleComponent(n).get("type"))?"+":"";return`(!isArray(${i}) || (${a}invert(${o}, ${r})[0] === ${a}${i}[0] && ${a}invert(${o}, ${r})[1] === ${a}${i}[1]))`}));r.length&&n.push({name:t,value:{},on:[{events:o.map((t=>({scale:e.scaleName(t.channel)}))),update:r.join(" && ")+` ? ${t} : {}`}]})}const s=o.map((e=>e.signals.data)),l=`unit: ${KJ(e)}, fields: ${i+LX}, values`;return n.concat({name:r,...a?{init:`{${l}: ${kX(a)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${l}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(FK(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===YX)).length||n.unshift({name:YX,value:null,on:[{events:"timer{1}",update:`${YX} === null ? {} : ${YX}`}]})}return n},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,a=r?.signals.visual,s=o?.signals.visual,l=`data(${Pt(t.name+YJ)})`;if(qX.defined(t)||!r&&!o)return n;const u={x:void 0!==r?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${s}[0]`}:{value:0},x2:void 0!==r?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${s}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const t of qB(u))u[t]=[{test:`${l}.length && ${l}[0].unit === ${KJ(e)}`,...u[t]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=qB(h).reduce(((e,t)=>(e[t]=[{test:[void 0!==r&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${s}[0] !== ${s}[1]`].filter((e=>e)).join(" && "),value:h[t]},{value:null}],e)),{});return[{name:`${i+GX}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:u}},...n,{name:i+GX,type:"rect",clip:!0,encode:{enter:{...d?{cursor:{value:d}}:{},fill:{value:"transparent"}},update:{...u,...p}}}]}},QX=JX,ZX={defined:e=>"point"===e.type,signals:(e,t,n)=>{const i=t.name,r=i+LX,o=t.project,a="(item().isVoronoi ? datum.datum : datum)",s=WB(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+GX):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),l="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let u=`unit: ${KJ(e)}, `;t.project.hasSelectionId?u+=`${CV}: ${a}[${Pt(CV)}]`:u+=`fields: ${r}, values: [${o.items.map((t=>{const n=e.fieldDef(t.channel);return n?.bin?`[${a}[${Pt(e.vgField(t.channel,{}))}], ${a}[${Pt(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${a}[${Pt(t.field)}]`})).join(", ")}]`;const c=t.events;return n.concat([{name:i+XJ,on:c?[{events:c,update:`${l} ? {${u}} : null`,force:!0}]:[]}])}},KX=ZX;function eJ(e,t,n,i){const r=ZH(t)&&t.condition,o=i(t);if(r){const t=nt(r).map((t=>{const n=i(t);if(function(e){return e.param}(t)){const{param:i,empty:r}=t;return{test:aQ(e,{param:i,empty:r}),...n}}return{test:lQ(e,t.test),...n}}));return{[n]:[...t,...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function tJ(e,t="text"){const n=e.encoding[t];return eJ(e,n,t,(t=>nJ(t,e.config)))}function nJ(e,t,n="datum"){if(e){if(uG(e))return qU(e.value);if(sG(e)){const{format:i,formatType:r}=kG(e);return SH({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function iJ(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,a=n.tooltip;if(Fe(a))return{tooltip:oJ({tooltip:a},o,r,t)};{const s=t.reactiveGeom?"datum.datum":"datum";return eJ(e,a,"tooltip",(e=>{const a=nJ(e,r,s);if(a)return a;if(null===e)return;let l=XU("tooltip",i,r);return!0===l&&(l={content:"encoding"}),St(l)?{value:l}:Oe(l)?TU(l)?l:"encoding"===l.content?oJ(n,o,r,t):{signal:s}:void 0}))}}function rJ(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},o={},a=i?"datum.datum":"datum",s=[];function l(n,i){const l=xI(i),u=lG(n)?n:{...n,type:e[l].type},c=nt(u.title||wG(u,r)).join(", ").replaceAll(/"/g,'\\"');let f;if(GI(i)){const t="x"===i?"x2":"y2",n=EG(e[t]);if($U(u.bin)&&n){const e=mG(u,{expr:a}),i=mG(n,{expr:a}),{format:s,formatType:l}=kG(u);f=RH(e,i,s,l,r),o[t]=!0}}if((GI(i)||i===$j||i===Ej)&&t&&t.fieldChannel===i&&"normalize"===t.offset){const{format:e,formatType:t}=kG(u);f=SH({fieldOrDatumDef:u,format:e,formatType:t,expr:a,config:r,normalizeStack:!0}).signal}f??(f=nJ(u,r,a).signal),s.push({channel:i,key:c,value:f})}ZG(e,((e,t)=>{tG(e)?l(e,t):KH(e)&&l(e.condition,t)}));const u={};for(const{channel:e,key:t,value:n}of s)o[e]||u[t]||(u[t]=n);return u}function oJ(e,t,n,{reactiveGeom:i}={}){const r=rJ(e,t,n,{reactiveGeom:i}),o=HB(r).map((([e,t])=>`"${e}": ${t}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function aJ(e){const{markDef:t,config:n}=e,i=XU("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...sJ(e),...lJ(e)}}function sJ(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=XU("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:t in LU?{}:{ariaRoleDescription:{value:t}}}function lJ(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return eJ(e,o,"description",(t=>nJ(t,e.config)));const a=XU("description",n,i);if(null!=a)return{description:qU(a)};if(!1===i.aria)return{};const s=rJ(t,r,i);return UB(s)?void 0:{description:{signal:HB(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function uJ(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:l}=n;void 0===s&&(l??(l=XU(e,i,o,{vgChannel:a,ignoreVgConfig:!0})),void 0!==l&&(s=qU(l)));const u=r[e];return eJ(t,u,a??e,(n=>kH({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:s})))}function cJ(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??XU("filled",n,r),s=FB(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,l=XU(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,u=XU(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],c=a?"fill":"stroke",f={...l?{fill:qU(l)}:{},...u?{stroke:qU(u)}:{}};return n.color&&(a?n.fill:n.stroke)&&Tq(yq("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...uJ("color",e,{vgChannel:c,defaultValue:a?l:u}),...uJ("fill",e,{defaultValue:i.fill?l:void 0}),...uJ("stroke",e,{defaultValue:i.stroke?u:void 0})}}function fJ(e){const{encoding:t,mark:n}=e,i=t.order;return!uH(n)&&uG(i)?eJ(e,i,"zindex",(e=>qU(e.value))):{}}function dJ({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const o=`${e}Offset`,a=t[o],s=n[o];if(("xOffset"===o||"yOffset"===o)&&s)return{offsetType:"encoding",offset:kH({channel:o,channelDef:s,markDef:t,config:i?.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:qU(a),bandPosition:r})};const l=t[o];return l?{offsetType:"visual",offset:l}:{}}function hJ(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,l=r[e],u=r[wI(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=dJ({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),p=pJ({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!l&&GI(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:a}=e;if(sG(n)&&r&&t===r.fieldChannel){if(tG(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return wH({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return _H(n,i,{suffix:"end"},{offset:o})}return vH(e)}({channel:e,channelDef:l,channel2Def:u,markDef:o,config:a,scaleName:c,scale:f,stack:s,offset:d,defaultRef:p,bandPosition:"encoding"===h?0:void 0});return m?{[i||e]:m}:void 0}function pJ({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=xI(n),l=_I(n),u=XU(n,o,a,{vgChannel:l});if(void 0!==u)return EH(n,u);switch(t){case"zeroOrMin":case"zeroOrMax":if(i){const e=r.get("type");if(FB([_W.LOG,_W.TIME,_W.UTC],e));else if(r.domainDefinitelyIncludesZero())return{scale:i,value:0}}if("zeroOrMin"===t)return"y"===s?{field:{group:"height"}}:{value:0};switch(s){case"radius":return{signal:`min(${e.width.signal},${e.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":return{...e[kI(n)],mult:.5}}}}const mJ={left:"x",center:"xc",right:"x2"},gJ={top:"y",middle:"yc",bottom:"y2"};function yJ(e,t,n,i="middle"){if("radius"===e||"theta"===e)return _I(e);const r="x"===e?"align":"baseline",o=XU(r,t,n);let a;return TU(o)?(Tq(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?mJ[a||("top"===i?"left":"center")]:gJ[a||i]}function vJ(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?bJ(e,t,{defaultPos:n,defaultPos2:i}):hJ(e,t,{defaultPos:n})}function bJ(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=wI(e),s=kI(e),l=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,l=xI(n),u=kI(n),c=_I(n),f=i[l],d=e.scaleName(l),h=e.getScaleComponent(l),{offset:p}=dJ(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:l,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=kI(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[c]:{field:e.getName(n)}}}const m=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:l,defaultRef:u}){return sG(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0)?_H(t,o,{suffix:"start"},{offset:l}):vH({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:l,defaultRef:u})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:h,stack:a,offset:p,defaultRef:void 0});return void 0!==m?{[c]:m}:xJ(n,o)||xJ(n,{[n]:QU(n,o,s.style),[u]:QU(u,o,s.style)})||xJ(n,s[r])||xJ(n,s.mark)||{[c]:pJ({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}(t,i,a);return{...hJ(e,t,{defaultPos:n,vgChannel:l[s]?yJ(e,r,o):_I(e)}),...l}}function xJ(e,t){const n=kI(e),i=_I(e);if(void 0!==t[i])return{[i]:EH(e,t[i])};if(void 0!==t[e])return{[i]:EH(e,t[e])};if(t[n]){const i=t[n];if(!gH(i))return{[n]:EH(e,i)};Tq(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function _J(e,t){const{config:n,encoding:i,markDef:r}=e,o=r.type,a=wI(t),s=kI(t),l=i[t],u=i[a],c=e.getScaleComponent(t),f=c?c.get("type"):void 0,d=r.orient,h=i[s]??i.size??XU("size",r,n,{vgChannel:s}),p=EI(t),m="bar"===o&&("x"===t?"vertical"===d:"horizontal"===d);return!tG(l)||!(AU(l.bin)||$U(l.bin)||l.timeUnit&&!u)||h&&!gH(h)||i[p]||OW(f)?(sG(l)&&OW(f)||m)&&!u?function(e,t,n){const{markDef:i,encoding:r,config:o,stack:a}=n,s=i.orient,l=n.scaleName(t),u=n.getScaleComponent(t),c=kI(t),f=wI(t),d=EI(t),h=n.scaleName(d),p=n.getScaleComponent(AI(t)),m="horizontal"===s&&"y"===t||"vertical"===s&&"x"===t;let g;(r.size||i.size)&&(m?g=uJ("size",n,{vgChannel:c,defaultRef:qU(i.size)}):Tq(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(i.type)));const y=!!g,v=XH({channel:t,fieldDef:e,markDef:i,config:o,scaleType:(u||p)?.get("type"),useVlSizeChannel:m});g=g||{[c]:wJ(c,h||l,p||u,o,v,!!e,i.type)};const b=yJ(t,i,o,"band"===(u||p)?.get("type")&&gH(v)&&!y?"top":"middle"),x="xc"===b||"yc"===b,{offset:_,offsetType:w}=dJ({channel:t,markDef:i,encoding:r,model:n,bandPosition:x?.5:0}),k=vH({channel:t,channelDef:e,markDef:i,config:o,scaleName:l,scale:u,stack:a,offset:_,defaultRef:pJ({model:n,defaultPos:"mid",channel:t,scaleName:l,scale:u}),bandPosition:x?"encoding"===w?0:.5:TU(v)?{signal:`(1-${v})/2`}:gH(v)?(1-v.band)/2:0});if(c)return{[b]:k,...g};{const e=_I(f),t=g[c],n=_?{...t,offset:_}:t;return{[b]:k,[e]:Fe(k)?[k[0],{...k[1],offset:n}]:{...k,offset:n}}}}(l,t,e):bJ(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:e,fieldDef2:t,channel:n,model:i}){const{config:r,markDef:o,encoding:a}=i,s=i.getScaleComponent(n),l=i.scaleName(n),u=s?s.get("type"):void 0,c=s.get("reverse"),f=XH({channel:n,fieldDef:e,markDef:o,config:r,scaleType:u}),d=i.component.axes[n]?.[0],h=d?.get("translate")??.5,p=GI(n)?XU("binSpacing",o,r)??0:0,m=wI(n),g=_I(n),y=_I(m),v=JU("minBandSize",o,r),{offset:b}=dJ({channel:n,markDef:o,encoding:a,model:i,bandPosition:0}),{offset:x}=dJ({channel:m,markDef:o,encoding:a,model:i,bandPosition:0}),_=function({scaleName:e,fieldDef:t}){const n=mG(t,{expr:"datum"});return`abs(scale("${e}", ${mG(t,{expr:"datum",suffix:"end"})}) - scale("${e}", ${n}))`}({fieldDef:e,scaleName:l}),w=kJ(n,p,c,h,b,v,_),k=kJ(m,p,c,h,x??b,v,_),E=TU(f)?{signal:`(1-${f.signal})/2`}:gH(f)?(1-f.band)/2:.5,A=YH({fieldDef:e,fieldDef2:t,markDef:o,config:r});if(AU(e.bin)||e.timeUnit){const t=e.timeUnit&&.5!==A;return{[y]:EJ({fieldDef:e,scaleName:l,bandPosition:E,offset:k,useRectOffsetField:t}),[g]:EJ({fieldDef:e,scaleName:l,bandPosition:TU(E)?{signal:`1-${E.signal}`}:1-E,offset:w,useRectOffsetField:t})}}if($U(e.bin)){const n=_H(e,l,{},{offset:k});if(tG(t))return{[y]:n,[g]:_H(t,l,{},{offset:w})};if(DU(e.bin)&&e.bin.step)return{[y]:n,[g]:{signal:`scale("${l}", ${mG(e,{expr:"datum"})} + ${e.bin.step})`,offset:w}}}Tq(Fq(m))}({fieldDef:l,fieldDef2:u,channel:t,model:e})}function wJ(e,t,n,i,r,o,a){if(gH(r)){if(!n)return{mult:r.band,field:{group:e}};{const e=n.get("type");if("band"===e){let e=`bandwidth('${t}')`;1!==r.band&&(e=`${r.band} * ${e}`);const n=JU("minBandSize",{type:a},i);return{signal:n?`max(${GU(n)}, ${e})`:e}}1!==r.band&&(Tq(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),r=void 0)}}else{if(TU(r))return r;if(r)return{value:r}}if(n){const e=n.get("range");if(zU(e)&&$t(e.step))return{value:e.step-2}}if(!o){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r}=i.scale,o=rj(t,"bar"===a?n:r);if(TU(o))return{signal:`(1 - (${o.signal})) * ${e}`};if($t(o))return{signal:`${1-o} * ${e}`}}return{value:WV(i.view,e)-2}}function kJ(e,t,n,i,r,o,a){if(Zj(e))return 0;const s="x"===e||"y2"===e,l=s?-t/2:t/2;if(TU(n)||TU(r)||TU(i)||o){const e=GU(n),t=GU(r),u=GU(i),c=GU(o),f=o?`(${a} < ${c} ? ${s?"":"-"}0.5 * (${c} - (${a})) : ${l})`:l;return{signal:(u?`${u} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${f})`:f)}}return r=r||0,i+(n?-r-l:+r+l)}function EJ({fieldDef:e,scaleName:t,bandPosition:n,offset:i,useRectOffsetField:r}){return wH({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i,...r?{startSuffix:NX,endSuffix:TX}:{}})}const AJ=new Set(["aria","width","height"]);function $J(e,t){const{fill:n,stroke:i}="include"===t.color?cJ(e):{};return{...SJ(e.markDef,t),...DJ(e,"fill",n),...DJ(e,"stroke",i),...uJ("opacity",e),...uJ("fillOpacity",e),...uJ("strokeOpacity",e),...uJ("strokeWidth",e),...uJ("strokeDash",e),...fJ(e),...iJ(e),...tJ(e,"href"),...aJ(e)}}function DJ(e,t,n){const{config:i,mark:r,markDef:o}=e;if("hide"===XU("invalid",o,i)&&n&&!uH(r)){const i=function(e,{invalid:t=!1,channels:n}){const i=n.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&NW(r)&&(t[o]=!0)}return t}),{}),r=qB(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>xH(e,t))).join(` ${e} `)}}(e,{invalid:!0,channels:uU});if(i)return{[t]:[{test:i,value:null},...nt(n)]}}return n?{[t]:n}:{}}function SJ(e,t){return PU.reduce(((n,i)=>(AJ.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=qU(e[i])),n)),{})}function MJ(e){const{config:t,markDef:n}=e;if(XU("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const i=n.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});o&&NW(r)&&(t[o]=!0)}return t}),{}),r=qB(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>xH(e,t))).join(` ${e} `)}}(e,{channels:HI});if(t)return{defined:{signal:t}}}return{}}function CJ(e,t){if(void 0!==t)return{[e]:qU(t)}}const FJ="voronoi",OJ={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(FJ)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(uH(o))return Tq(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(FJ),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...iJ(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let s=0,l=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.indexOf(FJ)>=0&&(l=!0)})),l||n.splice(s+1,0,a),n}},NJ=OJ,TJ={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!OV(e.bind),parse:(e,t,n)=>tQ(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,a=t.init&&t.init[0],s=NJ.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const l=VB(`${i}_${e.field}`);n.filter((e=>e.name===l)).length||n.unshift({name:l,...a?{init:kX(a[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${Pt(e.field)}] : null`}]:[],bind:o[e.field]??o[e.channel]??o})})),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.filter((e=>e.name===i+XJ))[0],a=i+LX,s=r.items.map((e=>VB(`${i}_${e.field}`))),l=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${l} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},zJ=TJ,RJ="_toggle",PJ={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+RJ,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+XJ,i=t.name+RJ;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${KJ(e)}}, `)+`${i} ? ${n} : null`}},LJ={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t)=>{t.clear&&(t.clear=St(t.clear)?JT(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(zJ.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===VB(`${t.name}_${e.field}`)));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)for(const e of t.project.items){const t=n.findIndex((t=>t.name===e.signals.visual));i(t,"[0, 0]"),-1===t&&i(n.findIndex((t=>t.name===e.signals.data)),"null")}else{let e=n.findIndex((e=>e.name===t.name+XJ));i(e,"null"),PJ.defined(t)&&(e=n.findIndex((e=>e.name===t.name+RJ)),i(e,"false"))}return n}},BJ={defined:e=>{const t="global"===e.resolve&&e.bind&&OV(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==CV;return t&&!n&&Tq("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n)=>{const i=AB(n);if(i.select=St(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},tQ(t,i),Oe(n.select)&&(n.select.on||n.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=nt(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}const r=NV(t.bind)?t.bind.legend:"click",o=St(r)?JT(r,"view"):nt(r);t.bind={legend:{merge:o}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=NV(t.bind)&&t.bind.legend,o=e=>t=>{const n=AB(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${VB(e.field)}_legend`,s=`${i}_${a}`;if(0===n.filter((e=>e.name===s)).length){const e=r.merge.map(o(`${a}_symbols`)).concat(r.merge.map(o(`${a}_labels`))).concat(r.merge.map(o(`${a}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+XJ)),a=i+LX,s=r.items.filter((e=>e.hasLegend)).map((e=>VB(`${i}_${VB(e.field)}_legend`))),l=`${s.map((e=>`${e} !== null`)).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?o.on.push({events:s.map((e=>({signal:e}))),update:l}):s.length>0&&(o.update=l,delete o.value,delete o.on);const u=n.find((e=>e.name===i+RJ)),c=NV(t.bind)&&t.bind.legend;return u&&(t.events?u.on.push({...u.on[0],events:c}):u.on[0].events=c),n}},jJ="_translate_anchor",IJ="_translate_delta",UJ={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=qX.defined(t),o=i+jJ,{x:a,y:s}=t.project.hasChannel;let l=JT(t.translate,"scope");return r||(l=l.map((e=>(e.between[0].markname=i+GX,e)))),n.push({name:o,value:{},on:[{events:l.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${r?WX(e,vj):`slice(${a.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?WX(e,bj):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+IJ,value:{},on:[{events:l,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&qJ(e,t,a,"width",n),void 0!==s&&qJ(e,t,s,"height",n),n}};function qJ(e,t,n,i,r){const o=t.name,a=o+jJ,s=o+IJ,l=n.channel,u=qX.defined(t),c=r.filter((e=>e.name===n.signals[u?"data":"visual"]))[0],f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(l),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${a}.extent_${l}`,g=`${u&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${m}, ${u?l===vj?p?"":"-":p?"-":"":""}${s}.${l} / ${u?`${f}`:`span(${m})`}${u?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:u?g:`clampRange(${g}, 0, ${f})`})}const WJ="_zoom_anchor",HJ="_zoom_delta",GJ={defined:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=qX.defined(t),o=i+HJ,{x:a,y:s}=t.project.hasChannel,l=Pt(e.scaleName(vj)),u=Pt(e.scaleName(bj));let c=JT(t.zoom,"scope");return r||(c=c.map((e=>(e.markname=i+GX,e)))),n.push({name:i+WJ,on:[{events:c,update:r?"{"+[l?`x: invert(${l}, x(unit))`:"",u?`y: invert(${u}, y(unit))`:""].filter((e=>e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==a&&VJ(e,t,a,"width",n),void 0!==s&&VJ(e,t,s,"height",n),n}};function VJ(e,t,n,i,r){const o=t.name,a=n.channel,s=qX.defined(t),l=r.filter((e=>e.name===n.signals[s?"data":"visual"]))[0],u=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(a),f=c&&c.get("type"),d=s?WX(e,a):l.name,h=o+HJ,p=`${s&&c?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${o}${WJ}.${a}, ${h}${s?"pow"===f?`, ${c.get("exponent")??1}`:"symlog"===f?`, ${c.get("constant")??1}`:"":""})`;l.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${u})`})}const YJ="_store",XJ="_tuple",JJ="_modify",QJ="vlSelectionResolve",ZJ=[KX,QX,IX,PJ,zJ,qX,BJ,LJ,UJ,GJ,NJ];function KJ(e,{escape:t}={escape:!0}){let n=t?Pt(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!OK(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of aI)e[t]&&(n+=` + '__facet_${t}_' + (facet[${Pt(i.vgField(t))}])`)}return n}function eQ(e){return WB(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function tQ(e,t){!St(t.select)&&t.select.on||delete e.events,!St(t.select)&&t.select.clear||delete e.clear,!St(t.select)&&t.select.toggle||delete e.toggle}function nQ(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...nQ(e.object)),t.push(...nQ(e.property))),t)}function iQ(e){return"MemberExpression"===e.object.type?iQ(e.object):"datum"===e.object.name}function rQ(e){const t=wF(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&iQ(e)&&n.add(nQ(e).slice(1).join("."))})),n}class oQ extends SX{clone(){return new oQ(null,this.model,AB(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=lQ(this.model,this.filter,this),this._dependentFields=rQ(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function aQ(e,t,n,i="datum"){const r=St(t)?t:t.param,o=VB(r),a=Pt(o+YJ);let s;try{s=e.getSelectionComponent(o,r)}catch(e){return`!!${o}`}if(s.project.timeUnit){const t=n??e.component.data.raw,i=s.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}const l=`${s.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${i}${"global"===s.resolve?")":`, ${Pt(s.resolve)})`}`,u=`length(data(${a}))`;return!1===t.empty?`${u} && ${l}`:`!${u} || ${l}`}function sQ(e,t,n){const i=VB(t),r=n.encoding;let o,a=n.field;try{o=e.getSelectionComponent(i,t)}catch(e){return i}if(r||a){if(r&&!a){const e=o.project.items.filter((e=>e.channel===r));!e.length||e.length>1?(a=o.project.items[0].field,Tq((e.length?"Multiple ":"No ")+`matching ${Pt(r)} encoding found for selection ${Pt(n.param)}. `+`Using "field": ${Pt(a)}.`)):a=e[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&Tq(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${Pt(a)}.`);return`${o.name}[${Pt(ej(a))}]`}function lQ(e,t,n){return YB(t,(t=>St(t)?t:function(e){return e?.param}(t)?aQ(e,t,n):fW(t)))}function uQ(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}function cQ(e,t,n,i={header:!1}){const{disable:r,orient:o,scale:a,labelExpr:s,title:l,zindex:u,...c}=e.combine();if(!r){for(const e in c){const n=LG[e],i=c[e];if(n&&n!==t&&"both"!==n)delete c[e];else if(RG(i)){const{condition:t,...n}=i,r=nt(t),o=zG[e];if(o){const{vgProp:t,part:i}=o,a=[...r.map((e=>{const{test:t,...n}=e;return{test:lQ(null,t),...n}})),n];uQ(c,i,t,a),delete c[e]}else if(null===o){const t={signal:r.map((e=>{const{test:t,...n}=e;return`${lQ(null,t)} ? ${HU(n)} : `})).join("")+HU(n)};c[e]=t}}else if(TU(i)){const t=zG[e];if(t){const{vgProp:n,part:r}=t;uQ(c,r,n,i),delete c[e]}}FB(["labelAlign","labelBaseline"],e)&&null===c[e]&&delete c[e]}if("grid"===t){if(!c.grid)return;if(c.encode){const{grid:e}=c.encode;c.encode={...e?{grid:e}:{}},UB(c.encode)&&delete c.encode}return{scale:a,orient:o,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:rj(u,0)}}{if(!i.header&&e.mainExtracted)return;if(void 0!==s){let e=s;c.encode?.labels?.update&&TU(c.encode.labels.update.text)&&(e=tj(s,"datum.label",c.encode.labels.update.text.signal)),uQ(c,"labels","text",{signal:e})}if(null===c.labelAlign&&delete c.labelAlign,c.encode){for(const t of PG)e.hasAxisPart(t)||delete c.encode[t];UB(c.encode)&&delete c.encode}const t=function(e,t){if(e)return Fe(e)&&!NU(e)?e.map((e=>wG(e,t))).join(", "):e}(l,n);return{scale:a,orient:o,grid:!1,...t?{title:t}:{},...c,...!1===n.aria?{aria:!1}:{},zindex:rj(u,0)}}}}function fQ(e){const{axes:t}=e.component,n=[];for(const i of HI)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}function dQ(e,t,n,i){return Object.assign.apply(null,[{},...e.map((e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},a=new Set([...qB(r),...qB(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${GU(r[t])} : ${GU(o[t])}`};return s}return t[e]}))])}function hQ(e,t){const n=[{}];for(const i of e){let e=t[i]?.style;if(e){e=nt(e);for(const i of e)n.push(t.style[i])}}return Object.assign.apply(null,n)}function pQ(e,t,n,i={}){const r=ZU(e,n,t);if(void 0!==r)return{configFrom:"style",configValue:r};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==i[t]?.[e])return{configFrom:t,configValue:i[t][e]};return{}}const mQ={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??function(e,t){return!OW(e)&&tG(t)&&!AU(t?.bin)&&!$U(t?.bin)}(n,e),gridScale:({model:e,channel:t})=>function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||vQ(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||yQ(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&FB(["quantitative","temporal"],e))return!0}(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??function(e,t,n,i){if(n&&!Oe(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t&&"symlog"!==t||"greedy"}(t.type,n,tG(t)&&!!t.timeUnit,tG(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const o="x"===e?"width":"y"===e?"height":void 0,a=o?t.getSizeSignalRef(o):void 0;return n.tickCount??function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){if(!i&&!OW(t)&&"log"!==t){if(tG(e)){if(AU(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&FB(["month","hours","day","quarter"],Zq(e.timeUnit)?.unit))return}return{signal:`ceil(${n.signal}/40)`}}}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},tickMinStep:function({format:e,fieldOrDatumDef:t}){if("d"===e)return 1;if(tG(t)){const{timeUnit:e}=t;if(e){const t=Kq(e);if(t)return{signal:t}}}},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=bQ(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return eq(r?[GH(r)]:[],tG(a)?[GH(a)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;return Fe(n)?NG(t,n):TU(n)?n:void 0}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){return"rect"===e&&gG(t)?1:0}(n,t)};function gQ(e){return`(((${e.signal} % 360) + 360) % 360)`}function yQ(e,t,n,i){if(void 0!==e){if("x"===n){if(TU(e)){const n=gQ(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${TU(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45{if(cG(t)&&UH(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${fW({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new xQ(e,{calculate:a,as:_Q(t,n,{forAs:!0})})}})),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${MB(this.transform)}`}}function _Q(e,t,n){return mG(e,{prefix:t,suffix:"sort_index",...n??{}})}function wQ(e,t){return FB(["top","bottom"],t)?"column":FB(["left","right"],t)||"row"===e?"row":"column"}function kQ(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return rj((t||{})[e],r[e],n.header[e])}function EQ(e,t,n,i){const r={};for(const o of e){const e=kQ(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const AQ=["row","column"],$Q=["header","footer"];function DQ(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:s}=EQ(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),l=wQ(t,s),u=cj(a);return{name:`${t}-title`,type:"group",role:`${l}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...MQ(u,l),...SQ(l,u,o),...RQ(i,r,t,AV,kV)}}}function SQ(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=vQ(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function MQ(e,t){const n=yQ(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function CQ(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of $Q)if(n[r])for(const o of n[r]){const a=NQ(e,t,r,n,o);null!=a&&i.push(a)}return i}function FQ(e,t){const{sort:n}=e;return IH(n)?{field:mG(n,{expr:"datum"}),order:n.order??"ascending"}:Fe(n)?{field:_Q(e,t,{expr:"datum"}),order:"ascending"}:{field:mG(e,{expr:"datum"}),order:n??"ascending"}}function OQ(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:l}=EQ(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),u=SH({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=wQ(t,s);return{text:{signal:l?tj(tj(l,"datum.label",u),"datum.value",mG(e,{expr:"parent"})):u},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...MQ(o,c),...SQ(c,o,a),...RQ(n,e,t,$V,EV)}}function NQ(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=EQ(["labelOrient"],a.header,s,t);("row"===t&&!FB(["top","bottom"],e)||"column"===t&&!FB(["left","right"],e))&&(o=OQ(a,t,s))}const l=OK(e)&&!qH(e.facet),u=r.axes,c=u?.length>0;if(o||c){const s="row"===t?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:FQ(a,t)}:{},...c&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...c?{axes:u}:{}}}}return null}const TQ={column:{start:0,end:1},row:{start:1,end:0}};function zQ(e,t){return TQ[t][e]}function RQ(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=kQ(a,t?.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function PQ(e){return[...LQ(e,"width"),...LQ(e,"height"),...LQ(e,"childWidth"),...LQ(e,"childHeight")]}function LQ(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(OW(i)&&zU(o)){const i=e.scaleName(n);return OK(e.parent)&&"independent"===e.parent.component.resolve.scale[n]?[BQ(i,o)]:[BQ(i,o),{name:r,update:jQ(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${qV(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function BQ(e,t){const n=`${e}_step`;return TU(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function jQ(e,t,n){const i=t.get("type"),r=t.get("padding"),o=rj(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${GU(a)}, ${GU(o)}) * ${e}_step`}function IQ(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function UQ(e,t){return qB(e).reduce(((n,i)=>{const r=e[i];return{...n,...eJ(t,r,i,(e=>qU(e.value)))}}),{})}function qQ(e,t){if(OK(t))return"theta"===e?"independent":"shared";if(TK(t))return"shared";if(NK(t))return GI(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function WQ(e,t){const n=e.scale[t],i=GI(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&Tq(function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}(t)),"independent"):e[i][t]||"shared"}const HQ={...MV,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},GQ=qB(HQ);class VQ extends sX{}const YQ={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:s,config:l,mark:u}=n,c=a.filled&&"trail"!==u;let f={...VU({},n,hH),...cJ(n,{filled:c})};const d=r.get("symbolOpacity")??l.legend.symbolOpacity,h=r.get("symbolFillColor")??l.legend.symbolFillColor,p=r.get("symbolStrokeColor")??l.legend.symbolStrokeColor,m=void 0===d?XQ(s.opacity)??a.opacity:void 0;if(f.fill)if("fill"===i||c&&i===Oj)delete f.fill;else if(f.fill.field)h?delete f.fill:(f.fill=qU(l.legend.symbolBaseFillColor??"black"),f.fillOpacity=qU(m??1));else if(Fe(f.fill)){const e=JQ(s.fill??s.color)??a.fill??(c&&a.color);e&&(f.fill=qU(e))}if(f.stroke)if("stroke"===i||!c&&i===Oj)delete f.stroke;else if(f.stroke.field||p)delete f.stroke;else if(Fe(f.stroke)){const e=rj(JQ(s.stroke||s.color),a.stroke,c?a.color:void 0);e&&(f.stroke={value:e})}if(i!==Lj){const e=tG(t)&&ZQ(0,r,t);e?f.opacity=[{test:e,...qU(m??1)},qU(l.legend.unselectedOpacity)]:m&&(f.opacity=qU(m))}return f={...f,...e},UB(f)?void 0:f},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){if("gradient"!==n)return;const{config:r,markDef:o,encoding:a}=t;let s={};const l=void 0===(i.get("gradientOpacity")??r.legend.gradientOpacity)?XQ(a.opacity)||o.opacity:void 0;return l&&(s.opacity=qU(l)),s={...s,...e},UB(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=tG(t)?ZQ(0,r,t):void 0,l=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:u,formatType:c}=o;let f;AH(c)?f=CH({fieldOrDatumDef:t,field:"datum.value",format:u,formatType:c,config:a}):void 0===u&&void 0===c&&a.customFormatTypes&&("quantitative"===t.type&&a.numberFormatType?f=CH({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===t.type&&a.timeFormatType&&tG(t)&&void 0===t.timeUnit&&(f=CH({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...l?{opacity:l}:{},...f?{text:f}:{},...e};return UB(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return n?.length?{...e,fill:{value:"transparent"}}:e}};function XQ(e){return QQ(e,((e,t)=>Math.max(e,t.value)))}function JQ(e){return QQ(e,((e,t)=>rj(e,t.value)))}function QQ(e,t){return function(e){const t=e?.condition;return!!t&&(Fe(t)||uG(t))}(e)?nt(e.condition).reduce(t,e.value):uG(e)?e.value:void 0}function ZQ(e,t,n){const i=t.get("selections");if(!i?.length)return;const r=Pt(n.field);return i.map((e=>`(!length(data(${Pt(VB(e)+YJ)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`)).join(" || ")}const KQ={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return FH(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return OH(i,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:s,gradientVerticalMinLength:l}=e;if(TW(r))return"horizontal"===n?"top"===i||"bottom"===i?tZ(t,"width",a,o):a:tZ(t,"height",l,s)}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(FB(["quantile","threshold","log","symlog"],e))return"greedy"}(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??function(e,t,n,i){if("shape"!==t){const e=JQ(n)??i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,n,i.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>xG(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(rI(n)&&TW(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;return Fe(n)?NG(t,n):TU(n)?n:void 0}(t,e)};function eZ({legendConfig:e,legendType:t,orient:n,legend:i}){return i.direction??e[t?"gradientDirection":"symbolDirection"]??function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(n,t)}function tZ(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function nZ(e){const t=FK(e)?function(e){const{encoding:t}=e,n={};for(const i of[Oj,...SV]){const r=AG(t[i]);r&&e.getScaleComponent(i)&&(i===zj&&tG(r)&&r.type===xW||(n[i]=rZ(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){nZ(i);for(const r of qB(i.component.legends))n.legend[r]=WQ(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=oZ(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of qB(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function iZ(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!n?.values;case"title":if("title"===t&&e===i?.title)return!0}return e===(n||{})[t]}function rZ(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:o}=e,a=o.legend,s=new VQ({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){const i=e.fieldDef(t)?.field;for(const r of WB(e.component.selection??{})){const e=r.project.hasField[i]??r.project.hasChannel[t];if(e&&BJ.defined(r)){const t=n.get("selections")??[];t.push(r.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,s);const l=void 0!==n?!n:a.disable;if(s.set("disable",l,void 0!==n),l)return s;n=n||{};const u=e.getScaleComponent(t).get("type"),c=AG(r[t]),f=tG(c)?Zq(c.timeUnit)?.unit:void 0,d=n.orient||o.legend.orient||"right",h=function(e){const{legend:t}=e;return rj(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(rI(e)){if(FB(["quarter","month","day"],t))return"symbol";if(TW(n))return"gradient"}return"symbol"}(e))}({legend:n,channel:t,timeUnit:f,scaleType:u}),p={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:c,legendConfig:a,config:o,scaleType:u,orient:d,legendType:h,direction:eZ({legend:n,legendType:h,orient:d,legendConfig:a})};for(const i of GQ){if("gradient"===h&&i.startsWith("symbol")||"symbol"===h&&i.startsWith("gradient"))continue;const r=i in KQ?KQ[i](p):n[i];if(void 0!==r){const a=iZ(r,i,n,e.fieldDef(t));(a||void 0===o.legend[i])&&s.set(i,r,a)}}const m=n?.encoding??{},g=s.get("selections"),y={},v={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:s,legendType:h};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=UQ(m[t]??{},e),i=t in YQ?YQ[t](n,v):n;void 0===i||UB(i)||(y[t]={...g?.length&&tG(c)?{name:`${VB(c.field)}_legend_${t}`}:{},...g?.length?{interactive:!!g}:{},update:i})}return UB(y)||s.set("encode",y,!!n?.encoding),s}function oZ(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const n of GQ){const i=dX(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",((e,t)=>{switch(n){case"symbolType":return i=e,"circle"===(o=t).value?o:i;case"title":return nq(e,t);case"type":return r=!0,uX("symbol")}var i,o;return fX(e,t,n,"legend")}));e.setWithExplicit(n,i)}return r&&(e.implicit?.encode?.gradient&&XB(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&XB(e.explicit,["encode","gradient"])),e}function aZ(e){const t=e.component.legends,n={};for(const i of qB(t)){const r=pj(e.getScaleComponent(i).get("domains"));if(n[r])for(const e of n[r])oZ(e,t[i])||n[r].push(t[i]);else n[r]=[t[i].clone()]}const i=WB(n).flat().map((t=>function(e,t){const{disable:n,labelExpr:i,selections:r,...o}=e.combine();if(!n){if(!1===t.aria&&null==o.aria&&(o.aria=!1),o.encode?.symbols){const e=o.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||o.stroke||(e.stroke={value:"transparent"});for(const t of SV)o[t]&&delete e[t]}if(o.title||delete o.title,void 0!==i){let e=i;o.encode?.labels?.update&&TU(o.encode.labels.update.text)&&(e=tj(i,"datum.label",o.encode.labels.update.text.signal)),function(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update.text=i}(o,"labels",0,{signal:e})}return o}}(t,e.config))).filter((e=>void 0!==e));return i}function sZ(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map((e=>e.signal)).join(", ")}]`},o=t.data.reduce(((t,n)=>{const i=TU(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return FB(t,i)||t.push(i),t}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const lZ=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class uZ extends sX{constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function cZ(e){e.component.projection=FK(e)?function(e){if(e.hasProjection){const t=FU(e.specifiedProjection),n=!(t&&(null!=t.scale||null!=t.translate)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?function(e){const t=[],{encoding:n}=e;for(const i of[[Mj,Sj],[Fj,Cj]])(AG(n[i[0]])||AG(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(zj)&&e.typedFieldDef(zj).type===xW&&t.push({signal:e.getName(`geojson_${t.length}`)}),0===t.length&&t.push(e.requestDataName(_X.Main)),t}(e):void 0,o=new uZ(e.projectionName(!0),{...FU(e.config.projection)??{},...t??{}},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}}(e):function(e){if(0===e.children.length)return;let t;for(const t of e.children)cZ(t);const n=NB(e.children,(e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=NB(lZ,(n=>!yt(e.explicit,n)&&!yt(t.explicit,n)||!!(yt(e.explicit,n)&&yt(t.explicit,n)&&hj(e.get(n),t.get(n)))));if(hj(e.size,t.size)){if(n)return e;if(hj(e.explicit,{}))return t;if(hj(t.explicit,{}))return e}return null}(t,n);return e&&(t=e),!!e}return t=n,!0}return!0}));if(t&&n){const n=e.projectionName(!0),i=new uZ(n,t.specifiedProjection,t.size,AB(t.data));for(const t of e.children){const e=t.component.projection;e&&(e.isFit&&i.data.push(...t.component.projection.data),t.renameProjection(e.get("name"),n),e.merged=!0)}return i}}(e)}function fZ(e,t,n,i){if(TG(t,n)){const r=FK(e)?e.axis(n)??e.legend(n)??{}:{},o=mG(t,{expr:"datum"}),a=mG(t,{expr:"datum",binSuffix:"end"});return{formulaAs:mG(t,{binSuffix:"range",forAs:!0}),formula:RH(o,a,r.format,r.formatType,i)}}return{}}function dZ(e,t){return`${EU(e)}_${t}`}function hZ(e,t,n){const i=dZ(MG(n,void 0)??{},t);return e.getName(`${i}_bins`)}function pZ(e,t,n){let i,r;i=function(e){return"as"in e}(e)?St(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[mG(e,{forAs:!0}),mG(e,{binSuffix:"end",forAs:!0})];const o={...MG(t,void 0)},a=dZ(o,e.field),{signal:s,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(SU(o.extent)){const e=o.extent;r=sQ(n,e.param,e),delete o.extent}return{key:a,binComponent:{bin:o,field:e.field,as:[i],...s?{signal:s}:{},...l?{extentSignal:l}:{},...r?{span:r}:{}}}}class mZ extends SX{clone(){return new mZ(null,AB(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(lG(n)&&AU(n.bin)){const{key:r,binComponent:o}=pZ(n,n.bin,t);e[r]={...o,...e[r],...fZ(t,n,i,t.config)}}return e}),{});return UB(n)?null:new mZ(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=pZ(t,t.bin,n);return new mZ(e,{[i]:r})}merge(e,t){for(const n of qB(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=RB([...this.bins[n].as,...e.bins[n].as],MB)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(WB(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(WB(this.bins).map((e=>e.field)))}hash(){return`Bin ${MB(this.bins)}`}assemble(){return WB(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:ej(e.field),as:n,signal:e.signal,...SU(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:ej(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:mG({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}class gZ extends SX{clone(){return new gZ(null,new Set(this.dimensions),AB(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef((e=>{e.aggregate&&(n=!0)}));const i={},r=new Set;return n?(t.forEachFieldDef(((e,n)=>{const{aggregate:o,field:a}=e;if(o)if("count"===o)i["*"]??(i["*"]={}),i["*"].count=new Set([mG(e,{forAs:!0})]);else{if(yU(o)||vU(o)){const e=yU(o)?"argmin":"argmax",t=o[e];i[t]??(i[t]={}),i[t][e]=new Set([mG({op:e,field:t},{forAs:!0})])}else i[a]??(i[a]={}),i[a][o]=new Set([mG(e,{forAs:!0})]);cU(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??(i[a]={}),i[a].min=new Set([mG({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([mG({field:a,aggregate:"max"},{forAs:!0})]))}else!function(e,t,n,i){const r=FK(i)?i.encoding[wI(t)]:void 0;if(lG(n)&&FK(i)&&JH(n,r,i.markDef,i.config)){e.add(mG(n,{})),e.add(mG(n,{suffix:"end"}));const{mark:r,markDef:o,config:a}=i,s=YH({fieldDef:n,markDef:o,config:a});cH(r)&&.5!==s&&GI(t)&&(e.add(mG(n,{suffix:NX})),e.add(mG(n,{suffix:TX}))),n.bin&&TG(n,t)&&e.add(mG(n,{binSuffix:"range"}))}else if(tI(t)){const n=eI(t);e.add(i.getName(n))}else e.add(mG(n));cG(n)&&function(e){return Oe(e)&&"field"in e}(n.scale?.range)&&e.add(n.scale.range.field)}(r,n,e,t)})),r.size+qB(i).length===0?null:new gZ(e,r,i)):null}static makeFromTransform(e,t){const n=new Set,i={};for(const e of t.aggregate){const{op:t,field:n,as:r}=e;t&&("count"===t?(i["*"]??(i["*"]={}),i["*"].count=new Set([r||mG(e,{forAs:!0})])):(i[n]??(i[n]={}),i[n][t]=new Set([r||mG(e,{forAs:!0})])))}for(const e of t.groupby??[])n.add(e);return n.size+qB(i).length===0?null:new gZ(e,n,i)}merge(e){return LB(this.dimensions,e.dimensions)?(function(e,t){for(const n of qB(t)){const i=t[n];for(const t of qB(i))n in e?e[n][t]=new Set([...e[n][t]??[],...i[t]]):e[n]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(...e){Nq.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...qB(this.measures)])}producedFields(){const e=new Set;for(const t of qB(this.measures))for(const n of qB(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${MB({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of qB(this.measures))for(const r of qB(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:ej(i));return{type:"aggregate",groupby:[...this.dimensions].map(ej),ops:e,fields:t,as:n}}}class yZ extends SX{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of aI){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]={name:t.getName(`${e}_domain`),fields:[mG(n),...AU(i)?[mG(n,{binSuffix:"end"})]:[]],...IH(r)?{sortField:r}:Fe(r)?{sortIndexField:_Q(n,e)}:{}}}}this.childModel=t.child}hash(){let e="Facet";for(const t of aI)this[t]&&(e+=` ${t.charAt(0)}:${MB(this[t])}`);return e}get fields(){const e=[];for(const t of aI)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){const e=new Set(this.fields);for(const t of aI)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of HI){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(OW(i)&&zU(r)){const n=sK(lK(this.childModel,t));n?e[t]=n:Tq(lq(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],o=[],a=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:l}=this[e];if(s){const{op:e=PH,field:t}=s;r.push(t),o.push(e),a.push(mG(s,{forAs:!0}))}else l&&(r.push(l),o.push("max"),a.push(l));return{name:this[e].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:o,as:a}:{}}]}}assembleFacetHeaderData(e){const{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,i=[],r={};for(const e of AQ){for(const t of $Q){const i=(n[e]&&n[e][t])??[];for(const t of i)if(t.axes?.length>0){r[e]=!0;break}}if(r[e]){const n=`length(data("${this.facet.name}"))`,r="row"===e?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};i.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:r}]})}}const{row:o,column:a}=r;return(o||a)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,e)),i}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:o}=this;if(i&&r&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;const i=[].concat(n.x??[],n.y??[]),r=i.map((()=>"distinct"));e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:r}]})}for(const i of[gj,mj])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function vZ(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function bZ(e){const t={};return kB(e.filter,(e=>{if(uW(e)){let n=null;nW(e)?n=IU(e.equal):rW(e)?n=IU(e.lte):iW(e)?n=IU(e.lt):oW(e)?n=IU(e.gt):aW(e)?n=IU(e.gte):sW(e)?n=e.range[0]:lW(e)&&(n=(e.oneOf??e.in)[0]),n&&(zq(n)?t[e.field]="date":$t(n)?t[e.field]="number":St(n)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}})),t}class xZ extends SX{clone(){return new xZ(null,AB(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${MB(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!yX(r)&&r?.format?.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of qB(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:Tq(hq(e,n[e],t.value)))}for(const e of qB(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:Tq(hq(e,t[e],n)))}const r=new sX(t,n);i.copyAll(r);const o={};for(const e of qB(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===qB(o).length||i.parseNothing?null:new xZ(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of qB(this._parse)){const n=this._parse[t];1===ij(t)&&(e[t]=n)}return e}producedFields(){return new Set(qB(this._parse))}dependentFields(){return new Set(qB(this._parse))}assembleTransforms(e=!1){return qB(this._parse).filter((t=>!e||ij(t)>1)).map((e=>{const t=function(e,t){const n=QB(e);return"number"===t?`toNumber(${n})`:"boolean"===t?`toBoolean(${n})`:"string"===t?`toString(${n})`:"date"===t?`toDate(${n})`:"flatten"===t?n:t.startsWith("date:")?`timeParse(${n},'${vZ(t.slice(5,t.length))}')`:t.startsWith("utc:")?`utcParse(${n},'${vZ(t.slice(4,t.length))}')`:(Tq(`Unrecognized parse "${t}".`),null)}(e,this._parse[e]);return t?{type:"formula",expr:t,as:nj(e)}:null})).filter((e=>null!==e))}}class _Z extends SX{clone(){return new _Z(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([CV])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:CV}}}class wZ extends SX{clone(){return new wZ(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${MB(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class kZ extends SX{clone(){return new kZ(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${MB(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class EZ extends SX{constructor(e){let t;if(super(null),e??(e={name:"source"}),yX(e)||(t=e.format?{...SB(e.format,["parse"])}:{}),mX(e))this._data={values:e.values};else if(pX(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];FB(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else bX(e)?this._data={values:[{type:"Sphere"}]}:(gX(e)||yX(e))&&(this._data={});this._generator=yX(e),e.name&&(this._name=e.name),t&&!UB(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}var AZ,$Z=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};function DZ(e){return e instanceof EZ||e instanceof wZ||e instanceof kZ}class SZ{constructor(){AZ.set(this,void 0),$Z(this,AZ,!1,"f")}setModified(){$Z(this,AZ,!0,"f")}get modifiedFlag(){return function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}(this,AZ,"f")}}AZ=new WeakMap;class MZ extends SZ{getNodeDepths(e,t,n){n.set(e,t);for(const i of e.children)this.getNodeDepths(i,t+1,n);return n}optimize(e){const t=[...this.getNodeDepths(e,0,new Map).entries()].sort(((e,t)=>t[1]-e[1]));for(const e of t)this.run(e[0]);return this.modifiedFlag}}class CZ extends SZ{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class FZ extends CZ{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map((e=>e.hash())),n={};for(let i=0;i1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class OZ extends CZ{constructor(e){super(),this.requiresSelectionId=e&&eQ(e)}run(e){e instanceof _Z&&(this.requiresSelectionId&&(DZ(e.parent)||e.parent instanceof gZ||e.parent instanceof xZ)||(this.setModified(),e.remove()))}}class NZ extends SZ{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof OX&&(n=e.producedFields(),BB(n,t)&&(this.setModified(),e.removeFormulas(t),0===e.producedFields.length&&e.remove()));for(const i of e.children)this.run(i,new Set([...t,...n]))}}class TZ extends CZ{constructor(){super()}run(e){e instanceof MX&&!e.isRequired()&&(this.setModified(),e.remove())}}class zZ extends MZ{run(e){if(!(DZ(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof xZ)if(e instanceof xZ)this.setModified(),e.merge(t);else{if(IB(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class RZ extends MZ{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof xZ));if(e.numChildren()>1&&n.length>=1){const i={},r=new Set;for(const e of n){const t=e.parse;for(const e of qB(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!UB(i)){this.setModified();const n=new xZ(e,i);for(const r of t){if(r instanceof xZ)for(const e of qB(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof xZ&&0===qB(r.parse).length&&r.remove()}}}}}class PZ extends MZ{run(e){e instanceof MX||e.numChildren()>0||e instanceof yZ||e instanceof EZ||(this.setModified(),e.remove())}}class LZ extends MZ{run(e){const t=e.children.filter((e=>e instanceof OX)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class BZ extends MZ{run(e){const t=e.children.filter((e=>e instanceof gZ)),n={};for(const e of t){const t=MB(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of qB(n)){const i=n[t];if(i.length>1){const t=i.pop();for(const n of i)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}}class jZ extends MZ{constructor(e){super(),this.model=e}run(e){const t=!(DZ(e)||e instanceof oQ||e instanceof xZ||e instanceof _Z),n=[],i=[];for(const r of e.children)r instanceof mZ&&(t&&!IB(e.producedFields(),r.dependentFields())?n.push(r):i.push(r));if(n.length>0){const t=n.pop();for(const e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof mZ?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}}class IZ extends MZ{run(e){const t=[...e.children];if(!OB(t,(e=>e instanceof MX))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof MX){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof MX))break;t=e}n.push(...t.children),i?(e.removeChild(r),r.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(r);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class UZ extends SX{clone(){return new UZ(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=RB(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??mG(e)}hash(){return`JoinAggregateTransform ${MB(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class qZ extends SX{clone(){return new qZ(null,AB(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:o="zero"}=t,a=[],s=[];if(void 0!==t.sort)for(const e of t.sort)a.push(e.field),s.push(rj(e.order,"ascending"));const l={field:a,order:s};let u;return u=function(e){return Fe(e)&&e.every((e=>St(e)))&&e.length>1}(r)?r:St(r)?[r,`${r}_end`]:[`${t.stack}_start`,`${t.stack}_end`],new qZ(e,{dimensionFieldDefs:[],stackField:n,groupby:i,offset:o,sort:l,facetby:[],as:u})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;const{groupbyChannels:r,fieldChannel:o,offset:a,impute:s}=n,l=r.map((e=>EG(i[e]))).filter((e=>!!e)),u=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=mG(t.fieldDef);return n&&e.push(n),e}),[])}(t),c=t.encoding.order;let f;if(Fe(c)||tG(c))f=KU(c);else{const e=QH(c)?c.sort:"y"===o?"descending":"ascending";f=u.reduce(((t,n)=>(t.field.push(n),t.order.push(e),t)),{field:[],order:[]})}return new qZ(e,{dimensionFieldDefs:l,stackField:t.vgField(o),facetby:[],stackby:u,sort:f,offset:a,impute:s,as:[t.vgField(o,{suffix:"start",forAs:!0}),t.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${MB(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[mG(e,{binSuffix:"mid"})]:[mG(e,{}),mG(e,{binSuffix:"end"})]:[mG(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:l}=this._stack;if(s)for(const o of n){const{bandPosition:n=.5,bin:a}=o;if(a){const t=mG(o,{expr:"datum"}),i=mG(o,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${n}*${t}+${1-n}*${i}`,as:mG(o,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:mG(o,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:l,offset:a}),e}}class WZ extends SX{clone(){return new WZ(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=RB(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach((t=>e.add(t.field))),this.transform.window.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??mG(e)}hash(){return`WindowTransform ${MB(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const r of this.transform.window)t.push(r.op),n.push(this.getDefaultName(r)),i.push(void 0===r.param?null:r.param),e.push(void 0===r.field?null:r.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>bU(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==o?{groupby:o}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const e of this.transform.sort)a.push(e.field),s.push(e.order??"ascending");const l={field:a,order:s},u=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:l,...void 0!==u?{ignorePeers:u}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function HZ(e){if(e instanceof yZ)if(1!==e.numChildren()||e.children[0]instanceof MX){const n=e.model.component.data.main;GZ(n);const i=(t=e,function e(n){if(!(n instanceof yZ)){const i=n.clone();if(i instanceof MX){const e=VZ+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof gZ||i instanceof qZ||i instanceof WZ||i instanceof UZ)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof gZ||t instanceof qZ||t instanceof WZ||t instanceof UZ)&&t.addDimensions(e.fields),t.swapWithParent(),HZ(e)}else e.children.map(HZ);var t}function GZ(e){if(e instanceof MX&&e.type===_X.Main&&1===e.numChildren()){const t=e.children[0];t instanceof yZ||(t.swapWithParent(),GZ(e))}}const VZ="scale_",YZ=5;function XZ(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!XZ(t.children))return!1}return!0}function JZ(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function QZ(e,t,n){let i=e.sources,r=!1;return r=JZ(new TZ,i)||r,r=JZ(new OZ(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=JZ(new PZ,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=JZ(new zZ,i)||r,r=JZ(new jZ(t),i)||r,r=JZ(new NZ,i)||r,r=JZ(new RZ,i)||r,r=JZ(new BZ,i)||r,r=JZ(new LZ,i)||r,r=JZ(new FZ,i)||r,r=JZ(new IZ,i)||r),e.sources=i,r}class ZZ{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new ZZ((()=>e(t)))}}function KZ(e){FK(e)?function(e){const t=e.component.scales;for(const n of qB(t)){const i=eK(e,n);if(t[n].setWithExplicit("domains",i),rK(e,n),e.component.data.isFaceted){let t=e;for(;!OK(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)RU(e)&&(e.data=VZ+e.data.replace(VZ,""))}}}(e):function(e){for(const t of e.children)KZ(t);const t=e.component.scales;for(const n of qB(t)){let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):dX(i,e.getWithExplicit("domains"),"domains","scale",aK);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&Tq("The same selection must be used to override scale domains in a layered view."),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function eK(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=oK(t,n);if(!e)return void Tq(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=oK(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),"x"===t&&AG(i.x2)?AG(i.x)?dX(nK(n,r,e,"x"),nK(n,r,e,"x2"),"domain","scale",aK):nK(n,r,e,"x2"):"y"===t&&AG(i.y2)?AG(i.y)?dX(nK(n,r,e,"y"),nK(n,r,e,"y2"),"domain","scale",aK):nK(n,r,e,"y2"):nK(n,r,e,t)}function tK(e,t,n){const i=Zq(n)?.unit;return"temporal"===t||i?function(e,t,n){return e.map((e=>({signal:`{data: ${OG(e,{timeUnit:n,type:t})}}`})))}(e,t,i):[e]}function nK(e,t,n,i){const{encoding:r,markDef:o,mark:a,config:s,stack:l}=n,u=AG(r[i]),{type:c}=u,f=u.timeUnit;if(function(e){return e?.unionWith}(t)){const r=nK(e,void 0,n,i);return lX([...tK(t.unionWith,c,f),...r.value])}if(TU(t))return lX([t]);if(t&&"unaggregated"!==t&&!RW(t))return lX(tK(t,c,f));if(l&&i===l.fieldChannel){if("normalize"===l.offset)return uX([[0,1]]);const e=n.requestDataName(_X.Main);return uX([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const d=cU(i)&&tG(u)?function(e,t,n){if(!OW(n))return;const i=e.fieldDef(t),r=i.sort;if(UH(r))return{op:"min",field:_Q(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(IH(r))return iK(r,o&&!a.has(r.field));if(jH(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:l}=i,u=o&&!a.has(l);if(yU(s)||vU(s))return iK({field:mG(i),order:n},u);if(bU(s)||!s)return iK({op:s,field:l,order:n},u)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(FB(["ascending",void 0],r))return!0}}(n,i,e):void 0;if(iG(u))return uX(tK([u.datum],c,f));const h=u;if("unaggregated"===t){const e=n.requestDataName(_X.Main),{field:t}=u;return uX([{data:e,field:mG({field:t,aggregate:"min"})},{data:e,field:mG({field:t,aggregate:"max"})}])}if(AU(h.bin)){if(OW(e))return uX("bin-ordinal"===e?[]:[{data:GB(d)?n.requestDataName(_X.Main):n.requestDataName(_X.Raw),field:n.vgField(i,TG(h,i)?{binSuffix:"range"}:{}),sort:!0!==d&&Oe(d)?d:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=h;if(AU(e)){const t=hZ(n,h.field,e);return uX([new ZZ((()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return uX([{data:n.requestDataName(_X.Main),field:n.vgField(i,{})}])}}if(h.timeUnit&&FB(["time","utc"],e)){const e=r[wI(i)];if(JH(h,e,o,s)){const t=n.requestDataName(_X.Main),r=YH({fieldDef:h,fieldDef2:e,markDef:o,config:s}),l=cH(a)&&.5!==r;return uX([{data:t,field:n.vgField(i,l?{suffix:NX}:{})},{data:t,field:n.vgField(i,{suffix:l?TX:"end"})}])}}return uX(d?[{data:GB(d)?n.requestDataName(_X.Main):n.requestDataName(_X.Raw),field:n.vgField(i),sort:d}]:[{data:n.requestDataName(_X.Main),field:n.vgField(i)}])}function iK(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":PH),...i?{field:ej(i)}:{},...r?{order:r}:{}}}function rK(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,o=RW(i)&&i,a=DU(r)&&SU(r.extent)&&r.extent;(o||a)&&n.set("selectionExtent",o??a,!0)}function oK(e,t){const{aggregate:n,type:i}=e;return n?St(n)&&!kU.has(n)?{valid:!1,reason:Eq(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:Aq(e)}:{valid:!0}:{valid:!1,reason:kq(e)}}function aK(e,t,n,i){return e.explicit&&t.explicit&&Tq(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${pj(n)} and ${pj(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function sK(e){if(RU(e)&&St(e.field))return e.field;if(function(e){return!Fe(e)&&"fields"in e&&!("data"in e)}(e)){let t;for(const n of e.fields)if(RU(n)&&St(n.field))if(t){if(t!==n.field)return Tq("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),t}else t=n.field;return Tq("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),t}if(function(e){return!Fe(e)&&"fields"in e&&"data"in e}(e)){Tq("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const t=e.fields[0];return St(t)?t:void 0}}function lK(e,t){return function(e){const t=RB(e.map((e=>{if(RU(e)){const{sort:t,...n}=e;return n}return e})),MB),n=RB(e.map((e=>{if(RU(e)){const t=e.sort;return void 0===t||GB(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),MB);if(0===t.length)return;if(1===t.length){const t=e[0];if(RU(t)&&n.length>0){let e=n[0];if(n.length>1){Tq(Sq);const t=n.filter((e=>Oe(e)&&"op"in e&&"min"!==e.op));e=!n.every((e=>Oe(e)&&"op"in e))||1!==t.length||t[0]}else if(Oe(e)&&"field"in e){const n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}const i=RB(n.map((e=>GB(e)||!("op"in e)||St(e.op)&&e.op in gU?e:(Tq(function(e){return`Dropping sort property ${pj(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),MB);let r;1===i.length?r=i[0]:i.length>1&&(Tq(Sq),r=!0);const o=RB(e.map((e=>RU(e)?e.data:null)),(e=>e));return 1===o.length&&null!==o[0]?{data:o[0],fields:t.map((e=>e.field)),...r?{sort:r}:{}}:{fields:t,...r?{sort:r}:{}}}(e.component.scales[t].get("domains").map((t=>(RU(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function uK(e){return TK(e)||NK(e)?e.children.reduce(((e,t)=>e.concat(uK(t))),cK(e)):cK(e)}function cK(e){return qB(e.component.scales).reduce(((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:o,type:a,selectionExtent:s,domains:l,range:u,reverse:c,...f}=r,d=function(e,t,n,i){if(GI(n)){if(zU(e))return{step:{signal:`${t}_step`}}}else if(Oe(e)&&RU(e))return{...e,data:i.lookupDataSource(e.data)};return e}(r.range,o,n,e),h=lK(e,n),p=s?function(e,t,n,i){const r=sQ(e,t.param,t);return{signal:NW(n.get("type"))&&Fe(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}(e,s,i,h):null;return t.push({name:o,type:a,...h?{domain:h}:{},...p?{domainRaw:p}:{},range:d,...void 0!==c?{reverse:c}:{},...f}),t}),[])}class fK extends sX{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||OB(this.get("domains"),(e=>Fe(e)&&2===e.length&&$t(e[0])&&e[0]<=0&&$t(e[1])&&e[1]>=0))}}const dK=["range","scheme"];function hK(e,t){const n=e.fieldDef(t);if(n?.bin){const{bin:i,field:r}=n,o=kI(t),a=e.getName(o);if(Oe(i)&&i.binned&&void 0!==i.step)return new ZZ((()=>{const n=e.scaleName(t),r=`(domain("${n}")[1] - domain("${n}")[0]) / ${i.step}`;return`${e.getSignalName(a)} / (${r})`}));if(AU(i)){const t=hZ(e,r,i);return new ZZ((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(a)} / (${i})`}))}}}function pK(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const i of dK)if(void 0!==n[i]){const o=GW(r,i),a=VW(e,i);if(o)if(a)Tq(a);else switch(i){case"range":{const i=n.range;if(Fe(i)){if(GI(e))return lX(i.map((e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return ZZ.fromName(i,n)}return e})))}else if(Oe(i))return lX({data:t.requestDataName(_X.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return lX(i)}case"scheme":return lX(mK(n[i]))}else Tq($q(r,i,e))}const o=e===vj||"xOffset"===e?"width":"height",a=i[o];if(jV(a))if(GI(e))if(OW(r)){const n=yK(a,t,e);if(n)return lX({step:n})}else Tq(Dq(o));else if(QI(e)){const n=e===wj?"x":"y";if("band"===t.getScaleComponent(n).get("type")){const e=vK(a,r);if(e)return lX(e)}}const{rangeMin:s,rangeMax:l}=n,u=function(e,t){const{size:n,config:i,mark:r,encoding:o}=t,{type:a}=AG(o[e]),s=t.getScaleComponent(e).get("type"),{domain:l,domainMid:u}=t.specifiedScales[e];switch(e){case vj:case bj:if(FB(["point","band"],s)){const r=bK(e,n,i.view);if(jV(r))return{step:yK(r,t,e)}}return gK(e,t,s);case wj:case kj:return function(e,t,n){const i=e===wj?"x":"y",r=t.getScaleComponent(i);if(!r)return gK(i,t,n,{center:!0});const o=r.get("type"),a=t.scaleName(i),{markDef:s,config:l}=t;if("band"===o){const e=bK(i,t.size,t.config.view);if(jV(e)){const t=vK(e,n);if(t)return t}return[0,{signal:`bandwidth('${a}')`}]}{const n=t.encoding[i];if(tG(n)&&n.timeUnit){const e=Kq(n.timeUnit,(e=>`scale('${a}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner,r=YH({fieldDef:n,markDef:s,config:l})-.5,o=0!==r?` + ${r}`:"";return i?[{signal:`${TU(i)?`${i.signal}/2`+o:`${i/2+r}`} * (${e})`},{signal:`${TU(i)?`(1 - ${i.signal}/2)`+o:`${1-i/2+r}`} * (${e})`}]:[0,{signal:e}]}return $B(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,t,s);case Rj:{const o=xK(r,t.component.scales[e].get("zero"),i),a=function(e,t,n,i){const r={x:hK(n,"x"),y:hK(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=wK(t,r,i.view);return $t(e)?e-1:new ZZ((()=>`${e.signal} - 1`))}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const e=wK(t,r,i.view);return $t(e)?Math.pow(_K*e,2):new ZZ((()=>`pow(${_K} * ${e.signal}, 2)`))}}throw new Error(bq("size",e))}(r,n,t,i);return zW(s)?function(e,t,n){const i=()=>{const i=GU(t),r=GU(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return TU(t)?new ZZ(i):{signal:i()}}(o,a,function(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&Fe(n)?n.length+1:(Tq(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(s,i,l,e)):[o,a]}case $j:return[0,2*Math.PI];case Pj:return[0,360];case Ej:return[0,new ZZ((()=>`min(${t.getSignalName("width")},${t.getSignalName("height")})/2`))];case Ij:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case Uj:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case zj:return"symbol";case Oj:case Nj:case Tj:return"ordinal"===s?"nominal"===a?"category":"ordinal":void 0!==u?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case Lj:case Bj:case jj:return[i.scale.minOpacity,i.scale.maxOpacity]}}(e,t);return(void 0!==s||void 0!==l)&&GW(r,"rangeMin")&&Fe(u)&&2===u.length?lX([s??u[0],l??u[1]]):uX(u)}function mK(e){return function(e){return!St(e)&&!!e.name}(e)?{scheme:e.name,...SB(e,["name"])}:{scheme:e}}function gK(e,t,n,{center:i}={}){const r=kI(e),o=t.getName(r),a=t.getSignalName.bind(t);return e===bj&&NW(n)?i?[ZZ.fromName((e=>`${a(e)}/2`),o),ZZ.fromName((e=>`-${a(e)}/2`),o)]:[ZZ.fromName(a,o),0]:i?[ZZ.fromName((e=>`-${a(e)}/2`),o),ZZ.fromName((e=>`${a(e)}/2`),o)]:[0,ZZ.fromName(a,o)]}function yK(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=AI(n),a=i[o];if("offset"===BV({step:e,offsetIsDiscrete:sG(a)&&mW(a.type)})&&GG(i,o)){const n=t.getScaleComponent(o);let i=`domain('${t.scaleName(o)}').length`;"band"===n.get("type")&&(i=`bandspace(${i}, ${n.get("paddingInner")??n.get("padding")??0}, ${n.get("paddingOuter")??n.get("padding")??0})`);const a=r.get("paddingInner")??r.get("padding");return{signal:`${e.step} * ${i} / (1-${WU(a)})`}}return e.step}function vK(e,t){if("offset"===BV({step:e,offsetIsDiscrete:OW(t)}))return{step:e.step}}function bK(e,t,n){const i=e===vj?"width":"height";return t[i]||HV(n,i)}function xK(e,t,n){if(t)return TU(t)?{signal:`${t.signal} ? 0 : ${xK(e,!1,n)}`}:0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(bq("size",e))}const _K=.95;function wK(e,t,n){const i=jV(e.width)?e.width.step:WV(n,"width"),r=jV(e.height)?e.height.step:WV(n,"height");return t.x||t.y?new ZZ((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function kK(e,t){FK(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of qB(n)){const l=a[s],u=n[s],c=e.getScaleComponent(s),f=AG(r[s]),d=l[t],h=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),g=GW(h,t),y=VW(s,t);if(void 0!==d&&(g?y&&Tq(y):Tq($q(h,t,s))),g&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":zq(l[t])||"temporal"===n||e?u.set(t,{signal:OG(l[t],{type:n,timeUnit:e})},!0):u.set(t,l[t],!0);break;default:u.copyKeyFromObject(t,l)}}else{const n=t in EK?EK[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:h,scalePadding:p,scalePaddingInner:m,domain:l.domain,domainMin:l.domainMin,domainMax:l.domainMax,markDef:o,config:i,hasNestedOffsetScale:VG(r,s),hasSecondaryRangeChannel:!!r[wI(s)]}):i.scale[t];void 0!==n&&u.set(t,n,!1)}}}(e,t):$K(e,t)}const EK={bins:({model:e,fieldOrDatumDef:t})=>tG(t)?function(e,t){const n=t.bin;if(AU(n)){const i=hZ(e,t.field,n);return new ZZ((()=>e.getSignalName(i)))}if($U(n)&&DU(n)&&void 0!==n.step)return{step:n.step}}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(FB([Oj,Nj,Tj],e)&&"nominal"!==t)return"hcl"}(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:o})=>function(e,t,n,i,r,o){if(!(EG(o)?.bin||Fe(n)||null!=r||null!=i||FB([_W.TIME,_W.UTC],e)))return!!GI(t)||void 0}(e,t,n,i,r,o),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,o){if(GI(e)){if(TW(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!tG(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===_W.POINT)return n.pointPadding}}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0===e){if(GI(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,bandWithNestedOffsetPaddingInner:a}=r;return o?a:rj(e,"bar"===n?t:i)}return QI(t)&&i===_W.BAND?r.offsetBandPaddingInner:void 0}}(e,t,n.type,i,r.scale,o),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0===e)if(GI(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===_W.BAND)return rj(e,TU(i)?{signal:`${i.signal}/2`}:i/2)}else if(QI(t)){if(n===_W.POINT)return.5;if(n===_W.BAND)return r.offsetBandPaddingOuter}}(e,t,n,i,r.scale,o),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){return"x"===n&&void 0!==i.xReverse?NW(e)&&"descending"===t?TU(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse:!(!NW(e)||"descending"!==t)||void 0}(t,tG(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r,config:o,hasSecondaryRangeChannel:a})=>function(e,t,n,i,r,o,a){if(n&&"unaggregated"!==n&&NW(r)){if(Fe(n)){const e=n[0],t=n[n.length-1];if($t(e)&&e<=0&&$t(t)&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!zW(r))return!0;if((!tG(t)||!t.bin)&&FB([...HI,...YI],e)){const{orient:t,type:n}=i;return(!FB(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!FB(["bar","area"],n)||a)||o?.zero)}return!1}(e,t,n,i,r,o.scale,a)};function AK(e){FK(e)?function(e){const t=e.component.scales;for(const n of uU){const i=t[n];if(!i)continue;const r=pK(n,e);i.setWithExplicit("range",r)}}(e):$K(e,"range")}function $K(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?AK(n):kK(n,t);for(const i of qB(n)){let r;for(const n of e.children){const e=n.component.scales[i];e&&(r=dX(r,e.getWithExplicit(t),t,"scale",cX(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0))))}n[i].setWithExplicit(t,r)}}function DK(e,t,n,i,r=!1){const o=function(e,t,n,i){switch(t.type){case"nominal":case"ordinal":if(rI(e)||"discrete"===pU(e))return"shape"===e&&"ordinal"===t.type&&Tq(wq(e,"ordinal")),"ordinal";if(GI(e)||QI(e)){if(FB(["rect","bar","image","rule"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in VI)return"band";return gH(n[kI(e)])||fG(t)&&t.axis?.tickBand?"band":"point";case"temporal":return rI(e)?"time":"discrete"===pU(e)?(Tq(wq(e,"temporal")),"ordinal"):tG(t)&&t.timeUnit&&Zq(t.timeUnit).utc?"utc":"time";case"quantitative":return rI(e)?tG(t)&&AU(t.bin)?"bin-ordinal":"linear":"discrete"===pU(e)?(Tq(wq(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(gq(t.type))}(t,n,i,r),{type:a}=e;return cU(t)?void 0!==a?function(e,t,n=!1){if(!cU(e))return!1;switch(e){case vj:case bj:case wj:case kj:case $j:case Ej:return!!TW(t)||"band"===t||"point"===t&&!n;case Rj:case Ij:case Lj:case Bj:case jj:case Pj:return TW(t)||zW(t)||FB(["band","point","ordinal"],t);case Oj:case Nj:case Tj:return"band"!==t;case Uj:case zj:return"ordinal"===t||zW(t)}}(t,a)?tG(n)&&(s=a,l=n.type,!(FB([yW,bW],l)?void 0===s||OW(s):l===vW?FB([_W.TIME,_W.UTC,void 0],s):l!==gW||SW(s)||zW(s)||void 0===s))?(Tq(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(a,o)),o):a:(Tq(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,a,o)),o):o:null;var s,l}function SK(e){FK(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of uU){const a=AG(t[o]);if(a&&n===lH&&o===zj&&a.type===xW)continue;let s=a&&a.scale;if(a&&null!==s&&!1!==s){s??(s={});const n=DK(s,o,a,i,VG(t,o));r[o]=new fK(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}return r}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const n of e.children){SK(n);for(const o of qB(n.component.scales))if((t=r.scale)[o]??(t[o]=qQ(o,e)),"shared"===r.scale[o]){const e=i[o],t=n.component.scales[o].getWithExplicit("type");e?kW(e.value,t.value)?i[o]=dX(e,t,"type","scale",MK):(r.scale[o]="independent",delete i[o]):i[o]=t}}for(const t of qB(i)){const r=e.scaleName(t,!0),o=i[t];n[t]=new fK(r,o);for(const n of e.children){const e=n.component.scales[t];e&&(n.renameScale(e.get("name"),r),e.merged=!0)}}return n}(e)}const MK=cX(((e,t)=>AW(e)-AW(t)));class CK{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function FK(e){return"unit"===e?.type}function OK(e){return"facet"===e?.type}function NK(e){return"concat"===e?.type}function TK(e){return"layer"===e?.type}class zK{constructor(e,t,n,i,r,o,a){this.type=t,this.parent=n,this.config=r,this.correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=r,this.view=FU(a),this.name=e.name??i,this.title=NU(e.title)?{text:e.title}:e.title?FU(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new CK,this.projectionNameMap=n?n.projectionNameMap:new CK,this.signalNameMap=n?n.signalNameMap:new CK,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>SY(e)?{filter:EB(e.filter,hW)}:e)),this.layout="layer"===t||"unit"===t?{}:function(e,t,n){const i=n[t],r={},{spacing:o,columns:a}=i;void 0!==o&&(r.spacing=o),void 0!==a&&(HH(e)&&!qH(e.facet)||RV(e))&&(r.columns=a),PV(e)&&(r.columns=1);for(const t of UV)if(void 0!==e[t])if("spacing"===t){const n=e[t];r[t]=$t(n)?n:{row:n.row??o,column:n.column??o}}else r[t]=e[t];return r}(e,t,r),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:HH(e)||n?.component.data.isFaceted&&void 0===e.data},layoutSize:new sX,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?AB(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e,{ignoreRange:t}={}){SK(e),KZ(e);for(const t of HW)kK(e,t);t||AK(e)}(this)}parseProjection(){cZ(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){nZ(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of qB(n)){const t=n[e];void 0!==t&&(i[e]=qU(t))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=qU(this.description)),"unit"!==this.type&&"layer"!==this.type)?UB(t)?void 0:t:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...t??{}}}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,r=function(e,t){const n={};for(const i of aI){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:e,titleOrient:o}=EQ(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=wQ(i,o),s=zQ(e,a);void 0!==s&&(n[a]=s)}}return UB(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of aI)e[n].title&&t.push(DQ(this,n));for(const e of AQ)t=t.concat(CQ(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>cQ(e,"grid",t))),...i.map((e=>cQ(e,"grid",t))),...n.map((e=>cQ(e,"main",t))),...i.map((e=>cQ(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return aZ(this)}assembleProjections(){return TK(e=this)||NK(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),sZ(e))}(e):sZ(e);var e}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...OU(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return FB(["unit","layer"],this.type)?FB(["middle",void 0],n.anchor)&&(n.frame??(n.frame="group")):n.anchor??(n.anchor="start"),UB(n)?void 0:n}assembleGroup(e=[]){const t={};(e=e.concat(this.assembleSignals())).length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||OK(this.parent)?uK(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}getName(e){return VB((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(_X[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(OK(this.parent)){const t=XI(IQ(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(OW(e)&&zU(i)){const e=n.get("name"),i=sK(lK(this,t));return i?{signal:jQ(e,n,mG({aggregate:"distinct",field:i},{expr:"datum"}))}:(Tq(lq(t)),null)}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):yI(e)&&cU(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(`Cannot find a selection named "${t}".`);return n}hasAxisOrientSignalRef(){return this.component.axes.x?.some((e=>e.hasOrientSignalRef()))||this.component.axes.y?.some((e=>e.hasOrientSignalRef()))}}class RK extends zK{vgField(e,t={}){const n=this.fieldDef(e);if(n)return mG(n,t)}reduceFieldDef(e,t){return function(e,t,n,i){return e?qB(e).reduce(((n,r)=>{const o=e[r];return Fe(o)?o.reduce(((e,n)=>t.call(i,e,n,r)),n):t.call(i,n,o,r)}),n):n}(this.getMapping(),((t,n,i)=>{const r=EG(n);return r?e(t,r,i):t}),t)}forEachFieldDef(e,t){ZG(this.getMapping(),((t,n)=>{const i=EG(t);i&&e(i,n)}),t)}}class PK extends SX{clone(){return new PK(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=AB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"]}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${MB(this.transform)}`}assemble(){const{density:e,...t}=this.transform,n={type:"kde",field:e,...t};return this.transform.groupby&&(n.resolve="shared"),n}}class LK extends SX{clone(){return new LK(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=AB(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${MB(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class BK extends SX{clone(){return new BK(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==XU("invalid",r,n))return null;const o=t.reduceFieldDef(((e,n,r)=>{const o=cU(r)&&t.getScaleComponent(r);return o&&NW(o.get("type"))&&"count"!==n.aggregate&&!uH(i)&&(e[n.field]=n),e}),{});return qB(o).length?new BK(e,o):null}dependentFields(){return new Set(qB(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${MB(this.filter)}`}assemble(){const e=qB(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=mG(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class jK extends SX{clone(){return new jK(this.parent,AB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=AB(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map(((e,t)=>i[t]??e))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${MB(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class IK extends SX{clone(){return new IK(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=AB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"key",n[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${MB(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class UK extends SX{clone(){return new UK(null,AB(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[Mj,Sj],[Fj,Cj]]){const r=i.map((e=>{const n=AG(t.encoding[e]);return tG(n)?n.field:iG(n)?{expr:`${n.datum}`}:uG(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new UK(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(zj)){const i=t.typedFieldDef(zj);i.type===xW&&(e=new UK(e,null,i.field,t.getName("geojson_"+n++)))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){const e=(this.fields??[]).filter(St);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${MB(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class qK extends SX{clone(){return new qK(null,this.projection,AB(this.fields),AB(this.as))}constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[Mj,Sj],[Fj,Cj]]){const i=n.map((e=>{const n=AG(t.encoding[e]);return tG(n)?n.field:iG(n)?{expr:`${n.datum}`}:uG(n)?{expr:`${n.value}`}:void 0})),r=n[0]===Fj?"2":"";(i[0]||i[1])&&(e=new qK(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(St))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${MB(this.fields)} ${MB(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class WK extends SX{clone(){return new WK(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new WK(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(tG(i)&&tG(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const a=i.impute?r:r.impute?i:void 0,{method:s,value:l,frame:u,keyvals:c}=o.impute,f=KG(t.mark,n);return new WK(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==l?{value:l}:{},...u?{frame:u}:{},...void 0!==c?{keyvals:c}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${MB(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:a=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:MY(n)?this.processSequence(n):n}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};return i&&"value"!==i?[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]:[s]}}class HK extends SX{clone(){return new HK(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=AB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${MB(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class GK extends SX{clone(){return new GK(null,AB(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let a=null;if(function(e){return"data"in e}(o)){let e=a0(o.data,r);e||(e=new EZ(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new MX(e,n,_X.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return"param"in e}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(VB(e),e)}catch(t){throw new Error(`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`)}if(a=i.materialized,!a)throw new Error(`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new GK(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?nt(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${MB({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:nt(this.transform.as)}:{}};else{let t=this.transform.as;St(t)||(Tq('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),t="_lookup"),e={as:[t]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class VK extends SX{clone(){return new VK(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=AB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"prob",n[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${MB(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class YK extends SX{clone(){return new YK(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=AB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${MB(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class XK extends SX{clone(){return new XK(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=RB((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${MB(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==r?{op:r}:{},...void 0!==n?{groupby:n}:{}}}}class JK extends SX{clone(){return new JK(null,AB(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${MB(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function QK(e){let t=0;return function n(i,r){if(i instanceof EZ&&!i.isGenerator&&!pX(i.data)&&(e.push(r),r={name:null,source:r.name,transform:[]}),i instanceof xZ&&(i.parent instanceof EZ&&!r.source?(r.format={...r.format??{},parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof yZ)return r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,void e.push(...i.assemble());switch((i instanceof wZ||i instanceof kZ||i instanceof BK||i instanceof oQ||i instanceof xQ||i instanceof qK||i instanceof gZ||i instanceof GK||i instanceof WZ||i instanceof UZ||i instanceof IK||i instanceof jK||i instanceof PK||i instanceof HK||i instanceof VK||i instanceof YK||i instanceof _Z||i instanceof JK||i instanceof XK||i instanceof LK)&&r.transform.push(i.assemble()),(i instanceof mZ||i instanceof OX||i instanceof WK||i instanceof qZ||i instanceof UK)&&r.transform.push(...i.assemble()),i instanceof MX&&(r.source&&0===r.transform.length?i.setSource(r.source):i.parent instanceof MX?i.setSource(r.name):(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()&&(e.push(r),r={name:null,source:r.name,transform:[]}))),i.numChildren()){case 0:i instanceof MX&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const e of i.children)n(e,{name:null,source:o,transform:[]});break}}}}function ZK(e,t){const{facet:n,config:i,child:r,component:o}=e;if(e.channelHasField(t)){const a=n[t],s=kQ("title",null,i,t);let l=xG(a,i,{allowDisabling:!0,includeDefault:void 0===s||!!s});r.component.layoutHeaders[t].title&&(l=Fe(l)?l.join(", "):l,l+=` / ${r.component.layoutHeaders[t].title}`,r.component.layoutHeaders[t].title=null);const u=kQ("labelOrient",a.header,i,t),c=null!==a.header&&rj(a.header?.labels,i.header.labels,!0),f=FB(["bottom","right"],u)?"footer":"header";o.layoutHeaders[t]={title:null!==a.header?l:null,facetFieldDef:a,[f]:"facet"===t?[]:[KK(e,t,c)]}}}function KK(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function e0(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=WQ(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",a=r[o];for(const r of n.component.axes[t]){const t="top"===(i=r.get("orient"))||"left"===i||TU(i)?"header":"footer";a[t]??(a[t]=[KK(e,o,!1)]);const n=cQ(r,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}var i}function t0(e){for(const t of e.children)t.parseLayoutSize()}function n0(e,t){const n=IQ(t),i=XI(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const t of e.children){const o=t.component.layoutSize.getWithExplicit(n),s=r.scale[i]??qQ(i,e);if("independent"===s&&"step"===o.value){a=void 0;break}if(a){if("independent"===s&&a.value!==o.value){a=void 0;break}a=dX(a,o,n,"")}else a=o}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,a)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function i0(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(OW(e)){const e=HV(i.view,t);return zU(n)||jV(e)?"step":e}return qV(i.view,t)}if(e.hasProjection||"arc"===e.mark)return qV(i.view,t);{const e=HV(i.view,t);return jV(e)?e.step:e}}function r0(e,t,n){return mG(t,{suffix:`by_${mG(e)}`,...n??{}})}class o0 extends RK{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=M0(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!qH(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=qB(e),n={};for(const i of t){if(![mj,gj].includes(i)){Tq(bq(i,"facet"));break}const t=e[i];if(void 0===t.field){Tq(vq(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=SG(e,t);return n.header?n.header=FU(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=s0(this),this.child.parseData()}parseLayoutSize(){t0(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of aI)ZK(e,t);e0(e,"x"),e0(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){const e={};for(const t of aI)for(const n of $Q){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=kQ("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=wQ(t,n);e.titleAnchor??(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(r?.[0]){const r="row"===t?"height":"width",o="header"===n?"headerBand":"footerBand";"facet"===t||this.child.component.layoutSize.get(r)||(e[o]??(e[o]={}),e[o][t]=.5),i.title&&(e.offset??(e.offset={}),e.offset["row"===t?"rowTitle":"columnTitle"]=10)}}return e}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof o0))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof o0?{...this.channelHasField("column")?{encode:{update:{columns:{field:mG(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof o0){if(this.child.channelHasField("column")){const i=mG(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of HI){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(OW(o)&&zU(a)){const r=sK(lK(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):Tq(lq(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:i}=this.facet,{fields:r,ops:o,as:a}=this.getCardinalityAggregateForChild(),s=[];for(const e of aI){const t=this.facet[e];if(t){s.push(mG(t));const{bin:l,sort:u}=t;if(AU(l)&&s.push(mG(t,{binSuffix:"end"})),IH(u)){const{field:e,op:s=PH}=u,l=r0(t,u);n&&i?(r.push(l),o.push("max"),a.push(l)):(r.push(e),o.push(s),a.push(l))}else if(Fe(u)){const n=_Q(t,e);r.push(n),o.push("max"),a.push(n)}}}const l=!!n&&!!i;return{name:e,data:t,groupby:s,...l||r.length>0?{aggregate:{...l?{cross:l}:{},...r.length?{fields:r,ops:o,as:a}:{}}}:{}}}facetSortFields(e){const{facet:t}=this,n=t[e];return n?IH(n.sort)?[r0(n,n.sort,{expr:"datum"})]:Fe(n.sort)?[_Q(n,e,{expr:"datum"})]:[mG(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(IH(e)?e.order:!Fe(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return OQ(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of AQ)if(e[i]){const r=kQ("labelOrient",e[i]?.header,t,i);if(n[i].includes(r))return OQ(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=QK(t);for(const t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...r?{style:r}:{},from:{facet:this.assembleFacet()},sort:{field:aI.map((e=>this.facetSortFields(e))).flat(),order:aI.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(AX(this,[]))}]}getMapping(){return this.facet}}function a0(e,t){for(const n of t){const t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;const i=e.format?.mesh,r=t.format?.feature;if(i&&r)continue;const o=e.format?.feature;if((o||r)&&o!==r)continue;const a=t.format?.mesh;if(!i&&!a||i===a)if(mX(e)&&mX(t)){if(hj(e.values,t.values))return n}else if(pX(e)&&pX(t)){if(e.url===t.url)return n}else if(gX(e)&&e.name===n.dataName)return n}return null}function s0(e){let t=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new EZ({values:[]});return t.push(e),e}const n=a0(e.data,t);if(n)return yX(e.data)||(n.data.format=TB({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new EZ(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:i}=e.component.data,r=e.data,o=r&&(yX(r)||pX(r)||mX(r))||!e.parent?new hX:e.parent.component.data.ancestorParse.clone();yX(r)?(vX(r)?t=new kZ(t,r.sequence):xX(r)&&(t=new wZ(t,r.graticule)),o.parseNothing=!0):null===r?.format?.parse&&(o.parseNothing=!0),t=xZ.makeExplicit(t,e,o)??t,t=new _Z(t);const a=e.parent&&TK(e.parent);(FK(e)||OK(e))&&a&&(t=mZ.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(jY(r))a=e=new xQ(e,r),o="derived";else if(SY(r)){const i=bZ(r);a=e=xZ.makeWithAncestors(e,{},i,n)??e,e=new oQ(e,t,r.filter)}else if(IY(r))a=e=mZ.makeFromTransform(e,r,t),o="number";else if(qY(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new xZ(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=OX.makeFromTransform(e,r);else if(WY(r))a=e=gZ.makeFromTransform(e,r),o="number",eQ(t)&&(e=new _Z(e));else if(CY(r))a=e=GK.make(e,t,r,i++),o="derived";else if(PY(r))a=e=new WZ(e,r),o="number";else if(LY(r))a=e=new UZ(e,r),o="number";else if(HY(r))a=e=qZ.makeFromTransform(e,r),o="derived";else if(GY(r))a=e=new IK(e,r),o="derived";else if(VY(r))a=e=new LK(e,r),o="derived";else if(BY(r))a=e=new jK(e,r),o="derived";else if(FY(r))a=e=new XK(e,r),o="derived";else if(RY(r))e=new JK(e,r);else if(UY(r))a=e=WK.makeFromTransform(e,r),o="derived";else if(OY(r))a=e=new PK(e,r),o="derived";else if(NY(r))a=e=new VK(e,r),o="derived";else if(TY(r))a=e=new YK(e,r),o="derived";else{if(!zY(r)){Tq(`Ignoring an invalid transform: ${pj(r)}.`);continue}a=e=new HK(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(t,e,o));const s=function(e){const t={};if(FK(e)&&e.component.selection)for(const n of qB(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&ij(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=function(e){const t={};function n(e){var n;FG(e)?t[e.field]="date":"quantitative"===e.type&&St(n=e.aggregate)&&FB(["min","max"],n)?t[e.field]="number":ij(e.field)>1?e.field in t||(t[e.field]="flatten"):cG(e)&&IH(e.sort)&&ij(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((FK(e)||OK(e))&&e.forEachFieldDef(((t,i)=>{if(lG(t))n(t);else{const r=xI(i),o=e.fieldDef(r);n({...t,type:o.type})}})),FK(e)){const{mark:n,markDef:i,encoding:r}=e;if(uH(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];tG(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}(e);t=xZ.makeWithAncestors(t,{},{...s,...l},o)??t,FK(e)&&(t=UK.parseAll(t,e),t=qK.parseAll(t,e)),(FK(e)||OK(e))&&(a||(t=mZ.makeFromEncoding(t,e)??t),t=OX.makeFromEncoding(t,e)??t,t=xQ.parseAllForSortIndex(t,e));const u=e.getDataName(_X.Raw),c=new MX(t,u,_X.Raw,i);if(n[u]=c,t=c,FK(e)){const n=gZ.makeFromEncoding(t,e);n&&(t=n,eQ(e)&&(t=new _Z(t))),t=WK.makeFromEncoding(t,e)??t,t=qZ.makeFromEncoding(t,e)??t}FK(e)&&(t=BK.make(t,e)??t);const f=e.getDataName(_X.Main),d=new MX(t,f,_X.Main,i);n[f]=d,t=d,FK(e)&&function(e,t){for(const[n,i]of HB(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new MX(new oQ(t,e,{param:n}),r,_X.Lookup,e.component.data.outputNodeRefCounts)}}(e,d);let h=null;if(OK(e)){const i=e.getName("facet");t=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(IH(r.sort)){const{field:n,op:i=PH}=r.sort;e=t=new UZ(e,{joinaggregate:[{op:i,field:n,as:r0(r,r.sort,{forAs:!0})}],groupby:[mG(r)]})}return t}return null}(t,e.facet)??t,h=new yZ(t,e,i,d.getSource()),n[i]=h}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:c,main:d,facetRoot:h,ancestorParse:o}}class l0 extends zK{constructor(e,t,n,i){super(e,"concat",t,n,i,e.resolve),"shared"!==e.resolve?.axis?.x&&"shared"!==e.resolve?.axis?.y||Tq("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map(((e,t)=>M0(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=s0(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of qB(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return PV(e)?e.vconcat:LV(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){t0(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";n0(e,t),n0(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.forEach((e=>e.assembleSignals())),[]}assembleLayoutSignals(){const e=PQ(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleMarks(){return this.children.map((e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return{type:"group",name:e.getName("group"),...t?{title:t}:{},...n?{style:n}:{},...i?{encode:{update:i}}:{},...e.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const e=this.layout.columns;return{...null!=e?{columns:e}:{},bounds:"full",align:"each"}}}const u0={disable:1,gridScale:1,scale:1,...BG,labelExpr:1,encode:1},c0=qB(u0);class f0 extends sX{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new f0(AB(this.explicit),AB(this.implicit),this.mainExtracted)}hasAxisPart(e){return!("axis"!==e&&("grid"===e||"title"===e?!this.get(e):(t=this.get(e),!1===t||null===t)));var t}hasOrientSignalRef(){return TU(this.explicit.orient)}}const d0={bottom:"top",top:"bottom",left:"right",right:"left"};function h0(e,t){if(!e)return t.map((e=>e.clone()));{if(e.length!==t.length)return;const n=e.length;for(let i=0;i{switch(n){case"title":return nq(e,t);case"gridScale":return{explicit:e.explicit,value:rj(e.value,t.value)}}return fX(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function m0(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(TU(n.labelAngle)?n.labelAngle:cj(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===bQ(i,r))return!0}return e===n[t]}const g0=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function y0(e,t){let n=t.axis(e);const i=new f0,r=AG(t.encoding[e]),{mark:o,config:a}=t,s=n?.orient||a["x"===e?"axisX":"axisY"]?.orient||a.axis?.orient||function(e){return"x"===e?"bottom":"left"}(e),l=t.getScaleComponent(e).get("type"),u=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:SW(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=TU(n)?"axisOrient":`axis${JB(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],l=["axis",a,o];return{vlOnlyAxisConfig:dQ(s,i,e,n),vgAxisConfig:dQ(l,i,e,n),axisConfigStyle:hQ([...l,...s],i)}}(e,l,s,t.config),c=void 0!==n?!n:pQ("disable",a.style,n?.style,u).configValue;if(i.set("disable",c,void 0!==n),c)return i;n=n||{};const f=function(e,t,n,i,r){const o=t?.labelAngle;if(void 0!==o)return TU(o)?o:cj(o);{const{configValue:o}=pQ("labelAngle",i,t?.style,r);return void 0!==o?cj(o):n!==vj||!FB([bW,yW],e.type)||tG(e)&&e.timeUnit?void 0:270}}(r,n,e,a.style,u),d=OH(n.formatType,r,l),h=FH(r,r.type,n.format,n.formatType,a,!0),p={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:l,orient:s,labelAngle:f,format:h,formatType:d,mark:o,config:a};for(const r of c0){const o=r in mQ?mQ[r](p):IG(r)?n[r]:void 0,s=void 0!==o,l=m0(o,r,n,t,e);if(s&&l)i.set(r,o,l);else{const{configValue:e,configFrom:t}=IG(r)&&"values"!==r?pQ(r,a.style,n.style,u):{},c=void 0!==e;s&&!c?i.set(r,o,l):("vgAxisConfig"!==t||g0.has(r)&&c||RG(e)||TU(e))&&i.set(r,e,!1)}}const m=n.encoding??{},g=PG.reduce(((n,r)=>{if(!i.hasAxisPart(r))return n;const o=UQ(m[r]??{},t),a="labels"===r?function(e,t,n){const{encoding:i,config:r}=e,o=AG(i[t])??AG(i[wI(t)]),a=e.axis(t)||{},{format:s,formatType:l}=a;if(AH(l))return{text:CH({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:l,config:r}),...n};if(void 0===s&&void 0===l&&r.customFormatTypes){if("quantitative"===nG(o)){if(fG(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:CH({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:CH({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===nG(o)&&r.timeFormatType&&tG(o)&&!o.timeUnit)return{text:CH({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,o):o;return void 0===a||UB(a)||(n[r]={update:a}),n}),{});return UB(g)||i.set("encode",g,!!n.encoding||void 0!==n.labelAngle),i}function v0(e,t){const{config:n}=e;return{...$J(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...hJ("x",e,{defaultPos:"mid"}),...hJ("y",e,{defaultPos:"mid"}),...uJ("size",e),...uJ("angle",e),...b0(e,0,t)}}function b0(e,t,n){return n?{shape:{value:n}}:uJ("shape",e)}function x0(e,t,n){if(void 0===XU("align",e,n))return"center"}function _0(e,t,n){if(void 0===XU("baseline",e,n))return"middle"}function w0(e){const{config:t,markDef:n}=e,{orient:i}=n,r="horizontal"===i?"width":"height",o=e.getScaleComponent("horizontal"===i?"x":"y"),a=XU("size",n,t,{vgChannel:r})??t.tick.bandSize;if(void 0!==a)return a;{const e=o?o.get("range"):void 0;return e&&zU(e)&&$t(e.step)?3*e.step/4:3*WV(t.view,r)/4}}const k0={arc:{vgMark:"arc",encodeEntry:e=>({...$J(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...hJ("x",e,{defaultPos:"mid"}),...hJ("y",e,{defaultPos:"mid"}),..._J(e,"radius"),..._J(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...$J(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...vJ("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...vJ("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...MJ(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...$J(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),..._J(e,"x"),..._J(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>v0(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...$J(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&tG(n)&&n.type===xW?{field:mG(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...$J(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),..._J(e,"x"),..._J(e,"y"),...tJ(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...$J(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...hJ("x",e,{defaultPos:"mid"}),...hJ("y",e,{defaultPos:"mid"}),...uJ("size",e,{vgChannel:"strokeWidth"}),...MJ(e)})},point:{vgMark:"symbol",encodeEntry:e=>v0(e)},rect:{vgMark:"rect",encodeEntry:e=>({...$J(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),..._J(e,"x"),..._J(e,"y")})},rule:{vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?{...$J(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...vJ("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...vJ("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...uJ("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>v0(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...$J(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...hJ("x",e,{defaultPos:"mid"}),...hJ("y",e,{defaultPos:"mid"}),...tJ(e),...uJ("size",e,{vgChannel:"fontSize"}),...uJ("angle",e),...CJ("align",x0(e.markDef,0,t)),...CJ("baseline",_0(e.markDef,0,t)),...hJ("radius",e,{defaultPos:null}),...hJ("theta",e,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",o="horizontal"===i?"height":"width";return{...$J(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...hJ("x",e,{defaultPos:"mid",vgChannel:"xc"}),...hJ("y",e,{defaultPos:"mid",vgChannel:"yc"}),...uJ("size",e,{defaultValue:w0(e),vgChannel:r}),[o]:qU(XU("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...$J(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...hJ("x",e,{defaultPos:"mid"}),...hJ("y",e,{defaultPos:"mid"}),...uJ("size",e),...MJ(e)})}};const E0="faceted_path_",A0="stack_group_";function $0(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,a=rj(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!t?.get("selectionExtent")&&!n?.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),s=YU(i),l=r.key,u=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,a=t.order;if(!(!Fe(a)&&uG(a)&&CB(a.value)||!a&&CB(XU("order",r,o)))){if((Fe(a)||tG(a))&&!n)return KU(a,{expr:"datum"});if(uH(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(tG(i)){const t=i.sort;return Fe(t)?{field:mG(i,{prefix:n,suffix:"sort_index",expr:"datum"})}:IH(t)?{field:mG({aggregate:YG(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})}:jH(t)?{field:mG(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}:null===t?void 0:{field:mG(i,{binSuffix:e.stack?.impute?"mid":void 0,expr:"datum"})}}}}}(e),c=function(e){if(!e.component.selection)return null;const t=qB(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=qB(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip}:null}(e),f=XU("aria",i,o),d=k0[n].postEncodingTransform?k0[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:k0[n].vgMark,...a?{clip:!0}:{},...s?{style:s}:{},...l?{key:l.field}:{},...u?{sort:u}:{},...c||{},...!1===f?{aria:f}:{},from:{data:t.fromPrefix+e.requestDataName(_X.Main)},encode:{update:k0[n].encodeEntry(e)},...d?{transform:d}:{}}]}class D0 extends RK{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,IV(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[];const o=dH(e.mark)?{...e.mark}:{type:e.mark},a=o.type;void 0===o.filled&&(o.filled=function(e,t,{graticule:n}){if(n)return!1;const i=JU("filled",e,t),r=e.type;return rj(i,r!==eH&&r!==KW&&r!==nH)}(o,r,{graticule:e.data&&xX(e.data)}));const s=this.encoding=function(e,t,n,i){const r={};for(const t of qB(e))yI(t)||Tq(`${o=t}-encoding is dropped as ${o} is not a valid encoding channel.`);var o,a;for(let o of DI){if(!e[o])continue;const s=e[o];if(QI(o)){const e=$I(o),t=r[e];if(tG(t)&&("quantitative"===(a=t.type)||"temporal"===a)&&tG(s)&&!t.timeUnit){Tq(mq(e));continue}}if("angle"!==o||"arc"!==t||e.theta||(Tq("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=$j),JG(e,o,t)){if(o===Rj&&"line"===t){const t=EG(e[o]);if(t?.aggregate){Tq("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(o===Oj&&(n?"fill"in e:"stroke"in e))Tq(yq("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(o===Hj||o===Wj&&!Fe(s)&&!uG(s)||o===Vj&&Fe(s)){if(s){if(o===Wj){const t=e[o];if(QH(t)){r[o]=t;continue}}r[o]=nt(s).reduce(((e,t)=>(tG(t)?e.push(SG(t,o)):Tq(vq(t,o)),e)),[])}}else{if(o===Vj&&null===s)r[o]=null;else if(!(tG(s)||iG(s)||uG(s)||ZH(s)||TU(s))){Tq(vq(s,o));continue}r[o]=$G(s,o,i)}}else Tq(bq(o,t))}return r}(e.encoding||{},a,o.filled,r);this.markDef=dY(o,s,r),this.size=function({encoding:e,size:t}){for(const n of HI){const i=kI(n);jV(t[i])&&rG(e[n])&&(delete t[i],Tq(Dq(i)))}return t}({encoding:s,size:IV(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=fY(this.markDef,s),this.specifiedScales=this.initScales(a,s),this.specifiedAxes=this.initAxes(s),this.specifiedLegends=this.initLegends(s),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter((e=>TV(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===lH,n=e&&nI.some((t=>sG(e[t])));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return uU.reduce(((e,n)=>{const i=AG(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:t,range:n}=e,i=FU(e);return Fe(t)&&(i.domain=t.map(IU)),Fe(n)&&(i.range=n.map(IU)),i}initAxes(e){return HI.reduce(((t,n)=>{const i=e[n];if(sG(i)||n===vj&&sG(e.x2)||n===bj&&sG(e.y2)){const e=sG(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=qB(e),n={};for(const i of t){const t=e[i];n[i]=RG(t)?jU(t):IU(t)}return n}initLegends(e){return sU.reduce(((t,n)=>{const i=AG(e[n]);if(i&&function(e){switch(e){case Oj:case Nj:case Tj:case Rj:case zj:case Lj:case Ij:case Uj:return!0;case Bj:case jj:case Pj:return!1}}(n)){const e=i.legend;t[n]=e?FU(e):e}return t}),{})}parseData(){this.component.data=s0(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of HI){const r=kI(i);if(t[r]){const e=t[r];n.layoutSize.set(r,jV(e)?"step":e,!0)}else{const t=i0(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){const n={},i=e.config.selection;if(!t||!t.length)return n;for(const r of t){const t=VB(r.name),o=r.select,a=St(o)?o:o.type,s=Oe(o)?AB(o):{type:a},l=i[a];for(const e in l)"fields"!==e&&"encodings"!==e&&("mark"===e&&(s[e]={...l[e],...s[e]}),void 0!==s[e]&&!0!==s[e]||(s[e]=AB(l[e]??s[e])));const u=n[t]={...s,name:t,type:a,init:r.value,bind:r.bind,events:St(s.on)?JT(s.on,"scope"):nt(AB(s.on))},c=AB(r);for(const t of ZJ)t.defined(u)&&t.parse&&t.parse(e,u,c)}return n}(this,this.selection)}parseMarkGroup(){this.component.mark=function(e){if(FB([KW,JW,oH],e.mark)){const t=KG(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:E0+e.requestDataName(_X.Main),data:e.requestDataName(_X.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:$0(e,{fromPrefix:E0})}]}(e,t)}else if(e.mark===QW){const t=BU.some((t=>XU(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=$0(e,{fromPrefix:A0}),n=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),r=(e,t)=>`${e}(${[i({prefix:"min",suffix:"start",expr:t}),i({prefix:"max",suffix:"start",expr:t}),i({prefix:"min",suffix:"end",expr:t}),i({prefix:"max",suffix:"end",expr:t})].map((e=>`scale('${n}',${e})`)).join(",")})`;let o,a;"x"===e.stack.fieldChannel?(o={...DB(t.encode.update,["y","yc","y2","height",...BU]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...SB(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...DB(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...SB(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const n of BU){const i=JU(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=qU(i)),i&&(t.encode.update[n]={value:0})}const s=[];if(e.stack.groupbyChannels?.length>0)for(const t of e.stack.groupbyChannels){const n=e.fieldDef(t),i=mG(n);i&&s.push(i),(n?.bin||n?.timeUnit)&&s.push(mG(n,{binSuffix:"end"}))}return o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((n,i)=>{if(t.encode.update[i])return{...n,[i]:t.encode.update[i]};{const t=JU(i,e.markDef,e.config);return void 0!==t?{...n,[i]:qU(t)}:n}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(_X.Main),name:A0+e.requestDataName(_X.Main),groupby:s,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[t]}]}]}(e)}return $0(e)}(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,HI.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[y0(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;for(const i of WB(e.component.selection??{})){const r=i.name,o=Pt(r+YJ);if(0===t.filter((e=>e.name===r)).length){const e="global"===i.resolve?"union":i.resolve,n="point"===i.type?", true, true)":")";t.push({name:i.name,update:`${QJ}(${o}, ${Pt(e)}${n}`})}n=!0;for(const n of ZJ)n.defined(i)&&n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))}if(n){0===t.filter((e=>"unit"===e.name)).length&&t.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]})}return DX(t)}(this,e)}assembleSignals(){return[...fQ(this),...EX(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t],i=KJ(e,{escape:!1});for(const t of WB(e.component.selection??{})){const e={name:t.name+YJ};if(t.project.hasSelectionId&&(e.transform=[{type:"collect",sort:{field:CV}}]),t.init){const n=t.project.items.map(wX);e.values=t.project.hasSelectionId?t.init.map((e=>({unit:i,[CV]:kX(e,!1)[0]}))):t.init.map((e=>({unit:i,fields:n,values:kX(e,!1)})))}n.filter((e=>e.name===t.name+YJ)).length||n.push(e)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return PQ(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&TK(this.parent)||(e=$X(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){const{style:e}=this.view||{};return void 0!==e?e:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return HG(this.encoding,e)}fieldDef(e){return EG(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return lG(t)?t:null}}class S0 extends zK{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const o={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(rY(e))return new S0(e,this,this.getName(`layer_${t}`),o,r);if(qG(e))return new D0(e,this,this.getName(`layer_${t}`),o,r);throw new Error(iq(e))}))}parseData(){this.component.data=s0(this);for(const e of this.children)e.parseData()}parseLayoutSize(){t0(this),n0(this,"width"),n0(this,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of qB(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const i of e.children){i.parseAxesAndHeaders();for(const r of qB(i.component.axes))n.axis[r]=WQ(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=h0(t[r],i.component.axes[r]),t[r]||(n.axis[r]="independent",delete t[r]))}for(const r of HI){for(const o of e.children)if(o.component.axes[r]){if("independent"===n.axis[r]){t[r]=(t[r]??[]).concat(o.component.axes[r]);for(const e of o.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!TU(t)){if(i[t]>0&&!n){const n=d0[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete o.component.axes[r]}if("independent"===n.axis[r]&&t[r]&&t[r].length>1)for(const[e,n]of(t[r]||[]).entries())e>0&&n.get("grid")&&!n.explicit.grid&&(n.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleSignals())),fQ(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),PQ(this))}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleGroupStyle(){const e=new Set;for(const t of this.children)for(const n of nt(t.assembleGroupStyle()))e.add(n);const t=Array.from(e);return t.length>1?t:1===t.length?t[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)FK(n)&&(t=$X(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),aZ(this))}}function M0(e,t,n,i,r){if(HH(e))return new o0(e,t,n,r);if(rY(e))return new S0(e,t,n,i,r);if(qG(e))return new D0(e,t,n,i,r);if(function(e){return PV(e)||LV(e)||RV(e)}(e))return new l0(e,t,n,r);throw new Error(iq(e))}function C0(e,t={}){var n;t.logger&&(n=t.logger,Nq=n),t.fieldTitle&&bG(t.fieldTitle);try{const n=KV(Te(t.config,e.config)),i=eX(e,n),r=M0(i,null,"",void 0,n);r.parse(),function(e,t){XZ(e.sources);let n=0,i=0;for(let i=0;i"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:f,...d}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...d,...s?{title:s}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([]),...zV(f)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}(r,function(e,t,n,i){const r=i.component.layoutSize.get("width"),o=i.component.layoutSize.get("height");if(void 0===t?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):St(t)&&(t={type:t}),r&&o&&("fit"===(a=t.type)||"fit-x"===a||"fit-y"===a))if("step"===r&&"step"===o)Tq(sq()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";Tq(sq(XI(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${XI(e)}`:"fit"}(n)}var a;return{...1===qB(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t},...aX(n,!1),...aX(e,!0)}}(e,i.autosize,n,r),e.datasets,e.usermeta);return{spec:o,normalized:i}}finally{t.logger&&(Nq=Oq),t.fieldTitle&&bG(yG)}}const F0="5.16.2",O0=function(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}};const N0="#fff",T0="#888",z0={background:"#333",view:{stroke:T0},title:{color:N0,subtitleColor:N0},style:{"guide-label":{fill:N0},"guide-title":{fill:N0}},axis:{domainColor:N0,gridColor:T0,tickColor:N0}},R0="#4572a7",P0={background:"#fff",arc:{fill:R0},area:{fill:R0},line:{stroke:R0,strokeWidth:2},path:{stroke:R0},rect:{fill:R0},shape:{stroke:R0},symbol:{fill:R0,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},L0="#30a2da",B0="#cbcbcb",j0="#f0f0f0",I0="#333",U0={arc:{fill:L0},area:{fill:L0},axis:{domainColor:B0,grid:!0,gridColor:B0,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:B0,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:j0,group:{fill:j0},legend:{labelColor:I0,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:I0,titleFontSize:14,titlePadding:10},line:{stroke:L0,strokeWidth:2},path:{stroke:L0,strokeWidth:.5},rect:{fill:L0},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:L0},bar:{binSpacing:2,fill:L0,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},q0="#000",W0={group:{fill:"#e5e5e5"},arc:{fill:q0},area:{fill:q0},line:{stroke:q0},path:{stroke:q0},rect:{fill:q0},shape:{stroke:q0},symbol:{fill:q0,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},H0="Benton Gothic, sans-serif",G0="#82c6df",V0="Benton Gothic Bold, sans-serif",Y0="normal",X0={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},J0={background:"#ffffff",title:{anchor:"start",color:"#000000",font:V0,fontSize:22,fontWeight:"normal"},arc:{fill:G0},area:{fill:G0},line:{stroke:G0,strokeWidth:2},path:{stroke:G0},rect:{fill:G0},shape:{stroke:G0},symbol:{fill:G0,size:30},axis:{labelFont:H0,labelFontSize:11.5,labelFontWeight:"normal",titleFont:V0,titleFontSize:13,titleFontWeight:Y0},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:H0,labelFontSize:11.5,symbolType:"square",titleFont:V0,titleFontSize:13,titleFontWeight:Y0},range:{category:X0["category-6"],diverging:X0["fireandice-6"],heatmap:X0["fire-7"],ordinal:X0["fire-7"],ramp:X0["fire-7"]}},Q0="#ab5787",Z0="#979797",K0={background:"#f9f9f9",arc:{fill:Q0},area:{fill:Q0},line:{stroke:Q0},path:{stroke:Q0},rect:{fill:Q0},shape:{stroke:Q0},symbol:{fill:Q0,size:30},axis:{domainColor:Z0,domainWidth:.5,gridWidth:.2,labelColor:Z0,tickColor:Z0,tickWidth:.2,titleColor:Z0},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},e1="#3e5c69",t1={background:"#fff",arc:{fill:e1},area:{fill:e1},line:{stroke:e1},path:{stroke:e1},rect:{fill:e1},shape:{stroke:e1},symbol:{fill:e1},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},n1="#1696d2",i1="#000000",r1="Lato",o1="Lato",a1={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},s1={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:r1},axisX:{domain:!0,domainColor:i1,domainWidth:1,grid:!1,labelFontSize:12,labelFont:o1,labelAngle:0,tickColor:i1,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:r1},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:o1,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:r1,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:o1,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:r1,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:a1["six-groups-cat-1"],diverging:a1["diverging-colors"],heatmap:a1["diverging-colors"],ordinal:a1["six-groups-seq"],ramp:a1["shades-blue"]},area:{fill:n1},rect:{fill:n1},line:{color:n1,stroke:n1,strokeWidth:5},trail:{color:n1,stroke:n1,strokeWidth:0,size:1},path:{stroke:n1,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:n1,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:n1,stroke:null}},arc:{fill:n1},shape:{stroke:n1},symbol:{fill:n1,size:30}},l1="#3366CC",u1="#ccc",c1="Arial, sans-serif",f1={arc:{fill:l1},area:{fill:l1},path:{stroke:l1},rect:{fill:l1},shape:{stroke:l1},symbol:{stroke:l1},circle:{fill:l1},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:c1,fontSize:12},"guide-title":{font:c1,fontSize:12},"group-title":{font:c1,fontSize:12}},title:{font:c1,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:u1,tickColor:u1,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},d1=e=>e*(1/3+1),h1=d1(9),p1=d1(10),m1=d1(12),g1="Segoe UI",y1="wf_standard-font, helvetica, arial, sans-serif",v1="#252423",b1="#605E5C",x1="transparent",_1="#118DFF",w1="#DEEFFF",k1=[w1,_1],E1={view:{stroke:x1},background:x1,font:g1,header:{titleFont:y1,titleFontSize:m1,titleColor:v1,labelFont:g1,labelFontSize:p1,labelColor:b1},axis:{ticks:!1,grid:!1,domain:!1,labelColor:b1,labelFontSize:h1,titleFont:y1,titleColor:v1,titleFontSize:m1,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:_1},line:{stroke:_1,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:g1,fontSize:h1,fill:b1},arc:{fill:_1},area:{fill:_1,line:!0,opacity:.6},path:{stroke:_1},rect:{fill:_1},point:{fill:_1,filled:!0,size:75},shape:{stroke:_1},symbol:{fill:_1,strokeWidth:1.5,size:50},legend:{titleFont:g1,titleFontWeight:"bold",titleColor:b1,labelFont:g1,labelFontSize:p1,labelColor:b1,symbolType:"circle",symbolSize:75},range:{category:[_1,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:k1,heatmap:k1,ordinal:[w1,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",_1]}},A1='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',$1=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],D1=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function S1({type:e,background:t}){const n="dark"===e?"#161616":"#ffffff",i="dark"===e?"#f4f4f4":"#161616",r="dark"===e?"#d4bbff":"#6929c4";return{background:t,arc:{fill:r},area:{fill:r},path:{stroke:r},rect:{fill:r},shape:{stroke:r},symbol:{stroke:r},circle:{fill:r},view:{fill:n,stroke:n},group:{fill:n},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:A1,fontWeight:600},axis:{labelColor:i,labelFontSize:12,grid:!0,gridColor:"#525252",titleColor:i,labelAngle:0},style:{"guide-label":{font:A1,fill:i,fontWeight:400},"guide-title":{font:A1,fill:i,fontWeight:400}},range:{category:"dark"===e?$1:D1,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const M1=S1({type:"light",background:"#ffffff"}),C1=S1({type:"light",background:"#f4f4f4"}),F1=S1({type:"dark",background:"#262626"}),O1=S1({type:"dark",background:"#161616"}),N1="2.14.0";function T1(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,i){if("object"!=typeof i||null===i)return i;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(i)>=0?"[Circular]":(t.push(i),i)}}(t))}const z1="vg-tooltip-element",R1={offsetX:10,offsetY:10,id:z1,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/t(St(e)?e:T1(e,n)))).join(", ")}]`;if(Oe(e)){let i="";const{title:r,image:o,...a}=e;r&&(i+=`

${t(r)}

`),o&&(i+=``);const s=Object.keys(a);if(s.length>0){i+="";for(const e of s){let r=a[e];void 0!==r&&(Oe(r)&&(r=T1(r,n)),i+=``)}i+="
${t(e)}${t(r)}
"}return i||"{}"}return t(e)}};class P1{constructor(e){this.options={...R1,...e};const t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return"#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n".toString().replace(z1,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,i){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),null==i||""===i)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(i,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:r,y:o}=function(e,t,n,i){let r=e.clientX+n;r+t.width>window.innerWidth&&(r=+e.clientX-n-t.width);let o=e.clientY+i;return o+t.height>window.innerHeight&&(o=+e.clientY-i-t.height),{x:r,y:o}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.style.top=`${o}px`,this.el.style.left=`${r}px`}}function L1(e){return L1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L1(e)}function B1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==L1(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==L1(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===L1(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var I1,U1,q1=W1;function W1(e){var t=this;if(t instanceof W1||(t=new W1),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,i=arguments.length;n1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,n=this.head.value}for(var r=0;null!==i;r++)n=e(n,i.value,r),i=i.next;return n},W1.prototype.reduceReverse=function(e,t){var n,i=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,n=this.tail.value}for(var r=this.length-1;null!==i;r--)n=e(n,i.value,r),i=i.prev;return n},W1.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},W1.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},W1.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new W1;if(tthis.length&&(t=this.length);for(var i=0,r=this.head;null!==r&&ithis.length&&(t=this.length);for(var i=this.length,r=this.tail;null!==r&&i>t;i--)r=r.prev;for(;null!==r&&i>e;i--,r=r.prev)n.push(r.value);return n},W1.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,r=this.head;null!==r&&i1,s2=(e,t,n)=>{const i=e[r2].get(t);if(i){const t=i.value;if(l2(e,t)){if(c2(e,i),!e[K1])return}else n&&(e[o2]&&(i.value.now=Date.now()),e[i2].unshiftNode(i));return t.value}},l2=(e,t)=>{if(!t||!t.maxAge&&!e[e2])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[e2]&&n>e[e2]},u2=e=>{if(e[Q1]>e[J1])for(let t=e[i2].tail;e[Q1]>e[J1]&&null!==t;){const n=t.prev;c2(e,t),t=n}},c2=(e,t)=>{if(t){const n=t.value;e[t2]&&e[t2](n.key,n.value),e[Q1]-=n.length,e[r2].delete(n.key),e[i2].removeNode(t)}};class f2{constructor(e,t,n,i,r){this.key=e,this.value=t,this.length=n,this.now=i,this.maxAge=r||0}}const d2=(e,t,n,i)=>{let r=n.value;l2(e,r)&&(c2(e,n),e[K1]||(r=void 0)),r&&t.call(i,r.value,r.key,e)};var h2=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[J1]=e.max||1/0;const t=e.length||a2;if(this[Z1]="function"!=typeof t?a2:t,this[K1]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[e2]=e.maxAge||0,this[t2]=e.dispose,this[n2]=e.noDisposeOnSet||!1,this[o2]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[J1]=e||1/0,u2(this)}get max(){return this[J1]}set allowStale(e){this[K1]=!!e}get allowStale(){return this[K1]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[e2]=e,u2(this)}get maxAge(){return this[e2]}set lengthCalculator(e){"function"!=typeof e&&(e=a2),e!==this[Z1]&&(this[Z1]=e,this[Q1]=0,this[i2].forEach((e=>{e.length=this[Z1](e.value,e.key),this[Q1]+=e.length}))),u2(this)}get lengthCalculator(){return this[Z1]}get length(){return this[Q1]}get itemCount(){return this[i2].length}rforEach(e,t){t=t||this;for(let n=this[i2].tail;null!==n;){const i=n.prev;d2(this,e,n,t),n=i}}forEach(e,t){t=t||this;for(let n=this[i2].head;null!==n;){const i=n.next;d2(this,e,n,t),n=i}}keys(){return this[i2].toArray().map((e=>e.key))}values(){return this[i2].toArray().map((e=>e.value))}reset(){this[t2]&&this[i2]&&this[i2].length&&this[i2].forEach((e=>this[t2](e.key,e.value))),this[r2]=new Map,this[i2]=new X1,this[Q1]=0}dump(){return this[i2].map((e=>!l2(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[i2]}set(e,t,n){if((n=n||this[e2])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const i=n?Date.now():0,r=this[Z1](t,e);if(this[r2].has(e)){if(r>this[J1])return c2(this,this[r2].get(e)),!1;const o=this[r2].get(e).value;return this[t2]&&(this[n2]||this[t2](e,o.value)),o.now=i,o.maxAge=n,o.value=t,this[Q1]+=r-o.length,o.length=r,this.get(e),u2(this),!0}const o=new f2(e,t,r,i,n);return o.length>this[J1]?(this[t2]&&this[t2](e,t),!1):(this[Q1]+=o.length,this[i2].unshift(o),this[r2].set(e,this[i2].head),u2(this),!0)}has(e){if(!this[r2].has(e))return!1;const t=this[r2].get(e).value;return!l2(this,t)}get(e){return s2(this,e,!0)}peek(e){return s2(this,e,!1)}pop(){const e=this[i2].tail;return e?(c2(this,e),e.value):null}del(e){c2(this,this[r2].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const i=e[n],r=i.e||0;if(0===r)this.set(i.k,i.v);else{const e=r-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[r2].forEach(((e,t)=>s2(this,t,!1)))}};const p2=Object.freeze({loose:!0}),m2=Object.freeze({});var g2=e=>e?"object"!=typeof e?p2:e:m2,y2={exports:{}},v2={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},b2="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:r}=v2,o=b2,a=(t=e.exports={}).re=[],s=t.safeRe=[],l=t.src=[],u=t.t={};let c=0;const f="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",r],[f,i]],h=(e,t,n)=>{const i=(e=>{for(const[t,n]of d)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),r=c++;o(e,r,t),u[e]=r,l[r]=t,a[r]=new RegExp(t,n?"g":void 0),s[r]=new RegExp(i,n?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),h("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${l[u.NUMERICIDENTIFIER]}|${l[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NUMERICIDENTIFIERLOOSE]}|${l[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${f}+`),h("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`),h("FULL",`^${l[u.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`),h("LOOSE",`^${l[u.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`),h("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`),h("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),h("COERCERTL",l[u.COERCE],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(y2,y2.exports);var x2=y2.exports;const _2=/^[0-9]+$/,w2=(e,t)=>{const n=_2.test(e),i=_2.test(t);return n&&i&&(e=+e,t=+t),e===t?0:n&&!i?-1:i&&!n?1:ew2(t,e)};const E2=b2,{MAX_LENGTH:A2,MAX_SAFE_INTEGER:$2}=v2,{safeRe:D2,t:S2}=x2,M2=g2,{compareIdentifiers:C2}=k2;var F2=class e{constructor(t,n){if(n=M2(n),t instanceof e){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>A2)throw new TypeError(`version is longer than ${A2} characters`);E2("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const i=t.trim().match(n.loose?D2[S2.LOOSE]:D2[S2.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>$2||this.major<0)throw new TypeError("Invalid major version");if(this.minor>$2||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>$2||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<$2)return t}return e})):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(E2("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),C2(this.major,t.major)||C2(this.minor,t.minor)||C2(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const e=this.prerelease[n],i=t.prerelease[n];if(E2("prerelease compare",n,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return C2(e,i)}while(++n)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let n=0;do{const e=this.build[n],i=t.build[n];if(E2("prerelease compare",n,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return C2(e,i)}while(++n)}inc(e,t,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(0===this.prerelease.length)this.prerelease=[e];else{let i=this.prerelease.length;for(;--i>=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let i=[t,e];!1===n&&(i=[t]),0===C2(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const O2=F2;var N2=(e,t,n)=>new O2(e,n).compare(new O2(t,n));const T2=N2;const z2=N2;const R2=N2;const P2=N2;const L2=N2;const B2=N2;const j2=(e,t,n)=>0===T2(e,t,n),I2=(e,t,n)=>0!==z2(e,t,n),U2=(e,t,n)=>R2(e,t,n)>0,q2=(e,t,n)=>P2(e,t,n)>=0,W2=(e,t,n)=>L2(e,t,n)<0,H2=(e,t,n)=>B2(e,t,n)<=0;var G2,V2,Y2,X2,J2=(e,t,n,i)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return j2(e,n,i);case"!=":return I2(e,n,i);case">":return U2(e,n,i);case">=":return q2(e,n,i);case"<":return W2(e,n,i);case"<=":return H2(e,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const Q2=function e(){if(X2)return Y2;X2=1;class t{constructor(e,n){if(n=i(n),e instanceof t)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new t(e.raw,n);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&d)|(this.options.loose&&h))+":"+e,i=n.get(t);if(i)return i;const a=this.options.loose,m=a?s[l.HYPHENRANGELOOSE]:s[l.HYPHENRANGE];e=e.replace(m,D(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(s[l.COMPARATORTRIM],u),o("comparator trim",e),e=e.replace(s[l.TILDETRIM],c),o("tilde trim",e),e=e.replace(s[l.CARETTRIM],f),o("caret trim",e);let g=e.split(" ").map((e=>y(e,this.options))).join(" ").split(/\s+/).map((e=>$(e,this.options)));a&&(g=g.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(s[l.COMPARATORLOOSE]))))),o("range list",g);const v=new Map,b=g.map((e=>new r(e,this.options)));for(const e of b){if(p(e))return[e];v.set(e.value,e)}v.size>1&&v.has("")&&v.delete("");const x=[...v.values()];return n.set(t,x),x}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((t=>g(t,n)&&e.set.some((e=>g(e,n)&&t.every((t=>e.every((e=>t.intersects(e,n)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(a(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(a(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}G2=n;const i=g2,{safeRe:r,t:o}=x2,a=J2,s=b2,l=F2,u=e();return G2}(),o=b2,a=F2,{safeRe:s,t:l,comparatorTrimReplace:u,tildeTrimReplace:c,caretTrimReplace:f}=x2,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:h}=v2,p=e=>"<0.0.0-0"===e.value,m=e=>""===e.value,g=(e,t)=>{let n=!0;const i=e.slice();let r=i.pop();for(;n&&i.length;)n=i.every((e=>r.intersects(e,t))),r=i.pop();return n},y=(e,t)=>(o("comp",e,t),e=_(e,t),o("caret",e),e=b(e,t),o("tildes",e),e=k(e,t),o("xrange",e),e=A(e,t),o("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>x(e,t))).join(" "),x=(e,t)=>{const n=t.loose?s[l.TILDELOOSE]:s[l.TILDE];return e.replace(n,((t,n,i,r,a)=>{let s;return o("tilde",e,t,n,i,r,a),v(n)?s="":v(i)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(r)?s=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(o("replaceTilde pr",a),s=`>=${n}.${i}.${r}-${a} <${n}.${+i+1}.0-0`):s=`>=${n}.${i}.${r} <${n}.${+i+1}.0-0`,o("tilde return",s),s}))},_=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{o("caret",e,t);const n=t.loose?s[l.CARETLOOSE]:s[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(n,((t,n,r,a,s)=>{let l;return o("caret",e,t,n,r,a,s),v(n)?l="":v(r)?l=`>=${n}.0.0${i} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${r}.0${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.0${i} <${+n+1}.0.0-0`:s?(o("replaceCaret pr",s),l="0"===n?"0"===r?`>=${n}.${r}.${a}-${s} <${n}.${r}.${+a+1}-0`:`>=${n}.${r}.${a}-${s} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${a}-${s} <${+n+1}.0.0-0`):(o("no pr"),l="0"===n?"0"===r?`>=${n}.${r}.${a}${i} <${n}.${r}.${+a+1}-0`:`>=${n}.${r}.${a}${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${a} <${+n+1}.0.0-0`),o("caret return",l),l}))},k=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>E(e,t))).join(" ")),E=(e,t)=>{e=e.trim();const n=t.loose?s[l.XRANGELOOSE]:s[l.XRANGE];return e.replace(n,((n,i,r,a,s,l)=>{o("xRange",e,n,i,r,a,s,l);const u=v(r),c=u||v(a),f=c||v(s),d=f;return"="===i&&d&&(i=""),l=t.includePrerelease?"-0":"",u?n=">"===i||"<"===i?"<0.0.0-0":"*":i&&d?(c&&(a=0),s=0,">"===i?(i=">=",c?(r=+r+1,a=0,s=0):(a=+a+1,s=0)):"<="===i&&(i="<",c?r=+r+1:a=+a+1),"<"===i&&(l="-0"),n=`${i+r}.${a}.${s}${l}`):c?n=`>=${r}.0.0${l} <${+r+1}.0.0-0`:f&&(n=`>=${r}.${a}.0${l} <${r}.${+a+1}.0-0`),o("xRange return",n),n}))},A=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[l.STAR],"")),$=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(s[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),D=e=>(t,n,i,r,o,a,s,l,u,c,f,d,h)=>`${n=v(i)?"":v(r)?`>=${i}.0.0${e?"-0":""}`:v(o)?`>=${i}.${r}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(u)?"":v(c)?`<${+u+1}.0.0-0`:v(f)?`<${u}.${+c+1}.0-0`:d?`<=${u}.${c}.${f}-${d}`:e?`<${u}.${c}.${+f+1}-0`:`<=${l}`}`.trim(),S=(e,t,n)=>{for(let n=0;n0){const i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0};return Y2}();var Z2=(e,t,n)=>{try{t=new Q2(t,n)}catch(e){return!1}return t.test(e)},K2=j1(Z2);function e3(e,...t){for(const n of t)t3(e,n);return e}function t3(e,t){for(const n of Object.keys(t))ze(e,n,t[n],!0)}function n3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function i3(e){for(var t=1;te,"vega-lite":(e,t)=>o3.compile(e,{config:t}).spec};function d3(e,t,n,i){const r=`${t}
`,o=`
${n}`,a=window.open("");a.document.write(r+e+o),a.document.title=`${u3[i]} JSON Source`}function h3(e){return(t=e)&&"load"in t?e:r3.loader(e);var t}async function p3(e,t){const n=St(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=St(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return i3(i3(i3({},e),i?{patch:i}:{}),n?{config:n}:{})}function m3(){}function g3(e){return null==e?m3:function(){return this.querySelector(e)}}function y3(){return[]}function v3(e){return null==e?y3:function(){return this.querySelectorAll(e)}}function b3(e){return function(){return this.matches(e)}}function x3(e){return function(t){return t.matches(e)}}var _3=Array.prototype.find;function w3(){return this.firstElementChild}var k3=Array.prototype.filter;function E3(){return Array.from(this.children)}function A3(e){return new Array(e.length)}function $3(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function D3(e,t,n,i,r,o){for(var a,s=0,l=t.length,u=o.length;st?1:e>=t?0:NaN}$3.prototype={constructor:$3,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var O3="http://www.w3.org/1999/xhtml";const N3={svg:"http://www.w3.org/2000/svg",xhtml:O3,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function T3(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),N3.hasOwnProperty(t)?{space:N3[t],local:e}:e}function z3(e){return function(){this.removeAttribute(e)}}function R3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function P3(e,t){return function(){this.setAttribute(e,t)}}function L3(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function B3(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function j3(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function I3(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function U3(e){return function(){this.style.removeProperty(e)}}function q3(e,t,n){return function(){this.style.setProperty(e,t,n)}}function W3(e,t,n){return function(){var i=t.apply(this,arguments);null==i?this.style.removeProperty(e):this.style.setProperty(e,i,n)}}function H3(e,t){return e.style.getPropertyValue(t)||I3(e).getComputedStyle(e,null).getPropertyValue(t)}function G3(e){return function(){delete this[e]}}function V3(e,t){return function(){this[e]=t}}function Y3(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function X3(e){return e.trim().split(/^|\s+/)}function J3(e){return e.classList||new Q3(e)}function Q3(e){this._node=e,this._names=X3(e.getAttribute("class")||"")}function Z3(e,t){for(var n=J3(e),i=-1,r=t.length;++i=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var k5=[null];function E5(e,t){this._groups=e,this._parents=t}function A5(){return new E5([[document.documentElement]],k5)}E5.prototype=A5.prototype={constructor:E5,select:function(e){"function"!=typeof e&&(e=g3(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r=x&&(x=b+1);!(v=g[x])&&++x=0;)(i=r[o])&&(a&&4^i.compareDocumentPosition(a)&&a.parentNode.insertBefore(i,a),a=i);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=F3);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o1?this.each((null==t?U3:"function"==typeof t?W3:q3)(e,t,null==n?"":n)):H3(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?G3:"function"==typeof t?Y3:V3)(e,t)):this.node()[e]},classed:function(e,t){var n=X3(e+"");if(arguments.length<2){for(var i=J3(this.node()),r=-1,o=n.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}(e+""),a=o.length;if(!(arguments.length<2)){for(s=t?b5:v5,i=0;i{i.stop(),e(n+t)}),t,n),i}var S5=$$("start","end","cancel","interrupt"),M5=[],C5=0,F5=3;function O5(e,t,n,i,r,o){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var i,r=e.__transition;function o(l){var u,c,f,d;if(1!==n.state)return s();for(u in r)if((d=r[u]).name===n.name){if(d.state===F5)return D5(o);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete r[u]):+uC5)throw new Error("too late; already scheduled");return n}function T5(e,t){var n=z5(e,t);if(n.state>F5)throw new Error("too late; already running");return n}function z5(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function R5(e,t){var n,i;return function(){var r=T5(this,e),o=r.tween;if(o!==n)for(var a=0,s=(i=n=o).length;a=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?N5:T5;return function(){var a=o(this,e),s=a.on;s!==i&&(r=(i=s).copy()).on(t,n),a.on=r}}(n,e,t))},attr:function(e,t){var n=T3(e),i="transform"===n?Lh:B5;return this.attrTween(e,"function"==typeof t?(n.local?H5:W5)(n,i,L5(this,"attr."+e,t)):null==t?(n.local?I5:j5)(n):(n.local?q5:U5)(n,i,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var i=T3(e);return this.tween(n,(i.local?G5:V5)(i,t))},style:function(e,t,n){var i="transform"==(e+="")?Ph:B5;return null==t?this.styleTween(e,function(e,t){var n,i,r;return function(){var o=H3(this,e),a=(this.style.removeProperty(e),H3(this,e));return o===a?null:o===n&&a===i?r:r=t(n=o,i=a)}}(e,i)).on("end.style."+e,K5(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var i,r,o;return function(){var a=H3(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=H3(this,e)),a===l?null:a===i&&l===r?o:(r=l,o=t(i=a,s))}}(e,i,L5(this,"style."+e,t))).each(function(e,t){var n,i,r,o,a="style."+t,s="end."+a;return function(){var l=T5(this,e),u=l.on,c=null==l.value[a]?o||(o=K5(t)):void 0;u===n&&r===c||(i=(n=u).copy()).on(s,r=c),l.on=i}}(this._id,e)):this.styleTween(e,function(e,t,n){var i,r,o=n+"";return function(){var a=H3(this,e);return a===o?null:a===i?r:r=t(i=a,n)}}(e,i,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==t)return this.tween(i,null);if("function"!=typeof t)throw new Error;return this.tween(i,function(e,t,n){var i,r;function o(){var o=t.apply(this,arguments);return o!==r&&(i=(r=o)&&function(e,t,n){return function(i){this.style.setProperty(e,t.call(this,i),n)}}(e,o,n)),i}return o._value=t,o}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(L5(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function i(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&function(e){return function(t){this.textContent=e.call(this,t)}}(i)),t}return i._value=e,i}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var i,r=z5(this.node(),n).tween,o=0,a=r.length;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[r]):a=!1;a&&delete e.__transition}}(this,e)}))},$5.prototype.transition=function(e){var t,n;e instanceof t6?(t=e._id,e=e._name):(t=n6(),(n=r6).time=L$(),e=null==e?null:e+"");for(var i=this._groups,r=i.length,o=0;o :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n'.toString():n.defaultStyle,i.appendChild(t)}}const f=function(e,t){if(e.$schema){const n=O0(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${u3[n.library]}, but mode argument sets ${u3[t]??t}.`);const i=n.library;return K2(c3[i],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${u3[i]} ${n.version}, but the current version of ${u3[i]} is v${c3[i]}.`),i}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}(t,n.mode);let d=f3[f](t,r);if("vega-lite"===f&&d.$schema){const e=O0(d.$schema);K2(c3.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${c3.vega}.`)}c.classList.add("vega-embed"),o&&c.classList.add("has-actions"),c.innerHTML="";let h=c;if(o){const e=document.createElement("div");e.classList.add("chart-wrapper"),c.appendChild(e),h=e}const p=n.patch;if(p&&(d=p instanceof Function?p(d):Y(d,p,!0,!1).newDocument),n.formatLocale&&r3.formatLocale(n.formatLocale),n.timeFormatLocale&&r3.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const e in n.expressionFunctions){const t=n.expressionFunctions[e];"fn"in t?r3.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&r3.expressionFunction(e,t)}const{ast:m}=n,g=r3.parse(d,"vega-lite"===f?{}:r,{ast:m}),y=new(n.viewClass||r3.View)(g,i3({loader:i,logLevel:l,renderer:s},m?{expr:r3.expressionInterpreter??n.expr??bB}:{}));if(y.addSignalListener("autosize",((e,t)=>{const{type:n}=t;"fit-x"==n?(h.classList.add("fit-x"),h.classList.remove("fit-y")):"fit-y"==n?(h.classList.remove("fit-x"),h.classList.add("fit-y")):"fit"==n?h.classList.add("fit-x","fit-y"):h.classList.remove("fit-x","fit-y")})),!1!==n.tooltip){const e="function"==typeof n.tooltip?n.tooltip:new P1(!0===n.tooltip?{}:n.tooltip).call;y.tooltip(e)}let v,{hover:x}=n;if(void 0===x&&(x="vega"===f),x){const{hoverSet:e,updateSet:t}="boolean"==typeof x?{}:x;y.hover(e,t)}if(n&&(null!=n.width&&y.width(n.width),null!=n.height&&y.height(n.height),null!=n.padding&&y.padding(n.padding)),await y.initialize(h,n.bind).runAsync(),!1!==o){let e=c;if(!1!==n.defaultStyle||n.forceActionsMenu){const t=document.createElement("details");t.title=a.CLICK_TO_VIEW_ACTIONS,c.append(t),e=t;const n=document.createElement("summary");n.innerHTML='\n\n \n \n \n',t.append(n),v=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",v)}const i=document.createElement("div");if(e.append(i),i.classList.add("vega-actions"),!0===o||!1!==o.export)for(const e of["svg","png"])if(!0===o||!0===o.export||o.export[e]){const t=a[`${e.toUpperCase()}_ACTION`],r=document.createElement("a"),o=Oe(n.scaleFactor)?n.scaleFactor[e]:n.scaleFactor;r.text=t,r.href="#",r.target="_blank",r.download=`${u}.${e}`,r.addEventListener("mousedown",(async function(t){t.preventDefault();const n=await y.toImageURL(e,o);this.href=n})),i.append(r)}if(!0===o||!1!==o.source){const e=document.createElement("a");e.text=a.SOURCE_ACTION,e.href="#",e.addEventListener("click",(function(e){d3(le()(t),n.sourceHeader??"",n.sourceFooter??"",f),e.preventDefault()})),i.append(e)}if("vega-lite"===f&&(!0===o||!1!==o.compiled)){const e=document.createElement("a");e.text=a.COMPILED_ACTION,e.href="#",e.addEventListener("click",(function(e){d3(le()(d),n.sourceHeader??"",n.sourceFooter??"","vega"),e.preventDefault()})),i.append(e)}if(!0===o||!1!==o.editor){const e=n.editorUrl??"https://vega.github.io/editor/",o=document.createElement("a");o.text=a.EDITOR_ACTION,o.href="#",o.addEventListener("click",(function(n){!function(e,t,n){const i=e.open(t),{origin:r}=new URL(t);let o=40;e.addEventListener("message",(function t(n){n.source===i&&(o=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){o<=0||(i.postMessage(n,r),setTimeout(e,250),o-=1)}),250)}(window,e,{config:r,mode:f,renderer:s,spec:le()(t)}),n.preventDefault()})),i.append(o)}}return{view:y,spec:t,vgSpec:d,finalize:function(){v&&document.removeEventListener("click",v),y.finalize()},embedOptions:n}}(e,i,u,r)}(this.el,this.props.spec,this.props.opt).then((function(t){e.finalize=t.finalize,e.vegaView=t.view;var n=e.vegaView.getState().signals||{};"unit"in n&&delete n.unit;var i={};if("all"===e.props.signalsToObserve[0])i=n;else for(var r in n)e.props.signalsToObserve.includes(r)&&(i[r]=n[r]);n=i,e.props.setProps({signalData:n});var o=e.props.debounceWait,a=o,s=function(t,n){var i=e.cleanJson(n),r=function(e){for(var t=1;t{var i=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt,l="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,u="object"==typeof self&&self&&self.Object===Object&&self,c=l||u||Function("return this")(),f=Object.prototype.toString,d=Math.max,h=Math.min,p=function(){return c.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==f.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var n=o.test(e);return n||a.test(e)?s(e.slice(2),n?2:8):r.test(e)?NaN:+e}e.exports=function(e,t,n){var i,r,o,a,s,l,u=0,c=!1,f=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=i,o=r;return i=r=void 0,u=t,a=e.apply(o,n)}function b(e){var n=e-l;return void 0===l||n>=t||n<0||f&&e-u>=o}function x(){var e=p();if(b(e))return _(e);s=setTimeout(x,function(e){var n=t-(e-l);return f?h(n,o-(e-u)):n}(e))}function _(e){return s=void 0,y&&i?v(e):(i=r=void 0,a)}function w(){var e=p(),n=b(e);if(i=arguments,r=this,l=e,n){if(void 0===s)return function(e){return u=e,s=setTimeout(x,t),c?v(e):a}(l);if(f)return s=setTimeout(x,t),v(l)}return void 0===s&&(s=setTimeout(x,t)),a}return t=g(t)||0,m(n)&&(c=!!n.leading,o=(f="maxWait"in n)?d(g(n.maxWait)||0,t):o,y="trailing"in n?!!n.trailing:y),w.cancel=function(){void 0!==s&&clearTimeout(s),u=0,i=l=r=s=void 0},w.flush=function(){return void 0===s?a:_(p())},w}},801:e=>{"use strict";var t=/("(?:[^\\"]|\\.)*")|[:,]/g;e.exports=function(e,n){var i,r,o;return n=n||{},i=JSON.stringify([1],void 0,void 0===n.indent?2:n.indent).slice(2,-3),r=""===i?1/0:void 0===n.maxLength?80:n.maxLength,o=n.replacer,function e(n,a,s){var l,u,c,f,d,h,p,m,g,y,v,b;if(n&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===(v=JSON.stringify(n,o)))return v;if(p=r-a.length-s,v.length<=p&&(g=v.replace(t,(function(e,t){return t||e+" "}))).length<=p)return g;if(null!=o&&(n=JSON.parse(v),o=void 0),"object"==typeof n&&null!==n){if(m=a+i,c=[],u=0,Array.isArray(n))for(y="[",l="]",p=n.length;u0)return[y,i+c.join(",\n"+m),l].join("\n"+a)}return v}(e,"",0)}}}]); +(self.webpackChunkdash_vega_components=self.webpackChunkdash_vega_components||[]).push([[736],{90:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>A6});var i={};n.r(i),n.d(i,{JsonPatchError:()=>U,_areEquals:()=>Z,applyOperation:()=>V,applyPatch:()=>Y,applyReducer:()=>X,deepClone:()=>q,getValueByPointer:()=>G,validate:()=>Q,validator:()=>J});var r={};n.r(r),n.d(r,{compare:()=>ae,generate:()=>re,observe:()=>ie,unobserve:()=>ne});var o={};n.r(o),n.d(o,{aggregate:()=>Jl,bin:()=>Ql,collect:()=>Kl,compare:()=>eu,countpattern:()=>nu,cross:()=>iu,density:()=>su,dotbin:()=>du,expression:()=>hu,extent:()=>mu,facet:()=>yu,field:()=>vu,filter:()=>xu,flatten:()=>_u,fold:()=>wu,formula:()=>ku,generate:()=>Eu,impute:()=>Du,joinaggregate:()=>Su,kde:()=>Mu,key:()=>Cu,load:()=>Ou,lookup:()=>Tu,multiextent:()=>zu,multivalues:()=>Pu,params:()=>Bu,pivot:()=>ju,prefacet:()=>Iu,project:()=>Uu,proxy:()=>qu,quantile:()=>Wu,relay:()=>Hu,sample:()=>Gu,sequence:()=>Vu,sieve:()=>Yu,subflow:()=>gu,timeunit:()=>Xu,tupleindex:()=>Qu,values:()=>Zu,window:()=>ic});var a={};n.r(a),n.d(a,{interpolate:()=>Cd,interpolateArray:()=>wd,interpolateBasis:()=>cd,interpolateBasisClosed:()=>fd,interpolateCubehelix:()=>Ep,interpolateCubehelixLong:()=>Ap,interpolateDate:()=>Ed,interpolateDiscrete:()=>Ch,interpolateHcl:()=>fp,interpolateHclLong:()=>dp,interpolateHsl:()=>Uh,interpolateHslLong:()=>qh,interpolateHue:()=>Fh,interpolateLab:()=>up,interpolateNumber:()=>Ad,interpolateNumberArray:()=>xd,interpolateObject:()=>$d,interpolateRgb:()=>gd,interpolateRgbBasis:()=>vd,interpolateRgbBasisClosed:()=>bd,interpolateRound:()=>Fd,interpolateString:()=>Md,interpolateTransformCss:()=>Ph,interpolateTransformSvg:()=>Lh,interpolateZoom:()=>jh,piecewise:()=>bh,quantize:()=>$p});var s={};n.r(s),n.d(s,{bound:()=>h_,identifier:()=>g_,mark:()=>y_,overlap:()=>v_,render:()=>A_,viewlayout:()=>G_});var l={};n.r(l),n.d(l,{axisticks:()=>Y_,datajoin:()=>X_,encode:()=>Q_,legendentries:()=>Z_,linkpath:()=>iw,pie:()=>lw,scale:()=>fw,sortitems:()=>mw,stack:()=>xw});var u={};n.r(u),n.d(u,{contour:()=>n$,geojson:()=>o$,geopath:()=>a$,geopoint:()=>s$,geoshape:()=>l$,graticule:()=>u$,heatmap:()=>c$,isocontour:()=>GA,kde2d:()=>KA,projection:()=>d$});var c={};n.r(c),n.d(c,{force:()=>sD});var f={};n.r(f),n.d(f,{nest:()=>fS,pack:()=>yS,partition:()=>bS,stratify:()=>xS,tree:()=>kS,treelinks:()=>ES,treemap:()=>DS});var d={};n.r(d),n.d(d,{label:()=>XS});var h={};n.r(h),n.d(h,{loess:()=>QS,regression:()=>KS});var p={};n.r(p),n.d(p,{voronoi:()=>MM});var m={};n.r(m),n.d(m,{wordcloud:()=>WM});var g={};n.r(g),n.d(g,{crossfilter:()=>QM,resolvefilter:()=>ZM});var y={};n.r(y),n.d(y,{Bounds:()=>qg,CanvasHandler:()=>Eb,CanvasRenderer:()=>Cb,DATE:()=>Ai,DAY:()=>$i,DAYOFYEAR:()=>Di,Dataflow:()=>ws,Debug:()=>Me,Error:()=>$e,EventStream:()=>ls,Gradient:()=>Vm,GroupItem:()=>Hg,HOURS:()=>Si,Handler:()=>nb,HybridHandler:()=>kx,HybridRenderer:()=>_x,Info:()=>Se,Item:()=>Wg,MILLISECONDS:()=>Fi,MINUTES:()=>Mi,MONTH:()=>ki,Marks:()=>jv,MultiPulse:()=>vs,None:()=>Ae,Operator:()=>os,Parameters:()=>ns,Pulse:()=>ps,QUARTER:()=>wi,RenderType:()=>Dx,Renderer:()=>rb,ResourceLoader:()=>Gg,SECONDS:()=>Ci,SVGHandler:()=>Ob,SVGRenderer:()=>rx,SVGStringRenderer:()=>vx,Scenegraph:()=>Yv,TIME_UNITS:()=>Oi,Transform:()=>Es,View:()=>PT,WEEK:()=>Ei,Warn:()=>De,YEAR:()=>_i,accessor:()=>ue,accessorFields:()=>fe,accessorName:()=>ce,array:()=>nt,ascending:()=>st,bandwidthNRD:()=>js,bin:()=>Is,bootstrapCI:()=>Ws,boundClip:()=>zx,boundContext:()=>hy,boundItem:()=>Iv,boundMark:()=>qv,boundStroke:()=>Xg,changeset:()=>es,clampRange:()=>it,codegenExpression:()=>CF,compare:()=>at,constant:()=>ft,cumulativeLogNormal:()=>ol,cumulativeNormal:()=>Ks,cumulativeUniform:()=>fl,dayofyear:()=>Bi,debounce:()=>dt,defaultLocale:()=>da,definition:()=>$s,densityLogNormal:()=>rl,densityNormal:()=>Zs,densityUniform:()=>cl,domChild:()=>Zv,domClear:()=>Kv,domCreate:()=>Jv,domFind:()=>Qv,dotbin:()=>Hs,error:()=>me,expressionFunction:()=>RN,extend:()=>ht,extent:()=>pt,extentIndex:()=>mt,falsy:()=>ke,fastmap:()=>bt,field:()=>ye,flush:()=>xt,font:()=>Ov,fontFamily:()=>Fv,fontSize:()=>$v,format:()=>Ra,formatLocale:()=>ra,formats:()=>Pa,hasOwnProperty:()=>yt,id:()=>ve,identity:()=>be,inferType:()=>Ma,inferTypes:()=>Ca,ingest:()=>Ya,inherits:()=>_t,inrange:()=>wt,interpolate:()=>gm,interpolateColors:()=>hm,interpolateRange:()=>dm,intersect:()=>Cx,intersectBoxLine:()=>Ey,intersectPath:()=>xy,intersectPoint:()=>_y,intersectRule:()=>ky,isArray:()=>Fe,isBoolean:()=>kt,isDate:()=>Et,isFunction:()=>rt,isIterable:()=>At,isNumber:()=>$t,isObject:()=>Oe,isRegExp:()=>Dt,isString:()=>St,isTuple:()=>Ha,key:()=>Mt,lerp:()=>Ct,lineHeight:()=>Dv,loader:()=>ja,locale:()=>fa,logger:()=>Ce,lruCache:()=>Ot,markup:()=>Jb,merge:()=>Nt,mergeConfig:()=>Te,multiLineOffset:()=>Mv,one:()=>_e,pad:()=>zt,panLinear:()=>He,panLog:()=>Ge,panPow:()=>Ve,panSymlog:()=>Ye,parse:()=>dB,parseExpression:()=>DF,parseSelector:()=>tz,path:()=>sf,pathCurves:()=>Xm,pathEqual:()=>Lx,pathParse:()=>tg,pathRectangle:()=>Ag,pathRender:()=>dg,pathSymbols:()=>gg,pathTrail:()=>$g,peek:()=>Pe,point:()=>tb,projection:()=>TA,quantileLogNormal:()=>al,quantileNormal:()=>el,quantileUniform:()=>dl,quantiles:()=>Ls,quantizeInterpolator:()=>pm,quarter:()=>et,quartiles:()=>Bs,random:()=>Us,randomInteger:()=>Vs,randomKDE:()=>nl,randomLCG:()=>Gs,randomLogNormal:()=>sl,randomMixture:()=>ll,randomNormal:()=>tl,randomUniform:()=>hl,read:()=>Ba,regressionConstant:()=>pl,regressionExp:()=>_l,regressionLinear:()=>bl,regressionLoess:()=>Sl,regressionLog:()=>xl,regressionPoly:()=>El,regressionPow:()=>wl,regressionQuad:()=>kl,renderModule:()=>Mx,repeat:()=>Tt,resetDefaultLocale:()=>ha,resetSVGClipId:()=>Ig,resetSVGDefIds:()=>Bx,responseType:()=>La,runtimeContext:()=>GN,sampleCurve:()=>Ol,sampleLogNormal:()=>il,sampleNormal:()=>Qs,sampleUniform:()=>ul,scale:()=>nm,sceneEqual:()=>Px,sceneFromJSON:()=>Gv,scenePickVisit:()=>zy,sceneToJSON:()=>Hv,sceneVisit:()=>Ty,sceneZOrder:()=>Ny,scheme:()=>xm,serializeXML:()=>Qb,setHybridRendererOptions:()=>xx,setRandom:()=>qs,span:()=>Rt,splitAccessPath:()=>ge,stringValue:()=>Pt,textMetrics:()=>xv,timeBin:()=>Er,timeFloor:()=>tr,timeFormatLocale:()=>ua,timeInterval:()=>sr,timeOffset:()=>cr,timeSequence:()=>hr,timeUnitSpecifier:()=>Ri,timeUnits:()=>Ti,toBoolean:()=>Lt,toDate:()=>jt,toNumber:()=>Le,toSet:()=>Ut,toString:()=>It,transform:()=>Ds,transforms:()=>As,truncate:()=>qt,truthy:()=>we,tupleid:()=>Ga,typeParsers:()=>$a,utcFloor:()=>rr,utcInterval:()=>lr,utcOffset:()=>fr,utcSequence:()=>pr,utcdayofyear:()=>Hi,utcquarter:()=>tt,utcweek:()=>Gi,version:()=>hB,visitArray:()=>Wt,week:()=>ji,writeConfig:()=>ze,zero:()=>xe,zoomLinear:()=>Je,zoomLog:()=>Qe,zoomPow:()=>Ze,zoomSymlog:()=>Ke});var v={};n.r(v),n.d(v,{accessPathDepth:()=>lj,accessPathWithDatum:()=>nj,compile:()=>z0,contains:()=>RB,deepEqual:()=>vj,deleteNestedProperty:()=>ej,duplicate:()=>CB,entries:()=>JB,every:()=>LB,fieldIntersection:()=>GB,flatAccessWithDatum:()=>ij,getFirstDefined:()=>uj,hasIntersection:()=>WB,hash:()=>TB,internalField:()=>hj,isBoolean:()=>QB,isEmpty:()=>VB,isEqual:()=>UB,isInternalField:()=>pj,isNullOrFalse:()=>zB,isNumeric:()=>gj,keys:()=>YB,logicalExpr:()=>KB,mergeDeep:()=>BB,never:()=>FB,normalize:()=>oX,normalizeAngle:()=>mj,omit:()=>NB,pick:()=>OB,prefixGenerator:()=>HB,removePathFromField:()=>sj,replaceAll:()=>aj,replacePathInField:()=>oj,resetIdCounter:()=>dj,setEqual:()=>qB,some:()=>PB,stringify:()=>bj,titleCase:()=>tj,unique:()=>IB,uniqueId:()=>fj,vals:()=>XB,varName:()=>ZB,version:()=>R0});var b={};n.r(b),n.d(b,{carbong10:()=>z1,carbong100:()=>P1,carbong90:()=>R1,carbonwhite:()=>T1,dark:()=>j0,excel:()=>U0,fivethirtyeight:()=>V0,ggplot2:()=>X0,googlecharts:()=>g1,latimes:()=>t1,powerbi:()=>M1,quartz:()=>r1,urbaninstitute:()=>d1,version:()=>L1,vox:()=>a1});var x=n(196),_=n.n(x),w=n(64),k=n.n(w);const E={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let A;const $=new Uint8Array(16);function D(){if(!A&&(A="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!A))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return A($)}const S=[];for(let e=0;e<256;++e)S.push((e+256).toString(16).slice(1));const M=function(e,t,n){if(E.randomUUID&&!t&&!e)return E.randomUUID();const i=(e=e||{}).random||(e.rng||D)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=i[e];return t}return function(e,t=0){return S[e[t+0]]+S[e[t+1]]+S[e[t+2]]+S[e[t+3]]+"-"+S[e[t+4]]+S[e[t+5]]+"-"+S[e[t+6]]+S[e[t+7]]+"-"+S[e[t+8]]+S[e[t+9]]+"-"+S[e[t+10]]+S[e[t+11]]+S[e[t+12]]+S[e[t+13]]+S[e[t+14]]+S[e[t+15]]}(i)};var C,F=(C=function(e,t){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},C(e,t)},function(e,t){function n(){this.constructor=e}C(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),O=Object.prototype.hasOwnProperty;function N(e,t){return O.call(e,t)}function T(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=48&&t<=57))return!1;n++}return!0}function P(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function L(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function B(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t0&&"constructor"==s[u-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===f&&(void 0===l[d]?f=s.slice(0,u).join("/"):u==c-1&&(f=t.path),void 0!==f&&h(t,0,e,f)),u++,Array.isArray(l)){if("-"===d)d=l.length;else{if(n&&!R(d))throw new U("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,t,e);R(d)&&(d=~~d)}if(u>=c){if(n&&"add"===t.op&&d>l.length)throw new U("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);if(!1===(a=H[t.op].call(t,l,d,e)).test)throw new U("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(u>=c){if(!1===(a=W[t.op].call(t,l,d,e)).test)throw new U("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[d],n&&u0)throw new U('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new U("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new U("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&B(e.value))throw new U("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var r=e.path.split("/").length,o=i.split("/").length;if(r!==o+1&&r!==o)throw new U("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==i)throw new U("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var a=Q([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new U("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function Q(e,t,n){try{if(!Array.isArray(e))throw new U("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Y(z(t),z(e),n||!0);else{n=n||J;for(var i=0;i0&&(e.patches=[],e.callback&&e.callback(i)),i}function oe(e,t,n,i,r){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=T(t),a=T(e),s=!1,l=a.length-1;l>=0;l--){var u=e[f=a[l]];if(!N(t,f)||void 0===t[f]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:i+"/"+P(f),value:z(u)}),n.push({op:"remove",path:i+"/"+P(f)}),s=!0):(r&&n.push({op:"test",path:i,value:e}),n.push({op:"replace",path:i,value:t}));else{var c=t[f];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?oe(u,c,n,i+"/"+P(f),r):u!==c&&(r&&n.push({op:"test",path:i+"/"+P(f),value:z(u)}),n.push({op:"replace",path:i+"/"+P(f),value:z(c)}))}}if(s||o.length!=a.length)for(l=0;lfunction(t){return t[e]},pe=e=>{const t=e.length;return function(n){for(let i=0;ii&&u(),s=i=r+1):"]"===o&&(s||me("Access path missing open bracket: "+e),s>0&&u(),s=0,i=r+1):r>i?u():i=r+1}return s&&me("Access path missing closing bracket: "+e),a&&me("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function ye(e,t,n){const i=ge(e);return e=1===i.length?i[0]:e,ue((n&&n.get||de)(i),[e],t||e)}const ve=ye("id"),be=ue((e=>e),[],"identity"),xe=ue((()=>0),[],"zero"),_e=ue((()=>1),[],"one"),we=ue((()=>!0),[],"true"),ke=ue((()=>!1),[],"false");function Ee(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const Ae=0,$e=1,De=2,Se=3,Me=4;function Ce(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ee,i=e||Ae;return{level(e){return arguments.length?(i=+e,this):i},error(){return i>=$e&&n(t||"error","ERROR",arguments),this},warn(){return i>=De&&n(t||"warn","WARN",arguments),this},info(){return i>=Se&&n(t||"log","INFO",arguments),this},debug(){return i>=Me&&n(t||"log","DEBUG",arguments),this}}}var Fe=Array.isArray;function Oe(e){return e===Object(e)}const Ne=e=>"__proto__"!==e;function Te(){for(var e=arguments.length,t=new Array(e),n=0;n{for(const n in t)if("signals"===n)e.signals=Re(e.signals,t.signals);else{const i="legend"===n?{layout:1}:"style"===n||null;ze(e,n,t[n],i)}return e}),{})}function ze(e,t,n,i){if(!Ne(t))return;let r,o;if(Oe(n)&&!Fe(n))for(r in o=Oe(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?ze(o,r,n[r]):Ne(r)&&(o[r]=n[r]);else e[t]=n}function Re(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function Pe(e){return e[e.length-1]}function Le(e){return null==e||""===e?null:+e}const Be=e=>t=>e*Math.exp(t),je=e=>t=>Math.log(e*t),Ie=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),Ue=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,qe=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function We(e,t,n,i){const r=n(e[0]),o=n(Pe(e)),a=(o-r)*t;return[i(r-a),i(o-a)]}function He(e,t){return We(e,t,Le,be)}function Ge(e,t){var n=Math.sign(e[0]);return We(e,t,je(n),Be(n))}function Ve(e,t,n){return We(e,t,qe(n),qe(1/n))}function Ye(e,t,n){return We(e,t,Ie(n),Ue(n))}function Xe(e,t,n,i,r){const o=i(e[0]),a=i(Pe(e)),s=null!=t?i(t):(o+a)/2;return[r(s+(o-s)*n),r(s+(a-s)*n)]}function Je(e,t,n){return Xe(e,t,n,Le,be)}function Qe(e,t,n){const i=Math.sign(e[0]);return Xe(e,t,n,je(i),Be(i))}function Ze(e,t,n,i){return Xe(e,t,n,qe(i),qe(1/i))}function Ke(e,t,n,i){return Xe(e,t,n,Ie(i),Ue(i))}function et(e){return 1+~~(new Date(e).getMonth()/3)}function tt(e){return 1+~~(new Date(e).getUTCMonth()/3)}function nt(e){return null!=e?Fe(e)?e:[e]:[]}function it(e,t,n){let i,r=e[0],o=e[1];return o=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-i),r+i]}function rt(e){return"function"==typeof e}const ot="descending";function at(e,t,n){n=n||{},t=nt(t)||[];const i=[],r=[],o={},a=n.comparator||lt;return nt(e).forEach(((e,a)=>{null!=e&&(i.push(t[a]===ot?-1:1),r.push(e=rt(e)?e:ye(e,null,n)),(fe(e)||[]).forEach((e=>o[e]=1)))})),0===r.length?null:ue(a(r,i),Object.keys(o))}const st=(e,t)=>(et||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0),lt=(e,t)=>1===e.length?ut(e[0],t[0]):ct(e,t,e.length),ut=(e,t)=>function(n,i){return st(e(n),e(i))*t},ct=(e,t,n)=>(t.push(0),function(i,r){let o,a=0,s=-1;for(;0===a&&++se}function dt(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout((()=>(t(i),n=null)),e)}}function ht(e){for(let t,n,i=1,r=arguments.length;io&&(o=i))}else{for(i=t(e[a]);ao&&(o=i))}return[r,o]}function mt(e,t){const n=e.length;let i,r,o,a,s,l=-1;if(null==t){for(;++l=r){i=o=r;break}if(l===n)return[-1,-1];for(a=s=l;++lr&&(i=r,a=l),o=r){i=o=r;break}if(l===n)return[-1,-1];for(a=s=l;++lr&&(i=r,a=l),oi(e)?n[e]:void 0,set(e,t){return i(e)||(++r.size,n[e]===vt&&--r.empty),n[e]=t,this},delete(e){return i(e)&&(--r.size,++r.empty,n[e]=vt),this},clear(){r.size=r.empty=0,r.object=n={}},test(e){return arguments.length?(t=e,r):t},clean(){const e={};let i=0;for(const r in n){const o=n[r];o===vt||t&&t(o)||(e[r]=o,++i)}r.size=i,r.empty=0,r.object=n=e}};return e&&Object.keys(e).forEach((t=>{r.set(t,e[t])})),r}function xt(e,t,n,i,r,o){if(!n&&0!==n)return o;const a=+n;let s,l=e[0],u=Pe(e);ua&&(r=o,o=a,a=r),i=void 0===i||i,((n=void 0===n||n)?o<=e:oe.replace(/\\(.)/g,"$1"))):nt(e));const i=e&&e.length,r=n&&n.get||de,o=e=>r(t?[e]:ge(e));let a;if(i)if(1===i){const t=o(e[0]);a=function(e){return""+t(e)}}else{const t=e.map(o);a=function(e){let n=""+t[0](e),r=0;for(;++r{t={},n={},i=0},o=(r,o)=>(++i>e&&(n=t,t={},i=1),t[r]=o);return r(),{clear:r,has:e=>yt(t,e)||yt(n,e),get:e=>yt(t,e)?t[e]:yt(n,e)?o(e,n[e]):void 0,set:(e,n)=>yt(t,e)?t[e]=n:o(e,n)}}function Nt(e,t,n,i){const r=t.length,o=n.length;if(!o)return t;if(!r)return n;const a=i||new t.constructor(r+o);let s=0,l=0,u=0;for(;s0?n[l++]:t[s++];for(;s=0;)n+=e;return n}function zt(e,t,n,i){const r=n||" ",o=e+"",a=t-o.length;return a<=0?o:"left"===i?Tt(r,a)+o:"center"===i?Tt(r,~~(a/2))+o+Tt(r,Math.ceil(a/2)):o+Tt(r,a)}function Rt(e){return e&&Pe(e)-e[0]||0}function Pt(e){return Fe(e)?"["+e.map(Pt)+"]":Oe(e)||St(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function Lt(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e||!e)}const Bt=e=>$t(e)||Et(e)?e:Date.parse(e);function jt(e,t){return t=t||Bt,null==e||""===e?null:t(e)}function It(e){return null==e||""===e?null:e+""}function Ut(e){const t={},n=e.length;for(let i=0;i=o?l=!0:(i=e.charCodeAt(a++))===Yt?u=!0:i===Xt&&(u=!0,e.charCodeAt(a)===Yt&&++a),e.slice(r+1,t-1).replace(/""/g,'"')}for(;a9999?"+"+Zt(t,6):Zt(t,4))+"-"+Zt(e.getUTCMonth()+1,2)+"-"+Zt(e.getUTCDate(),2)+(o?"T"+Zt(n,2)+":"+Zt(i,2)+":"+Zt(r,2)+"."+Zt(o,3)+"Z":r?"T"+Zt(n,2)+":"+Zt(i,2)+":"+Zt(r,2)+"Z":i||n?"T"+Zt(n,2)+":"+Zt(i,2)+"Z":"")}(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,r,o=i(e,(function(e,i){if(n)return n(e,i-1);r=e,n=t?function(e,t){var n=Jt(e);return function(i,r){return t(n(i),r,e)}}(e,t):Jt(e)}));return o.columns=r||[],o},parseRows:i,format:function(t,n){return null==n&&(n=Qt(t)),[n.map(a).join(e)].concat(r(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=Qt(e)),r(e,t).join("\n")},formatRows:function(e){return e.map(o).join("\n")},formatRow:o,formatValue:a}}function en(e){return e}function tn(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return nn(e,t)}))}:nn(e,t)}function nn(e,t){var n=t.id,i=t.bbox,r=null==t.properties?{}:t.properties,o=rn(e,t);return null==n&&null==i?{type:"Feature",properties:r,geometry:o}:null==i?{type:"Feature",id:n,properties:r,geometry:o}:{type:"Feature",id:n,bbox:i,properties:r,geometry:o}}function rn(e,t){var n=function(e){if(null==e)return en;var t,n,i=e.scale[0],r=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var l=2,u=e.length,c=new Array(u);for(c[0]=(t+=e[0])*i+o,c[1]=(n+=e[1])*r+a;l1)i=function(e,t,n){var i,r=[],o=[];function a(e){var t=e<0?~e:e;(o[t]||(o[t]=[])).push({i:e,g:i})}function s(e){e.forEach(a)}function l(e){e.forEach(s)}return function e(t){switch(i=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(l)}(t.arcs)}}(t),o.forEach(null==n?function(e){r.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&r.push(e[0].i)}),r}(0,t,n);else for(r=0,i=new Array(o=e.arcs.length);r=ln?10:o>=un?5:o>=cn?2:1;let s,l,u;return r<0?(u=Math.pow(10,-r)/a,s=Math.round(e*u),l=Math.round(t*u),s/ut&&--l,u=-u):(u=Math.pow(10,r)*a,s=Math.round(e/u),l=Math.round(t/u),s*ut&&--l),l0))return[];if((e=+e)==(t=+t))return[e];const i=t=r))return[];const s=o-r+1,l=new Array(s);if(i)if(a<0)for(let e=0;e=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function yn(e){if(!(t=gn.exec(e)))throw new Error("invalid format: "+e);var t;return new vn({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function vn(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function bn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function xn(e){return(e=bn(Math.abs(e)))?e[1]:NaN}function _n(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(xn(t)/3)))-xn(Math.abs(e)))}function wn(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,xn(t)-xn(e))+1}function kn(e){return Math.max(0,-xn(Math.abs(e)))}function En(e,t){var n=bn(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}yn.prototype=vn.prototype,vn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const An={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>En(100*e,t),r:En,s:function(e,t){var n=bn(e,t);if(!n)return e+"";var i=n[0],r=n[1],o=r-(mn=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+bn(e,Math.max(0,t+o-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function $n(e){return e}var Dn,Sn,Mn,Cn=Array.prototype.map,Fn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function On(e){var t,n,i=void 0===e.grouping||void 0===e.thousands?$n:(t=Cn.call(e.grouping,Number),n=e.thousands+"",function(e,i){for(var r=e.length,o=[],a=0,s=t[0],l=0;r>0&&s>0&&(l+s+1>i&&(s=Math.max(1,i-l)),o.push(e.substring(r-=s,r+s)),!((l+=s+1)>i));)s=t[a=(a+1)%t.length];return o.reverse().join(n)}),r=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?$n:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(Cn.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function f(e){var t=(e=yn(e)).fill,n=e.align,f=e.sign,d=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,y=e.trim,v=e.type;"n"===v?(m=!0,v="g"):An[v]||(void 0===g&&(g=12),y=!0,v="g"),(h||"0"===t&&"="===n)&&(h=!0,t="0",n="=");var b="$"===d?r:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===d?o:/[%p]/.test(v)?l:"",_=An[v],w=/[defgprs%]/.test(v);function k(e){var r,o,l,d=b,k=x;if("c"===v)k=_(e)+k,e="";else{var E=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:_(Math.abs(e),g),y&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),E&&0==+e&&"+"!==f&&(E=!1),d=(E?"("===f?f:u:"-"===f||"("===f?"":f)+d,k=("s"===v?Fn[8+mn/3]:"")+k+(E&&"("===f?")":""),w)for(r=-1,o=e.length;++r(l=e.charCodeAt(r))||l>57){k=(46===l?a+e.slice(r+1):e.slice(r))+k,e=e.slice(0,r);break}}m&&!h&&(e=i(e,1/0));var A=d.length+e.length+k.length,$=A>1)+d+e+k+$.slice(A);break;default:e=$+d+e+k}return s(e)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return e+""},k}return{format:f,formatPrefix:function(e,t){var n=f(((e=yn(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(xn(t)/3))),r=Math.pow(10,-i),o=Fn[8+i/3];return function(e){return n(r*e)+o}}}}Dn=On({thousands:",",grouping:[3],currency:["$",""]}),Sn=Dn.format,Mn=Dn.formatPrefix;const Nn=new Date,Tn=new Date;function zn(e,t,n,i){function r(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return r.floor=t=>(e(t=new Date(+t)),t),r.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),r.round=e=>{const t=r(e),n=r.ceil(e);return e-t(t(e=new Date(+e),null==n?1:Math.floor(n)),e),r.range=(n,i,o)=>{const a=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n0))return a;let s;do{a.push(s=new Date(+n)),t(n,o),e(n)}while(szn((t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)}),((e,i)=>{if(e>=e)if(i<0)for(;++i<=0;)for(;t(e,-1),!n(e););else for(;--i>=0;)for(;t(e,1),!n(e););})),n&&(r.count=(t,i)=>(Nn.setTime(+t),Tn.setTime(+i),e(Nn),e(Tn),Math.floor(n(Nn,Tn))),r.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?r.filter(i?t=>i(t)%e==0:t=>r.count(0,t)%e==0):r:null)),r}const Rn=1e3,Pn=6e4,Ln=36e5,Bn=864e5,jn=6048e5,In=31536e6,Un=zn((e=>e.setHours(0,0,0,0)),((e,t)=>e.setDate(e.getDate()+t)),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Pn)/Bn),(e=>e.getDate()-1)),qn=(Un.range,zn((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Bn),(e=>e.getUTCDate()-1))),Wn=(qn.range,zn((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Bn),(e=>Math.floor(e/Bn))));function Hn(e){return zn((t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),((e,t)=>{e.setDate(e.getDate()+7*t)}),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Pn)/jn))}Wn.range;const Gn=Hn(0),Vn=Hn(1),Yn=Hn(2),Xn=Hn(3),Jn=Hn(4),Qn=Hn(5),Zn=Hn(6);function Kn(e){return zn((t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)}),((e,t)=>(t-e)/jn))}Gn.range,Vn.range,Yn.range,Xn.range,Jn.range,Qn.range,Zn.range;const ei=Kn(0),ti=Kn(1),ni=Kn(2),ii=Kn(3),ri=Kn(4),oi=Kn(5),ai=Kn(6),si=(ei.range,ti.range,ni.range,ii.range,ri.range,oi.range,ai.range,zn((e=>{e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,t)=>{e.setFullYear(e.getFullYear()+t)}),((e,t)=>t.getFullYear()-e.getFullYear()),(e=>e.getFullYear())));si.every=e=>isFinite(e=Math.floor(e))&&e>0?zn((t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n*e)})):null,si.range;const li=zn((e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)}),((e,t)=>t.getUTCFullYear()-e.getUTCFullYear()),(e=>e.getUTCFullYear()));li.every=e=>isFinite(e=Math.floor(e))&&e>0?zn((t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null,li.range;const ui=zn((e=>{e.setDate(1),e.setHours(0,0,0,0)}),((e,t)=>{e.setMonth(e.getMonth()+t)}),((e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())),(e=>e.getMonth())),ci=(ui.range,zn((e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)}),((e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())),(e=>e.getUTCMonth()))),fi=(ci.range,zn((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Rn-e.getMinutes()*Pn)}),((e,t)=>{e.setTime(+e+t*Ln)}),((e,t)=>(t-e)/Ln),(e=>e.getHours()))),di=(fi.range,zn((e=>{e.setUTCMinutes(0,0,0)}),((e,t)=>{e.setTime(+e+t*Ln)}),((e,t)=>(t-e)/Ln),(e=>e.getUTCHours()))),hi=(di.range,zn((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Rn)}),((e,t)=>{e.setTime(+e+t*Pn)}),((e,t)=>(t-e)/Pn),(e=>e.getMinutes()))),pi=(hi.range,zn((e=>{e.setUTCSeconds(0,0)}),((e,t)=>{e.setTime(+e+t*Pn)}),((e,t)=>(t-e)/Pn),(e=>e.getUTCMinutes()))),mi=(pi.range,zn((e=>{e.setTime(e-e.getMilliseconds())}),((e,t)=>{e.setTime(+e+t*Rn)}),((e,t)=>(t-e)/Rn),(e=>e.getUTCSeconds()))),gi=(mi.range,zn((()=>{}),((e,t)=>{e.setTime(+e+t)}),((e,t)=>t-e)));function yi(e,t){return null==e||null==t?NaN:et?1:e>=t?0:NaN}function vi(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function bi(e){let t,n,i;function r(e,i,r=0,o=e.length){if(r>>1;n(e[t],i)<0?r=t+1:o=t}while(ryi(e(t),n),i=(t,n)=>e(t)-n):(t=e===yi||e===vi?e:xi,n=e,i=e),{left:r,center:function(e,t,n=0,o=e.length){const a=r(e,t,n,o-1);return a>n&&i(e[a-1],t)>-i(e[a],t)?a-1:a},right:function(e,i,r=0,o=e.length){if(r>>1;n(e[t],i)<=0?r=t+1:o=t}while(r(e=Math.floor(e),isFinite(e)&&e>0?e>1?zn((t=>{t.setTime(Math.floor(t/e)*e)}),((t,n)=>{t.setTime(+t+n*e)}),((t,n)=>(n-t)/e)):gi:null),gi.range;const _i="year",wi="quarter",ki="month",Ei="week",Ai="date",$i="day",Di="dayofyear",Si="hours",Mi="minutes",Ci="seconds",Fi="milliseconds",Oi=[_i,wi,ki,Ei,Ai,$i,Di,Si,Mi,Ci,Fi],Ni=Oi.reduce(((e,t,n)=>(e[t]=1+n,e)),{});function Ti(e){const t=nt(e).slice(),n={};return t.length||me("Missing time unit."),t.forEach((e=>{yt(Ni,e)?n[e]=1:me(`Invalid time unit: ${e}.`)})),(n[Ei]||n[$i]?1:0)+(n[wi]||n[ki]||n[Ai]?1:0)+(n[Di]?1:0)>1&&me(`Incompatible time units: ${e}`),t.sort(((e,t)=>Ni[e]-Ni[t])),t}const zi={[_i]:"%Y ",[wi]:"Q%q ",[ki]:"%b ",[Ai]:"%d ",[Ei]:"W%U ",[$i]:"%a ",[Di]:"%j ",[Si]:"%H:00",[Mi]:"00:%M",[Ci]:":%S",[Fi]:".%L",[`${_i}-${ki}`]:"%Y-%m ",[`${_i}-${ki}-${Ai}`]:"%Y-%m-%d ",[`${Si}-${Mi}`]:"%H:%M"};function Ri(e,t){const n=ht({},zi,t),i=Ti(e),r=i.length;let o,a,s="",l=0;for(l=0;ll;--o)if(a=i.slice(l,o).join("-"),null!=n[a]){s+=n[a],l=o;break}return s.trim()}const Pi=new Date;function Li(e){return Pi.setFullYear(e),Pi.setMonth(0),Pi.setDate(1),Pi.setHours(0,0,0,0),Pi}function Bi(e){return Ii(new Date(e))}function ji(e){return Ui(new Date(e))}function Ii(e){return Un.count(Li(e.getFullYear())-1,e)}function Ui(e){return Gn.count(Li(e.getFullYear())-1,e)}function qi(e){return Li(e).getDay()}function Wi(e,t,n,i,r,o,a){if(0<=e&&e<100){const s=new Date(-1,t,n,i,r,o,a);return s.setFullYear(e),s}return new Date(e,t,n,i,r,o,a)}function Hi(e){return Vi(new Date(e))}function Gi(e){return Yi(new Date(e))}function Vi(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return qn.count(t-1,e)}function Yi(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return ei.count(t-1,e)}function Xi(e){return Pi.setTime(Date.UTC(e,0,1)),Pi.getUTCDay()}function Ji(e,t,n,i,r,o,a){if(0<=e&&e<100){const e=new Date(Date.UTC(-1,t,n,i,r,o,a));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,i,r,o,a))}function Qi(e,t,n,i,r){const o=t||1,a=Pe(e),s=(e,t,r)=>function(e,t,n,i){const r=n<=1?e:i?(t,r)=>i+n*Math.floor((e(t,r)-i)/n):(t,i)=>n*Math.floor(e(t,i)/n);return t?(e,n)=>t(r(e,n),n):r}(n[r=r||e],i[r],e===a&&o,t),l=new Date,u=Ut(e),c=u[_i]?s(_i):ft(2012),f=u[ki]?s(ki):u[wi]?s(wi):xe,d=u[Ei]&&u[$i]?s($i,1,Ei+$i):u[Ei]?s(Ei,1):u[$i]?s($i,1):u[Ai]?s(Ai,1):u[Di]?s(Di,1):_e,h=u[Si]?s(Si):xe,p=u[Mi]?s(Mi):xe,m=u[Ci]?s(Ci):xe,g=u[Fi]?s(Fi):xe;return function(e){l.setTime(+e);const t=c(l);return r(t,f(l),d(l,t),h(l),p(l),m(l),g(l))}}function Zi(e,t,n){return t+7*e-(n+6)%7}const Ki={[_i]:e=>e.getFullYear(),[wi]:e=>Math.floor(e.getMonth()/3),[ki]:e=>e.getMonth(),[Ai]:e=>e.getDate(),[Si]:e=>e.getHours(),[Mi]:e=>e.getMinutes(),[Ci]:e=>e.getSeconds(),[Fi]:e=>e.getMilliseconds(),[Di]:e=>Ii(e),[Ei]:e=>Ui(e),[Ei+$i]:(e,t)=>Zi(Ui(e),e.getDay(),qi(t)),[$i]:(e,t)=>Zi(1,e.getDay(),qi(t))},er={[wi]:e=>3*e,[Ei]:(e,t)=>Zi(e,0,qi(t))};function tr(e,t){return Qi(e,t||1,Ki,er,Wi)}const nr={[_i]:e=>e.getUTCFullYear(),[wi]:e=>Math.floor(e.getUTCMonth()/3),[ki]:e=>e.getUTCMonth(),[Ai]:e=>e.getUTCDate(),[Si]:e=>e.getUTCHours(),[Mi]:e=>e.getUTCMinutes(),[Ci]:e=>e.getUTCSeconds(),[Fi]:e=>e.getUTCMilliseconds(),[Di]:e=>Vi(e),[Ei]:e=>Yi(e),[$i]:(e,t)=>Zi(1,e.getUTCDay(),Xi(t)),[Ei+$i]:(e,t)=>Zi(Yi(e),e.getUTCDay(),Xi(t))},ir={[wi]:e=>3*e,[Ei]:(e,t)=>Zi(e,0,Xi(t))};function rr(e,t){return Qi(e,t||1,nr,ir,Ji)}const or={[_i]:si,[wi]:ui.every(3),[ki]:ui,[Ei]:Gn,[Ai]:Un,[$i]:Un,[Di]:Un,[Si]:fi,[Mi]:hi,[Ci]:mi,[Fi]:gi},ar={[_i]:li,[wi]:ci.every(3),[ki]:ci,[Ei]:ei,[Ai]:qn,[$i]:qn,[Di]:qn,[Si]:di,[Mi]:pi,[Ci]:mi,[Fi]:gi};function sr(e){return or[e]}function lr(e){return ar[e]}function ur(e,t,n){return e?e.offset(t,n):void 0}function cr(e,t,n){return ur(sr(e),t,n)}function fr(e,t,n){return ur(lr(e),t,n)}function dr(e,t,n,i){return e?e.range(t,n,i):void 0}function hr(e,t,n,i){return dr(sr(e),t,n,i)}function pr(e,t,n,i){return dr(lr(e),t,n,i)}const mr=31536e6,gr=[_i,ki,Ai,Si,Mi,Ci,Fi],yr=gr.slice(0,-1),vr=yr.slice(0,-1),br=vr.slice(0,-1),xr=br.slice(0,-1),_r=[_i,ki],wr=[_i],kr=[[yr,1,1e3],[yr,5,5e3],[yr,15,15e3],[yr,30,3e4],[vr,1,6e4],[vr,5,3e5],[vr,15,9e5],[vr,30,18e5],[br,1,36e5],[br,3,108e5],[br,6,216e5],[br,12,432e5],[xr,1,864e5],[[_i,Ei],1,6048e5],[_r,1,2592e6],[_r,3,7776e6],[wr,1,mr]];function Er(e){const t=e.extent,n=e.maxbins||40,i=Math.abs(Rt(t))/n;let r,o,a=bi((e=>e[2])).right(kr,i);return a===kr.length?(r=wr,o=pn(t[0]/mr,t[1]/mr,n)):a?(a=kr[i/kr[a-1][2]=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Jo,s:Qo,S:yo,u:vo,U:bo,V:_o,w:wo,W:ko,x:null,X:null,y:Eo,Y:$o,Z:So,"%":Xo},x={a:function(e){return a[e.getUTCDay()]},A:function(e){return o[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:Mo,e:Mo,f:To,g:Ho,G:Vo,H:Co,I:Fo,j:Oo,L:No,m:zo,M:Ro,p:function(e){return r[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Jo,s:Qo,S:Po,u:Lo,U:Bo,V:Io,w:Uo,W:qo,x:null,X:null,y:Wo,Y:Go,Z:Yo,"%":Xo},_={a:function(e,t,n){var i=h.exec(t.slice(n));return i?(e.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(e,t,n){var i=f.exec(t.slice(n));return i?(e.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(e,t,n){var i=y.exec(t.slice(n));return i?(e.m=v.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(e,t,n){var i=m.exec(t.slice(n));return i?(e.m=g.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(e,n,i){return E(e,t,n,i)},d:Zr,e:Zr,f:ro,g:Yr,G:Vr,H:eo,I:eo,j:Kr,L:io,m:Qr,M:to,p:function(e,t,n){var i=u.exec(t.slice(n));return i?(e.p=c.get(i[0].toLowerCase()),n+i[0].length):-1},q:Jr,Q:ao,s:so,S:no,u:qr,U:Wr,V:Hr,w:Ur,W:Gr,x:function(e,t,i){return E(e,n,t,i)},X:function(e,t,n){return E(e,i,t,n)},y:Yr,Y:Vr,Z:Xr,"%":oo};function w(e,t){return function(n){var i,r,o,a=[],s=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=$r(Dr(o.y,0,1))).getUTCDay(),i=r>4||0===r?ti.ceil(i):ti(i),i=qn.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=Ar(Dr(o.y,0,1))).getDay(),i=r>4||0===r?Vn.ceil(i):Vn(i),i=Un.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?$r(Dr(o.y,0,1)).getUTCDay():Ar(Dr(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,$r(o)):Ar(o)}}function E(e,t,n,i){for(var r,o,a=0,s=t.length,l=n.length;a=l)return-1;if(37===(r=t.charCodeAt(a++))){if(r=t.charAt(a++),!(o=_[r in Tr?t.charAt(a++):r])||(i=o(e,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return b.x=w(n,b),b.X=w(i,b),b.c=w(t,b),x.x=w(n,x),x.X=w(i,x),x.c=w(t,x),{format:function(e){var t=w(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=w(e+="",x);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}var Mr,Cr,Fr,Or,Nr,Tr={"-":"",_:" ",0:"0"},zr=/^\s*\d+/,Rr=/^%/,Pr=/[\\^$*+?|[\]().{}]/g;function Lr(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",o=r.length;return i+(o[e.toLowerCase(),t])))}function Ur(e,t,n){var i=zr.exec(t.slice(n,n+1));return i?(e.w=+i[0],n+i[0].length):-1}function qr(e,t,n){var i=zr.exec(t.slice(n,n+1));return i?(e.u=+i[0],n+i[0].length):-1}function Wr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.U=+i[0],n+i[0].length):-1}function Hr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.V=+i[0],n+i[0].length):-1}function Gr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.W=+i[0],n+i[0].length):-1}function Vr(e,t,n){var i=zr.exec(t.slice(n,n+4));return i?(e.y=+i[0],n+i[0].length):-1}function Yr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Xr(e,t,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function Jr(e,t,n){var i=zr.exec(t.slice(n,n+1));return i?(e.q=3*i[0]-3,n+i[0].length):-1}function Qr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function Zr(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function Kr(e,t,n){var i=zr.exec(t.slice(n,n+3));return i?(e.m=0,e.d=+i[0],n+i[0].length):-1}function eo(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function to(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function no(e,t,n){var i=zr.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function io(e,t,n){var i=zr.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function ro(e,t,n){var i=zr.exec(t.slice(n,n+6));return i?(e.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function oo(e,t,n){var i=Rr.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function ao(e,t,n){var i=zr.exec(t.slice(n));return i?(e.Q=+i[0],n+i[0].length):-1}function so(e,t,n){var i=zr.exec(t.slice(n));return i?(e.s=+i[0],n+i[0].length):-1}function lo(e,t){return Lr(e.getDate(),t,2)}function uo(e,t){return Lr(e.getHours(),t,2)}function co(e,t){return Lr(e.getHours()%12||12,t,2)}function fo(e,t){return Lr(1+Un.count(si(e),e),t,3)}function ho(e,t){return Lr(e.getMilliseconds(),t,3)}function po(e,t){return ho(e,t)+"000"}function mo(e,t){return Lr(e.getMonth()+1,t,2)}function go(e,t){return Lr(e.getMinutes(),t,2)}function yo(e,t){return Lr(e.getSeconds(),t,2)}function vo(e){var t=e.getDay();return 0===t?7:t}function bo(e,t){return Lr(Gn.count(si(e)-1,e),t,2)}function xo(e){var t=e.getDay();return t>=4||0===t?Jn(e):Jn.ceil(e)}function _o(e,t){return e=xo(e),Lr(Jn.count(si(e),e)+(4===si(e).getDay()),t,2)}function wo(e){return e.getDay()}function ko(e,t){return Lr(Vn.count(si(e)-1,e),t,2)}function Eo(e,t){return Lr(e.getFullYear()%100,t,2)}function Ao(e,t){return Lr((e=xo(e)).getFullYear()%100,t,2)}function $o(e,t){return Lr(e.getFullYear()%1e4,t,4)}function Do(e,t){var n=e.getDay();return Lr((e=n>=4||0===n?Jn(e):Jn.ceil(e)).getFullYear()%1e4,t,4)}function So(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Lr(t/60|0,"0",2)+Lr(t%60,"0",2)}function Mo(e,t){return Lr(e.getUTCDate(),t,2)}function Co(e,t){return Lr(e.getUTCHours(),t,2)}function Fo(e,t){return Lr(e.getUTCHours()%12||12,t,2)}function Oo(e,t){return Lr(1+qn.count(li(e),e),t,3)}function No(e,t){return Lr(e.getUTCMilliseconds(),t,3)}function To(e,t){return No(e,t)+"000"}function zo(e,t){return Lr(e.getUTCMonth()+1,t,2)}function Ro(e,t){return Lr(e.getUTCMinutes(),t,2)}function Po(e,t){return Lr(e.getUTCSeconds(),t,2)}function Lo(e){var t=e.getUTCDay();return 0===t?7:t}function Bo(e,t){return Lr(ei.count(li(e)-1,e),t,2)}function jo(e){var t=e.getUTCDay();return t>=4||0===t?ri(e):ri.ceil(e)}function Io(e,t){return e=jo(e),Lr(ri.count(li(e),e)+(4===li(e).getUTCDay()),t,2)}function Uo(e){return e.getUTCDay()}function qo(e,t){return Lr(ti.count(li(e)-1,e),t,2)}function Wo(e,t){return Lr(e.getUTCFullYear()%100,t,2)}function Ho(e,t){return Lr((e=jo(e)).getUTCFullYear()%100,t,2)}function Go(e,t){return Lr(e.getUTCFullYear()%1e4,t,4)}function Vo(e,t){var n=e.getUTCDay();return Lr((e=n>=4||0===n?ri(e):ri.ceil(e)).getUTCFullYear()%1e4,t,4)}function Yo(){return"+0000"}function Xo(){return"%"}function Jo(e){return+e}function Qo(e){return Math.floor(+e/1e3)}function Zo(e){const t={};return n=>t[n]||(t[n]=e(n))}function Ko(e){const t=Zo(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){const n=yn(e||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return function(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let o=function(e,t){let n,i=e.lastIndexOf("e");if(i>0)return i;for(i=e.length;--i>t;)if(n=e.charCodeAt(i),n>=48&&n<=57)return i+1}(i,r);const a=or;)if("0"!==i[o]){++o;break}return i.slice(0,o)+a}}(t(n),t(".1f")(1)[1])}return t(n)},formatSpan(e,i,r,o){o=yn(null==o?",f":o);const a=pn(e,i,r),s=Math.max(Math.abs(e),Math.abs(i));let l;if(null==o.precision)switch(o.type){case"s":return isNaN(l=_n(a,s))||(o.precision=l),n(o,s);case"":case"e":case"g":case"p":case"r":isNaN(l=wn(a,s))||(o.precision=l-("e"===o.type));break;case"f":case"%":isNaN(l=kn(a))||(o.precision=l-2*("%"===o.type))}return t(o)}}}let ea,ta;function na(){return ea=Ko({format:Sn,formatPrefix:Mn})}function ia(e){return Ko(On(e))}function ra(e){return arguments.length?ea=ia(e):ea}function oa(e,t,n){Oe(n=n||{})||me(`Invalid time multi-format specifier: ${n}`);const i=t(Ci),r=t(Mi),o=t(Si),a=t(Ai),s=t(Ei),l=t(ki),u=t(wi),c=t(_i),f=e(n[Fi]||".%L"),d=e(n[Ci]||":%S"),h=e(n[Mi]||"%I:%M"),p=e(n[Si]||"%I %p"),m=e(n[Ai]||n[$i]||"%a %d"),g=e(n[Ei]||"%b %d"),y=e(n[ki]||"%B"),v=e(n[wi]||"%B"),b=e(n[_i]||"%Y");return e=>(i(e)St(e)?t(e):oa(t,sr,e),utcFormat:e=>St(e)?n(e):oa(n,lr,e),timeParse:Zo(e.parse),utcParse:Zo(e.utcParse)}}function sa(){return ta=aa({format:Cr,parse:Fr,utcFormat:Or,utcParse:Nr})}function la(e){return aa(Sr(e))}function ua(e){return arguments.length?ta=la(e):ta}Mr=Sr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Cr=Mr.format,Fr=Mr.parse,Or=Mr.utcFormat,Nr=Mr.utcParse,na(),sa();const ca=(e,t)=>ht({},e,t);function fa(e,t){const n=e?ia(e):ra(),i=t?la(t):ua();return ca(n,i)}function da(e,t){const n=arguments.length;return n&&2!==n&&me("defaultLocale expects either zero or two arguments."),n?ca(ra(e),ua(t)):ca(ra(),ua())}function ha(){return na(),sa(),da()}const pa=/^(data:|([A-Za-z]+:)?\/\/)/,ma=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,ga=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,ya="file://";async function va(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t)}async function ba(e,t){t=ht({},this.options,t);const n=this.fileAccess,i={href:null};let r,o,a;const s=ma.test(e.replace(ga,""));null!=e&&"string"==typeof e&&s||me("Sanitize failure, invalid URI: "+Pt(e));const l=pa.test(e);return(a=t.baseURL)&&!l&&(e.startsWith("/")||a.endsWith("/")||(e="/"+e),e=a+e),o=(r=e.startsWith(ya))||"file"===t.mode||"http"!==t.mode&&!l&&n,r?e=e.slice(7):e.startsWith("//")&&("file"===t.defaultProtocol?(e=e.slice(2),o=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!o}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),"image"===t.context&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function xa(e){return e?t=>new Promise(((n,i)=>{e.readFile(t,((e,t)=>{e?i(e):n(t)}))})):_a}async function _a(){me("No file system access.")}function wa(e){return e?async function(t,n){const i=ht({},this.options.http,n),r=n&&n.response,o=await e(t,i);return o.ok?rt(o[r])?o[r]():o.text():me(o.status+""+o.statusText)}:ka}async function ka(){me("No HTTP fetch method available.")}const Ea=e=>null!=e&&e==e,Aa=e=>!(Number.isNaN(+e)||e instanceof Date),$a={boolean:Lt,integer:Le,number:Le,date:jt,string:It,unknown:be},Da=[e=>"true"===e||"false"===e||!0===e||!1===e,e=>Aa(e)&&Number.isInteger(+e),Aa,e=>!Number.isNaN(Date.parse(e))],Sa=["boolean","integer","number","date"];function Ma(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=Da.length,r=Da.map(((e,t)=>t+1));for(let o,a,s=0,l=0;s0===e?t:e),0)-1]}function Ca(e,t){return t.reduce(((t,n)=>(t[n]=Ma(e,n),t)),{})}function Fa(e){const t=function(t,n){const i={delimiter:e};return Oa(t,n?ht(n,i):i)};return t.responseType="text",t}function Oa(e,t){return t.header&&(e=t.header.map(Pt).join(t.delimiter)+"\n"+e),Kt(t.delimiter).parse(e+"")}function Na(e,t){const n=t&&t.property?ye(t.property):be;return!Oe(e)||(i=e,"function"==typeof Buffer&&rt(Buffer.isBuffer)&&Buffer.isBuffer(i))?n(JSON.parse(e)):function(e,t){return!Fe(e)&&At(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}(n(e),t);var i}Oa.responseType="text",Na.responseType="json";const Ta={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function za(e,t){let n,i,r,o;return e=Na(e,t),t&&t.feature?(n=tn,r=t.feature):t&&t.mesh?(n=an,r=t.mesh,o=Ta[t.filter]):me("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,o):me("Invalid TopoJSON object: "+r),i&&i.features||[i]}za.responseType="json";const Ra={dsv:Oa,csv:Fa(","),tsv:Fa("\t"),json:Na,topojson:za};function Pa(e,t){return arguments.length>1?(Ra[e]=t,this):yt(Ra,e)?Ra[e]:null}function La(e){const t=Pa(e);return t&&t.responseType||"text"}function Ba(e,t,n,i){const r=Pa((t=t||{}).type||"json");return r||me("Unknown data format type: "+t.type),e=r(e,t),t.parse&&function(e,t,n,i){if(!e.length)return;const r=ua();n=n||r.timeParse,i=i||r.utcParse;let o,a,s,l,u,c,f=e.columns||Object.keys(e[0]);"auto"===t&&(t=Ca(e,f)),f=Object.keys(t);const d=f.map((e=>{const r=t[e];let o,a;if(r&&(r.startsWith("date:")||r.startsWith("utc:")))return o=r.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1)),("utc"===o[0]?i:n)(a);if(!$a[r])throw Error("Illegal format pattern: "+e+":"+r);return $a[r]}));for(s=0,u=e.length,c=f.length;s({options:t||{},sanitize:ba,load:va,fileAccess:!1,file:xa(null),http:wa(e)})}("undefined"!=typeof fetch&&fetch);function Ia(e){const t=e||be,n=[],i={};return n.add=e=>{const r=t(e);return i[r]||(i[r]=1,n.push(e)),n},n.remove=e=>{const r=t(e);if(i[r]){i[r]=0;const t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function Ua(e,t){try{await t(e)}catch(t){e.error(t)}}const qa=Symbol("vega_id");let Wa=1;function Ha(e){return!(!e||!Ga(e))}function Ga(e){return e[qa]}function Va(e,t){return e[qa]=t,e}function Ya(e){const t=e===Object(e)?e:{data:e};return Ga(t)?t:Va(t,Wa++)}function Xa(e){return Ja(e,Ya({}))}function Ja(e,t){for(const n in e)t[n]=e[n];return t}function Qa(e,t){return Va(t,Ga(e))}function Za(e,t){return e?t?(n,i)=>e(n,i)||Ga(t(n))-Ga(t(i)):(t,n)=>e(t,n)||Ga(t)-Ga(n):null}function Ka(e){return e&&e.constructor===es}function es(){const e=[],t=[],n=[],i=[],r=[];let o=null,a=!1;return{constructor:es,insert(t){const n=nt(t),i=n.length;for(let t=0;t{p(e)&&(u[Ga(e)]=-1)}));for(f=0,d=e.length;f0&&(y(m,p,h.value),s.modifies(p));for(f=0,d=r.length;f{p(e)&&u[Ga(e)]>0&&y(e,h.field,h.value)})),s.modifies(h.field);if(a)s.mod=t.length||i.length?l.filter((e=>u[Ga(e)]>0)):l.slice();else for(g in c)s.mod.push(c[g]);return(o||null==o&&(t.length||i.length))&&s.clean(!0),s}}}const ts="_:mod:_";function ns(){Object.defineProperty(this,ts,{writable:!0,value:{}})}ns.prototype={set(e,t,n,i){const r=this,o=r[e],a=r[ts];return null!=t&&t>=0?(o[t]!==n||i)&&(o[t]=n,a[t+":"+e]=-1,a[e]=-1):(o!==n||i)&&(r[e]=n,a[e]=Fe(n)?1+n.length:-1),r},modified(e,t){const n=this[ts];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(Fe(e)){for(let t=0;t=0?t+1{a instanceof os?(a!==this&&(t&&a.targets().add(this),o.push(a)),r.push({op:a,name:e,index:n})):i.set(e,n,a)};for(a in e)if(s=e[a],"pulse"===a)nt(s).forEach((e=>{e instanceof os?e!==this&&(e.targets().add(this),o.push(e)):me("Pulse parameters must be operator instances.")})),this.source=s;else if(Fe(s))for(i.set(a,-1,Array(l=s.length)),u=0;u{const n=Date.now();return n-t>e?(t=n,1):0}))},debounce(e){const t=us();return this.targets().add(us(null,null,dt(e,(e=>{const n=e.dataflow;t.receive(e),n&&n.run&&n.run()})))),t},between(e,t){let n=!1;return e.targets().add(us(null,null,(()=>n=!0))),t.targets().add(us(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=we,this._targets=null}};const cs={skip:!0};function fs(e,t,n,i,r,o){const a=ht({},o,cs);let s,l;rt(n)||(n=ft(n)),void 0===i?s=t=>e.touch(n(t)):rt(i)?(l=new os(null,i,r,!1),s=t=>{l.evaluate(t);const i=n(t),r=l.value;Ka(r)?e.pulse(i,r,o):e.update(i,r,a)}):s=t=>e.update(n(t),i,a),t.apply(s)}function ds(e,t,n,i,r,o){if(void 0===i)t.targets().add(n);else{const a=o||{},s=new os(null,function(e,t){return t=rt(t)?t:ft(t),e?function(n,i){const r=t(n,i);return e.skip()||(e.skip(r!==this.value).value=r),r}:t}(n,i),r,!1);s.modified(a.force),s.rank=t.rank,t.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),e.connect(n,[s]))}}const hs={};function ps(e,t,n){this.dataflow=e,this.stamp=null==t?-1:t,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function ms(e,t){const n=[];return Wt(e,t,(e=>n.push(e))),n}function gs(e,t){const n={};return e.visit(t,(e=>{n[Ga(e)]=1})),e=>n[Ga(e)]?null:e}function ys(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function vs(e,t,n,i){const r=this;let o=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const e of n)if(e.stamp===t){if(e.fields){const t=r.fields||(r.fields={});for(const n in e.fields)t[n]=1}e.changed(r.ADD)&&(o|=r.ADD),e.changed(r.REM)&&(o|=r.REM),e.changed(r.MOD)&&(o|=r.MOD)}this.changes=o}function bs(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}ps.prototype={StopPropagation:hs,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(e){return new ps(this.dataflow).init(this,e)},clone(){const e=this.fork(7);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new ps(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,!e.fields||64&t||(n.fields=e.fields),1&t?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),2&t?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),4&t?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),32&t?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||7;return 1&t&&this.add.length||2&t&&this.rem.length||4&t&&this.mod.length},reflow(e){if(e)return this.fork(7).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(4,gs(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return Fe(e)?e.forEach((e=>t[e]=!0)):t[e]=!0,this},modified(e,t){const n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?Fe(e)?e.some((e=>n[e])):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=ys(n.addF,t)),2&e&&(n.remF=ys(n.remF,t)),4&e&&(n.modF=ys(n.modF,t)),16&e&&(n.srcF=ys(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=ms(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=ms(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=ms(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,i=t;if(16&e)return Wt(n.source,n.srcF,i),n;1&e&&Wt(n.add,n.addF,i),2&e&&Wt(n.rem,n.remF,i),4&e&&Wt(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||Wt(r,e?gs(n,5):n.srcF,i)}return n}},_t(vs,ps,{fork(e){const t=new ps(this.dataflow).init(this,e&this.NO_FIELDS);return void 0!==e&&(e&t.ADD&&this.visit(t.ADD,(e=>t.add.push(e))),e&t.REM&&this.visit(t.REM,(e=>t.rem.push(e))),e&t.MOD&&this.visit(t.MOD,(e=>t.mod.push(e)))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?Fe(e)?e.some((e=>n[e])):n[e]:0},filter(){me("MultiPulse does not support filtering.")},materialize(){me("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let o=0;if(e&n.SOURCE)for(;ot&&(o=n-1>>1,r=e[o],i(a,r)<0);)e[n]=r,n=o;return e[n]=a}function ws(){this.logger(Ce()),this.logLevel($e),this._clock=0,this._rank=0,this._locale=da();try{this._loader=ja()}catch(e){}this._touched=Ia(ve),this._input={},this._pulse=null,this._heap=function(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),_s(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let i;return t.length?(i=t[0],t[0]=n,function(e,t,n){const i=t,r=e.length,o=e[t];let a,s=1+(t<<1);for(;s=0&&(s=a),e[t]=e[s],s=1+((t=s)<<1);e[t]=o,_s(e,i,t,n)}(t,0,e)):i=n,i}}}(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function ks(e){return function(){return this._log[e].apply(this,arguments)}}function Es(e,t){os.call(this,e,null,t)}ws.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:ks("error"),warn:ks("warn"),info:ks("info"),debug:ks("debug"),logLevel:ks("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,o=1;return e instanceof os?r=e:e&&e.prototype instanceof os?r=new e:rt(e)?r=new os(null,e):(o=0,r=new os(e,t)),this.rank(r),o&&(i=n,n=t),n&&this.connect(r,r.parameters(n,i)),this.touch(r),r},connect:function(e,t){const n=e.rank,i=t.length;for(let r=0;r=0;)t.push(n=i[r]),n===e&&me("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||xs);const i=new ps(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return i.target=e,this._input[e.id]=t.pulse(i,r),this},touch:function(e,t){const n=t||xs;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||xs;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:es,ingest:function(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))},parse:function(e,t){const n=this.locale();return Ba(e,t,n.timeParse,n.utcParse)},preload:async function(e,t,n){const i=this,r=i._pending||function(e){let t;const n=new Promise((e=>t=e));return n.requests=0,n.done=()=>{0==--n.requests&&(e._pending=null,t(e))},e._pending=n}(i);r.requests+=1;const o=await i.request(t,n);return i.pulse(e,i.changeset().remove(we).insert(o.data||[])),r.done(),o},request:async function(e,t){const n=this;let i,r=0;try{i=await n.loader().load(e,{context:"dataflow",response:La(t&&t.type)});try{i=n.parse(i,t)}catch(t){r=-2,n.warn("Data ingestion failed",e,t)}}catch(t){r=-1,n.warn("Loading failed",e,t)}return{data:i,status:r}},events:function(e,t,n,i){const r=this,o=us(n,i),a=function(e){e.dataflow=r;try{o.receive(e)}catch(e){r.error(e)}finally{r.run()}};let s;s="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):nt(e);const l=s.length;for(let e=0;ei._enqueue(e,!0))),i._touched=Ia(ve);let a,s,l,u=0;try{for(;i._heap.size()>0;)a=i._heap.pop(),a.rank===a.qrank?(s=a.run(i._getPulse(a,e)),s.then?s=await s:s.async&&(r.push(s.async),s=hs),s!==hs&&a._targets&&a._targets.forEach((e=>i._enqueue(e))),++u):i._enqueue(a,!0)}catch(e){i._heap.clear(),l=e}if(i._input={},i._pulse=null,i.debug(`Pulse ${o}: ${u} operators`),l&&(i._postrun=[],i.error(l)),i._postrun.length){const e=i._postrun.sort(((e,t)=>t.priority-e.priority));i._postrun=[];for(let t=0;ti.runAsync(null,(()=>{e.forEach((e=>{try{e(i)}catch(e){i.error(e)}}))})))),i},run:function(e,t,n){return this._pulse?bs(this):(this.evaluate(e,t,n),this)},runAsync:async function(e,t,n){for(;this._running;)await this._running;const i=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(i,i),this._running},runAfter:function(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(e){this.error(e)}},_enqueue:function(e,t){const n=e.stampe.pulse)),t):this._input[e.id]||function(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==hs&&(e.source=t.source),e)}(this._pulse,n&&n.pulse)}},_t(Es,os,{run(e){if(e.stampthis.pulse=e)):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const As={};function $s(e){const t=Ds(e);return t&&t.Definition||null}function Ds(e){return e=e&&e.toLowerCase(),yt(As,e)?As[e]:null}function Ss(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n=r)&&(n=r)}return n}function Ms(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n>r||void 0===n&&r>=r)&&(n=r)}return n}function Cs(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(et?1:0)}function Fs(e,t,n=0,i=1/0,r){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),i=Math.floor(Math.min(e.length-1,i)),!(n<=t&&t<=i))return e;for(r=void 0===r?Cs:function(e=yi){if(e===yi)return Cs;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const i=e(t,n);return i||0===i?i:(0===e(n,n))-(0===e(t,t))}}(r);i>n;){if(i-n>600){const o=i-n+1,a=t-n+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Fs(e,t,Math.max(n,Math.floor(t-a*l/o+u)),Math.min(i,Math.floor(t+(o-a)*l/o+u)),r)}const o=e[t];let a=n,s=i;for(Os(e,n,t),r(e[i],o)>0&&Os(e,n,i);a0;)--s}0===r(e[n],o)?Os(e,n,s):(++s,Os(e,s,i)),s<=t&&(n=s+1),t<=s&&(i=s-1)}return e}function Os(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function Ns(e){return null===e?NaN:+e}function Ts(e,t,n){if(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)null!=(i=t(i,++n,e))&&(i=+i)>=i&&(yield i)}}(e,n)),(i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return Ms(e);if(t>=1)return Ss(e);var i,r=(i-1)*t,o=Math.floor(r),a=Ss(Fs(e,o).subarray(0,o+1));return a+(Ms(e.subarray(o+1))-a)*(r-o)}}function zs(e,t,n=Ns){if((i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,o=Math.floor(r),a=+n(e[o],o,e);return a+(+n(e[o+1],o+1,e)-a)*(r-o)}}function Rs(e,t){return Ts(e,.5,t)}function*Ps(e,t){if(null==t)for(let t of e)null!=t&&""!==t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)i=t(i,++n,e),null!=i&&""!==i&&(i=+i)>=i&&(yield i)}}function Ls(e,t,n){const i=Float64Array.from(Ps(e,n));return i.sort(yi),t.map((e=>zs(i,e)))}function Bs(e,t){return Ls(e,[.25,.5,.75],t)}function js(e,t){const n=e.length,i=function(e,t){const n=function(e,t){let n,i=0,r=0,o=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(n=t-r,r+=n/++i,o+=n*(t-r));else{let a=-1;for(let s of e)null!=(s=t(s,++a,e))&&(s=+s)>=s&&(n=s-r,r+=n/++i,o+=n*(s-r))}if(i>1)return o/(i-1)}(e,t);return n?Math.sqrt(n):n}(e,t),r=Bs(e,t),o=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,o)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function Is(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let o,a,s,l,u,c,f=e.extent[0],d=e.extent[1];const h=e.span||d-f||Math.abs(f)||1;if(e.step)o=e.step;else if(e.steps){for(l=h/t,u=0,c=e.steps.length;ut;)o*=n;for(u=0,c=r.length;u=s&&h/l<=t&&(o=l)}l=Math.log(o);const p=l>=0?0:1+~~(-l/i),m=Math.pow(n,-p-1);return(e.nice||void 0===e.nice)&&(l=Math.floor(f/o+m)*o,f=fe);const r=e.length,o=new Float64Array(r);let a,s=0,l=1,u=i(e[0]),c=u,f=u+t;for(;l=f){for(c=(u+c)/2;s>1);ra;)e[r--]=e[o]}o=a,a=i}return e}(o,t+t/4):o}function Gs(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}}function Vs(e,t){let n,i,r;null==t&&(t=e,e=0);const o={min(e){return arguments.length?(n=e||0,r=i-n,o):n},max(e){return arguments.length?(i=e||0,r=i-n,o):i},sample:()=>n+Math.floor(r*Us()),pdf:e=>e===Math.floor(e)&&e>=n&&e=i?1:(t-n+1)/r},icdf:e=>e>=0&&e<=1?n-1+Math.floor(e*r):NaN};return o.min(e).max(t)}const Ys=Math.sqrt(2*Math.PI),Xs=Math.SQRT2;let Js=NaN;function Qs(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,o=0;if(Js==Js)r=Js,Js=NaN;else{do{r=2*Us()-1,o=2*Us()-1,n=r*r+o*o}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,Js=o*i}return e+r*t}function Zs(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*Ys)}function Ks(e,t,n){const i=(e-(t=t||0))/(n=null==n?1:n),r=Math.abs(i);let o;if(r>37)o=0;else{const e=Math.exp(-r*r/2);let t;r<7.07106781186547?(t=.0352624965998911*r+.700383064443688,t=t*r+6.37396220353165,t=t*r+33.912866078383,t=t*r+112.079291497871,t=t*r+221.213596169931,t=t*r+220.206867912376,o=e*t,t=.0883883476483184*r+1.75566716318264,t=t*r+16.064177579207,t=t*r+86.7807322029461,t=t*r+296.564248779674,t=t*r+637.333633378831,t=t*r+793.826512519948,t=t*r+440.413735824752,o/=t):(t=r+.65,t=r+4/t,t=r+3/t,t=r+2/t,t=r+1/t,o=e/t/2.506628274631)}return i>0?1-o:o}function el(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*Xs*function(e){let t,n=-Math.log((1-e)*(1+e));return n<6.25?(n-=3.125,t=-364441206401782e-35,t=t*n-16850591381820166e-35,t=128584807152564e-32+t*n,t=11157877678025181e-33+t*n,t=t*n-1333171662854621e-31,t=20972767875968562e-33+t*n,t=6637638134358324e-30+t*n,t=t*n-4054566272975207e-29,t=t*n-8151934197605472e-29,t=26335093153082323e-28+t*n,t=t*n-12975133253453532e-27,t=t*n-5415412054294628e-26,t=1.0512122733215323e-9+t*n,t=t*n-4.112633980346984e-9,t=t*n-2.9070369957882005e-8,t=4.2347877827932404e-7+t*n,t=t*n-13654692000834679e-22,t=t*n-13882523362786469e-21,t=.00018673420803405714+t*n,t=t*n-.000740702534166267,t=t*n-.006033670871430149,t=.24015818242558962+t*n,t=1.6536545626831027+t*n):n<16?(n=Math.sqrt(n)-3.25,t=2.2137376921775787e-9,t=9.075656193888539e-8+t*n,t=t*n-2.7517406297064545e-7,t=1.8239629214389228e-8+t*n,t=15027403968909828e-22+t*n,t=t*n-4013867526981546e-21,t=29234449089955446e-22+t*n,t=12475304481671779e-21+t*n,t=t*n-47318229009055734e-21,t=6828485145957318e-20+t*n,t=24031110387097894e-21+t*n,t=t*n-.0003550375203628475,t=.0009532893797373805+t*n,t=t*n-.0016882755560235047,t=.002491442096107851+t*n,t=t*n-.003751208507569241,t=.005370914553590064+t*n,t=1.0052589676941592+t*n,t=3.0838856104922208+t*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,t=-27109920616438573e-27,t=t*n-2.555641816996525e-10,t=1.5076572693500548e-9+t*n,t=t*n-3.789465440126737e-9,t=7.61570120807834e-9+t*n,t=t*n-1.496002662714924e-8,t=2.914795345090108e-8+t*n,t=t*n-6.771199775845234e-8,t=2.2900482228026655e-7+t*n,t=t*n-9.9298272942317e-7,t=4526062597223154e-21+t*n,t=t*n-1968177810553167e-20,t=7599527703001776e-20+t*n,t=t*n-.00021503011930044477,t=t*n-.00013871931833623122,t=1.0103004648645344+t*n,t=4.849906401408584+t*n):t=1/0,t*e}(2*e-1)}function tl(e,t){let n,i;const r={mean(e){return arguments.length?(n=e||0,r):n},stdev(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>Qs(n,i),pdf:e=>Zs(e,n,i),cdf:e=>Ks(e,n,i),icdf:e=>el(e,n,i)};return r.mean(e).stdev(t)}function nl(e,t){const n=tl();let i=0;const r={data(n){return arguments.length?(e=n,i=n?n.length:0,r.bandwidth(t)):e},bandwidth(n){return arguments.length?(!(t=n)&&e&&(t=js(e)),r):t},sample:()=>e[~~(Us()*i)]+t*n.sample(),pdf(r){let o=0,a=0;for(;ail(n,i),pdf:e=>rl(e,n,i),cdf:e=>ol(e,n,i),icdf:e=>al(e,n,i)};return r.mean(e).stdev(t)}function ll(e,t){let n,i=0;const r={weights(e){return arguments.length?(n=function(e){const t=[];let n,r=0;for(n=0;n=t&&e<=n?1/(n-t):0}function fl(e,t,n){return null==n&&(n=null==t?1:t,t=0),en?1:(e-t)/(n-t)}function dl(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function hl(e,t){let n,i;const r={min(e){return arguments.length?(n=e||0,r):n},max(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>ul(n,i),pdf:e=>cl(e,n,i),cdf:e=>fl(e,n,i),icdf:e=>dl(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function pl(e,t,n){let i=0,r=0;for(const o of e){const e=n(o);null==t(o)||null==e||isNaN(e)||(i+=(e-i)/++r)}return{coef:[i],predict:()=>i,rSquared:0}}function ml(e,t,n,i){const r=i-e*e,o=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-o*e,o]}function gl(e,t,n,i){e=e.filter((e=>{let i=t(e),r=n(e);return null!=i&&(i=+i)>=i&&null!=r&&(r=+r)>=r})),i&&e.sort(((e,n)=>t(e)-t(n)));const r=e.length,o=new Float64Array(r),a=new Float64Array(r);let s,l,u,c=0,f=0,d=0;for(u of e)o[c]=s=+t(u),a[c]=l=+n(u),++c,f+=(s-f)/c,d+=(l-d)/c;for(c=0;c=r&&null!=o&&(o=+o)>=o&&i(r,o,++a)}function vl(e,t,n,i,r){let o=0,a=0;return yl(e,t,n,((e,t)=>{const n=t-r(e),s=t-i;o+=n*n,a+=s*s})),1-o/a}function bl(e,t,n){let i=0,r=0,o=0,a=0,s=0;yl(e,t,n,((e,t)=>{++s,i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const l=ml(i,r,o,a),u=e=>l[0]+l[1]*e;return{coef:l,predict:u,rSquared:vl(e,t,n,r,u)}}function xl(e,t,n){let i=0,r=0,o=0,a=0,s=0;yl(e,t,n,((e,t)=>{++s,e=Math.log(e),i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const l=ml(i,r,o,a),u=e=>l[0]+l[1]*Math.log(e);return{coef:l,predict:u,rSquared:vl(e,t,n,r,u)}}function _l(e,t,n){const[i,r,o,a]=gl(e,t,n);let s,l,u,c=0,f=0,d=0,h=0,p=0;yl(e,t,n,((e,t)=>{s=i[p++],l=Math.log(t),u=s*t,c+=(t*l-c)/p,f+=(u-f)/p,d+=(u*l-d)/p,h+=(s*u-h)/p}));const[m,g]=ml(f/a,c/a,d/a,h/a),y=e=>Math.exp(m+g*(e-o));return{coef:[Math.exp(m-g*o),g],predict:y,rSquared:vl(e,t,n,a,y)}}function wl(e,t,n){let i=0,r=0,o=0,a=0,s=0,l=0;yl(e,t,n,((e,t)=>{const n=Math.log(e),u=Math.log(t);++l,i+=(n-i)/l,r+=(u-r)/l,o+=(n*u-o)/l,a+=(n*n-a)/l,s+=(t-s)/l}));const u=ml(i,r,o,a),c=e=>u[0]*Math.pow(e,u[1]);return u[0]=Math.exp(u[0]),{coef:u,predict:c,rSquared:vl(e,t,n,s,c)}}function kl(e,t,n){const[i,r,o,a]=gl(e,t,n),s=i.length;let l,u,c,f,d=0,h=0,p=0,m=0,g=0;for(l=0;lb*(e-=o)*e+x*e+_+a;return{coef:[_-x*o+b*o*o+a,x-2*b*o,b],predict:w,rSquared:vl(e,t,n,a,w)}}function El(e,t,n,i){if(0===i)return pl(e,t,n);if(1===i)return bl(e,t,n);if(2===i)return kl(e,t,n);const[r,o,a,s]=gl(e,t,n),l=r.length,u=[],c=[],f=i+1;let d,h,p,m,g;for(d=0;dMath.abs(e[i][a])&&(a=r);for(o=i;o=i;o--)e[o][r]-=e[o][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(s=0,o=r+1;o{e-=a;let t=s+y[0]+y[1]*e+y[2]*e*e;for(d=3;d=0;--o)for(s=t[o],l=1,r[o]+=s,a=1;a<=o;++a)l*=(o+1-a)/a,r[o-a]+=s*Math.pow(n,a)*l;return r[0]+=i,r}const $l=2,Dl=1e-12;function Sl(e,t,n,i){const[r,o,a,s]=gl(e,t,n,!0),l=r.length,u=Math.max(2,~~(i*l)),c=new Float64Array(l),f=new Float64Array(l),d=new Float64Array(l).fill(1);for(let e=-1;++e<=$l;){const t=[0,u-1];for(let e=0;er[a]-n?i:a;let l=0,u=0,h=0,p=0,m=0;const g=1/Math.abs(r[s]-n||1);for(let e=i;e<=a;++e){const t=r[e],i=o[e],a=Ml(Math.abs(n-t)*g)*d[e],s=t*a;l+=a,u+=s,h+=i*a,p+=i*s,m+=t*s}const[y,v]=ml(u/l,h/l,p/l,m/l);c[e]=y+v*n,f[e]=Math.abs(o[e]-c[e]),Cl(r,e+1,t)}if(e===$l)break;const n=Rs(f);if(Math.abs(n)=1?Dl:(t=1-e*e)*t}return function(e,t,n,i){const r=e.length,o=[];let a,s=0,l=0,u=[];for(;s=e.length))for(;t>r&&e[o]-i<=i-e[r];)n[0]=++r,n[1]=o,++o}const Fl=.5*Math.PI/180;function Ol(e,t,n,i){n=n||25,i=Math.max(n,i||200);const r=t=>[t,e(t)],o=t[0],a=t[1],s=a-o,l=s/i,u=[r(o)],c=[];if(n===i){for(let e=1;e0;)c.push(r(o+e/n*s));let f=u[0],d=c[c.length-1];const h=1/s,p=function(e,t){let n=e,i=e;const r=t.length;for(let e=0;ei&&(i=r)}return 1/(i-n)}(f[1],c);for(;d;){const e=r((f[0]+d[0])/2);e[0]-f[0]>=l&&Nl(f,e,d,h,p)>Fl?c.push(e):(f=d,u.push(d),c.pop()),d=c[c.length-1]}return u}function Nl(e,t,n,i,r){const o=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),a=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(o-a)}function Tl(e,t,n){e=+e,t=+t,n=(r=arguments.length)<2?(t=e,e=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((t-e)/n)),o=new Array(r);++i{const n=t.length;let i=1,r=String(t[0](e));for(;i{},Ll={init:Pl,add:Pl,rem:Pl,idx:0},Bl={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.sum,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||void 0===e.max)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:["exponential"],idx:1}},jl=Object.keys(Bl).filter((e=>"__count__"!==e));function Il(e,t,n){return Bl[e](n,t)}function Ul(e,t){return e.idx-t.idx}function ql(){this.valid=0,this.missing=0,this._ops.forEach((e=>null==e.aggregate_param?e.init(this):e.init(this,e.aggregate_param)))}function Wl(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function Hl(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function Gl(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function Vl(e,t){const n=t||be,i=function(e){const t={};e.forEach((e=>t[e.name]=e));const n=e=>{e.req&&e.req.forEach((e=>{t[e]||n(t[e]=Bl[e]())}))};return e.forEach(n),Object.values(t).sort(Ul)}(e),r=e.slice().sort(Ul);function o(e){this._ops=i,this._out=r,this.cell=e,this.init()}return o.prototype.init=ql,o.prototype.add=Wl,o.prototype.rem=Hl,o.prototype.set=Gl,o.prototype.get=n,o.fields=e.map((e=>e.out)),o}function Yl(e){this._key=e?ye(e):Ga,this.reset()}[...jl,"__count__"].forEach((e=>{Bl[e]=function(e,t){return(n,i)=>ht({name:e,aggregate_param:i,out:n||e},Ll,t)}(e,Bl[e])}));const Xl=Yl.prototype;function Jl(e){Es.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function Ql(e){Es.call(this,null,e)}function Zl(e,t,n){const i=e;let r=t||[],o=n||[],a={},s=0;return{add:e=>o.push(e),remove:e=>a[i(e)]=++s,size:()=>r.length,data:(e,t)=>(s&&(r=r.filter((e=>!a[i(e)])),a={},s=0),t&&e&&r.sort(e),o.length&&(r=e?Nt(e,r,o.sort(e)):r.concat(o),o=[]),r)}}function Kl(e){Es.call(this,[],e)}function eu(e){os.call(this,null,tu,e)}function tu(e){return this.value&&!e.modified()?this.value:at(e.fields,e.orders)}function nu(e){Es.call(this,null,e)}function iu(e){Es.call(this,null,e)}Xl.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Xl.add=function(e){this._add.push(e)},Xl.rem=function(e){this._rem.push(e)},Xl.values=function(){if(this._get=null,0===this._rem.length)return this._add;const e=this._add,t=this._rem,n=this._key,i=e.length,r=t.length,o=Array(i-r),a={};let s,l,u;for(s=0;s=0;)i=e(t[r])+"",yt(n,i)||(n[i]=1,++o);return o},Xl.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=mt(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},Xl.argmin=function(e){return this.extent(e)[0]||{}},Xl.argmax=function(e){return this.extent(e)[1]||{}},Xl.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},Xl.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},Xl.quartile=function(e){return this._get===e&&this._q||(this._q=Bs(this.values(),e),this._get=e),this._q},Xl.q1=function(e){return this.quartile(e)[0]},Xl.q2=function(e){return this.quartile(e)[1]},Xl.q3=function(e){return this.quartile(e)[2]},Xl.ci=function(e){return this._get===e&&this._ci||(this._ci=Ws(this.values(),1e3,.05,e),this._get=e),this._ci},Xl.ci0=function(e){return this.ci(e)[0]},Xl.ci1=function(e){return this.ci(e)[1]},Jl.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:jl},{name:"aggregate_params",type:"field",null:!0,array:!0,default:[null]},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},_t(Jl,Es,{transform(e,t){const n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=i.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):Object.create(null),t.visit(t.SOURCE,(e=>n.add(e)))):(n.value=n.value||n.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),i.modifies(n._outputs),n._drop=!1!==e.drop,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter((()=>this.clean())),n.changes(i)},cross(){const e=this,t=e.value,n=e._dnames,i=n.map((()=>({}))),r=n.length;function o(e){let t,o,a,s;for(t in e)for(a=e[t].tuple,o=0;o{const t=ce(e);return r(e),n.push(t),t})),this.cellkey=e.key?e.key:zl(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=e.fields||[null],a=e.ops||["count"],s=e.aggregate_params||[null],l=e.as||[],u=o.length,c={};let f,d,h,p,m,g,y;for(u!==a.length&&me("Unmatched number of fields and aggregate ops."),y=0;yVl(e,e.field))),Object.create(null)},cellkey:zl(),cell(e,t){let n=this.value[e];return n?0===n.num&&this._drop&&n.stamp{const t=i(e);e[s]=t,e[l]=null==t?null:r+o*(1+(t-r)/o)}:e=>e[s]=i(e)),t.modifies(n?a:s)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=Is(e),i=n.step;let r,o,a=n.start,s=a+Math.ceil((n.stop-a)/i)*i;null!=(r=e.anchor)&&(o=r-(a+i*Math.floor((r-a)/i)),a+=o,s+=o);const l=function(e){let n=Le(t(e));return null==n?null:ns?1/0:(n=Math.max(a,Math.min(n,s-i)),a+i*Math.floor(1e-14+(n-a)/i))};return l.start=a,l.stop=n.stop,l.step=i,this.value=ue(l,fe(t),e.name||"bin_"+ce(t))}}),Kl.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},_t(Kl,Es,{transform(e,t){const n=t.fork(t.ALL),i=Zl(Ga,this.value,n.materialize(n.ADD).add),r=e.sort,o=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(o),this.value=n.source=i.data(Za(r),o),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),_t(eu,os),nu.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},_t(nu,Es,{transform(e,t){const n=t=>n=>{for(var i,r=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(s(n),e.case,o)||[],l=0,u=r.length;lr[e]=1+(r[e]||0))),c=n((e=>r[e]-=1));return i?t.visit(t.SOURCE,u):(t.visit(t.ADD,u),t.visit(t.REM,c)),this._finish(t,l)},_parameterCheck(e,t){let n=!1;return!e.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),!e.modified("pattern")&&this._match||(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,i=this._tuples||(this._tuples={}),r=t[0],o=t[1],a=e.fork(e.NO_SOURCE|e.NO_FIELDS);let s,l,u;for(s in n)l=i[s],u=n[s]||0,!l&&u?(i[s]=l=Ya({}),l[r]=s,l[o]=u,a.add.push(l)):0===u?(l&&a.rem.push(l),n[s]=null,i[s]=null):l[o]!==u&&(l[o]=u,a.mod.push(l));return a.modifies(t)}}),iu.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},_t(iu,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],o=i[1],a=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let s=this.value;return a?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=function(e,t,n,i){for(var r,o,a=[],s={},l=e.length,u=0;uau(e,t)))):typeof i[n]===ou&&i[n](e[n]);return i}function su(e){Es.call(this,null,e)}const lu=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],uu={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:lu},{name:"weights",type:"number",array:!0}]};function cu(e,t){return e?e.map(((e,n)=>t[n]||ce(e))):null}function fu(e,t,n){const i=[],r=e=>e(l);let o,a,s,l,u,c;if(null==t)i.push(e.map(n));else for(o={},a=0,s=e.length;at(n,e)),fe(t),ce(t))}function mu(e){Es.call(this,[void 0,void 0],e)}function gu(e,t){os.call(this,e),this.parent=t,this.count=0}function yu(e){Es.call(this,{},e),this._keys=bt();const t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,i=t.active;nye(e))):ye(e.name,e.as)}function xu(e){Es.call(this,bt(),e)}function _u(e){Es.call(this,[],e)}function wu(e){Es.call(this,[],e)}function ku(e){Es.call(this,null,e)}function Eu(e){Es.call(this,[],e)}su.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:lu.concat(uu)},{name:"as",type:"string",array:!0,default:["value","density"]}]},_t(su,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=au(e.distribution,function(e){return()=>e.materialize(e.SOURCE).source}(t)),r=e.steps||e.minsteps||25,o=e.steps||e.maxsteps||200;let a=e.method||"pdf";"pdf"!==a&&"cdf"!==a&&me("Invalid density method: "+a),e.extent||i.data||me("Missing density extent parameter."),a=i[a];const s=e.as||["value","density"],l=Ol(a,e.extent||pt(i.data()),r,o).map((e=>{const t={};return t[s[0]]=e[0],t[s[1]]=e[1],Ya(t)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),du.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]},_t(du,Es,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=fu(t.source,e.groupby,be),r=e.smooth||!1,o=e.field,a=e.step||((e,t)=>Rt(pt(e,t))/30)(n,o),s=Za(((e,t)=>o(e)-o(t))),l=e.as||"bin",u=i.length;let c,f=1/0,d=-1/0,h=0;for(;hd&&(d=t),e[++c][l]=t}return this.value={start:f,stop:d,step:a},t.reflow(!0).modifies(l)}}),_t(hu,os),mu.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},_t(mu,Es,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let o=n[0],a=n[1];if((r||null==o)&&(o=1/0,a=-1/0),t.visit(r?t.SOURCE:t.ADD,(e=>{const t=Le(i(e));null!=t&&(ta&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=ce(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),_t(gu,os,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),_t(yu,Es,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let o,a,s=yt(r,e)&&r[e];return s?s.value.stampe&&e.count>0));this.initTargets(e)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;rthis.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,(e=>{const t=Ga(e),n=o.get(t);void 0!==n&&(o.delete(t),s(n).rem(e))})),t.visit(t.ADD,(e=>{const t=i(e);o.set(Ga(e),t),s(t).add(e)})),a||t.modified(i.fields)?t.visit(t.MOD,(e=>{const t=Ga(e),n=o.get(t),r=i(e);n===r?s(r).mod(e):(o.set(t,r),s(n).rem(e),s(r).add(e))})):t.changed(t.MOD)&&t.visit(t.MOD,(e=>{s(o.get(Ga(e))).mod(e)})),a&&t.visit(t.REFLOW,(e=>{const t=Ga(e),n=o.get(t),r=i(e);n!==r&&(o.set(t,r),s(n).rem(e),s(r).add(e))})),t.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),t}}),_t(vu,os),xu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},_t(xu,Es,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),o=r.add,a=r.rem,s=r.mod,l=e.expr;let u=!0;function c(t){const n=Ga(t),r=l(t,e),c=i.get(n);r&&c?(i.delete(n),o.push(t)):r||c?u&&r&&!c&&s.push(t):(i.set(n,1),a.push(t))}return t.visit(t.REM,(e=>{const t=Ga(e);i.has(t)?i.delete(t):a.push(e)})),t.visit(t.ADD,(t=>{l(t,e)?o.push(t):i.set(Ga(t),1)})),t.visit(t.MOD,c),e.modified()&&(u=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}}),_u.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},_t(_u,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=cu(i,e.as||[]),o=e.index||null,a=r.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{const t=i.map((t=>t(e))),s=t.reduce(((e,t)=>Math.max(e,t.length)),0);let l,u,c,f=0;for(;f{for(let t,o=0;ot[i]=n(t,e)))}}),_t(Eu,Es,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r,o,a,s=this.value,l=e.size-s.length;if(l>0){for(r=[];--l>=0;)r.push(a=Ya(i(e))),s.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else o=s.slice(0,-l),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,s=s.slice(-l);return n.source=this.value=s,n}});const Au={value:"value",median:Rs,mean:function(e,t){let n=0,i=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++n,i+=t);else{let r=-1;for(let o of e)null!=(o=t(o,++r,e))&&(o=+o)>=o&&(++n,i+=o)}if(n)return i/n},min:Ms,max:Ss},$u=[];function Du(e){Es.call(this,[],e)}function Su(e){Jl.call(this,e)}function Mu(e){Es.call(this,null,e)}function Cu(e){os.call(this,null,Fu,e)}function Fu(e){return this.value&&!e.modified()?this.value:Mt(e.fields,e.flat)}function Ou(e){Es.call(this,[],e),this._pending=null}function Nu(e,t,n){n.forEach(Ya);const i=t.fork(t.NO_FIELDS&t.NO_SOURCE);return i.rem=e.value,e.value=i.source=i.add=n,e._pending=null,i.rem.length&&i.clean(!0),i}function Tu(e){Es.call(this,{},e)}function zu(e){os.call(this,null,Ru,e)}function Ru(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i,r,o=1/0,a=-1/0;for(i=0;ia&&(a=r[1]);return[o,a]}function Pu(e){os.call(this,null,Lu,e)}function Lu(e){return this.value&&!e.modified()?this.value:e.values.reduce(((e,t)=>e.concat(t)),[])}function Bu(e){Es.call(this,null,e)}function ju(e){Jl.call(this,e)}function Iu(e){yu.call(this,e)}function Uu(e){Es.call(this,null,e)}function qu(e){Es.call(this,null,e)}function Wu(e){Es.call(this,null,e)}function Hu(e){Es.call(this,null,e)}function Gu(e){Es.call(this,[],e),this.count=0}function Vu(e){Es.call(this,null,e)}function Yu(e){Es.call(this,null,e),this.modified(!0)}function Xu(e){Es.call(this,null,e)}Du.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},_t(Du,Es,{transform(e,t){var n,i,r,o,a,s,l,u,c,f,d=t.fork(t.ALL),h=function(e){var t,n=e.method||Au.value;if(null!=Au[n])return n===Au.value?(t=void 0!==e.value?e.value:0,()=>t):Au[n];me("Unrecognized imputation method: "+n)}(e),p=function(e){const t=e.field;return e=>e?t(e):NaN}(e),m=ce(e.field),g=ce(e.key),y=(e.groupby||[]).map(ce),v=function(e,t,n,i){var r,o,a,s,l,u,c,f,d=e=>e(f),h=[],p=i?i.slice():[],m={},g={};for(p.forEach(((e,t)=>m[e]=t+1)),s=0,c=e.length;sn.add(e)))):(r=n.value=n.value||this.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),n.changes(),t.visit(t.SOURCE,(e=>{ht(e,r[n.cellkey(e)].tuple)})),t.reflow(i).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,i;for(n=0,i=this._alen;n{const n=nl(t,a)[s],i=e.counts?t.length:1;Ol(n,c||pt(t),f,d).forEach((e=>{const n={};for(let e=0;e(this._pending=nt(e.data),e=>e.touch(this))));return{async:t}}return n.request(e.url,e.format).then((e=>Nu(this,t,nt(e.data))))}}),Tu.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},_t(Tu,Es,{transform(e,t){const n=e.fields,i=e.index,r=e.values,o=null==e.default?null:e.default,a=e.modified(),s=n.length;let l,u,c,f=a?t.SOURCE:t.ADD,d=t,h=e.as;return r?(u=r.length,s>1&&!h&&me('Multi-field lookup requires explicit "as" parameter.'),h&&h.length!==s*u&&me('The "as" parameter has too few output field names.'),h=h||r.map(ce),l=function(e){for(var t,a,l=0,c=0;lt.modified(e.fields))),f|=c?t.MOD:0),t.visit(f,l),d.modifies(h)}}),_t(zu,os),_t(Pu,os),_t(Bu,Es,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),ju.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:jl,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},_t(ju,Jl,{_transform:Jl.prototype.transform,transform(e,t){return this._transform(function(e,t){const n=e.field,i=e.value,r=("count"===e.op?"__count__":e.op)||"sum",o=fe(n).concat(fe(i)),a=function(e,t,n){const i={},r=[];return n.visit(n.SOURCE,(t=>{const n=e(t);i[n]||(i[n]=1,r.push(n))})),r.sort(st),t?r.slice(0,t):r}(n,e.limit||0,t);return t.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:a.map((()=>r)),fields:a.map((e=>function(e,t,n,i){return ue((i=>t(i)===e?n(i):NaN),i,e+"")}(e,n,i,o))),as:a.map((e=>e+"")),modified:e.modified.bind(e)}}(e,t),t)}}),_t(Iu,yu,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(Ga(e),n,t,e);return(e.modified("field")||i&&t.modified(fe(i)))&&me("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,(e=>{const t=r(e);i(e).forEach((e=>t.mod(e)))})),t.visit(t.ADD,(e=>{const t=r(e);i(e).forEach((e=>t.add(Ya(e))))})),t.visit(t.REM,(e=>{const t=r(e);i(e).forEach((e=>t.rem(e)))}))):(t.visit(t.MOD,(e=>r(e).mod(e))),t.visit(t.ADD,(e=>r(e).add(e))),t.visit(t.REM,(e=>r(e).rem(e)))),t.clean()&&t.runAfter((()=>this.clean())),t}}),Uu.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},_t(Uu,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=cu(e.fields,e.as||[]),o=i?(e,t)=>function(e,t,n,i){for(let r=0,o=n.length;r{const t=Ga(e);n.rem.push(a[t]),a[t]=null})),t.visit(t.ADD,(e=>{const t=o(e,Ya({}));a[Ga(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{n.mod.push(o(e,a[Ga(e)]))})),n}}),_t(qu,Es,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),Wu.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]},_t(Wu,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;const r=fu(t.materialize(t.SOURCE).source,e.groupby,e.field),o=(e.groupby||[]).map(ce),a=[],s=e.step||.01,l=e.probs||Tl(s/2,1-1e-14,s),u=l.length;return r.forEach((e=>{const t=Ls(e,l);for(let n=0;n{const t=Ga(e);n.rem.push(i[t]),i[t]=null})),t.visit(t.ADD,(e=>{const t=Xa(e);i[Ga(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{const t=i[Ga(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)}))),n}}),Gu.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},_t(Gu,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,o=this.value.reduce(((e,t)=>(e[Ga(t)]=1,e)),{});let a=this.value,s=this.count,l=0;function u(e){let t,i;a.length=l&&(t=a[i],o[Ga(t)]&&n.rem.push(t),a[i]=e)),++s}if(t.rem.length&&(t.visit(t.REM,(e=>{const t=Ga(e);o[t]&&(o[t]=-1,n.rem.push(e)),--s})),a=a.filter((e=>-1!==o[Ga(e)]))),(t.rem.length||i)&&a.length{o[Ga(e)]||u(e)})),l=-1),i&&a.length>r){const e=a.length-r;for(let t=0;t{o[Ga(e)]&&n.mod.push(e)})),t.add.length&&t.visit(t.ADD,u),(t.add.length||l<0)&&(n.add=a.filter((e=>!o[Ga(e)]))),this.count=s,this.value=n.source=a,n}}),Vu.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},_t(Vu,Es,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),i=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=Tl(e.start,e.stop,e.step||1).map((e=>{const t={};return t[i]=e,Ya(t)})),n.add=t.add.concat(this.value),n}}),_t(Yu,Es,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const Ju=["unit0","unit1"];function Qu(e){Es.call(this,bt(),e)}function Zu(e){Es.call(this,null,e)}Xu.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Oi,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:Ju}]},_t(Xu,Es,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,o=this._floor(e,t),a=(r?lr:sr)(o.unit).offset,s=e.as||Ju,l=s[0],u=s[1],c=o.step;let f=o.start||1/0,d=o.stop||-1/0,h=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(fe(n)))&&(h=(t=t.reflow(!0)).SOURCE,f=1/0,d=-1/0),t.visit(h,(e=>{const t=n(e);let r,s;null==t?(e[l]=null,i&&(e[u]=null)):(e[l]=r=s=o(t),i&&(e[u]=s=a(r,c)),rd&&(d=s))})),o.start=f,o.stop=d,t.modifies(i?s:l)},_floor(e,t){const n="utc"===e.timezone,{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:Er({extent:e.extent||pt(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),o=Ti(i),a=this.value||{},s=(n?rr:tr)(o,r);return s.unit=Pe(o),s.units=o,s.step=r,s.start=a.start,s.stop=a.stop,this.value=s}}),_t(Qu,Es,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,o=e=>r.set(i(e),e);let a=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,o)):t.changed()?(t.visit(t.REM,(e=>r.delete(i(e)))),t.visit(t.ADD,o)):a=!1,this.modified(a),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}}),_t(Zu,Es,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(Za(e.sort)):t.source).map(e.field))}});const Ku={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){const e=Ku.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,i=t.compare;let r=t.index;if(e0||me("ntile num must be greater than zero.");const n=Ku.cume_dist(),i=n.next;return{init:n.init,next:e=>Math.ceil(t*i(e))}},lag:function(e,t){return t=+t||1,{next:n=>{const i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const i=n.index+t,r=n.data;return ie(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return(t=+t)>0||me("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return it=null,next:n=>{const i=e(n.data[n.index]);return null!=i?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{const r=i.data;return i.index<=n?t:(n=function(e,t,n){for(let i=t.length;nl[e]=1))}h(e.sort),t.forEach(((e,t)=>{const l=n[t],p=i[t],m=r[t]||null,g=ce(l),y=Rl(e,g,o[t]);if(h(l),a.push(y),yt(Ku,e))s.push(function(e,t,n,i){const r=Ku[e](t,n);return{init:r.init||xe,update:function(e,t){t[i]=r.next(e)}}}(e,l,p,y));else{if(null==l&&"count"!==e&&me("Null aggregate field specified."),"count"===e)return void c.push(y);d=!1;let t=u[g];t||(t=u[g]=[],t.field=l,f.push(t)),t.push(Il(e,m,y))}})),(c.length||f.length)&&(this.cell=function(e,t,n){e=e.map((e=>Vl(e,e.field)));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,o=i.agg=Array(r),a=0;a0&&!r(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),ie.init())),this.cell&&this.cell.init()},nc.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,o=i&&i.length;let a;if(n){for(a=e.p0;athis.group(r(e));let a=this.state;a&&!n||(a=this.state=new tc(e)),n||t.modified(a.inputs)?(this.value={},t.visit(t.SOURCE,(e=>o(e).add(e)))):(t.visit(t.REM,(e=>o(e).remove(e))),t.visit(t.ADD,(e=>o(e).add(e))));for(let t=0,n=this._mlen;t0)for(var i,r=e[0],o=t[0],a=e[n]-r,s=t[n]-o,l=-1;++l<=n;)i=l/n,this._basis.point(this._beta*e[l]+(1-this._beta)*(r+i*a),this._beta*t[l]+(1-this._beta)*(o+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const hc=function e(t){function n(e){return 1===t?new lc(e):new dc(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function pc(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function mc(e,t){this._context=e,this._k=(1-t)/6}mc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:pc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:pc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const gc=function e(t){function n(e){return new mc(e,t)}return n.tension=function(t){return e(+t)},n}(0);function yc(e,t){this._context=e,this._k=(1-t)/6}yc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:pc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const vc=function e(t){function n(e){return new yc(e,t)}return n.tension=function(t){return e(+t)},n}(0);function bc(e,t){this._context=e,this._k=(1-t)/6}bc.prototype={areaStart:uc,areaEnd:uc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:pc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const xc=function e(t){function n(e){return new bc(e,t)}return n.tension=function(t){return e(+t)},n}(0),_c=Math.abs,wc=Math.atan2,kc=Math.cos,Ec=Math.max,Ac=Math.min,$c=Math.sin,Dc=Math.sqrt,Sc=1e-12,Mc=Math.PI,Cc=Mc/2,Fc=2*Mc;function Oc(e){return e>=1?Cc:e<=-1?-Cc:Math.asin(e)}function Nc(e,t,n){var i=e._x1,r=e._y1,o=e._x2,a=e._y2;if(e._l01_a>Sc){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,r=(r*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>Sc){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*u+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*u+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(i,r,o,a,e._x2,e._y2)}function Tc(e,t){this._context=e,this._alpha=t}Tc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Nc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const zc=function e(t){function n(e){return t?new Tc(e,t):new mc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Rc(e,t){this._context=e,this._alpha=t}Rc.prototype={areaStart:uc,areaEnd:uc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Nc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Pc=function e(t){function n(e){return t?new Rc(e,t):new bc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Lc(e,t){this._context=e,this._alpha=t}Lc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Nc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Bc=function e(t){function n(e){return t?new Lc(e,t):new yc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function jc(e){this._context=e}function Ic(e){return new jc(e)}function Uc(e){this._context=e}function qc(e){return e<0?-1:1}function Wc(e,t,n){var i=e._x1-e._x0,r=t-e._x1,o=(e._y1-e._y0)/(i||r<0&&-0),a=(n-e._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(qc(o)+qc(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function Hc(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Gc(e,t,n){var i=e._x0,r=e._y0,o=e._x1,a=e._y1,s=(o-i)/3;e._context.bezierCurveTo(i+s,r+s*t,o-s,a-s*n,o,a)}function Vc(e){this._context=e}function Yc(e){this._context=new Xc(e)}function Xc(e){this._context=e}function Jc(e){this._context=e}function Qc(e){var t,n,i=e.length-1,r=new Array(i),o=new Array(i),a=new Array(i);for(r[0]=0,o[0]=2,a[0]=e[0]+2*e[1],t=1;t=0;--t)r[t]=(a[t]-r[t+1])/o[t];for(o[i-1]=(e[i]+r[i-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};const ef=Math.PI,tf=2*ef,nf=1e-6,rf=tf-nf;function of(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return of;const n=10**t;return function(e){this._+=e[0];for(let t=1,i=e.length;tnf)if(Math.abs(c*s-l*u)>nf&&r){let d=n-o,h=i-a,p=s*s+l*l,m=d*d+h*h,g=Math.sqrt(p),y=Math.sqrt(f),v=r*Math.tan((ef-Math.acos((p+f-m)/(2*g*y)))/2),b=v/y,x=v/g;Math.abs(b-1)>nf&&this._append`L${e+b*u},${t+b*c}`,this._append`A${r},${r},0,0,${+(c*d>u*h)},${this._x1=e+x*s},${this._y1=t+x*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,i,r,o){if(e=+e,t=+t,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),s=n*Math.sin(i),l=e+a,u=t+s,c=1^o,f=o?i-r:r-i;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>nf||Math.abs(this._y1-u)>nf)&&this._append`L${l},${u}`,n&&(f<0&&(f=f%tf+tf),f>rf?this._append`A${n},${n},0,1,${c},${e-a},${t-s}A${n},${n},0,1,${c},${this._x1=l},${this._y1=u}`:f>nf&&this._append`A${n},${n},0,${+(f>=ef)},${c},${this._x1=e+n*Math.cos(r)},${this._y1=t+n*Math.sin(r)}`)}rect(e,t,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function sf(){return new af}function lf(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new af(t)}function uf(e){return e.innerRadius}function cf(e){return e.outerRadius}function ff(e){return e.startAngle}function df(e){return e.endAngle}function hf(e){return e&&e.padAngle}function pf(e,t,n,i,r,o,a){var s=e-n,l=t-i,u=(a?o:-o)/Dc(s*s+l*l),c=u*l,f=-u*s,d=e+c,h=t+f,p=n+c,m=i+f,g=(d+p)/2,y=(h+m)/2,v=p-d,b=m-h,x=v*v+b*b,_=r-o,w=d*m-p*h,k=(b<0?-1:1)*Dc(Ec(0,_*_*x-w*w)),E=(w*b-v*k)/x,A=(-w*v-b*k)/x,$=(w*b+v*k)/x,D=(-w*v+b*k)/x,S=E-g,M=A-y,C=$-g,F=D-y;return S*S+M*M>C*C+F*F&&(E=$,A=D),{cx:E,cy:A,x01:-c,y01:-f,x11:E*(r/_-1),y11:A*(r/_-1)}}function mf(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function gf(e){return e[0]}function yf(e){return e[1]}function vf(e,t){var n=Kc(!0),i=null,r=Ic,o=null,a=lf(s);function s(s){var l,u,c,f=(s=mf(s)).length,d=!1;for(null==i&&(o=r(c=a())),l=0;l<=f;++l)!(l=f;--d)s.point(y[d],v[d]);s.lineEnd(),s.areaEnd()}g&&(y[c]=+e(h,c,u),v[c]=+t(h,c,u),s.point(i?+i(h,c,u):y[c],n?+n(h,c,u):v[c]))}if(p)return s=null,p+""||null}function c(){return vf().defined(r).curve(a).context(o)}return e="function"==typeof e?e:void 0===e?gf:Kc(+e),t="function"==typeof t?t:Kc(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?yf:Kc(+n),u.x=function(t){return arguments.length?(e="function"==typeof t?t:Kc(+t),i=null,u):e},u.x0=function(t){return arguments.length?(e="function"==typeof t?t:Kc(+t),u):e},u.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:Kc(+e),u):i},u.y=function(e){return arguments.length?(t="function"==typeof e?e:Kc(+e),n=null,u):t},u.y0=function(e){return arguments.length?(t="function"==typeof e?e:Kc(+e),u):t},u.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:Kc(+e),u):n},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(n)},u.lineX1=function(){return c().x(i).y(t)},u.defined=function(e){return arguments.length?(r="function"==typeof e?e:Kc(!!e),u):r},u.curve=function(e){return arguments.length?(a=e,null!=o&&(s=a(o)),u):a},u.context=function(e){return arguments.length?(null==e?o=s=null:s=a(o=e),u):o},u}sf.prototype=af.prototype,Array.prototype.slice,Dc(3);const xf={draw(e,t){const n=Dc(t/Mc);e.moveTo(n,0),e.arc(0,0,n,0,Fc)}};Dc(1/3),$c(Mc/10),$c(7*Mc/10);function _f(e,t){if("undefined"!=typeof document&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}$c(Fc/10),kc(Fc/10),Dc(3),Dc(3),Dc(3),Dc(12);const wf=()=>"undefined"!=typeof Image?Image:null,kf=bi(yi),Ef=kf.right,Af=kf.left,$f=(bi(Ns).center,Ef);function Df(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Sf(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function Mf(){}var Cf=.7,Ff=1/Cf,Of="\\s*([+-]?\\d+)\\s*",Nf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Tf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zf=/^#([0-9a-f]{3,8})$/,Rf=new RegExp(`^rgb\\(${Of},${Of},${Of}\\)$`),Pf=new RegExp(`^rgb\\(${Tf},${Tf},${Tf}\\)$`),Lf=new RegExp(`^rgba\\(${Of},${Of},${Of},${Nf}\\)$`),Bf=new RegExp(`^rgba\\(${Tf},${Tf},${Tf},${Nf}\\)$`),jf=new RegExp(`^hsl\\(${Nf},${Tf},${Tf}\\)$`),If=new RegExp(`^hsla\\(${Nf},${Tf},${Tf},${Nf}\\)$`),Uf={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function qf(){return this.rgb().formatHex()}function Wf(){return this.rgb().formatRgb()}function Hf(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=zf.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Gf(t):3===n?new Jf(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Vf(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Vf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Rf.exec(e))?new Jf(t[1],t[2],t[3],1):(t=Pf.exec(e))?new Jf(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Lf.exec(e))?Vf(t[1],t[2],t[3],t[4]):(t=Bf.exec(e))?Vf(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=jf.exec(e))?nd(t[1],t[2]/100,t[3]/100,1):(t=If.exec(e))?nd(t[1],t[2]/100,t[3]/100,t[4]):Uf.hasOwnProperty(e)?Gf(Uf[e]):"transparent"===e?new Jf(NaN,NaN,NaN,0):null}function Gf(e){return new Jf(e>>16&255,e>>8&255,255&e,1)}function Vf(e,t,n,i){return i<=0&&(e=t=n=NaN),new Jf(e,t,n,i)}function Yf(e){return e instanceof Mf||(e=Hf(e)),e?new Jf((e=e.rgb()).r,e.g,e.b,e.opacity):new Jf}function Xf(e,t,n,i){return 1===arguments.length?Yf(e):new Jf(e,t,n,null==i?1:i)}function Jf(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}function Qf(){return`#${td(this.r)}${td(this.g)}${td(this.b)}`}function Zf(){const e=Kf(this.opacity);return`${1===e?"rgb(":"rgba("}${ed(this.r)}, ${ed(this.g)}, ${ed(this.b)}${1===e?")":`, ${e})`}`}function Kf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ed(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function td(e){return((e=ed(e))<16?"0":"")+e.toString(16)}function nd(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new od(e,t,n,i)}function id(e){if(e instanceof od)return new od(e.h,e.s,e.l,e.opacity);if(e instanceof Mf||(e=Hf(e)),!e)return new od;if(e instanceof od)return e;var t=(e=e.rgb()).r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),o=Math.max(t,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=t===o?(n-i)/s+6*(n0&&l<1?0:a,new od(a,s,l,e.opacity)}function rd(e,t,n,i){return 1===arguments.length?id(e):new od(e,t,n,null==i?1:i)}function od(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function ad(e){return(e=(e||0)%360)<0?e+360:e}function sd(e){return Math.max(0,Math.min(1,e||0))}function ld(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function ud(e,t,n,i,r){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*n+(1+3*e+3*o-3*a)*i+a*r)/6}function cd(e){var t=e.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[i],o=e[i+1],a=i>0?e[i-1]:2*r-o,s=i=240?e-240:e+120,r,i),ld(e,r,i),ld(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new od(ad(this.h),sd(this.s),sd(this.l),Kf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Kf(this.opacity);return`${1===e?"hsl(":"hsla("}${ad(this.h)}, ${100*sd(this.s)}%, ${100*sd(this.l)}%${1===e?")":`, ${e})`}`}}));const dd=e=>()=>e;function hd(e,t){return function(n){return e+n*t}}function pd(e,t){var n=t-e;return n?hd(e,n>180||n<-180?n-360*Math.round(n/360):n):dd(isNaN(e)?t:e)}function md(e,t){var n=t-e;return n?hd(e,n):dd(isNaN(e)?t:e)}const gd=function e(t){var n=function(e){return 1==(e=+e)?md:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}(t,n,e):dd(isNaN(t)?n:t)}}(t);function i(e,t){var i=n((e=Xf(e)).r,(t=Xf(t)).r),r=n(e.g,t.g),o=n(e.b,t.b),a=md(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=r(t),e.b=o(t),e.opacity=a(t),e+""}}return i.gamma=e,i}(1);function yd(e){return function(t){var n,i,r=t.length,o=new Array(r),a=new Array(r),s=new Array(r);for(n=0;no&&(r=t.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:Ad(n,i)})),o=Sd.lastIndex;return ot&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(a[0],a[e-1])),i=e>2?Pd:Rd,r=o=null,f}function f(t){return null==t||isNaN(t=+t)?n:(r||(r=i(a.map(e),s,l)))(e(u(t)))}return f.invert=function(n){return u(t((o||(o=i(s,a.map(e),Ad)))(n)))},f.domain=function(e){return arguments.length?(a=Array.from(e,Od),c()):a.slice()},f.range=function(e){return arguments.length?(s=Array.from(e),c()):s.slice()},f.rangeRound=function(e){return s=Array.from(e),l=Fd,c()},f.clamp=function(e){return arguments.length?(u=!!e||Td,c()):u!==Td},f.interpolate=function(e){return arguments.length?(l=e,c()):l},f.unknown=function(e){return arguments.length?(n=e,f):n},function(n,i){return e=n,t=i,c()}}function jd(){return Bd()(Td,Td)}function Id(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Ud(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}function qd(e,t,n,i){var r,o=pn(e,t,n);switch((i=yn(null==i?",f":i)).type){case"s":var a=Math.max(Math.abs(e),Math.abs(t));return null!=i.precision||isNaN(r=_n(o,a))||(i.precision=r),Mn(i,a);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=wn(o,Math.max(Math.abs(e),Math.abs(t))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=kn(o))||(i.precision=r-2*("%"===i.type))}return Sn(i)}function Wd(e){var t=e.domain;return e.ticks=function(e){var n=t();return dn(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var i=t();return qd(i[0],i[i.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var i,r,o=t(),a=0,s=o.length-1,l=o[a],u=o[s],c=10;for(u0;){if((r=hn(l,u,n))===i)return o[a]=l,o[s]=u,t(o);if(r>0)l=Math.floor(l/r)*r,u=Math.ceil(u/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,u=Math.floor(u*r)/r}i=r}return e},e}function Hd(e,t){var n,i=0,r=(e=e.slice()).length-1,o=e[i],a=e[r];return a-e(-t,n)}function Zd(e){const t=e(Gd,Vd),n=t.domain;let i,r,o=10;function a(){return i=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(o),r=function(e){return 10===e?Jd:e===Math.E?Math.exp:t=>Math.pow(e,t)}(o),n()[0]<0?(i=Qd(i),r=Qd(r),e(Yd,Xd)):e(Gd,Vd),t}return t.base=function(e){return arguments.length?(o=+e,a()):o},t.domain=function(e){return arguments.length?(n(e),a()):n()},t.ticks=e=>{const t=n();let a=t[0],s=t[t.length-1];const l=s0){for(;f<=d;++f)for(u=1;us)break;p.push(c)}}else for(;f<=d;++f)for(u=o-1;u>=1;--u)if(c=f>0?u/r(-f):u*r(f),!(cs)break;p.push(c)}2*p.length{if(null==e&&(e=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=yn(n)).precision||(n.trim=!0),n=Sn(n)),e===1/0)return n;const a=Math.max(1,o*e/t.ticks().length);return e=>{let t=e/r(Math.round(i(e)));return t*on(Hd(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function Kd(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function eh(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function th(e){return e<0?-e*e:e*e}function nh(e){var t=e(Td,Td),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(Td,Td):.5===n?e(eh,th):e(Kd(n),Kd(1/n)):n},Wd(t)}function ih(){var e=nh(Bd());return e.copy=function(){return Ld(e,ih()).exponent(e.exponent())},Id.apply(e,arguments),e}function rh(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function oh(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function ah(e){var t=1,n=e(rh(t),oh(t));return n.constant=function(n){return arguments.length?e(rh(t=+n),oh(t)):t},Wd(n)}function sh(e,t,n,i,r,o){const a=[[mi,1,Rn],[mi,5,5e3],[mi,15,15e3],[mi,30,3e4],[o,1,Pn],[o,5,3e5],[o,15,9e5],[o,30,18e5],[r,1,Ln],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,Bn],[i,2,1728e5],[n,1,jn],[t,1,2592e6],[t,3,7776e6],[e,1,In]];function s(t,n,i){const r=Math.abs(n-t)/i,o=bi((([,,e])=>e)).right(a,r);if(o===a.length)return e.every(pn(t/In,n/In,i));if(0===o)return gi.every(Math.max(pn(t,n,i),1));const[s,l]=a[r/a[o-1][2]180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:Ad(e,t)})):t&&n.push(r(n)+"rotate("+t+i)}(o.rotate,a.rotate,s,l),function(e,t,n,o){e!==t?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:Ad(e,t)}):t&&n.push(r(n)+"skewX("+t+i)}(o.skewX,a.skewX,s,l),function(e,t,n,i,o,a){if(e!==n||t!==i){var s=o.push(r(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Ad(e,n)},{i:s-2,x:Ad(t,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(e){for(var t,n=-1,i=l.length;++nZh?Math.pow(e,1/3):e/Qh+Xh}function ip(e){return e>Jh?e*e*e:Qh*(e-Xh)}function rp(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function op(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ap(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof sp)return new sp(e.h,e.c,e.l,e.opacity);if(e instanceof tp||(e=Kh(e)),0===e.a&&0===e.b)return new sp(NaN,00?i:1:0}const Sp="linear",Mp="log",Cp="pow",Fp="sqrt",Op="symlog",Np="time",Tp="utc",zp="sequential",Rp="diverging",Pp="quantile",Lp="quantize",Bp="threshold",jp="ordinal",Ip="point",Up="band",qp="bin-ordinal",Wp="continuous",Hp="discrete",Gp="discretizing",Vp="interpolating",Yp="temporal";function Xp(){const e=Mh().unknown(void 0),t=e.domain,n=e.range;let i,r,o=[0,1],a=!1,s=0,l=0,u=.5;function c(){const e=t().length,c=o[1]h+i*e));return n(c?p.reverse():p)}return delete e.unknown,e.domain=function(e){return arguments.length?(t(e),c()):t()},e.range=function(e){return arguments.length?(o=[+e[0],+e[1]],c()):o.slice()},e.rangeRound=function(e){return o=[+e[0],+e[1]],a=!0,c()},e.bandwidth=function(){return r},e.step=function(){return i},e.round=function(e){return arguments.length?(a=!!e,c()):a},e.padding=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),s=l,c()):s},e.paddingInner=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),c()):s},e.paddingOuter=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),c()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=o[1]o[1-i])?void 0:(l=Math.max(0,Ef(a,f)-1),u=f===d?l:Ef(a,d)-1,f-a[l]>r+1e-10&&++l,i&&(c=l,l=s-u,u=s-c),l>u?void 0:t().slice(l,u+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return Xp().domain(t()).range(o).round(a).paddingInner(s).paddingOuter(l).align(u)},c()}function Jp(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Jp(t())},e}var Qp=Array.prototype.map;const Zp=Array.prototype.slice,Kp=new Map,em=Symbol("vega_scale");function tm(e){return e[em]=!0,e}function nm(e,t,n){return arguments.length>1?(Kp.set(e,function(e,t,n){const i=function(){const n=t();return n.invertRange||(n.invertRange=n.invert?function(e){return function(t){let n,i=t[0],r=t[1];return r=s&&n[o]<=l&&(u<0&&(u=o),i=o);if(!(u<0))return s=e.invertExtent(n[u]),l=e.invertExtent(n[i]),[void 0===s[0]?s[1]:s[0],void 0===l[1]?l[0]:l[1]]}}(n):void 0),n.type=e,tm(n)};return i.metadata=Ut(nt(n)),i}(e,t,n)),this):im(e)?Kp.get(e):void 0}function im(e){return Kp.has(e)}function rm(e,t){const n=Kp.get(e);return n&&n.metadata[t]}function om(e){return rm(e,Wp)}function am(e){return rm(e,Hp)}function sm(e){return rm(e,Gp)}function lm(e){return rm(e,Mp)}function um(e){return rm(e,Vp)}function cm(e){return rm(e,Pp)}nm("identity",(function e(t){var n;function i(e){return null==e||isNaN(e=+e)?n:e}return i.invert=i,i.domain=i.range=function(e){return arguments.length?(t=Array.from(e,Od),i):t.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,Od):[0,1],Wd(i)})),nm(Sp,(function e(){var t=jd();return t.copy=function(){return Ld(t,e())},Id.apply(t,arguments),Wd(t)}),Wp),nm(Mp,(function e(){const t=Zd(Bd()).domain([1,10]);return t.copy=()=>Ld(t,e()).base(t.base()),Id.apply(t,arguments),t}),[Wp,Mp]),nm(Cp,ih,Wp),nm(Fp,(function(){return ih.apply(null,arguments).exponent(.5)}),Wp),nm(Op,(function e(){var t=ah(Bd());return t.copy=function(){return Ld(t,e()).constant(t.constant())},Id.apply(t,arguments)}),Wp),nm(Np,(function(){return Id.apply(ph(ch,fh,si,ui,Gn,Un,fi,hi,mi,Cr).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Wp,Yp]),nm(Tp,(function(){return Id.apply(ph(lh,uh,li,ci,ei,qn,di,pi,mi,Or).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Wp,Yp]),nm(zp,yh,[Wp,Vp]),nm(`${zp}-${Sp}`,yh,[Wp,Vp]),nm(`${zp}-${Mp}`,(function e(){var t=Zd(mh()).domain([1,10]);return t.copy=function(){return gh(t,e()).base(t.base())},Ud.apply(t,arguments)}),[Wp,Vp,Mp]),nm(`${zp}-${Cp}`,vh,[Wp,Vp]),nm(`${zp}-${Fp}`,(function(){return vh.apply(null,arguments).exponent(.5)}),[Wp,Vp]),nm(`${zp}-${Op}`,(function e(){var t=ah(mh());return t.copy=function(){return gh(t,e()).constant(t.constant())},Ud.apply(t,arguments)}),[Wp,Vp]),nm(`${Rp}-${Sp}`,(function e(){var t=Wd(xh()(Td));return t.copy=function(){return gh(t,e())},Ud.apply(t,arguments)}),[Wp,Vp]),nm(`${Rp}-${Mp}`,(function e(){var t=Zd(xh()).domain([.1,1,10]);return t.copy=function(){return gh(t,e()).base(t.base())},Ud.apply(t,arguments)}),[Wp,Vp,Mp]),nm(`${Rp}-${Cp}`,_h,[Wp,Vp]),nm(`${Rp}-${Fp}`,(function(){return _h.apply(null,arguments).exponent(.5)}),[Wp,Vp]),nm(`${Rp}-${Op}`,(function e(){var t=ah(xh());return t.copy=function(){return gh(t,e()).constant(t.constant())},Ud.apply(t,arguments)}),[Wp,Vp]),nm(Pp,(function e(){var t,n=[],i=[],r=[];function o(){var e=0,t=Math.max(1,i.length);for(r=new Array(t-1);++e0?r[t-1]:n[0],t=r?[o[r-1],i]:[o[t-1],o[t]]},s.unknown=function(e){return arguments.length?(t=e,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return e().domain([n,i]).range(a).unknown(t)},Id.apply(Wd(s),arguments)}),Gp),nm(Bp,(function e(){var t,n=[.5],i=[0,1],r=1;function o(e){return null!=e&&e<=e?i[$f(n,e,0,r)]:t}return o.domain=function(e){return arguments.length?(n=Array.from(e),r=Math.min(n.length,i.length-1),o):n.slice()},o.range=function(e){return arguments.length?(i=Array.from(e),r=Math.min(n.length,i.length-1),o):i.slice()},o.invertExtent=function(e){var t=i.indexOf(e);return[n[t-1],n[t]]},o.unknown=function(e){return arguments.length?(t=e,o):t},o.copy=function(){return e().domain(n).range(i).unknown(t)},Id.apply(o,arguments)}),Gp),nm(qp,(function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[($f(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return Qp.call(e,Le)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=Zp.call(e),i):n.slice()},i.tickFormat=function(e,n){return qd(t[0],Pe(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i}),[Hp,Gp]),nm(jp,Mh,Hp),nm(Up,Xp,Hp),nm(Ip,(function(){return Jp(Xp().paddingInner(1))}),Hp);const fm=["clamp","base","constant","exponent"];function dm(e,t){const n=t[0],i=Pe(t)-n;return function(t){return e(n+t*i)}}function hm(e,t,n){return bh(gm(t||"rgb",n),e)}function pm(e,t){const n=new Array(t),i=t+1;for(let r=0;re[t]?a[t](e[t]()):0)),a):ft(.5)}function gm(e,t){const n=a[function(e){return"interpolate"+e.toLowerCase().split("-").map((e=>e[0].toUpperCase()+e.slice(1))).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}function ym(e){const t=e.length/6|0,n=new Array(t);for(let i=0;i1?(bm[e]=t,this):bm[e]}vm({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},ym),vm({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(e=>hm(ym(e))));const _m="symbol",wm="discrete",km=e=>Fe(e)?e.map((e=>String(e))):String(e),Em=(e,t)=>e[1]-t[1],Am=(e,t)=>t[1]-e[1];function $m(e,t,n){let i;return $t(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,Math.floor(Rt(e.domain())/n||1)+1))),Oe(t)&&(i=t.step,t=t.interval),St(t)&&(t=e.type===Np?sr(t):e.type==Tp?lr(t):me("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function Dm(e,t,n){let i=e.range(),r=i[0],o=Pe(i),a=Em;if(r>o&&(i=o,o=r,r=i,a=Am),r=Math.floor(r),o=Math.ceil(o),t=t.map((t=>[t,e(t)])).filter((e=>r<=e[1]&&e[1]<=o)).sort(a).map((e=>e[0])),n>0&&t.length>1){const e=[t[0],Pe(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((e,t)=>!(t%2)));t.length<3&&(t=e)}return t}function Sm(e,t){return e.bins?Dm(e,e.bins):e.ticks?e.ticks(t):e.domain()}function Mm(e,t,n,i,r,o){const a=t.type;let s=km;if(a===Np||r===Np)s=e.timeFormat(i);else if(a===Tp||r===Tp)s=e.utcFormat(i);else if(lm(a)){const r=e.formatFloat(i);if(o||t.bins)s=r;else{const e=Cm(t,n,!1);s=t=>e(t)?r(t):""}}else if(t.tickFormat){const r=t.domain();s=e.formatSpan(r[0],r[r.length-1],n,i)}else i&&(s=e.format(i));return s}function Cm(e,t,n){const i=Sm(e,t),r=e.base(),o=Math.log(r),a=Math.max(1,r*t/i.length),s=e=>{let t=e/Math.pow(r,Math.round(Math.log(e)/o));return t*rFm[e.type]||e.bins;function zm(e,t,n,i,r,o,a){const s=Om[t.type]&&o!==Np&&o!==Tp?function(e,t,n){const i=t[Om[t.type]](),r=i.length;let o,a=r>1?i[1]-i[0]:i[0];for(o=1;o(t,n,i)=>{const r=Pm(i[n+1],Pm(i.max,1/0)),o=jm(t,e),a=jm(r,e);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Pm=(e,t)=>null!=e?e:t,Lm=e=>(t,n)=>n?e(t):null,Bm=e=>t=>e(t),jm=(e,t)=>Number.isFinite(e)?t(e):null;function Im(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=function(e,t,n,i){const r=i||t.type;return St(n)&&function(e){return rm(e,Yp)}(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==Np?n||r!==Tp?zm(e,t,5,null,n,i,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}(e,t,n.format,n.formatType);if(sm(t.type)){const e=Nm(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(am(t.type)){const e=t.domain(),n=e.length;return`${n} value${1===n?"":"s"}: ${n>i?e.slice(0,i-2).map(r).join(", ")+", ending with "+e.slice(-1).map(r):e.map(r).join(", ")}`}{const e=t.domain();return`values from ${r(e[0])} to ${r(Pe(e))}`}}let Um=0;const qm="p_";function Wm(e){return e&&e.gradient}function Hm(e,t,n){const i=e.gradient;let r=e.id,o="radial"===i?qm:"";return r||(r=e.id="gradient_"+Um++,"radial"===i?(e.x1=Gm(e.x1,.5),e.y1=Gm(e.y1,.5),e.r1=Gm(e.r1,0),e.x2=Gm(e.x2,.5),e.y2=Gm(e.y2,.5),e.r2=Gm(e.r2,.5),o=qm):(e.x1=Gm(e.x1,0),e.y1=Gm(e.y1,0),e.x2=Gm(e.x2,1),e.y2=Gm(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function Gm(e,t){return null!=e?e:t}function Vm(e,t){var n,i=[];return n={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:i,stop:function(e,t){return i.push({offset:e,color:t}),n}}}const Ym={basis:{curve:function(e){return new lc(e)}},"basis-closed":{curve:function(e){return new cc(e)}},"basis-open":{curve:function(e){return new fc(e)}},bundle:{curve:hc,tension:"beta",value:.85},cardinal:{curve:gc,tension:"tension",value:0},"cardinal-open":{curve:vc,tension:"tension",value:0},"cardinal-closed":{curve:xc,tension:"tension",value:0},"catmull-rom":{curve:zc,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Pc,tension:"alpha",value:.5},"catmull-rom-open":{curve:Bc,tension:"alpha",value:.5},linear:{curve:Ic},"linear-closed":{curve:function(e){return new Uc(e)}},monotone:{horizontal:function(e){return new Yc(e)},vertical:function(e){return new Vc(e)}},natural:{curve:function(e){return new Jc(e)}},step:{curve:function(e){return new Zc(e,.5)}},"step-after":{curve:function(e){return new Zc(e,1)}},"step-before":{curve:function(e){return new Zc(e,0)}}};function Xm(e,t,n){var i=yt(Ym,e)&&Ym[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const Jm={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Qm=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Zm=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Km=/^((\s+,?\s*)|(,\s*))/,eg=/^[01]/;function tg(e){const t=[];return(e.match(Qm)||[]).forEach((e=>{let n=e[0];const i=n.toLowerCase(),r=Jm[i],o=function(e,t,n){const i=[];for(let r=0;t&&r1&&(m=Math.sqrt(m),n*=m,i*=m);const g=d/n,y=f/n,v=-f/i,b=d/i,x=g*s+y*l,_=v*s+b*l,w=g*e+y*t,k=v*e+b*t;let E=1/((w-x)*(w-x)+(k-_)*(k-_))-.25;E<0&&(E=0);let A=Math.sqrt(E);o==r&&(A=-A);const $=.5*(x+w)-A*(k-_),D=.5*(_+k)+A*(w-x),S=Math.atan2(_-D,x-$);let M=Math.atan2(k-D,w-$)-S;M<0&&1===o?M+=rg:M>0&&0===o&&(M-=rg);const C=Math.ceil(Math.abs(M/(ig+.001))),F=[];for(let e=0;e+e}function Eg(e,t,n){return Math.max(t,Math.min(e,n))}function Ag(){var e=bg,t=xg,n=_g,i=wg,r=kg(0),o=r,a=r,s=r,l=null;function u(u,c,f){var d,h=null!=c?c:+e.call(this,u),p=null!=f?f:+t.call(this,u),m=+n.call(this,u),g=+i.call(this,u),y=Math.min(m,g)/2,v=Eg(+r.call(this,u),0,y),b=Eg(+o.call(this,u),0,y),x=Eg(+a.call(this,u),0,y),_=Eg(+s.call(this,u),0,y);if(l||(l=d=sf()),v<=0&&b<=0&&x<=0&&_<=0)l.rect(h,p,m,g);else{var w=h+m,k=p+g;l.moveTo(h+v,p),l.lineTo(w-b,p),l.bezierCurveTo(w-vg*b,p,w,p+vg*b,w,p+b),l.lineTo(w,k-_),l.bezierCurveTo(w,k-vg*_,w-vg*_,k,w-_,k),l.lineTo(h+x,k),l.bezierCurveTo(h+vg*x,k,h,k-vg*x,h,k-x),l.lineTo(h,p+v),l.bezierCurveTo(h,p+vg*v,h+vg*v,p,h+v,p),l.closePath()}if(d)return l=null,d+""||null}return u.x=function(t){return arguments.length?(e=kg(t),u):e},u.y=function(e){return arguments.length?(t=kg(e),u):t},u.width=function(e){return arguments.length?(n=kg(e),u):n},u.height=function(e){return arguments.length?(i=kg(e),u):i},u.cornerRadius=function(e,t,n,i){return arguments.length?(r=kg(e),o=null!=t?kg(t):r,s=null!=n?kg(n):r,a=null!=i?kg(i):o,u):r},u.context=function(e){return arguments.length?(l=null==e?null:e,u):l},u}function $g(){var e,t,n,i,r,o,a,s,l=null;function u(e,t,n){const i=n/2;if(r){var u=a-t,c=e-o;if(u||c){var f=Math.hypot(u,c),d=(u/=f)*s,h=(c/=f)*s,p=Math.atan2(c,u);l.moveTo(o-d,a-h),l.lineTo(e-u*i,t-c*i),l.arc(e,t,i,p-Math.PI,p),l.lineTo(o+d,a+h),l.arc(o,a,s,p,p+Math.PI)}else l.arc(e,t,i,0,rg);l.closePath()}else r=1;o=e,a=t,s=i}function c(o){var a,s,c,f=o.length,d=!1;for(null==l&&(l=c=sf()),a=0;a<=f;++a)!(ae.x||0,Mg=e=>e.y||0,Cg=e=>!(!1===e.defined),Fg=function(){var e=uf,t=cf,n=Kc(0),i=null,r=ff,o=df,a=hf,s=null,l=lf(u);function u(){var u,c,f=+e.apply(this,arguments),d=+t.apply(this,arguments),h=r.apply(this,arguments)-Cc,p=o.apply(this,arguments)-Cc,m=_c(p-h),g=p>h;if(s||(s=u=l()),dSc)if(m>Fc-Sc)s.moveTo(d*kc(h),d*$c(h)),s.arc(0,0,d,h,p,!g),f>Sc&&(s.moveTo(f*kc(p),f*$c(p)),s.arc(0,0,f,p,h,g));else{var y,v,b=h,x=p,_=h,w=p,k=m,E=m,A=a.apply(this,arguments)/2,$=A>Sc&&(i?+i.apply(this,arguments):Dc(f*f+d*d)),D=Ac(_c(d-f)/2,+n.apply(this,arguments)),S=D,M=D;if($>Sc){var C=Oc($/f*$c(A)),F=Oc($/d*$c(A));(k-=2*C)>Sc?(_+=C*=g?1:-1,w-=C):(k=0,_=w=(h+p)/2),(E-=2*F)>Sc?(b+=F*=g?1:-1,x-=F):(E=0,b=x=(h+p)/2)}var O=d*kc(b),N=d*$c(b),T=f*kc(w),z=f*$c(w);if(D>Sc){var R,P=d*kc(x),L=d*$c(x),B=f*kc(_),j=f*$c(_);if(m1?0:e<-1?Mc:Math.acos(e)}((I*q+U*W)/(Dc(I*I+U*U)*Dc(q*q+W*W)))/2),G=Dc(R[0]*R[0]+R[1]*R[1]);S=Ac(D,(f-G)/(H-1)),M=Ac(D,(d-G)/(H+1))}else S=M=0}E>Sc?M>Sc?(y=pf(B,j,O,N,d,M,g),v=pf(P,L,T,z,d,M,g),s.moveTo(y.cx+y.x01,y.cy+y.y01),MSc&&k>Sc?S>Sc?(y=pf(T,z,P,L,f,-S,g),v=pf(O,N,B,j,f,-S,g),s.lineTo(y.cx+y.x01,y.cy+y.y01),Se.startAngle||0)).endAngle((e=>e.endAngle||0)).padAngle((e=>e.padAngle||0)).innerRadius((e=>e.innerRadius||0)).outerRadius((e=>e.outerRadius||0)).cornerRadius((e=>e.cornerRadius||0)),Og=bf().x(Sg).y1(Mg).y0((e=>(e.y||0)+(e.height||0))).defined(Cg),Ng=bf().y(Mg).x1(Sg).x0((e=>(e.x||0)+(e.width||0))).defined(Cg),Tg=vf().x(Sg).y(Mg).defined(Cg),zg=Ag().x(Sg).y(Mg).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>Dg(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>Dg(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>Dg(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>Dg(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),Rg=function(e,t){let n=null,i=lf(r);function r(){let r;if(n||(n=r=i()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return e="function"==typeof e?e:Kc(e||xf),t="function"==typeof t?t:Kc(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:Kc(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:Kc(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type((e=>gg(e.shape||"circle"))).size((e=>Dg(e.size,64))),Pg=$g().x(Sg).y(Mg).defined(Cg).size((e=>e.size||1));function Lg(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Bg(e,t,n,i){return zg.context(e)(t,n,i)}var jg=1;function Ig(){jg=1}function Ug(e,t,n){var i=t.clip,r=e._defs,o=t.clip_id||(t.clip_id="clip"+jg++),a=r.clipping[o]||(r.clipping[o]={id:o});return rt(i)?a.path=i(null):Lg(n)?a.path=Bg(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function qg(e){this.clear(),e&&this.union(e)}function Wg(e){this.mark=e,this.bounds=this.bounds||new qg}function Hg(e){Wg.call(this,e),this.items=this.items||[]}function Gg(e){this._pending=0,this._loader=e||ja()}function Vg(e){e._pending+=1}function Yg(e){e._pending-=1}function Xg(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){const i=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(i+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,i):0))}return e}qg.prototype={clone(){return new qg(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:o,y2:a}=this,s=Math.cos(e),l=Math.sin(e),u=t-t*s+n*l,c=n-t*l-n*s;return[s*i-l*r+u,l*i+s*r+c,s*i-l*a+u,l*i+s*a+c,s*o-l*r+u,l*o+s*r+c,s*o-l*a+u,l*o+s*a+c]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},_t(Hg,Wg),Gg.prototype={pending(){return this._pending},sanitizeURL(e){const t=this;return Vg(t),t._loader.sanitize(e,{context:"href"}).then((e=>(Yg(t),e))).catch((()=>(Yg(t),null)))},loadImage(e){const t=this,n=wf();return Vg(t),t._loader.sanitize(e,{context:"image"}).then((e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,o=yt(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=o&&(r.crossOrigin=o),r.onload=()=>Yg(t),r.onerror=()=>Yg(t),r.src=i,r})).catch((e=>(Yg(t),{complete:!1,width:0,height:0,src:e&&e.url||""})))},ready(){const e=this;return new Promise((t=>{!function n(i){e.pending()?setTimeout((()=>{n(!0)}),10):t(i)}(!1)}))}};const Jg=rg-1e-8;let Qg,Zg,Kg,ey,ty,ny,iy,ry;const oy=(e,t)=>Qg.add(e,t),ay=(e,t)=>oy(Zg=e,Kg=t),sy=e=>oy(e,Qg.y1),ly=e=>oy(Qg.x1,e),uy=(e,t)=>ty*e+iy*t,cy=(e,t)=>ny*e+ry*t,fy=(e,t)=>oy(uy(e,t),cy(e,t)),dy=(e,t)=>ay(uy(e,t),cy(e,t));function hy(e,t){return Qg=e,t?(ey=t*ng,ty=ry=Math.cos(ey),ny=Math.sin(ey),iy=-ny):(ty=ry=1,ey=ny=iy=0),py}const py={beginPath(){},closePath(){},moveTo:dy,lineTo:dy,rect(e,t,n,i){ey?(fy(e+n,t),fy(e+n,t+i),fy(e,t+i),dy(e,t)):(oy(e+n,t+i),ay(e,t))},quadraticCurveTo(e,t,n,i){const r=uy(e,t),o=cy(e,t),a=uy(n,i),s=cy(n,i);my(Zg,r,a,sy),my(Kg,o,s,ly),ay(a,s)},bezierCurveTo(e,t,n,i,r,o){const a=uy(e,t),s=cy(e,t),l=uy(n,i),u=cy(n,i),c=uy(r,o),f=cy(r,o);gy(Zg,a,l,c,sy),gy(Kg,s,u,f,ly),ay(c,f)},arc(e,t,n,i,r,o){if(i+=ey,r+=ey,Zg=n*Math.cos(r)+e,Kg=n*Math.sin(r)+t,Math.abs(r-i)>Jg)oy(e-n,t-n),oy(e+n,t+n);else{const a=i=>oy(n*Math.cos(i)+e,n*Math.sin(i)+t);let s,l;if(a(i),a(r),r!==i)if((i%=rg)<0&&(i+=rg),(r%=rg)<0&&(r+=rg),rr;++l,s-=ig)a(s);else for(s=i-i%ig+ig,l=0;l<4&&s1e-14?(l=a*a+s*o,l>=0&&(l=Math.sqrt(l),u=(-a+l)/o,c=(-a-l)/o)):u=.5*s/a,0g)return!1;h>m&&(m=h)}else if(f>0){if(h0&&(e.globalAlpha=n,e.fillStyle=Sy(e,t,t.fill),!0)}var Cy=[];function Fy(e,t,n){var i=null!=(i=t.strokeWidth)?i:1;return!(i<=0)&&(n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=Sy(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||Cy),e.lineDashOffset=t.strokeDashOffset||0),!0)}function Oy(e,t){return e.zindex-t.zindex||e.index-t.index}function Ny(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,o=[];for(n=0,i=r.length;n=0;)if(n=t(r[i]))return n;if(r===o)for(i=(r=e.items).length;--i>=0;)if(!r[i].zindex&&(n=t(r[i])))return n;return null}function Ry(e){return function(t,n,i){Ty(n,(n=>{i&&!i.intersects(n.bounds)||Ly(e,t,n,n)}))}}function Py(e){return function(t,n,i){!n.items.length||i&&!i.intersects(n.bounds)||Ly(e,t,n.items[0],n.items)}}function Ly(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(Ay(t,n),n.fill&&My(t,n,r)&&t.fill(),n.stroke&&Fy(t,n,r)&&t.stroke()))}function By(e){return e=e||we,function(t,n,i,r,o,a){return i*=t.pixelRatio,r*=t.pixelRatio,zy(n,(n=>{const s=n.bounds;if((!s||s.contains(o,a))&&s)return e(t,n,i,r,o,a)?n:void 0}))}}function jy(e,t){return function(n,i,r,o){var a,s,l=Array.isArray(i)?i[0]:i,u=null==t?l.fill:t,c=l.stroke&&n.isPointInStroke;return c&&(a=l.strokeWidth,s=l.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!e(n,i)&&(u&&n.isPointInPath(r,o)||c&&n.isPointInStroke(r,o))}}function Iy(e){return By(jy(e))}function Uy(e,t){return"translate("+e+","+t+")"}function qy(e){return"rotate("+e+")"}function Wy(e){return Uy(e.x||0,e.y||0)}function Hy(e,t,n){function i(e,n){var i=n.x||0,r=n.y||0,o=n.angle||0;e.translate(i,r),o&&e.rotate(o*=ng),e.beginPath(),t(e,n),o&&e.rotate(-o),e.translate(-i,-r)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",function(e){return Uy(e.x||0,e.y||0)+(e.angle?" "+qy(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(hy(e,n.angle),n),Xg(e,n).translate(n.x||0,n.y||0)},draw:Ry(i),pick:Iy(i),isect:n||xy(i)}}var Gy=Hy("arc",(function(e,t){return Fg.context(e)(t)}));function Vy(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=jy(i);return{type:e,tag:"path",nested:!0,attr:function(e,n){var i=n.mark.items;i.length&&e("d",t(null,i))},bound:function(e,n){var i=n.items;return 0===i.length?e:(t(hy(e),i),Xg(e,i[0]))},draw:Py(i),pick:function(e,t,n,i,o,a){var s=t.items,l=t.bounds;return!s||!s.length||l&&!l.contains(o,a)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,s,n,i)?s[0]:null)},isect:_y,tip:n}}var Yy=Vy("area",(function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?Ng:Og).curve(Xm(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r="horizontal"===e[0].orient?t[1]:t[0],o="horizontal"===e[0].orient?"y":"x",a=e.length,s=1/0;--a>=0;)!1!==e[a].defined&&(i=Math.abs(e[a][o]-r)).5&&t<1.5?.5-Math.abs(t-1):0}function Qy(e,t){const n=Jy(t);e("d",Bg(null,t,n,n))}function Zy(e,t,n,i){const r=Jy(t);e.beginPath(),Bg(e,t,(n||0)+r,(i||0)+r)}const Ky=jy(Zy),ev=jy(Zy,!1),tv=jy(Zy,!0);var nv={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",Wy(t))},bound:function(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let t=0;t{const r=t.x||0,o=t.y||0,a=t.strokeForeground,s=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&s&&(Zy(e,t,r,o),Ay(e,t),t.fill&&My(e,t,s)&&e.fill(),t.stroke&&!a&&Fy(e,t,s)&&e.stroke()),e.save(),e.translate(r,o),t.clip&&Xy(e,t),n&&n.translate(-r,-o),Ty(t,(t=>{("group"===t.marktype||null==i||i.includes(t.marktype))&&this.draw(e,t,n,i)})),n&&n.translate(r,o),e.restore(),a&&t.stroke&&s&&(Zy(e,t,r,o),Ay(e,t),Fy(e,t,s)&&e.stroke())}))},pick:function(e,t,n,i,r,o){if(t.bounds&&!t.bounds.contains(r,o)||!t.items)return null;const a=n*e.pixelRatio,s=i*e.pixelRatio;return zy(t,(l=>{let u,c,f;const d=l.bounds;if(d&&!d.contains(r,o))return;c=l.x||0,f=l.y||0;const h=c+(l.width||0),p=f+(l.height||0),m=l.clip;if(m&&(rh||op))return;if(e.save(),e.translate(c,f),c=r-c,f=o-f,m&&Lg(l)&&!tv(e,l,a,s))return e.restore(),null;const g=l.strokeForeground,y=!1!==t.interactive;return y&&g&&l.stroke&&ev(e,l,a,s)?(e.restore(),l):(u=zy(l,(e=>function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,c,f)?this.pick(e,n,i,c,f):null)),!u&&y&&(l.fill||!g&&l.stroke)&&Ky(e,l,a,s)&&(u=l),e.restore(),u||null)}))},isect:wy,content:function(e,t,n){e("clip-path",t.clip?Ug(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),Qy(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?Qy(e,t):e("d","")}},iv={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function rv(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then((t=>{e.image=t,e.image.url=e.url}))),n}function ov(e,t){return null!=e.width?e.width:t&&t.width?!1!==e.aspect&&e.height?e.height*t.width/t.height:t.width:0}function av(e,t){return null!=e.height?e.height:t&&t.height?!1!==e.aspect&&e.width?e.width*t.height/t.width:t.height:0}function sv(e,t){return"center"===e?t/2:"right"===e?t:0}function lv(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var uv={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=rv(t,n),r=ov(t,i),o=av(t,i),a=(t.x||0)-sv(t.align,r),s=(t.y||0)-lv(t.baseline,o);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",iv["xmlns:xlink"],"xlink:href"),e("transform",Uy(a,s)),e("width",r),e("height",o),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=ov(t,n),r=av(t,n),o=(t.x||0)-sv(t.align,i),a=(t.y||0)-lv(t.baseline,r);return e.set(o,a,o+i,a+r)},draw:function(e,t,n){Ty(t,(t=>{if(n&&!n.intersects(t.bounds))return;const i=rv(t,this);let r=ov(t,i),o=av(t,i);if(0===r||0===o)return;let a,s,l,u,c=(t.x||0)-sv(t.align,r),f=(t.y||0)-lv(t.baseline,o);!1!==t.aspect&&(s=i.width/i.height,l=t.width/t.height,s==s&&l==l&&s!==l&&(l=0;)if(!1!==e[o].defined&&(n=e[o].x-t[0])*n+(i=e[o].y-t[1])*i{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&mv(e,t,i)&&(Ay(e,t),e.stroke())}}))},pick:By((function(e,t,n,i){return!!e.isPointInStroke&&mv(e,t,1)&&e.isPointInStroke(n,i)})),isect:ky},yv=Hy("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),vv=Hy("symbol",(function(e,t){return Rg.context(e)(t)}),_y);const bv=Ot();var xv={height:$v,measureWidth:Ev,estimateWidth:wv,width:wv,canvas:_v};function _v(e){xv.width=e&&vy?Ev:wv}function wv(e,t){return kv(Cv(e,t),$v(e))}function kv(e,t){return~~(.8*e.length*t)}function Ev(e,t){return $v(e)<=0||!(t=Cv(e,t))?0:Av(t,Ov(e))}function Av(e,t){const n=`(${t}) ${e}`;let i=bv.get(n);return void 0===i&&(vy.font=t,i=vy.measureText(e).width,bv.set(n,i)),i}function $v(e){return null!=e.fontSize?+e.fontSize||0:11}function Dv(e){return null!=e.lineHeight?e.lineHeight:$v(e)+2}function Sv(e){return t=e.lineBreak&&e.text&&!Fe(e.text)?e.text.split(e.lineBreak):e.text,Fe(t)?t.length>1?t:t[0]:t;var t}function Mv(e){const t=Sv(e);return(Fe(t)?t.length-1:0)*Dv(e)}function Cv(e,t){const n=null==t?"":(t+"").trim();return e.limit>0&&n.length?function(e,t){var n=+e.limit,i=function(e){if(xv.width===Ev){const t=Ov(e);return e=>Av(e,t)}if(xv.width===wv){const t=$v(e);return e=>kv(e,t)}return t=>xv.width(e,t)}(e);if(i(t)>>1,i(t.slice(r))>n?s=r+1:l=r;return o+t.slice(s)}for(;s>>1),i(t.slice(0,r))Math.max(e,xv.width(t,n))),0)):i=xv.width(t,f),"center"===o?u-=i/2:"right"===o&&(u-=i),e.set(u+=s,c+=l,u+i,c+r),t.angle&&!n)e.rotate(t.angle*ng,s,l);else if(2===n)return e.rotatedPoints(t.angle*ng,s,l);return e}var Lv={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+Nv(t),o=Rv(t),a=o.x1,s=o.y1,l=t.angle||0;e("text-anchor",Tv[t.align]||"start"),l?(n=Uy(a,s)+" "+qy(l),(i||r)&&(n+=" "+Uy(i,r))):n=Uy(a+i,s+r),e("transform",n)},bound:Pv,draw:function(e,t,n){Ty(t,(t=>{var i,r,o,a,s,l,u,c=null==t.opacity?1:t.opacity;if(!(n&&!n.intersects(t.bounds)||0===c||t.fontSize<=0||null==t.text||0===t.text.length)){if(e.font=Ov(t),e.textAlign=t.align||"left",r=(i=Rv(t)).x1,o=i.y1,t.angle&&(e.save(),e.translate(r,o),e.rotate(t.angle*ng),r=o=0),r+=t.dx||0,o+=(t.dy||0)+Nv(t),l=Sv(t),Ay(e,t),Fe(l))for(s=Dv(t),a=0;a=0;)if(!1!==e[r].defined&&(n=e[r].x-t[0])*n+(i=e[r].y-t[1])*i<(n=e[r].size||1)*n)return e[r];return null})),jv={arc:Gy,area:Yy,group:nv,image:uv,line:cv,path:dv,rect:pv,rule:gv,shape:yv,symbol:vv,text:Lv,trail:Bv};function Iv(e,t,n){var i=jv[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new qg),e,n)}var Uv={mark:null};function qv(e,t,n){var i,r,o,a,s=jv[e.marktype],l=s.bound,u=e.items,c=u&&u.length;if(s.nested)return c?o=u[0]:(Uv.mark=e,o=Uv),a=Iv(o,l,n),t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new qg,c)for(i=0,r=u.length;it;)e.removeChild(n[--i]);return e}function eb(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function tb(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function nb(e,t){this._active=null,this._handlers={},this._loader=e||ja(),this._tooltip=t||ib}function ib(e,t,n,i){e.element().setAttribute("title",i||"")}function rb(e){this._el=null,this._bgcolor=null,this._loader=new Gg(e)}Yv.prototype={toJSON(e){return Hv(this.root,e||0)},mark(e,t,n){const i=Xv(e,t=t||this.root.items[0]);return t.items[n]=i,i.zindex&&(i.group.zdirty=!0),i}},nb.prototype={initialize(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()},scene(e){return arguments.length?(this._scene=e,this):this._scene},on(){},off(){},_handlerIndex(e,t,n){for(let i=e?e.length:0;--i>=0;)if(e[i].type===t&&(!n||e[i].handler===n))return i;return-1},handlers(e){const t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(const e in t)n.push(...t[e]);return n},eventName(e){const t=e.indexOf(".");return t<0?e:e.slice(0,t)},handleHref(e,t,n){this._loader.sanitize(n,{context:"href"}).then((t=>{const n=new MouseEvent(e.type,e),i=Jv(null,"a");for(const e in t)i.setAttribute(e,t[e]);i.dispatchEvent(n)})).catch((()=>{}))},handleTooltip(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,i){var r,o,a=e&&e.mark;if(a&&(r=jv[a.marktype]).tip){for((o=tb(t,n))[0]-=i[0],o[1]-=i[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=r.tip(a.items,o)}return e}(t,e,this.canvas(),this._origin);const i=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,i)}},getItemBoundingClientRect(e){const t=this.canvas();if(!t)return;const n=t.getBoundingClientRect(),i=this._origin,r=e.bounds,o=r.width(),a=r.height();let s=r.x1+i[0]+n.left,l=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,l+=e.y||0;return{x:s,y:l,width:o,height:a,left:s,top:l,right:s+o,bottom:l+a}}},rb.prototype={initialize(e,t,n,i,r){return this._el=e,this.resize(t,n,i,r)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},background(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)},resize(e,t,n,i){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=i||1,this},dirty(){},render(e,t){const n=this;return n._call=function(){n._render(e,t)},n._call(),n._call=null,n},_render(){},renderAsync(e,t){const n=this.render(e,t);return this._ready?this._ready.then((()=>n)):Promise.resolve(n)},_load(e,t){var n=this,i=n._loader[e](t);if(!n._ready){const e=n._call;n._ready=n._loader.ready().then((t=>{t&&e(),n._ready=null}))}return i},sanitizeURL(e){return this._load("sanitizeURL",e)},loadImage(e){return this._load("loadImage",e)}};const ob="dragenter",ab="dragleave",sb="dragover",lb="pointerdown",ub="pointermove",cb="pointerout",fb="pointerover",db="mousedown",hb="mousemove",pb="mouseout",mb="mouseover",gb="click",yb="mousewheel",vb="touchstart",bb="touchmove",xb="touchend",_b=ub,wb=cb,kb=gb;function Eb(e,t){nb.call(this,e,t),this._down=null,this._touch=null,this._first=!0,this._events={}}function Ab(e,t){(e=>e===vb||e===bb||e===xb?[vb,bb,xb]:[e])(t).forEach((t=>function(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}(e,t)))}function $b(e,t,n){t.forEach((t=>e.fire(t,n)))}function Db(e,t,n){return function(i){const r=this._active,o=this.pickEvent(i);o===r||(r&&r.exit||$b(this,n,i),this._active=o,$b(this,t,i)),$b(this,e,i)}}function Sb(e){return function(t){$b(this,e,t),this._active=null}}_t(Eb,nb,{initialize(e,t,n){return this._canvas=e&&Qv(e,"canvas"),[gb,db,lb,ub,cb,ab].forEach((e=>Ab(this,e))),nb.prototype.initialize.call(this,e,t,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",ob,ab,sb,lb,"pointerup",ub,cb,fb,db,"mouseup",hb,pb,mb,gb,"dblclick","wheel",yb,vb,bb,xb],DOMMouseScroll(e){this.fire(yb,e)},pointermove:Db([ub,hb],[fb,mb],[cb,pb]),dragover:Db([sb],[ob],[ab]),pointerout:Sb([cb,pb]),dragleave:Sb([ab]),pointerdown(e){this._down=this._active,this.fire(lb,e)},mousedown(e){this._down=this._active,this.fire(db,e)},click(e){this._down===this._active&&(this.fire(gb,e),this._down=null)},touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(vb,e,!0)},touchmove(e){this.fire(bb,e,!0)},touchend(e){this.fire(xb,e,!0),this._touch=null},fire(e,t,n){const i=n?this._touch:this._active,r=this._handlers[e];if(t.vegaType=e,e===kb&&i&&i.href?this.handleHref(t,i,i.href):e!==_b&&e!==wb||this.handleTooltip(t,i,e!==wb),r)for(let e=0,n=r.length;e=0&&i.splice(r,1),this},pickEvent(e){const t=tb(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])},pick(e,t,n,i,r){const o=this.context();return jv[e.marktype].pick.call(this,o,e,t,n,i,r)}});var Mb="undefined"!=typeof window&&window.devicePixelRatio||1;function Cb(e){rb.call(this,e),this._options={},this._redraw=!1,this._dirty=new qg,this._tempb=new qg}const Fb=rb.prototype;function Ob(e,t){nb.call(this,e,t);const n=this;n._hrefHandler=Nb(n,((e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=Nb(n,((e,t)=>{n.handleTooltip(e,t,e.type!==wb)}))}_t(Cb,rb,{initialize(e,t,n,i,r,o){return this._options=o||{},this._canvas=this._options.externalContext?null:_f(1,1,this._options.type),e&&this._canvas&&(Kv(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Fb.initialize.call(this,e,t,n,i,r)},resize(e,t,n,i){if(Fb.resize.call(this,e,t,n,i),this._canvas)!function(e,t,n,i,r,o){const a="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),l=a?Mb:r;e.width=t*l,e.height=n*l;for(const e in o)s[e]=o[e];a&&1!==l&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=l,s.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||me("CanvasRenderer is missing a valid canvas or context"),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},canvas(){return this._canvas},context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},dirty(e){const t=this._tempb.clear().union(e.bounds);let n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)},_render(e,t){const n=this.context(),i=this._origin,r=this._width,o=this._height,a=this._dirty,s=((e,t,n)=>(new qg).set(0,0,t,n).translate(-e[0],-e[1]))(i,r,o);n.save();const l=this._redraw||a.empty()?(this._redraw=!1,s.expand(1)):function(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(n,s.intersect(a),i);return this.clear(-i[0],-i[1],r,o),this.draw(n,e,l,t),n.restore(),a.clear(),this},draw(e,t,n,i){if("group"!==t.marktype&&null!=i&&!i.includes(t.marktype))return;const r=jv[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),rt(n)?(e.beginPath(),n(e),e.clip()):Xy(e,t.group)}(e,t),r.draw.call(this,e,t,n,i),t.clip&&e.restore()},clear(e,t,n,i){const r=this._options,o=this.context();"pdf"===r.type||r.externalContext||o.clearRect(e,t,n,i),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(e,t,n,i))}});const Nb=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)};_t(Ob,nb,{initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(kb,this._hrefHandler),i.removeEventListener(_b,this._tooltipHandler),i.removeEventListener(wb,this._tooltipHandler)),this._svg=i=e&&Qv(e,"svg"),i&&(i.addEventListener(kb,this._hrefHandler),i.addEventListener(_b,this._tooltipHandler),i.addEventListener(wb,this._tooltipHandler)),nb.prototype.initialize.call(this,e,t,n)},canvas(){return this._svg},on(e,t){const n=this.eventName(e),i=this._handlers;if(this._handlerIndex(i[n],e,t)<0){const r={type:e,handler:t,listener:Nb(this,t)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this}});const Tb="aria-hidden",zb="aria-label",Rb="role",Pb="aria-roledescription",Lb="graphics-object",Bb="graphics-symbol",jb=(e,t,n)=>({[Rb]:e,[Pb]:t,[zb]:n||void 0}),Ib=Ut(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Ub={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?Vb(e):null,r=e.context,o=r.scales[t.scale].value,a=r.dataflow.locale(),s=o.type;return`${"left"===n||"right"===n?"Y":"X"}-axis`+(i?` titled '${i}'`:"")+` for a ${am(s)?"discrete":s} scale`+` with ${Im(a,o,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?Vb(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,o=Object.keys(r),a=e.context,s=a.scales[r[o[0]]].value,l=a.dataflow.locale();return((u=i).length?u[0].toUpperCase()+u.slice(1):u)+(n?` titled '${n}'`:"")+` for ${function(e){return(e=e.map((e=>e+("fill"===e||"stroke"===e?" color":"")))).length<2?e[0]:e.slice(0,-1).join(", ")+" and "+Pe(e)}(o)}`+` with ${Im(l,s,e)}`;var u}},"title-text":{desc:"title",caption:e=>`Title text '${Gb(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${Gb(e)}'`}},qb={ariaRole:Rb,ariaRoleDescription:Pb,description:zb};function Wb(e,t){const n=!1===t.aria;if(e(Tb,n||void 0),n||null==t.description)for(const t in qb)e(qb[t],void 0);else{const n=t.mark.marktype;e(zb,t.description),e(Rb,t.ariaRole||("group"===n?Lb:Bb)),e(Pb,t.ariaRoleDescription||`${n} mark`)}}function Hb(e){return!1===e.aria?{[Tb]:!0}:Ib[e.role]?null:Ub[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return jb(t.role||Bb,t.desc,n.description||i(n))}catch(e){return null}}(e,Ub[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some((e=>null!=e.description&&!1!==e.aria));return jb(n?Lb:Bb,`${t} mark container`,e.description)}(e)}function Gb(e){return nt(e.text).join(" ")}function Vb(e){try{return nt(Pe(e.items).items[0].text).join(" ")}catch(e){return null}}const Yb=e=>(e+"").replace(/&/g,"&").replace(//g,">"),Xb=e=>Yb(e).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ");function Jb(){let e="",t="",n="";const i=[],r=()=>t=n="",o=(e,n)=>(null!=n&&(t+=` ${e}="${Xb(n)}"`),a),a={open(s){(o=>{t&&(e+=`${t}>${n}`,r()),i.push(o)})(s),t="<"+s;for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c${n}`:"/>"):``,r(),a},attr:o,text:e=>(n+=Yb(e),a),toString:()=>e};return a}const Qb=e=>Zb(Jb(),e)+"";function Zb(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let t=0;t1&&e.previousSibling!=t}(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}_t(rx,rb,{initialize(e,t,n,i,r){return this._defs={},this._clearDefs(),e&&(this._svg=Zv(e,0,"svg",ix),this._svg.setAttributeNS(nx,"xmlns",ix),this._svg.setAttributeNS(nx,"xmlns:xlink",iv["xmlns:xlink"]),this._svg.setAttribute("version",iv.version),this._svg.setAttribute("class","marks"),Kv(e,1),this._root=Zv(this._svg,0,"g",ix),mx(this._root,tx),Kv(this._svg,1)),this.background(this._bgcolor),ox.initialize.call(this,e,t,n,i,r)},background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),ox.background.apply(this,arguments)},resize(e,t,n,i){return ox.resize.call(this,e,t,n,i),this._svg&&(mx(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this},canvas(){return this._svg},svg(){const e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute("style"),n=Zv(e,0,"rect",ix),mx(n,{width:this._width,height:this._height,fill:t}));const i=Qb(e);return t&&(e.removeChild(n),this._svg.style.setProperty("background-color",t)),i},_render(e,t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e,void 0,t),Kv(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;const e=this._dirty;if(!e.length||!this._dirtyID)return!0;const t=++this._dirtyID;let n,i,r,o,a,s,l;for(a=0,s=e.length;a{e.dirty=t}))),i.zdirty||(n.exit?(o.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(o,l._svg,l)):n._svg&&(l=n._svg.parentNode,l&&l.removeChild(n._svg)),n._svg=null):(n=o.nested?i.items[0]:n,n._update!==t&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,ax(n,t)),n._update=t)));return!this._dirtyAll},mark(e,t,n,i){if(!this.isDirty(t))return t._svg;const r=this._svg,o=t.marktype,a=jv[o],s=!1===t.interactive?"none":null,l="g"===a.tag,u=ux(t,e,n,"g",r);if("group"!==o&&null!=i&&!i.includes(o))return Kv(u,0),t._svg;u.setAttribute("class",eb(t));const c=Hb(t);for(const e in c)gx(u,e,c[e]);l||gx(u,"pointer-events",s),gx(u,"clip-path",t.clip?Ug(this,t,t.group):null);let f=null,d=0;const h=e=>{const t=this.isDirty(e),n=ux(e,u,f,a.tag,r);t&&(this._update(a,n,e),l&&function(e,t,n,i){t=t.lastChild.previousSibling;let r,o=0;Ty(n,(n=>{r=e.mark(t,n,r,i),++o})),Kv(t,1+o)}(this,n,e,i)),f=n,++d};return a.nested?t.items.length&&h(t.items[0]):Ty(t,h),Kv(u,d),u},_update(e,t,n){cx=t,fx=t.__values__,Wb(hx,n),e.attr(hx,n,this);const i=dx[e.type];i&&i.call(this,e,t,n),cx&&this.style(cx,n)},style(e,t){if(null!=t){for(const n in Kb){let i="font"===n?Fv(t):t[n];if(i===fx[n])continue;const r=Kb[n];null==i?e.removeAttribute(r):(Wm(i)&&(i=Hm(i,this._defs.gradient,yx())),e.setAttribute(r,i+"")),fx[n]=i}for(const n in ex)px(e,ex[n],t[n])}},defs(){const e=this._svg,t=this._defs;let n=t.el,i=0;for(const r in t.gradient)n||(t.el=n=Zv(e,1,"defs",ix)),i=sx(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=Zv(e,1,"defs",ix)),i=lx(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):Kv(n,i))},_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}});let cx=null,fx=null;const dx={group(e,t,n){const i=cx=t.childNodes[2];fx=i.__values__,e.foreground(hx,n,this),fx=t.__values__,cx=t.childNodes[1],e.content(hx,n,this);const r=cx=t.childNodes[0];e.background(hx,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==fx.events&&(gx(i,"pointer-events",o),gx(r,"pointer-events",o),fx.events=o),n.strokeForeground&&n.stroke){const e=n.fill;gx(i,"display",null),this.style(r,n),gx(r,"stroke",null),e&&(n.fill=null),fx=i.__values__,this.style(i,n),e&&(n.fill=e),cx=null}else gx(i,"display","none")},image(e,t,n){!1===n.smooth?(px(t,"image-rendering","optimizeSpeed"),px(t,"image-rendering","pixelated")):px(t,"image-rendering",null)},text(e,t,n){const i=Sv(n);let r,o,a,s;Fe(i)?(o=i.map((e=>Cv(n,e))),r=o.join("\n"),r!==fx.text&&(Kv(t,0),a=t.ownerDocument,s=Dv(n),o.forEach(((e,i)=>{const r=Jv(a,"tspan",ix);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",s)),t.appendChild(r)})),fx.text=r)):(o=Cv(n,i),o!==fx.text&&(t.textContent=o,fx.text=o)),gx(t,"font-family",Fv(n)),gx(t,"font-size",$v(n)+"px"),gx(t,"font-style",n.fontStyle),gx(t,"font-variant",n.fontVariant),gx(t,"font-weight",n.fontWeight)}};function hx(e,t,n){t!==fx[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(cx,e,t,n):gx(cx,e,t),fx[e]=t)}function px(e,t,n){n!==fx[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),fx[t]=n)}function mx(e,t){for(const n in t)gx(e,n,t[n])}function gx(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function yx(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function vx(e){rb.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}_t(vx,rb,{svg(){return this._text},_render(e){const t=Jb();t.open("svg",ht({},iv,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&t.open("rect",{width:this._width,height:this._height,fill:n}).close(),t.open("g",tx,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this},mark(e,t){const n=jv[t.marktype],i=n.tag,r=[Wb,n.attr];e.open("g",{class:eb(t),"clip-path":t.clip?Ug(this,t,t.group):null},Hb(t),{"pointer-events":"g"!==i&&!1===t.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&e.open("a",a),e.open(i,this.attr(t,o,r,"g"!==i?i:null)),"text"===i){const t=Sv(o);if(Fe(t)){const n={x:0,dy:Dv(o)};for(let i=0;ithis.mark(e,t))),e.close(),i&&a?(r&&(o.fill=null),o.stroke=a,e.open("path",this.attr(t,o,n.foreground,"bgrect")).close(),r&&(o.fill=r)):e.open("path",this.attr(t,o,n.foreground,"bgfore")).close()}e.close(),a&&e.close()};return n.nested?t.items&&t.items.length&&o(t.items[0]):Ty(t,o),e.close()},href(e){const t=e.href;let n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then((e=>{e["xlink:href"]=e.href,e.href=null,(this._hrefs||(this._hrefs={}))[t]=e}))}return null},attr(e,t,n,i){const r={},o=(e,t,n,i)=>{r[i||e]=t};return Array.isArray(n)?n.forEach((e=>e(o,t,this))):n(o,t,this),i&&function(e,t,n,i,r){let o;if(null==t)return e;if("bgrect"===i&&!1===n.interactive&&(e["pointer-events"]="none"),"bgfore"===i&&(!1===n.interactive&&(e["pointer-events"]="none"),e.display="none",null!==t.fill))return e;"image"===i&&!1===t.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),"text"===i&&(e["font-family"]=Fv(t),e["font-size"]=$v(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const n in Kb){let i=t[n];const o=Kb[n];("transparent"!==i||"fill"!==o&&"stroke"!==o)&&null!=i&&(Wm(i)&&(i=Hm(i,r.gradient,"")),e[o]=i)}for(const e in ex){const n=t[e];null!=n&&(o=o||[],o.push(`${ex[e]}: ${n};`))}o&&(e.style=o.join(" "))}(r,t,e,i,this._defs),r},defs(e){const t=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(t).length+Object.keys(n).length){e.open("defs");for(const n in t){const i=t[n],r=i.stops;"radial"===i.gradient?(e.open("pattern",{id:qm+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),e.close(),e.open("radialGradient",{id:n,fx:i.x1,fy:i.y1,fr:i.r1,cx:i.x2,cy:i.y2,r:i.r2})):e.open("linearGradient",{id:n,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2});for(let t=0;t!bx.svgMarkTypes.includes(e)));this._svgRenderer.render(e,bx.svgMarkTypes),this._canvasRenderer.render(e,n)},resize(e,t,n,i){return wx.resize.call(this,e,t,n,i),this._svgRenderer.resize(e,t,n,i),this._canvasRenderer.resize(e,t,n,i),this},background(e){return bx.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}}),_t(kx,Eb,{initialize(e,t,n){const i=Zv(Zv(e,0,"div"),bx.svgOnTop?0:1,"div");return Eb.prototype.initialize.call(this,i,t,n)}});const Ex="canvas",Ax="hybrid",$x="none",Dx={Canvas:Ex,PNG:"png",SVG:"svg",Hybrid:Ax,None:$x},Sx={};function Mx(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(Sx[e]=t,this):Sx[e]}function Cx(e,t,n){const i=[],r=(new qg).union(t),o=e.marktype;return o?Fx(e,r,n,i):"group"===o?Ox(e,r,n,i):me("Intersect scene must be mark node or group item.")}function Fx(e,t,n,i){if(function(e,t,n){return e.bounds&&t.intersects(e.bounds)&&("group"===e.marktype||!1!==e.interactive&&(!n||n(e)))}(e,t,n)){const r=e.items,o=e.marktype,a=r.length;let s=0;if("group"===o)for(;s=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(!Px(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function Lx(e,t){return Px(tg(e),tg(t))}function Bx(){Ig(),Um=0}const jx="top",Ix="left",Ux="right",qx="bottom",Wx="start",Hx="middle",Gx="end",Vx="x",Yx="y",Xx="group",Jx="axis",Qx="title",Zx="legend",Kx="row-header",e_="row-footer",t_="row-title",n_="column-header",i_="column-footer",r_="column-title",o_="fit-x",a_="fit-y",s_="none",l_="all",u_="each",c_="flush",f_="column",d_="row";function h_(e){Es.call(this,null,e)}function p_(e,t,n){return t(e.bounds.clear(),e,n)}_t(h_,Es,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,o=jv[r],a=o.bound;let s,l=i.bounds;if(o.nested)i.items.length&&n.dirty(i.items[0]),l=p_(i,a),i.items.forEach((e=>{e.bounds.clear().union(l)}));else if(r===Xx||e.modified())switch(t.visit(t.MOD,(e=>n.dirty(e))),l.clear(),i.items.forEach((e=>l.union(p_(e,a)))),i.role){case Jx:case Zx:case Qx:t.reflow()}else s=t.changed(t.REM),t.visit(t.ADD,(e=>{l.union(p_(e,a))})),t.visit(t.MOD,(e=>{s=s||l.alignsWith(e.bounds),n.dirty(e),l.union(p_(e,a))})),s&&(l.clear(),i.items.forEach((e=>l.union(e.bounds))));return zx(i),t.modifies("bounds")}});const m_=":vega_identifier:";function g_(e){Es.call(this,0,e)}function y_(e){Es.call(this,null,e)}function v_(e){Es.call(this,null,e)}g_.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},_t(g_,Es,{transform(e,t){const n=(r=t.dataflow)._signals[m_]||(r._signals[m_]=r.add(0)),i=e.as;var r;let o=n.value;return t.visit(t.ADD,(e=>e[i]=e[i]||++o)),n.set(this.value=o),t}}),_t(y_,Es,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,function(e){const t=e.groups,n=e.parent;return t&&1===t.size?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const i=n.marktype===Xx?Hg:Wg;return t.visit(t.ADD,(e=>i.call(e,n))),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});const b_={parity:e=>e.filter(((e,t)=>t%2?e.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((e,i)=>i&&x_(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)))}},x_=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),__=(e,t)=>{for(var n,i=1,r=e.length,o=e[0].bounds;i{const t=e.bounds;return t.width()>1&&t.height()>1},k_=e=>(e.forEach((e=>e.opacity=1)),e),E_=(e,t)=>e.reflow(t.modified()).modifies("opacity");function A_(e){Es.call(this,null,e)}_t(v_,Es,{transform(e,t){const n=b_[e.method]||b_.parity,i=e.separation||0;let r,o,a=t.materialize(t.SOURCE).source;if(!a||!a.length)return;if(!e.method)return e.modified("method")&&(k_(a),t=E_(t,e)),t;if(a=a.filter(w_),!a.length)return;if(e.sort&&(a=a.slice().sort(e.sort)),r=k_(a),t=E_(t,e),r.length>=3&&__(r,i)){do{r=n(r,i)}while(r.length>=3&&__(r,i));r.length<3&&!Pe(a).opacity&&(r.length>1&&(Pe(r).opacity=0),Pe(a).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=((e,t,n)=>{var i=e.range(),r=new qg;return t===jx||t===qx?r.set(i[0],-1/0,i[1],1/0):r.set(-1/0,i[0],1/0,i[1]),r.expand(n||1),e=>r.encloses(e.bounds)})(e.boundScale,e.boundOrient,+e.boundTolerance),a.forEach((e=>{o(e)||(e.opacity=0)})));const s=r[0].mark.bounds.clear();return a.forEach((e=>{e.opacity&&s.union(e.bounds)})),t}}),_t(A_,Es,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,(e=>n.dirty(e))),t.fields&&t.fields.zindex){const e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}});const $_=new qg;function D_(e,t,n){return e[t]===n?0:(e[t]=n,1)}function S_(e){var t=e.items[0].orient;return t===Ix||t===Ux}function M_(e,t,n,i){var r,o,a=t.items[0],s=a.datum,l=null!=a.translate?a.translate:.5,u=a.orient,c=function(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(s),f=a.range,d=a.offset,h=a.position,p=a.minExtent,m=a.maxExtent,g=s.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,b=g&&Mv(g),x=0,_=0;switch($_.clear().union(v),v.clear(),(r=c[0])>-1&&v.union(a.items[r].bounds),(r=c[1])>-1&&v.union(a.items[r].bounds),u){case jx:x=h||0,_=-d,o=Math.max(p,Math.min(m,-v.y1)),v.add(0,-o).add(f,0),g&&C_(e,g,o,y,b,0,-1,v);break;case Ix:x=-d,_=h||0,o=Math.max(p,Math.min(m,-v.x1)),v.add(-o,0).add(0,f),g&&C_(e,g,o,y,b,1,-1,v);break;case Ux:x=n+d,_=h||0,o=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(o,f),g&&C_(e,g,o,y,b,1,1,v);break;case qx:x=h||0,_=i+d,o=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,o),g&&C_(e,g,o,y,0,0,1,v);break;default:x=a.x,_=a.y}return Xg(v.translate(x,_),a),D_(a,"x",x+l)|D_(a,"y",_+l)&&(a.bounds=$_,e.dirty(a),a.bounds=v,e.dirty(a)),a.mark.bounds.clear().union(v)}function C_(e,t,n,i,r,o,a,s){const l=t.bounds;if(t.auto){const s=a*(n+r+i);let u=0,c=0;e.dirty(t),o?u=(t.x||0)-(t.x=s):c=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(l.translate(-u,-c)),e.dirty(t)}s.union(l)}const F_=(e,t)=>Math.floor(Math.min(e,t)),O_=(e,t)=>Math.ceil(Math.max(e,t));function N_(e){return(new qg).set(0,0,e.width||0,e.height||0)}function T_(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function z_(e,t,n){const i=Oe(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function R_(e){return e<0?Math.ceil(-e):0}function P_(e,t,n){var i,r,o,a,s,l,u,c,f,d,h,p=!n.nodirty,m=n.bounds===c_?N_:T_,g=$_.set(0,0,0,0),y=z_(n.align,f_),v=z_(n.align,d_),b=z_(n.padding,f_),x=z_(n.padding,d_),_=n.columns||t.length,w=_<=0?1:Math.ceil(t.length/_),k=t.length,E=Array(k),A=Array(_),$=0,D=Array(k),S=Array(w),M=0,C=Array(k),F=Array(k),O=Array(k);for(r=0;r<_;++r)A[r]=0;for(r=0;r1)for(r=0;r0&&(C[r]+=f/2);if(v&&z_(n.center,d_)&&1!==_)for(r=0;r0&&(F[r]+=d/2);for(r=0;rr&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),E+=o,m=0,y=t.length;m=0&&null==(x=n[g]);g-=d);s?(_=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),w=E):(_=E,w=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),v.union(b.bounds.translate(_-(b.x||0),w-(b.y||0))),b.x=_,b.y=w,e.dirty(b),A=a(A,v[u])}return A}function I_(e,t,n,i,r,o){if(t){e.dirty(t);var a=n,s=n;i?a=Math.round(r.x1+o*r.width()):s=Math.round(r.y1+o*r.height()),t.bounds.translate(a-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=a,t.y=s,e.dirty(t)}}function U_(e,t,n,i,r,o,a){const s=function(e,t){const n=e[t]||{};return(t,i)=>null!=n[t]?n[t]:null!=e[t]?e[t]:i}(n,t),l=function(e,t){let n=-1/0;return e.forEach((e=>{null!=e.offset&&(n=Math.max(n,e.offset))})),n>-1/0?n:t}(e,s("offset",0)),u=s("anchor",Wx),c=u===Gx?1:u===Hx?.5:0,f={align:u_,bounds:s("bounds",c_),columns:"vertical"===s("direction")?1:e.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(t){case Ix:f.anchor={x:Math.floor(i.x1)-l,column:Gx,y:c*(a||i.height()+2*i.y1),row:u};break;case Ux:f.anchor={x:Math.ceil(i.x2)+l,y:c*(a||i.height()+2*i.y1),row:u};break;case jx:f.anchor={y:Math.floor(r.y1)-l,row:Gx,x:c*(o||r.width()+2*r.x1),column:u};break;case qx:f.anchor={y:Math.ceil(r.y2)+l,x:c*(o||r.width()+2*r.x1),column:u};break;case"top-left":f.anchor={x:l,y:l};break;case"top-right":f.anchor={x:o-l,y:l,column:Gx};break;case"bottom-left":f.anchor={x:l,y:a-l,row:Gx};break;case"bottom-right":f.anchor={x:o-l,y:a-l,column:Gx,row:Gx}}return f}function q_(e,t){var n,i,r=t.items[0],o=r.datum,a=r.orient,s=r.bounds,l=r.x,u=r.y;return r._bounds?r._bounds.clear().union(s):r._bounds=s.clone(),s.clear(),function(e,t,n){var i=t.padding,r=i-n.x,o=i-n.y;if(t.datum.title){var a=t.items[1].items[0],s=a.anchor,l=t.titlePadding||0,u=i-a.x,c=i-a.y;switch(a.orient){case Ix:r+=Math.ceil(a.bounds.width())+l;break;case Ux:case qx:break;default:o+=a.bounds.height()+l}switch((r||o)&&H_(e,n,r,o),a.orient){case Ix:c+=W_(t,n,a,s,1,1);break;case Ux:u+=W_(t,n,a,Gx,0,0)+l,c+=W_(t,n,a,s,1,1);break;case qx:u+=W_(t,n,a,s,0,0),c+=W_(t,n,a,Gx,-1,0,1)+l;break;default:u+=W_(t,n,a,s,0,0)}(u||c)&&H_(e,a,u,c),(u=Math.round(a.bounds.x1-i))<0&&(H_(e,n,-u,0),H_(e,a,-u,0))}else(r||o)&&H_(e,n,r,o)}(e,r,r.items[0].items[0]),s=function(e,t){return e.items.forEach((e=>t.union(e.bounds))),t.x1=e.padding,t.y1=e.padding,t}(r,s),n=2*r.padding,i=2*r.padding,s.empty()||(n=Math.ceil(s.width()+n),i=Math.ceil(s.height()+i)),"symbol"===o.type&&function(e){const t=e.reduce(((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e)),{});e.forEach((e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y}))}(r.items[0].items[0].items[0].items),a!==s_&&(r.x=l=0,r.y=u=0),r.width=n,r.height=i,Xg(s.set(l,u,l+n,u+i),r),r.mark.bounds.clear().union(s),r}function W_(e,t,n,i,r,o,a){const s="symbol"!==e.datum.type,l=n.datum.vgrad,u=(!s||!o&&l||a?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,c=l&&o?u:0,f=l&&o?0:u,d=r<=0?0:Mv(n);return Math.round(i===Wx?c:i===Gx?f-d:.5*(u-d))}function H_(e,t,n,i){t.x+=n,t.y+=i,t.bounds.translate(n,i),t.mark.bounds.translate(n,i),e.dirty(t)}function G_(e){Es.call(this,null,e)}function V_(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function Y_(e){Es.call(this,null,e)}function X_(e){Es.call(this,null,e)}function J_(){return Ya({})}function Q_(e){Es.call(this,null,e)}function Z_(e){Es.call(this,[],e)}_t(G_,Es,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach((t=>{e.layout&&function(e,t,n){var i,r,o,a,s,l,u,c=function(e){var t,n,i=e.items,r=i.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o{(o=e.orient||Ux)!==s_&&(t[o]||(t[o]=[])).push(e)}));for(const i in t){const r=t[i];P_(e,r,U_(r,i,n.legends,d,h,u,c))}p.forEach((t=>{const i=t.bounds;if(i.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=i,e.dirty(t)),!n.autosize||"fit"!==n.autosize.type&&n.autosize.type!==o_&&n.autosize.type!==a_)f.union(i);else switch(t.orient){case Ix:case Ux:f.add(i.x1,0).add(i.x2,0);break;case jx:case qx:f.add(0,i.y1).add(0,i.y2)}}))}f.union(d).union(h),i&&f.union(function(e,t,n,i,r){var o,a=t.items[0],s=a.frame,l=a.orient,u=a.anchor,c=a.offset,f=a.padding,d=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],p=l===Ix||l===Ux?i:n,m=0,g=0,y=0,v=0,b=0;if(s!==Xx?l===Ix?(m=r.y2,p=r.y1):l===Ux?(m=r.y1,p=r.y2):(m=r.x1,p=r.x2):l===Ix&&(m=i,p=0),o=u===Wx?m:u===Gx?p:(m+p)/2,h&&h.text){switch(l){case jx:case qx:b=d.bounds.height()+f;break;case Ix:v=d.bounds.width()+f;break;case Ux:v=-d.bounds.width()-f}$_.clear().union(h.bounds),$_.translate(v-(h.x||0),b-(h.y||0)),D_(h,"x",v)|D_(h,"y",b)&&(e.dirty(h),h.bounds.clear().union($_),h.mark.bounds.clear().union($_),e.dirty(h)),$_.clear().union(h.bounds)}else $_.clear();switch($_.union(d.bounds),l){case jx:g=o,y=r.y1-$_.height()-c;break;case Ix:g=r.x1-$_.width()-c,y=o;break;case Ux:g=r.x2+$_.width()+c,y=o;break;case qx:g=o,y=r.y2+c;break;default:g=a.x,y=a.y}return D_(a,"x",g)|D_(a,"y",y)&&($_.translate(g,y),e.dirty(a),a.bounds.clear().union($_),t.bounds.clear().union($_),e.dirty(a)),a.bounds}(e,i,u,c,f)),t.clip&&f.set(0,0,t.width||0,t.height||0),function(e,t,n,i){const r=i.autosize||{},o=r.type;if(e._autosize<1||!o)return;let a=e._width,s=e._height,l=Math.max(0,t.width||0),u=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-l)),h=Math.max(0,Math.ceil(n.y2-c));if("padding"===r.contains){const t=e.padding();a-=t.left+t.right,s-=t.top+t.bottom}o===s_?(u=0,f=0,l=a,c=s):"fit"===o?(l=Math.max(0,a-u-d),c=Math.max(0,s-f-h)):o===o_?(l=Math.max(0,a-u-d),s=c+f+h):o===a_?(a=l+u+d,c=Math.max(0,s-f-h)):"pad"===o&&(a=l+u+d,s=c+f+h),e._resizeView(a,s,l,c,[u,f],r.resize)}(e,t,f,n)}(n,t,e)})),function(e){return e&&"legend-entry"!==e.mark.role}(e.mark.group)?t.reflow():t}}),_t(Y_,Es,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,o=e.scale,a=$m(o,null==e.count?e.values?e.values.length:10:e.count,e.minstep),s=e.format||Mm(n,o,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?Dm(o,e.values,a):Sm(o,a);return r&&(i.rem=r),r=l.map(((e,t)=>Ya({index:t/(l.length-1||1),value:e,label:s(e)}))),e.extra&&r.length&&r.push(Ya({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),_t(X_,Es,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||J_,o=e.key||Ga,a=this.value;return Fe(i.encode)&&(i.encode=null),a&&(e.modified("key")||t.modified(o))&&me("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=function(e){const t=bt().test((e=>e.exit));return t.lookup=n=>t.get(e(n)),t}(o)),t.visit(t.ADD,(e=>{const t=o(e);let n=a.get(t);n?n.exit?(a.empty--,i.add.push(n)):i.mod.push(n):(n=r(e),a.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1})),t.visit(t.MOD,(e=>{const t=o(e),n=a.get(t);n&&(n.datum=e,i.mod.push(n))})),t.visit(t.REM,(e=>{const t=o(e),n=a.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++a.empty)})),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),i}}),_t(Q_,Es,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,o=t.encode;if(Fe(o)){if(!n.changed()&&!o.every((e=>r[e])))return t.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,s=r.update||ke,l=r.enter||ke,u=r.exit||ke,c=(o&&!a?r[o]:s)||ke;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{l(t,e),s(t,e)})),n.modifies(l.output),n.modifies(s.output),c!==ke&&c!==s&&(t.visit(t.ADD,(t=>{c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&u!==ke&&(t.visit(t.REM,(t=>{u(t,e)})),n.modifies(u.output)),a||c!==ke){const r=t.MOD|(e.modified()?t.REFLOW:0);a?(t.visit(r,(t=>{const r=l(t,e)||i;(c(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(l.output)):t.visit(r,(t=>{(c(t,e)||i)&&n.mod.push(t)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}}),_t(Z_,Es,{transform(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,i,r,o,a,s=t.dataflow.locale(),l=t.fork(t.NO_SOURCE|t.NO_FIELDS),u=this.value,c=e.type||_m,f=e.scale,d=+e.limit,h=$m(f,null==e.count?5:e.count,e.minstep),p=!!e.values||c===_m,m=e.format||zm(s,f,h,c,e.formatSpecifier,e.formatType,p),g=e.values||Nm(f,h);return u&&(l.rem=u),c===_m?(d&&g.length>d?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),u=g.slice(0,d-1),a=!0):u=g,rt(r=e.size)?(e.values||0!==f(u[0])||(u=u.slice(1)),o=u.reduce(((t,n)=>Math.max(t,r(n,e))),0)):r=ft(o=r||8),u=u.map(((t,n)=>Ya({index:n,label:m(t,n,u),value:t,offset:o,size:r(t,e)}))),a&&(a=g[u.length],u.push(Ya({index:u.length,label:`…${g.length-u.length} entries`,value:a,offset:o,size:r(a,e)})))):"gradient"===c?(n=f.domain(),i=mm(f,n[0],Pe(n)),g.length<3&&!e.values&&n[0]!==Pe(n)&&(g=[n[0],Pe(n)]),u=g.map(((e,t)=>Ya({index:t,label:m(e,t,g),value:e,perc:i(e)})))):(r=g.length-1,i=function(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+Pe(t),o=r-i;if(e.type===Bp){const e=n?o/n:.1;i-=e,r+=e,o=r-i}return e=>(e-i)/o}(f),u=g.map(((e,t)=>Ya({index:t,label:m(e,t,g),value:e,perc:t?i(e):0,perc2:t===r?1:i(g[t+1])})))),l.source=u,l.add=u,this.value=u,l}});const K_=e=>e.source.x,ew=e=>e.source.y,tw=e=>e.target.x,nw=e=>e.target.y;function iw(e){Es.call(this,{},e)}iw.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},_t(iw,Es,{transform(e,t){var n=e.sourceX||K_,i=e.sourceY||ew,r=e.targetX||tw,o=e.targetY||nw,a=e.as||"path",s=e.orient||"vertical",l=e.shape||"line",u=sw.get(l+"-"+s)||sw.get(l);return u||me("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[a]=u(n(e),i(e),r(e),o(e))})),t.reflow(e.modified()).modifies(a)}});const rw=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,ow=(e,t,n,i)=>{var r=n-e,o=i-t,a=Math.hypot(r,o)/2;return"M"+e+","+t+"A"+a+","+a+" "+180*Math.atan2(o,r)/Math.PI+" 0 1 "+n+","+i},aw=(e,t,n,i)=>{const r=n-e,o=i-t,a=.2*(r+o),s=.2*(o-r);return"M"+e+","+t+"C"+(e+a)+","+(t+s)+" "+(n+s)+","+(i-a)+" "+n+","+i},sw=bt({line:rw,"line-radial":(e,t,n,i)=>rw(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:ow,"arc-radial":(e,t,n,i)=>ow(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:aw,"curve-radial":(e,t,n,i)=>aw(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),"orthogonal-horizontal":(e,t,n,i)=>"M"+e+","+t+"V"+i+"H"+n,"orthogonal-vertical":(e,t,n,i)=>"M"+e+","+t+"H"+n+"V"+i,"orthogonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n);return"M"+t*r+","+t*o+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*a+","+t*s+"L"+i*a+","+i*s},"diagonal-horizontal":(e,t,n,i)=>{const r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+i+" "+n+","+i},"diagonal-vertical":(e,t,n,i)=>{const r=(t+i)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+i},"diagonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),l=(t+i)/2;return"M"+t*r+","+t*o+"C"+l*r+","+l*o+" "+l*a+","+l*s+" "+i*a+","+i*s}});function lw(e){Es.call(this,null,e)}lw.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},_t(lw,Es,{transform(e,t){var n,i,r,o=e.as||["startAngle","endAngle"],a=o[0],s=o[1],l=e.field||_e,u=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(l),h=d.length,p=u,m=(c-u)/V_(d),g=Tl(h);for(e.sort&&g.sort(((e,t)=>d[e]-d[t])),n=0;ne+(t<0?-1:t>0?1:0)),0))!==t.length&&n.warn("Log scale domain includes zero: "+Pt(t)));return t}function hw(e,t,n){return rt(e)&&(t||n)?dm(e,pw(t||[0,1],n)):e}function pw(e,t){return t?e.slice().reverse():e}function mw(e){Es.call(this,null,e)}_t(fw,Es,{transform(e,t){var n=t.dataflow,i=this.value,r=function(e){var t,n=e.type,i="";return n===zp?zp+"-"+Sp:(function(e){const t=e.type;return om(t)&&t!==Np&&t!==Tp&&(e.scheme||e.range&&e.range.length&&e.range.every(St))}(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?zp+"-":3===t?Rp+"-":""),(i+n||Sp).toLowerCase())}(e);for(r in i&&r===i.type||(this.value=i=nm(r)()),e)if(!cw[r]){if("padding"===r&&uw(i.type))continue;rt(i[r])?i[r](e[r]):n.warn("Unsupported scale property: "+r)}return function(e,t,n){var i=e.type,r=t.round||!1,o=t.range;if(null!=t.rangeStep)o=function(e,t,n){e!==Up&&e!==Ip&&me("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===Ip?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*Dp(n,r,i)]}(i,t,n);else if(t.scheme&&(o=function(e,t,n){var i,r=t.schemeExtent;return Fe(t.scheme)?i=hm(t.scheme,t.interpolate,t.interpolateGamma):(i=xm(t.scheme.toLowerCase()))||me(`Unrecognized scheme name: ${t.scheme}`),n=e===Bp?n+1:e===qp?n-1:e===Pp||e===Lp?+t.schemeCount||5:n,um(e)?hw(i,r,t.reverse):rt(i)?pm(hw(i,r),n):e===jp?i:i.slice(0,n)}(i,t,n),rt(o))){if(e.interpolator)return e.interpolator(o);me(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&um(i))return e.interpolator(hm(pw(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(gm(t.interpolate,t.interpolateGamma)):rt(e.round)?e.round(r):rt(e.rangeRound)&&e.interpolate(r?Fd:Cd),o&&e.range(pw(o,t.reverse))}(i,e,function(e,t,n){let i=t.bins;if(i&&!Fe(i)){const t=e.domain(),n=t[0],r=Pe(t),o=i.step;let a=null==i.start?n:i.start,s=null==i.stop?r:i.stop;o||me("Scale bins parameter missing step property."),ar&&(s=o*Math.floor(r/o)),i=Tl(a,s+o/2,o)}return i?e.bins=i:e.bins&&delete e.bins,e.type===qp&&(i?t.domain||t.domainRaw||(e.domain(i),n=i.length):e.bins=e.domain()),n}(i,e,function(e,t,n){const i=function(e,t,n){return t?(e.domain(dw(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(i>-1)return i;var r,o,a=t.domain,s=e.type,l=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===Sp||t===Cp||t===Fp)}(e);if(!a)return 0;if(uw(s)&&t.padding&&a[0]!==Pe(a)&&(a=function(e,t,n,i,r,o){var a=Math.abs(Pe(n)-n[0]),s=a/(a-2*i),l=e===Mp?Qe(t,null,s):e===Fp?Ze(t,null,s,.5):e===Cp?Ze(t,null,s,r||1):e===Op?Ke(t,null,s,o||1):Je(t,null,s);return(t=t.slice())[0]=l[0],t[t.length-1]=l[1],t}(s,a,t.range,t.padding,t.exponent,t.constant)),(l||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(r=(a=a.slice()).length-1||1,l&&(a[0]>0&&(a[0]=0),a[r]<0&&(a[r]=0)),null!=t.domainMin&&(a[0]=t.domainMin),null!=t.domainMax&&(a[r]=t.domainMax),null!=t.domainMid)){const e=(o=t.domainMid)>a[r]?r+1:oe(l);if(null==t)h.push(e.slice());else for(r={},o=0,a=e.length;od&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,u,c),i=0,r=n.length,o=n.max;ie;function Aw(e,t){e&&Dw.hasOwnProperty(e.type)&&Dw[e.type](e,t)}var $w={Feature:function(e,t){Aw(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i0){for(o=e[--r];r>0&&(t=o,n=e[--r],o=t+n,i=n-(o-t),!i););r>0&&(i<0&&e[r-1]<0||i>0&&e[r-1]>0)&&(n=2*i,t=o+n,n==t-o&&(o=t))}return o}}var Ow=1e-6,Nw=1e-12,Tw=Math.PI,zw=Tw/2,Rw=Tw/4,Pw=2*Tw,Lw=180/Tw,Bw=Tw/180,jw=Math.abs,Iw=Math.atan,Uw=Math.atan2,qw=Math.cos,Ww=Math.ceil,Hw=Math.exp,Gw=(Math.floor,Math.hypot),Vw=Math.log,Yw=Math.pow,Xw=Math.sin,Jw=Math.sign||function(e){return e>0?1:e<0?-1:0},Qw=Math.sqrt,Zw=Math.tan;function Kw(e){return e>1?0:e<-1?Tw:Math.acos(e)}function ek(e){return e>1?zw:e<-1?-zw:Math.asin(e)}function tk(){}var nk,ik,rk,ok,ak=new Fw,sk=new Fw,lk={point:tk,lineStart:tk,lineEnd:tk,polygonStart:function(){lk.lineStart=uk,lk.lineEnd=dk},polygonEnd:function(){lk.lineStart=lk.lineEnd=lk.point=tk,ak.add(jw(sk)),sk=new Fw},result:function(){var e=ak/2;return ak=new Fw,e}};function uk(){lk.point=ck}function ck(e,t){lk.point=fk,nk=rk=e,ik=ok=t}function fk(e,t){sk.add(ok*e-rk*t),rk=e,ok=t}function dk(){fk(nk,ik)}const hk=lk;var pk=1/0,mk=pk,gk=-pk,yk=gk,vk={point:function(e,t){egk&&(gk=e),tyk&&(yk=t)},lineStart:tk,lineEnd:tk,polygonStart:tk,polygonEnd:tk,result:function(){var e=[[pk,mk],[gk,yk]];return gk=yk=-(mk=pk=1/0),e}};const bk=vk;var xk,_k,wk,kk,Ek=0,Ak=0,$k=0,Dk=0,Sk=0,Mk=0,Ck=0,Fk=0,Ok=0,Nk={point:Tk,lineStart:zk,lineEnd:Lk,polygonStart:function(){Nk.lineStart=Bk,Nk.lineEnd=jk},polygonEnd:function(){Nk.point=Tk,Nk.lineStart=zk,Nk.lineEnd=Lk},result:function(){var e=Ok?[Ck/Ok,Fk/Ok]:Mk?[Dk/Mk,Sk/Mk]:$k?[Ek/$k,Ak/$k]:[NaN,NaN];return Ek=Ak=$k=Dk=Sk=Mk=Ck=Fk=Ok=0,e}};function Tk(e,t){Ek+=e,Ak+=t,++$k}function zk(){Nk.point=Rk}function Rk(e,t){Nk.point=Pk,Tk(wk=e,kk=t)}function Pk(e,t){var n=e-wk,i=t-kk,r=Qw(n*n+i*i);Dk+=r*(wk+e)/2,Sk+=r*(kk+t)/2,Mk+=r,Tk(wk=e,kk=t)}function Lk(){Nk.point=Tk}function Bk(){Nk.point=Ik}function jk(){Uk(xk,_k)}function Ik(e,t){Nk.point=Uk,Tk(xk=wk=e,_k=kk=t)}function Uk(e,t){var n=e-wk,i=t-kk,r=Qw(n*n+i*i);Dk+=r*(wk+e)/2,Sk+=r*(kk+t)/2,Mk+=r,Ck+=(r=kk*e-wk*t)*(wk+e),Fk+=r*(kk+t),Ok+=3*r,Tk(wk=e,kk=t)}const qk=Nk;function Wk(e){this._context=e}Wk.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Pw)}},result:tk};var Hk,Gk,Vk,Yk,Xk,Jk=new Fw,Qk={point:tk,lineStart:function(){Qk.point=Zk},lineEnd:function(){Hk&&Kk(Gk,Vk),Qk.point=tk},polygonStart:function(){Hk=!0},polygonEnd:function(){Hk=null},result:function(){var e=+Jk;return Jk=new Fw,e}};function Zk(e,t){Qk.point=Kk,Gk=Yk=e,Vk=Xk=t}function Kk(e,t){Yk-=e,Xk-=t,Jk.add(Qw(Yk*Yk+Xk*Xk)),Yk=e,Xk=t}const eE=Qk;let tE,nE,iE,rE;class oE{constructor(e){this._append=null==e?aE:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return aE;if(t!==tE){const e=10**t;tE=t,nE=function(t){let n=1;this._+=t[0];for(const i=t.length;n=0))throw new RangeError(`invalid digits: ${e}`);r=t}return null===t&&(i=new oE(r)),a},a.projection(e).digits(r).context(t)}function lE(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:tk,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function uE(e,t){return jw(e[0]-t[0])=0;--o)r.point((c=u[o])[0],c[1]);else i(d.x,d.p.x,-1,r);d=d.p}u=(d=d.o).z,h=!h}while(!d.v);r.lineEnd()}}}function dE(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i=0?1:-1,$=A*E,D=$>Tw,S=g*w;if(l.add(Uw(S*A*Xw($),y*k+S*qw($))),a+=D?E+A*Pw:E,D^p>=n^x>=n){var M=gE(pE(h),pE(b));bE(M);var C=gE(o,M);bE(C);var F=(D^E>=0?-1:1)*ek(C[2]);(i>F||i===F&&(M[0]||M[1]))&&(s+=D^E>=0?1:-1)}}return(a<-Ow||a0){for(f||(r.polygonStart(),f=!0),r.lineStart(),e=0;e1&&2&l&&d.push(d.pop().concat(d.shift())),a.push(d.filter(kE))}return d}}function kE(e){return e.length>1}function EE(e,t){return((e=e.x)[0]<0?e[1]-zw-Ow:zw-e[1])-((t=t.x)[0]<0?t[1]-zw-Ow:zw-t[1])}const AE=wE((function(){return!0}),(function(e){var t,n=NaN,i=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?Tw:-Tw,l=jw(o-n);jw(l-Tw)0?zw:-zw),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(o,i),t=0):r!==s&&l>=Tw&&(jw(n-r)Ow?Iw((Xw(t)*(o=qw(i))*Xw(n)-Xw(i)*(r=qw(t))*Xw(e))/(r*o*a)):(t+i)/2}(n,i,o,a),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),t=0),e.point(n=o,i=a),r=s},lineEnd:function(){e.lineEnd(),n=i=NaN},clean:function(){return 2-t}}}),(function(e,t,n,i){var r;if(null==e)r=n*zw,i.point(-Tw,r),i.point(0,r),i.point(Tw,r),i.point(Tw,0),i.point(Tw,-r),i.point(0,-r),i.point(-Tw,-r),i.point(-Tw,0),i.point(-Tw,r);else if(jw(e[0]-t[0])>Ow){var o=e[0]0)do{u.point(0===c||3===c?e:n,c>1?i:t)}while((c=(c+s+4)%4)!==f);else u.point(o[0],o[1])}function a(i,r){return jw(i[0]-e)0?0:3:jw(i[0]-n)0?2:1:jw(i[1]-t)0?1:0:r>0?3:2}function s(e,t){return l(e.x,t.x)}function l(e,t){var n=a(e,1),i=a(t,1);return n!==i?n-i:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){var l,u,c,f,d,h,p,m,g,y,v,b=a,x=lE(),_={point:w,lineStart:function(){_.point=k,u&&u.push(c=[]),y=!0,g=!1,p=m=NaN},lineEnd:function(){l&&(k(f,d),h&&g&&x.rejoin(),l.push(x.result())),_.point=w,g&&b.lineEnd()},polygonStart:function(){b=x,l=[],u=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,r=u.length;ni&&(d-o)*(i-a)>(h-a)*(e-o)&&++t:h<=i&&(d-o)*(i-a)<(h-a)*(e-o)&&--t;return t}(),n=v&&t,r=(l=_E(l)).length;(n||r)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),r&&fE(l,s,t,o,a),a.polygonEnd()),b=a,l=u=c=null}};function w(e,t){r(e,t)&&b.point(e,t)}function k(o,a){var s=r(o,a);if(u&&c.push([o,a]),y)f=o,d=a,h=s,y=!1,s&&(b.lineStart(),b.point(o,a));else if(s&&g)b.point(o,a);else{var l=[p=Math.max(SE,Math.min(DE,p)),m=Math.max(SE,Math.min(DE,m))],x=[o=Math.max(SE,Math.min(DE,o)),a=Math.max(SE,Math.min(DE,a))];!function(e,t,n,i,r,o){var a,s=e[0],l=e[1],u=0,c=1,f=t[0]-s,d=t[1]-l;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>c)return;a>u&&(u=a)}if(a=r-s,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>u&&(u=a)}else if(f>0){if(a0)){if(a/=d,d<0){if(a0){if(a>c)return;a>u&&(u=a)}if(a=o-l,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>u&&(u=a)}else if(d>0){if(a0&&(e[0]=s+u*f,e[1]=l+u*d),c<1&&(t[0]=s+c*f,t[1]=l+c*d),!0}}}}}(l,x,e,t,n,i)?s&&(b.lineStart(),b.point(o,a),v=!1):(g||(b.lineStart(),b.point(l[0],l[1])),b.point(x[0],x[1]),s||b.lineEnd(),v=!1)}p=o,m=a,g=s}return _}}function CE(e,t){function n(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,i){return(n=t.invert(n,i))&&e.invert(n[0],n[1])}),n}function FE(e,t){return jw(e)>Tw&&(e-=Math.round(e/Pw)*Pw),[e,t]}function OE(e,t,n){return(e%=Pw)?t||n?CE(TE(e),zE(t,n)):TE(e):t||n?zE(t,n):FE}function NE(e){return function(t,n){return jw(t+=e)>Tw&&(t-=Math.round(t/Pw)*Pw),[t,n]}}function TE(e){var t=NE(e);return t.invert=NE(-e),t}function zE(e,t){var n=qw(e),i=Xw(e),r=qw(t),o=Xw(t);function a(e,t){var a=qw(t),s=qw(e)*a,l=Xw(e)*a,u=Xw(t),c=u*n+s*i;return[Uw(l*r-c*o,s*n-u*i),ek(c*r+l*o)]}return a.invert=function(e,t){var a=qw(t),s=qw(e)*a,l=Xw(e)*a,u=Xw(t),c=u*r-l*o;return[Uw(l*r+u*o,s*n+c*i),ek(c*n-s*i)]},a}function RE(e){return function(t){var n=new PE;for(var i in e)n[i]=e[i];return n.stream=t,n}}function PE(){}function LE(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),Cw(n,e.stream(bk)),t(bk.result()),null!=i&&e.clipExtent(i),e}function BE(e,t,n){return LE(e,(function(n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],o=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),a=+t[0][0]+(i-o*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(r-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,s])}),n)}function jE(e,t,n){return BE(e,[[0,0],t],n)}function IE(e,t,n){return LE(e,(function(n){var i=+t,r=i/(n[1][0]-n[0][0]),o=(i-r*(n[1][0]+n[0][0]))/2,a=-r*n[0][1];e.scale(150*r).translate([o,a])}),n)}function UE(e,t,n){return LE(e,(function(n){var i=+t,r=i/(n[1][1]-n[0][1]),o=-r*n[0][0],a=(i-r*(n[1][1]+n[0][1]))/2;e.scale(150*r).translate([o,a])}),n)}FE.invert=FE,PE.prototype={constructor:PE,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var qE=16,WE=qw(30*Bw);function HE(e,t){return+t?function(e,t){function n(i,r,o,a,s,l,u,c,f,d,h,p,m,g){var y=u-i,v=c-r,b=y*y+v*v;if(b>4*t&&m--){var x=a+d,_=s+h,w=l+p,k=Qw(x*x+_*_+w*w),E=ek(w/=k),A=jw(jw(w)-1)t||jw((y*M+v*C)/b-.5)>.3||a*d+s*h+l*p0,r=jw(t)>Ow;function o(e,n){return qw(e)*qw(n)>t}function a(e,n,i){var r=[1,0,0],o=gE(pE(e),pE(n)),a=mE(o,o),s=o[0],l=a-s*s;if(!l)return!i&&e;var u=t*a/l,c=-t*s/l,f=gE(r,o),d=vE(r,u);yE(d,vE(o,c));var h=f,p=mE(d,h),m=mE(h,h),g=p*p-m*(mE(d,d)-1);if(!(g<0)){var y=Qw(g),v=vE(h,(-p-y)/m);if(yE(v,d),v=hE(v),!i)return v;var b,x=e[0],_=n[0],w=e[1],k=n[1];_0^v[1]<(jw(v[0]-x)Tw^(x<=v[0]&&v[0]<=_)){var $=vE(h,(-p+y)/m);return yE($,d),[v,hE($)]}}}function s(t,n){var r=i?e:Tw-e,o=0;return t<-r?o|=1:t>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return wE(o,(function(e){var t,n,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,d){var h,p=[f,d],m=o(f,d),g=i?m?0:s(f,d):m?s(f+(f<0?Tw:-Tw),d):0;if(!t&&(u=l=m)&&e.lineStart(),m!==l&&(!(h=a(t,p))||uE(t,h)||uE(p,h))&&(p[2]=1),m!==l)c=0,m?(e.lineStart(),h=a(p,t),e.point(h[0],h[1])):(h=a(t,p),e.point(h[0],h[1],2),e.lineEnd()),t=h;else if(r&&t&&i^m){var y;g&n||!(y=a(p,t,!0))||(c=0,i?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||t&&uE(t,p)||e.point(p[0],p[1]),t=p,l=m,n=g},lineEnd:function(){l&&e.lineEnd(),t=null},clean:function(){return c|(u&&l)<<1}}}),(function(t,i,r,o){!function(e,t,n,i,r,o){if(n){var a=qw(t),s=Xw(t),l=i*n;null==r?(r=t+i*Pw,o=t-l/2):(r=$E(a,r),o=$E(a,o),(i>0?ro)&&(r+=i*Pw));for(var u,c=r;i>0?c>o:c2?e[2]%360*Bw:0,M()):[g*Lw,y*Lw,v*Lw]},D.angle=function(e){return arguments.length?(b=e%360*Bw,M()):b*Lw},D.reflectX=function(e){return arguments.length?(x=e?-1:1,M()):x<0},D.reflectY=function(e){return arguments.length?(_=e?-1:1,M()):_<0},D.precision=function(e){return arguments.length?(a=HE(s,$=e*e),C()):Qw($)},D.fitExtent=function(e,t){return BE(D,e,t)},D.fitSize=function(e,t){return jE(D,e,t)},D.fitWidth=function(e,t){return IE(D,e,t)},D.fitHeight=function(e,t){return UE(D,e,t)},function(){return t=e.apply(this,arguments),D.invert=t.invert&&S,M()}}function JE(e){var t=0,n=Tw/3,i=XE(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*Bw,n=e[1]*Bw):[t*Lw,n*Lw]},r}function QE(e,t){var n=Xw(e),i=(n+Xw(t))/2;if(jw(i)2?e[2]*Bw:0),t.invert=function(t){return(t=e.invert(t[0]*Bw,t[1]*Bw))[0]*=Lw,t[1]*=Lw,t},t}(r.rotate()).invert([0,0]));return l(null==u?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:e===rA?[[Math.max(s[0]-o,u),t],[Math.min(s[0]+o,n),i]]:[[u,Math.max(s[1]-o,t)],[n,Math.min(s[1]+o,i)]])}return r.scale=function(e){return arguments.length?(a(e),c()):a()},r.translate=function(e){return arguments.length?(s(e),c()):s()},r.center=function(e){return arguments.length?(o(e),c()):o()},r.clipExtent=function(e){return arguments.length?(null==e?u=t=n=i=null:(u=+e[0][0],t=+e[0][1],n=+e[1][0],i=+e[1][1]),c()):null==u?null:[[u,t],[n,i]]},c()}function aA(e){return Zw((zw+e)/2)}function sA(e,t){var n=qw(e),i=e===t?Xw(e):Vw(n/qw(t))/Vw(aA(t)/aA(e)),r=n*Yw(aA(e),i)/i;if(!i)return rA;function o(e,t){r>0?t<-zw+Ow&&(t=-zw+Ow):t>zw-Ow&&(t=zw-Ow);var n=r/Yw(aA(t),i);return[n*Xw(i*e),r-n*qw(i*e)]}return o.invert=function(e,t){var n=r-t,o=Jw(i)*Qw(e*e+n*n),a=Uw(e,jw(n))*Jw(n);return n*i<0&&(a-=Tw*Jw(e)*Jw(n)),[a/i,2*Iw(Yw(r/o,1/i))-zw]},o}function lA(e,t){return[e,t]}function uA(e,t){var n=qw(e),i=e===t?Xw(e):(n-qw(t))/(t-e),r=n/i+e;if(jw(i)Ow&&--r>0);return[e/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},vA.invert=tA(ek),bA.invert=tA((function(e){return 2*Iw(e)})),xA.invert=function(e,t){return[-t,2*Iw(Hw(e))-zw]};var _A=Math.abs,wA=(Math.atan,Math.atan2,Math.ceil,Math.cos),kA=(Math.exp,Math.floor,Math.log,Math.max,Math.min,Math.pow,Math.round,Math.sign,Math.sin),EA=(Math.tan,1e-6),AA=Math.PI,$A=AA/2,DA=(Math.SQRT1_2,MA(2));function SA(e){return e>1?$A:e<-1?-$A:Math.asin(e)}function MA(e){return e>0?Math.sqrt(e):0}function CA(e,t){var n,i=e*kA(t),r=30;do{t-=n=(t+kA(t)-i)/(1+wA(t))}while(_A(n)>EA&&--r>0);return t/2}MA(AA);var FA=function(e,t,n){function i(i,r){return[e*i*wA(r=CA(n,r)),t*kA(r)]}return i.invert=function(i,r){return r=SA(r/t),[i/(e*wA(r)),SA((2*r+kA(2*r))/n)]},i}(DA/$A,DA,AA);const OA=sE(),NA=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function TA(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(RA[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=sE().projection(i),i.copy=i.copy||function(){const e=n();return NA.forEach((t=>{i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},tm(i)}}(e,t),this):RA[e]||null}function zA(e){return e&&e.path||OA}const RA={albers:KE,albersusa:function(){var e,t,n,i,r,o,a=KE(),s=ZE().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=ZE().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(e,t){o=[e,t]}};function c(e){var t=e[0],a=e[1];return o=null,n.point(t,a),o||(i.point(t,a),o)||(r.point(t,a),o)}function f(){return e=t=null,c}return c.invert=function(e){var t=a.scale(),n=a.translate(),i=(e[0]-n[0])/t,r=(e[1]-n[1])/t;return(r>=.12&&r<.234&&i>=-.425&&i<-.214?s:r>=.166&&r<.234&&i>=-.214&&i<-.115?l:a).invert(e)},c.stream=function(n){return e&&t===n?e:(i=[a.stream(t=n),s.stream(n),l.stream(n)],r=i.length,e={point:function(e,t){for(var n=-1;++n2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)}};for(const e in RA)TA(e,RA[e]);function PA(e,t,n){var i=Tl(e,t-Ow,n).concat(t);return function(e){return i.map((function(t){return[e,t]}))}}function LA(e,t,n){var i=Tl(e,t-Ow,n).concat(t);return function(e){return i.map((function(t){return[t,e]}))}}function BA(){}const jA=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function IA(){var e=1,t=1,n=a;function i(e,t){return t.map((t=>r(e,t)))}function r(i,r){var a=[],s=[];return function(n,i,r){var a,s,l,u,c,f,d=new Array,h=new Array;for(a=s=-1,u=n[0]>=i,jA[u<<1].forEach(p);++a=i,jA[l|u<<1].forEach(p);for(jA[u<<0].forEach(p);++s=i,c=n[s*e]>=i,jA[u<<1|c<<2].forEach(p);++a=i,f=c,c=n[s*e+a+1]>=i,jA[l|u<<1|c<<2|f<<3].forEach(p);jA[u|c<<3].forEach(p)}for(a=-1,c=n[s*e]>=i,jA[c<<2].forEach(p);++a=i,jA[c<<2|f<<3].forEach(p);function p(e){var t,n,i=[e[0][0]+a,e[0][1]+s],l=[e[1][0]+a,e[1][1]+s],u=o(i),c=o(l);(t=h[u])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(l),r(t.ring)):d[t.start]=h[n.end]={start:t.start,end:n.end,ring:t.ring.concat(n.ring)}):(delete h[t.end],t.ring.push(l),h[t.end=c]=t):(t=d[c])?(n=h[u])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(l),r(t.ring)):d[n.start]=h[t.end]={start:n.start,end:t.end,ring:n.ring.concat(t.ring)}):(delete d[t.start],t.ring.unshift(i),d[t.start=u]=t):d[u]=h[c]={start:u,end:c,ring:[i,l]}}jA[c<<3].forEach(p)}(i,r,(e=>{n(e,i,r),function(e){for(var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t0?a.push([e]):s.push(e)})),s.forEach((e=>{for(var t,n=0,i=a.length;n{var o,a=n[0],s=n[1],l=0|a,u=0|s,c=i[u*e+l];a>0&&a0&&s=0&&o>=0||me("invalid size"),e=r,t=o,i},i.smooth=function(e){return arguments.length?(n=e?a:BA,i):n===a},i}function UA(e,t){for(var n,i=-1,r=t.length;++ii!=h>i&&n<(d-u)*(i-c)/(h-c)+u&&(r=-r)}return r}function WA(e,t,n){var i,r,o,a;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])==(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&(r=e[i=+(e[0]===t[0])],o=n[i],a=t[i],r<=o&&o<=a||a<=o&&o<=r)}function HA(e,t,n){return function(i){var r=pt(i),o=n?Math.min(r[0],0):r[0],a=r[1],s=a-o,l=t?pn(o,a,e):s/(e+1);return Tl(o+l,a,l)}}function GA(e){Es.call(this,null,e)}function VA(e,t,n,i,r){const o=e.x1||0,a=e.y1||0,s=t*n<0;function l(e){e.forEach(u)}function u(e){s&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-o)*t+i,e[1]=(e[1]-a)*n+r}return function(e){return e.coordinates.forEach(l),e}}function YA(e,t,n){const i=e>=0?e:js(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function XA(e){return rt(e)?e:ft(+e)}function JA(){var e=e=>e[0],t=e=>e[1],n=_e,i=[-1,-1],r=960,o=500,a=2;function s(s,l){const u=YA(i[0],s,e)>>a,c=YA(i[1],s,t)>>a,f=u?u+2:0,d=c?c+2:0,h=2*f+(r>>a),p=2*d+(o>>a),m=new Float32Array(h*p),g=new Float32Array(h*p);let y=m;s.forEach((i=>{const r=f+(+e(i)>>a),o=d+(+t(i)>>a);r>=0&&r=0&&o0&&c>0?(QA(h,p,m,g,u),ZA(h,p,g,m,c),QA(h,p,m,g,u),ZA(h,p,g,m,c),QA(h,p,m,g,u),ZA(h,p,g,m,c)):u>0?(QA(h,p,m,g,u),QA(h,p,g,m,u),QA(h,p,m,g,u),y=g):c>0&&(ZA(h,p,m,g,c),ZA(h,p,g,m,c),ZA(h,p,m,g,c),y=g);const v=l?Math.pow(2,-2*a):1/V_(y);for(let e=0,t=h*p;e>a),y2:d+(o>>a)}}return s.x=function(t){return arguments.length?(e=XA(t),s):e},s.y=function(e){return arguments.length?(t=XA(e),s):t},s.weight=function(e){return arguments.length?(n=XA(e),s):n},s.size=function(e){if(!arguments.length)return[r,o];var t=+e[0],n=+e[1];return t>=0&&n>=0||me("invalid size"),r=t,o=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||me("invalid cell size"),a=Math.floor(Math.log(e)/Math.LN2),s):1<=r&&(t>=o&&(s-=n[t-o+a*e]),i[t-r+a*e]=s/Math.min(t+1,e-1+o-t,o))}function ZA(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a=r&&(s>=o&&(l-=n[a+(s-o)*e]),i[a+(s-r)*e]=l/Math.min(s+1,t-1+o-s,o))}function KA(e){Es.call(this,null,e)}GA.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},_t(GA,Es,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=e.field||be,o=IA().smooth(!1!==e.smooth),a=e.thresholds||function(e,t,n){const i=HA(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map((e=>Ss(t(e).values))))}(i,r,e),s=null===e.as?null:e.as||"contour",l=[];return i.forEach((t=>{const n=r(t),i=o.size([n.width,n.height])(n.values,Fe(a)?a:a(n.values));!function(e,t,n,i){let r=i.scale||t.scale,o=i.translate||t.translate;if(rt(r)&&(r=r(n,i)),rt(o)&&(o=o(n,i)),(1===r||null==r)&&!o)return;const a=($t(r)?r:r[0])||1,s=($t(r)?r:r[1])||1,l=o&&o[0]||0,u=o&&o[1]||0;e.forEach(VA(t,a,s,l,u))}(i,n,t,e),i.forEach((e=>{l.push(Ja(t,Ya(null!=s?{[s]:e}:e)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=l,n}}),KA.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const e$=["x","y","weight","size","cellSize","bandwidth"];function t$(e,t){return e$.forEach((n=>null!=t[n]?e[n](t[n]):0)),e}function n$(e){Es.call(this,null,e)}_t(KA,Es,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=function(e,t){var n,i,r,o,a,s,l=[],u=e=>e(o);if(null==t)l.push(e);else for(n={},i=0,r=e.length;iYa(function(e,t){for(let n=0;nOw})).map(l)).concat(Tl(Ww(o/h)*h,r,h).filter((function(e){return jw(e%m)>Ow})).map(u))}return y.lines=function(){return v().map((function(e){return{type:"LineString",coordinates:e}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(i).concat(f(a).slice(1),c(n).reverse().slice(1),f(s).reverse().slice(1))]}},y.extent=function(e){return arguments.length?y.extentMajor(e).extentMinor(e):y.extentMinor()},y.extentMajor=function(e){return arguments.length?(i=+e[0][0],n=+e[1][0],s=+e[0][1],a=+e[1][1],i>n&&(e=i,i=n,n=e),s>a&&(e=s,s=a,a=e),y.precision(g)):[[i,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],r=+n[1][1],t>e&&(n=t,t=e,e=n),o>r&&(n=o,o=r,r=n),y.precision(g)):[[t,o],[e,r]]},y.step=function(e){return arguments.length?y.stepMajor(e).stepMinor(e):y.stepMinor()},y.stepMajor=function(e){return arguments.length?(p=+e[0],m=+e[1],y):[p,m]},y.stepMinor=function(e){return arguments.length?(d=+e[0],h=+e[1],y):[d,h]},y.precision=function(d){return arguments.length?(g=+d,l=PA(o,r,90),u=LA(t,e,g),c=PA(s,a,90),f=LA(i,n,g),y):g},y.extentMajor([[-180,-90+Ow],[180,90-Ow]]).extentMinor([[-180,-80-Ow],[180,80+Ow]])}()}function c$(e){Es.call(this,null,e)}function f$(e){if(!rt(e))return!1;const t=Ut(fe(e));return t.$x||t.$y||t.$value||t.$max}function d$(e){Es.call(this,null,e),this.modified(!0)}function h$(e,t,n){rt(e[t])&&e[t](n)}function p$(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o,a,s,l,u,c,f,d,h=e._root,p={data:i},m=e._x0,g=e._y0,y=e._x1,v=e._y1;if(!h)return e._root=p,e;for(;h.length;)if((u=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a,r=h,!(h=h[f=c<<1|u]))return r[f]=p,e;if(s=+e._x.call(null,h.data),l=+e._y.call(null,h.data),t===s&&n===l)return p.next=h,r?r[f]=p:e._root=p,e;do{r=r?r[f]=new Array(4):e._root=new Array(4),(u=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a}while((f=c<<1|u)==(d=(l>=a)<<1|s>=o));return r[d]=h,r[f]=p,e}function m$(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function g$(e){return e[0]}function y$(e){return e[1]}function v$(e,t,n){var i=new b$(null==t?g$:t,null==n?y$:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function b$(e,t,n,i,r,o){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function x$(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}o$.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},_t(o$,Es,{transform(e,t){var n,i=this._features,r=this._points,o=e.fields,a=o&&o[0],s=o&&o[1],l=e.geojson||!o&&be,u=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(fe(l))||a&&t.modified(fe(a))||s&&t.modified(fe(s)),this.value&&!n||(u=t.SOURCE,this._features=i=[],this._points=r=[]),l&&t.visit(u,(e=>i.push(l(e)))),a&&s&&(t.visit(u,(e=>{var t=a(e),n=s(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])})),i=i.concat({type:i$,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:r$,features:i}}}),a$.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},_t(a$,Es,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||be,o=e.as||"path",a=n.SOURCE;!i||e.modified()?(this.value=i=zA(e.projection),n.materialize().reflow()):a=r===be||t.modified(r.fields)?n.ADD_MOD:n.ADD;const s=function(e,t){const n=e.pointRadius();return e.context(null),null!=t&&e.pointRadius(t),n}(i,e.pointRadius);return n.visit(a,(e=>e[o]=i(r(e)))),i.pointRadius(s),n.modifies(o)}}),s$.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},_t(s$,Es,{transform(e,t){var n,i=e.projection,r=e.fields[0],o=e.fields[1],a=e.as||["x","y"],s=a[0],l=a[1];function u(e){const t=i([r(e),o(e)]);t?(e[s]=t[0],e[l]=t[1]):(e[s]=void 0,e[l]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,u):(n=t.modified(r.fields)||t.modified(o.fields),t.visit(n?t.ADD_MOD:t.ADD,u)),t.modifies(a)}}),l$.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},_t(l$,Es,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",o=n.ADD;return i&&!e.modified()||(this.value=i=function(e,t,n){const i=null==n?n=>e(t(n)):i=>{var r=e.pointRadius(),o=e.pointRadius(n)(t(i));return e.pointRadius(r),o};return i.context=t=>(e.context(t),i),i}(zA(e.projection),e.field||ye("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(e=>e[r]=i)),n.modifies(r)}}),u$.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},_t(u$,Es,{transform(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(const t in e)rt(r[t])&&r[t](e[t]);return n=r(),i.length?t.mod.push(Qa(i[0],n)):t.add.push(Ya(n)),i[0]=n,t}}),c$.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},_t(c$,Es,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i="shared"===e.resolve,r=e.field||be,o=function(e,t){let n;return rt(e)?(n=n=>e(n,t),n.dep=f$(e)):e?n=ft(e):(n=e=>e.$value/e.$max||0,n.dep=!0),n}(e.opacity,e),a=function(e,t){let n;return rt(e)?(n=n=>Xf(e(n,t)),n.dep=f$(e)):n=ft(Xf(e||"#888")),n}(e.color,e),s=e.as||"image",l={$x:0,$y:0,$value:0,$max:i?Ss(n.map((e=>Ss(r(e).values)))):0};return n.forEach((e=>{const t=r(e),n=ht({},e,l);i||(n.$max=Ss(t.values||[])),e[s]=function(e,t,n,i){const r=e.width,o=e.height,a=e.x1||0,s=e.y1||0,l=e.x2||r,u=e.y2||o,c=e.values,f=c?e=>c[e]:xe,d=_f(l-a,u-s),h=d.getContext("2d"),p=h.getImageData(0,0,l-a,u-s),m=p.data;for(let e=s,o=0;e{null!=e[t]&&h$(n,t,e[t])}))):NA.forEach((t=>{e.modified(t)&&h$(n,t,e[t])})),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&function(e,t){const n=function(e){return 1===(e=nt(e)).length?e[0]:{type:r$,features:e.reduce(((e,t)=>e.concat(function(e){return e.type===r$?e.features:nt(e).filter((e=>null!=e)).map((e=>e.type===i$?e:{type:i$,geometry:e}))}(t))),[])}}(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});var _$=v$.prototype=b$.prototype;function w$(e){return function(){return e}}function k$(e){return 1e-6*(e()-.5)}function E$(e){return e.x+e.vx}function A$(e){return e.y+e.vy}_$.copy=function(){var e,t,n=new b$(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=x$(i),n;for(e=[{source:i,target:n._root=new Array(4)}];i=e.pop();)for(var r=0;r<4;++r)(t=i.source[r])&&(t.length?e.push({source:t,target:i.target[r]=new Array(4)}):i.target[r]=x$(t));return n},_$.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return p$(this.cover(t,n),t,n,e)},_$.addAll=function(e){var t,n,i,r,o=e.length,a=new Array(o),s=new Array(o),l=1/0,u=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=i),rf&&(f=r));if(l>c||u>f)return this;for(this.cover(l,u).cover(c,f),n=0;ne||e>=r||i>t||t>=o;)switch(s=(td||(o=l.y0)>h||(a=l.x1)=y)<<1|e>=g)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=l)}else{var v=e-+this._x.call(null,m.data),b=t-+this._y.call(null,m.data),x=v*v+b*b;if(x=(s=(p+g)/2))?p=s:g=s,(c=a>=(l=(m+y)/2))?m=l:y=l,t=h,!(h=h[f=c<<1|u]))return this;if(!h.length)break;(t[f+1&3]||t[f+2&3]||t[f+3&3])&&(n=t,d=f)}for(;h.data!==e;)if(i=h,!(h=h.next))return this;return(r=h.next)&&delete h.next,i?(r?i.next=r:delete i.next,this):t?(r?t[f]=r:delete t[f],(h=t[0]||t[1]||t[2]||t[3])&&h===(t[3]||t[2]||t[1]||t[0])&&!h.length&&(n?n[d]=h:this._root=h),this):(this._root=r,this)},_$.removeAll=function(e){for(var t=0,n=e.length;t{}};function D$(){for(var e,t=0,n=arguments.length,i={};t=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!i.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a0)for(var n,i,r=new Array(n),o=0;o=0&&t._call.call(void 0,e),t=t._next;--T$}()}finally{T$=0,function(){for(var e,t,n=O$,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:O$=t);N$=e,X$(i)}(),B$=0}}function Y$(){var e=I$.now(),t=e-L$;t>P$&&(j$-=t,L$=e)}function X$(e){T$||(z$&&(z$=clearTimeout(z$)),e-B$>24?(e<1/0&&(z$=setTimeout(V$,e-I$.now()-j$)),R$&&(R$=clearInterval(R$))):(R$||(L$=I$.now(),R$=setInterval(Y$,P$)),T$=1,U$(V$)))}H$.prototype=G$.prototype={constructor:H$,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?q$():+n)+(null==t?0:+t),this._next||N$===this||(N$?N$._next=this:O$=this,N$=this),this._call=e,this._time=n,X$()},stop:function(){this._call&&(this._call=null,this._time=1/0,X$())}};const J$=4294967296;function Q$(e){return e.x}function Z$(e){return e.y}var K$=Math.PI*(3-Math.sqrt(5));function eD(e){return e.index}function tD(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}const nD={center:function(e,t){var n,i=1;function r(){var r,o,a=n.length,s=0,l=0;for(r=0;ru+p||oc+p||al.index){var m=u-s.x-s.vx,g=c-s.y-s.vy,y=m*m+g*g;ye.r&&(e.r=e[t].r)}function l(){if(t){var i,r,o=t.length;for(n=new Array(o),i=0;i=s)){(e.data!==t||e.next)&&(0===f&&(p+=(f=k$(n))*f),0===d&&(p+=(d=k$(n))*d),p[s(e,t,i),e])));for(a=0,r=new Array(u);at(e,n):t)}function dD(e){var t=0,n=e.children,i=n&&n.length;if(i)for(;--i>=0;)t+=n[i].value;else t=1;e.value=t}function hD(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=mD)):void 0===t&&(t=pD);for(var n,i,r,o,a,s=new vD(e),l=[s];n=l.pop();)if((r=t(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)l.push(i=r[o]=new vD(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(yD)}function pD(e){return e.children}function mD(e){return Array.isArray(e)?e[1]:null}function gD(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function yD(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function vD(e){this.data=e,this.depth=this.height=0,this.parent=null}function bD(e){return null==e?null:xD(e)}function xD(e){if("function"!=typeof e)throw new Error;return e}function _D(){return 0}function wD(e){return function(){return e}}sD.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:aD}]},_t(sD,Es,{transform(e,t){var n,i,r=this.value,o=t.changed(t.ADD_REM),a=e.modified(rD),s=e.iterations||300;if(r?(o&&(t.modifies("index"),r.nodes(t.source)),(a||t.changed(t.MOD))&&lD(r,e,0,t)):(this.value=r=function(e,t){const n=function(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,l=G$(f),u=F$("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%J$)/J$}();function f(){d(),u.call("tick",t),n1?(null==n?s.delete(e):s.set(e,p(n)),t):s.get(e)},find:function(t,n,i){var r,o,a,s,l,u=0,c=e.length;for(null==i?i=1/0:i*=i,u=0;u1?(u.on(e,n),t):u.on(e)}}}(e),i=n.stop,r=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,r()),n.stop=()=>(o=!0,i()),lD(n,t,!0).on("end",(()=>o=!0))}(t.source,e),r.on("tick",(n=t.dataflow,i=this,()=>n.touch(i).run())),e.static||(o=!0,r.tick()),t.modifies("index")),a||o||e.modified(oD)||t.changed()&&e.restart)if(r.alpha(Math.max(r.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(r.alphaMin(),1/s)),e.static)for(r.stop();--s>=0;)r.tick();else if(r.stopped()&&r.restart(),!o)return t.StopPropagation;return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let e,t=this._argops,s=0,l=t.length;s=0;--i)o.push(n[i]);return this},find:function(e,t){let n=-1;for(const i of this)if(e.call(t,i,++n,this))return i},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,i=t.children,r=i&&i.length;--r>=0;)n+=i[r].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),i=t.ancestors(),r=null;for(e=n.pop(),t=i.pop();e===t;)r=e,e=n.pop(),t=i.pop();return r}(t,e),i=[t];t!==n;)t=t.parent,i.push(t);for(var r=i.length;e!==n;)i.splice(r,0,e),e=e.parent;return i},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return hD(this).eachBefore(gD)},[Symbol.iterator]:function*(){var e,t,n,i,r=this,o=[r];do{for(e=o.reverse(),o=[];r=e.pop();)if(yield r,t=r.children)for(n=0,i=t.length;n0&&n*n>i*i+r*r}function DD(e,t){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*$*S))/(2*$):S/D);return{x:i+w+k*M,y:r+E+A*M,r:M}}function FD(e,t,n){var i,r,o,a,s=e.x-t.x,l=e.y-t.y,u=s*s+l*l;u?(r=t.r+n.r,r*=r,a=e.r+n.r,r>(a*=a)?(i=(u+a-r)/(2*u),o=Math.sqrt(Math.max(0,a/u-i*i)),n.x=e.x-i*s-o*l,n.y=e.y-i*l+o*s):(i=(u+r-a)/(2*u),o=Math.sqrt(Math.max(0,r/u-i*i)),n.x=t.x+i*s-o*l,n.y=t.y+i*l+o*s)):(n.x=t.x+n.r,n.y=t.y)}function OD(e,t){var n=e.r+t.r-1e-6,i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function ND(e){var t=e._,n=e.next._,i=t.r+n.r,r=(t.x*n.r+n.x*t.r)/i,o=(t.y*n.r+n.y*t.r)/i;return r*r+o*o}function TD(e){this._=e,this.next=null,this.previous=null}function zD(e,t){if(!(o=(e=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(e)).length))return 0;var n,i,r,o,a,s,l,u,c,f,d;if((n=e[0]).x=0,n.y=0,!(o>1))return n.r;if(i=e[1],n.x=-i.r,i.x=n.r,i.y=0,!(o>2))return n.r+i.r;FD(i,n,r=e[2]),n=new TD(n),i=new TD(i),r=new TD(r),n.next=r.previous=i,i.next=n.previous=r,r.next=i.previous=n;e:for(l=3;lfunction(e){let t=(e=`${e}`).length;return XD(e,t-1)&&!XD(e,t-2)&&(e=e.slice(0,-1)),"/"===e[0]?e:`/${e}`}(e(t,n,i)))),n=t.map(YD),r=new Set(t).add("");for(const e of n)r.has(e)||(r.add(e),t.push(e),n.push(YD(e)),d.push(WD));h=(e,n)=>t[n],p=(e,t)=>n[t]}for(a=0,r=d.length;a=0&&(u=d[e]).data===WD;--e)u.data=null}if(s.parent=UD,s.eachBefore((function(e){e.depth=e.parent.depth+1,--r})).eachBefore(yD),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(e){return arguments.length?(t=bD(e),i):t},i.parentId=function(e){return arguments.length?(n=bD(e),i):n},i.path=function(t){return arguments.length?(e=bD(t),i):e},i}function YD(e){let t=e.length;if(t<2)return"";for(;--t>1&&!XD(e,t););return e.slice(0,t)}function XD(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(0==(1&n))return!0}return!1}function JD(e,t){return e.parent===t.parent?1:2}function QD(e){var t=e.children;return t?t[0]:e.t}function ZD(e){var t=e.children;return t?t[t.length-1]:e.t}function KD(e,t,n){var i=n/(t.i-e.i);t.c-=i,t.s+=n,e.c+=i,t.z+=n,t.m+=n}function eS(e,t,n){return e.a.parent===t.parent?e.a:n}function tS(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function nS(e,t){return e.parent===t.parent?1:2}function iS(e,t){return e+t.x}function rS(e,t){return Math.max(e,t.y)}function oS(e,t,n,i,r){for(var o,a=e.children,s=-1,l=a.length,u=e.value&&(r-n)/e.value;++sd&&(d=s),g=c*c*m,(h=Math.max(d/g,g/f))>p){c-=s;break}p=h}y.push(a={value:c,dice:l1?t:1)},n}(aS),uS=function e(t){function n(e,n,i,r,o){if((a=e._squarify)&&a.ratio===t)for(var a,s,l,u,c,f=-1,d=a.length,h=e.value;++f1?t:1)},n}(aS);function cS(e,t,n){const i={};return e.each((e=>{const r=e.data;n(r)&&(i[t(r)]=e)})),e.lookup=i,e}function fS(e){Es.call(this,null,e)}fS.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const dS=e=>e.values;function hS(){const e=[],t={entries:e=>i(n(e,0),0),key:n=>(e.push(n),t)};function n(t,i){if(i>=e.length)return t;const r=t.length,o=e[i++],a={},s={};let l,u,c,f=-1;for(;++fe.length)return t;const r=[];for(const e in t)r.push({key:e,values:i(t[e],n)});return r}return t}function pS(e){Es.call(this,null,e)}_t(fS,Es,{transform(e,t){t.source||me("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),r=t.clone(),o=this.value;return(!o||i||t.changed())&&(o&&o.each((e=>{e.children&&Ha(e.data)&&r.rem.push(e.data)})),this.value=o=hD({values:nt(e.keys).reduce(((e,t)=>(e.key(t),e)),hS()).entries(r.source)},dS),n&&o.each((e=>{e.children&&(e=Ya(e.data),r.add.push(e),r.source.push(e))})),cS(o,Ga,Ga)),r.source.root=o,r}});const mS=(e,t)=>e.parent===t.parent?1:2;_t(pS,Es,{transform(e,t){t.source&&t.source.root||me(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,o=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(Za(e.sort,(e=>e.data))),function(e,t,n){for(let i,r=0,o=t.length;rfunction(e,t,n){const i=e.data,r=t.length-1;for(let o=0;o(e=(1664525*e+1013904223)%kD)/kD}();return r.x=t/2,r.y=n/2,e?r.eachBefore(PD(e)).eachAfter(LD(i,.5,o)).eachBefore(BD(1)):r.eachBefore(PD(RD)).eachAfter(LD(_D,1,o)).eachAfter(LD(i,r.r/Math.min(t,n),o)).eachBefore(BD(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=bD(t),r):e},r.size=function(e){return arguments.length?(t=+e[0],n=+e[1],r):[t,n]},r.padding=function(e){return arguments.length?(i="function"==typeof e?e:wD(+e),r):i},r},params:["radius","size","padding"],fields:gS});const vS=["x0","y0","x1","y1","depth","children"];function bS(e){pS.call(this,e)}function xS(e){Es.call(this,null,e)}bS.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:vS.length,default:vS}]},_t(bS,pS,{layout:function(){var e=1,t=1,n=0,i=!1;function r(r){var o=r.height+1;return r.x0=r.y0=n,r.x1=e,r.y1=t/o,r.eachBefore(function(e,t){return function(i){i.children&&ID(i,i.x0,e*(i.depth+1)/t,i.x1,e*(i.depth+2)/t);var r=i.x0,o=i.y0,a=i.x1-n,s=i.y1-n;a=0;--r)s.push(n=t.children[r]=new tS(i[r],r)),n.parent=t;return(a.parent=new tS(null,0)).children=[a],a}(r);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),i)r.eachBefore(s);else{var u=r,c=r,f=r;r.eachBefore((function(e){e.xc.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=u===c?1:e(u,c)/2,h=d-u.x,p=t/(c.x+d+h),m=n/(f.depth||1);r.eachBefore((function(e){e.x=(e.x+h)*p,e.y=e.depth*m}))}return r}function o(t){var n=t.children,i=t.parent.children,r=t.i?i[t.i-1]:null;if(n){!function(e){for(var t,n=0,i=0,r=e.children,o=r.length;--o>=0;)(t=r[o]).z+=n,t.m+=n,n+=t.s+(i+=t.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+e(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+e(t._,r._));t.parent.A=function(t,n,i){if(n){for(var r,o=t,a=t,s=n,l=o.parent.children[0],u=o.m,c=a.m,f=s.m,d=l.m;s=ZD(s),o=QD(o),s&&o;)l=QD(l),(a=ZD(a)).a=t,(r=s.z+f-o.z-u+e(s._,o._))>0&&(KD(eS(s,t,i),t,r),u+=r,c+=r),f+=s.m,u+=o.m,d+=l.m,c+=a.m;s&&!ZD(a)&&(a.t=s,a.m+=f-c),o&&!QD(l)&&(l.t=o,l.m+=u-d,i=t)}return i}(t,r,t.parent.A||i[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=t,e.y=e.depth*n}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r},cluster:function(){var e=nS,t=1,n=1,i=!1;function r(r){var o,a=0;r.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(iS,0)/e.length}(n),t.y=function(e){return 1+e.reduce(rS,0)}(n)):(t.x=o?a+=e(t,o):0,t.y=0,o=t)}));var s=function(e){for(var t;t=e.children;)e=t[0];return e}(r),l=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(r),u=s.x-e(s,l)/2,c=l.x+e(l,s)/2;return r.eachAfter(i?function(e){e.x=(e.x-r.x)*t,e.y=(r.y-e.y)*n}:function(e){e.x=(e.x-u)/(c-u)*t,e.y=(1-(r.y?e.y/r.y:1))*n})}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r}},wS=["x","y","depth","children"];function kS(e){pS.call(this,e)}function ES(e){Es.call(this,[],e)}kS.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:wS.length,default:wS}]},_t(kS,pS,{layout(e){const t=e||"tidy";if(yt(_S,t))return _S[t]();me("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:wS}),ES.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},_t(ES,Es,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),o={};return i||me("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(e=>o[Ga(e)]=1)),i.each((e=>{const t=e.data,n=e.parent&&e.parent.data;n&&o[Ga(t)]&&o[Ga(n)]&&r.add.push(Ya({source:n,target:t}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(e=>o[Ga(e)]=1)),n.forEach((e=>{(o[Ga(e.source)]||o[Ga(e.target)])&&r.mod.push(e)}))),r}});const AS={binary:function(e,t,n,i,r){var o,a,s=e.children,l=s.length,u=new Array(l+1);for(u[0]=a=o=0;o=n-1){var c=s[t];return c.x0=r,c.y0=o,c.x1=a,void(c.y1=l)}for(var f=u[t],d=i/2+f,h=t+1,p=n-1;h>>1;u[m]l-o){var v=i?(r*y+a*g)/i:a;e(t,h,g,r,o,v,l),e(h,n,y,v,o,a,l)}else{var b=i?(o*y+l*g)/i:l;e(t,h,g,r,o,a,b),e(h,n,y,r,b,a,l)}}(0,l,e.value,t,n,i,r)},dice:ID,slice:oS,slicedice:function(e,t,n,i,r){(1&e.depth?oS:ID)(e,t,n,i,r)},squarify:lS,resquarify:uS},$S=["x0","y0","x1","y1","depth","children"];function DS(e){pS.call(this,e)}DS.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:$S.length,default:$S}]},_t(DS,pS,{layout(){const e=function(){var e=lS,t=!1,n=1,i=1,r=[0],o=_D,a=_D,s=_D,l=_D,u=_D;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(f),r=[0],t&&e.eachBefore(jD),e}function f(t){var n=r[t.depth],i=t.x0+n,c=t.y0+n,f=t.x1-n,d=t.y1-n;f{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{yt(AS,t)?e.tile(AS[t]):me("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:$S});const SS=4278190080;function MS(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function CS(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach((t=>{t.items.forEach((t=>CS(e,t.items,n)))})):jv[i].draw(e,{items:n?t.map(FS):t})}function FS(e){const t=Ja(e,{});return t.stroke&&0!==t.strokeOpacity||t.fill&&0!==t.fillOpacity?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const OS=5,NS=31,TS=32,zS=new Uint32Array(TS+1),RS=new Uint32Array(TS+1);RS[0]=0,zS[0]=~RS[0];for(let e=1;e<=TS;++e)RS[e]=RS[e-1]<<1|1,zS[e]=~RS[e];function PS(e,t,n,i,r,o){let a=n/2;return e-a<0||e+a>r||t-(a=i/2)<0||t+a>o}function LS(e,t,n,i,r,o,a,s){const l=r*o/(2*i),u=e(t-l),c=e(t+l),f=e(n-(o/=2)),d=e(n+o);return a.outOfBounds(u,f,c,d)||a.getRange(u,f,c,d)||s&&s.getRange(u,f,c,d)}const BS=[-1,-1,1,1],jS=[-1,1,-1,1],IS=["right","center","left"],US=["bottom","middle","top"];function qS(e,t,n,i,r,o,a,s,l,u,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&o||r).getRange(e,n,t,i))}const WS={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},HS={naive:function(e,t,n,i){const r=e.width,o=e.height;return function(e){const t=e.datum.datum.items[i].items,n=t.length,a=e.datum.fontSize,s=xv.width(e.datum,e.datum.text);let l,u,c,f,d,h,p,m=0;for(let i=0;i=m&&(m=p,e.x=d,e.y=h);return d=s/2,h=a/2,l=e.x-d,u=e.x+d,c=e.y-h,f=e.y+h,e.align="center",l<0&&u<=r?e.align="left":0<=l&&r=1;)d=(h+p)/2,LS(e,c,f,u,l,d,a,s)?p=d:h=d;if(h>i)return[c,f,h,!0]}}return function(t){const s=t.datum.datum.items[i].items,u=s.length,c=t.datum.fontSize,f=xv.width(t.datum,t.datum.text);let d,h,p,m,g,y,v,b,x,_,w,k,E,A,$,D,S,M=n?c:0,C=!1,F=!1,O=0;for(let i=0;ih&&(S=d,d=h,h=S),p>m&&(S=p,p=m,m=S),x=e(d),w=e(h),_=~~((x+w)/2),k=e(p),A=e(m),E=~~((k+A)/2),v=_;v>=x;--v)for(b=E;b>=k;--b)D=l(v,b,M,f,c),D&&([t.x,t.y,M,C]=D);for(v=_;v<=w;++v)for(b=E;b<=A;++b)D=l(v,b,M,f,c),D&&([t.x,t.y,M,C]=D);C||n||($=Math.abs(h-d+m-p),g=(d+h)/2,y=(p+m)/2,$>=O&&!PS(g,y,f,c,r,o)&&!LS(e,g,y,c,f,c,a,null)&&(O=$,t.x=g,t.y=y,F=!0))}return!(!C&&!F||(g=f/2,y=c/2,a.setRange(e(t.x-g),e(t.y-y),e(t.x+g),e(t.y+y)),t.align="center",t.baseline="middle",0))}},floodfill:function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],l=e.bitmap();return function(t){const u=t.datum.datum.items[i].items,c=u.length,f=t.datum.fontSize,d=xv.width(t.datum,t.datum.text),h=[];let p,m,g,y,v,b,x,_,w,k,E,A,$=n?f:0,D=!1,S=!1,M=0;for(let i=0;i=1;)E=(w+k)/2,LS(e,v,b,f,d,E,a,s)?k=E:w=E;w>$&&(t.x=v,t.y=b,$=w,D=!0)}}D||n||(A=Math.abs(m-p+y-g),v=(p+m)/2,b=(g+y)/2,A>=M&&!PS(v,b,d,f,r,o)&&!LS(e,v,b,f,d,f,a,null)&&(M=A,t.x=v,t.y=b,S=!0))}return!(!D&&!S||(v=d/2,b=f/2,a.setRange(e(t.x-v),e(t.y-b),e(t.x+v),e(t.y+b)),t.align="center",t.baseline="middle",0))}}};function GS(e,t,n,i,r,o,a,s,l,u,c){if(!e.length)return e;const f=Math.max(i.length,r.length),d=function(e,t){const n=new Float64Array(t),i=e.length;for(let t=0;t[e.x,e.x,e.x,e.y,e.y,e.y];return e?"line"===e||"area"===e?e=>r(e.datum):"line"===t?e=>{const t=e.datum.items[i].items;return r(t.length?t["start"===n?0:t.length-1]:{x:NaN,y:NaN})}:e=>{const t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:r}(p,m,s,l),v=null===u||u===1/0,b=g&&"naive"===c;var x;let _=-1,w=-1;const k=e.map((e=>{const t=v?xv.width(e,e.text):void 0;return _=Math.max(_,t),w=Math.max(w,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(e),textWidth:t}}));u=null===u||u===1/0?Math.max(_,w)+Math.max(...i):u;const E=function(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),o=~~((t+2*n+i)/i),a=e=>~~((e+n)/i);return a.invert=e=>e*i-n,a.bitmap=()=>function(e,t){const n=new Uint32Array(~~((e*t+TS)/TS));function i(e,t){n[e]|=t}function r(e,t){n[e]&=t}return{array:n,get:(t,i)=>{const r=i*e+t;return n[r>>>OS]&1<<(r&NS)},set:(t,n)=>{const r=n*e+t;i(r>>>OS,1<<(r&NS))},clear:(t,n)=>{const i=n*e+t;r(i>>>OS,~(1<<(i&NS)))},getRange:(t,i,r,o)=>{let a,s,l,u,c=o;for(;c>=i;--c)if(a=c*e+t,s=c*e+r,l=a>>>OS,u=s>>>OS,l===u){if(n[l]&zS[a&NS]&RS[1+(s&NS)])return!0}else{if(n[l]&zS[a&NS])return!0;if(n[u]&RS[1+(s&NS)])return!0;for(let e=l+1;e{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+r,l=a>>>OS,u=s>>>OS,l===u)i(l,zS[a&NS]&RS[1+(s&NS)]);else for(i(l,zS[a&NS]),i(u,RS[1+(s&NS)]),c=l+1;c{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+i,l=a>>>OS,u=s>>>OS,l===u)r(l,RS[a&NS]|zS[1+(s&NS)]);else for(r(l,RS[a&NS]),r(u,zS[1+(s&NS)]),c=l+1;cn<0||i<0||o>=t||r>=e}}(r,o),a.ratio=i,a.padding=n,a.width=e,a.height=t,a}(t[0],t[1],u);let A;if(!b){n&&k.sort(((e,t)=>n(e.datum,t.datum)));let t=!1;for(let e=0;ee.datum));A=o.length||i?function(e,t,n,i,r){const o=e.width,a=e.height,s=i||r,l=_f(o,a).getContext("2d"),u=_f(o,a).getContext("2d"),c=s&&_f(o,a).getContext("2d");n.forEach((e=>CS(l,e,!1))),CS(u,t,!1),s&&CS(c,t,!0);const f=MS(l,o,a),d=MS(u,o,a),h=s&&MS(c,o,a),p=e.bitmap(),m=s&&e.bitmap();let g,y,v,b,x,_,w,k;for(y=0;yn.set(e(t.boundary[0]),e(t.boundary[3])))),[n,void 0]}(E,a&&k)}const $=g?HS[c](E,A,a,l):function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],l=i.length;return function(t){const u=t.boundary,c=t.datum.fontSize;if(u[2]<0||u[5]<0||u[0]>r||u[3]>o)return!1;let f,d,h,p,m,g,y,v,b,x,_,w,k,E,A,$=t.textWidth??0;for(let r=0;r>>2&3)-1,h=0===f&&0===d||i[r]<0,p=f&&d?Math.SQRT1_2:1,m=i[r]<0?-1:1,g=u[1+f]+i[r]*f*p,_=u[4+d]+m*c*d/2+i[r]*d*p,v=_-c/2,b=_+c/2,w=e(g),E=e(v),A=e(b),!$){if(!qS(w,w,E,A,a,s,0,0,0,0,0,h))continue;$=xv.width(t.datum,t.datum.text)}if(x=g+m*$*f/2,g=x-$/2,y=x+$/2,w=e(g),k=e(y),qS(w,k,E,A,a,s,0,0,0,0,0,h))return t.x=f?f*m<0?y:g:x,t.y=d?d*m<0?b:v:_,t.align=IS[f*m+1],t.baseline=US[d*m+1],a.setRange(w,E,k,A),!0}return!1}}(E,A,h,d);return k.forEach((e=>e.opacity=+$(e))),k}const VS=["x","y","opacity","align","baseline"],YS=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function XS(e){Es.call(this,null,e)}function JS(e,t){var n,i,r,o,a,s,l=[],u=function(e){return e(o)};if(null==t)l.push(e);else for(n={},i=0,r=e.length;i{const t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline})),t.reflow(n).modifies(i)}}),QS.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},_t(QS,Es,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=JS(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(ce),o=r.length,a=e.as||[ce(e.x),ce(e.y)],s=[];i.forEach((t=>{Sl(t,e.x,e.y,e.bandwidth||.3).forEach((e=>{const n={};for(let e=0;e"poly"===e?t:"quad"===e?2:1)(o,a),l=e.as||[ce(e.x),ce(e.y)],u=ZS[o],c=[];let f=e.extent;yt(ZS,o)||me("Invalid regression method: "+o),null!=f&&"log"===o&&f[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),f=null),i.forEach((n=>{if(n.length<=s)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const i=u(n,e.x,e.y,a);if(e.params)return void c.push(Ya({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const d=f||pt(n,e.x),h=e=>{const t={};for(let e=0;eh([e,i.predict(e)]))):Ol(i.predict,d,25,200).forEach(h)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=c}return n}});const eM=134217729;function tM(e,t,n,i,r){let o,a,s,l,u=t[0],c=i[0],f=0,d=0;c>u==c>-u?(o=u,u=t[++f]):(o=c,c=i[++d]);let h=0;if(fu==c>-u?(a=u+o,s=o-(a-u),u=t[++f]):(a=c+o,s=o-(a-c),c=i[++d]),o=a,0!==s&&(r[h++]=s);fu==c>-u?(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++f]):(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=i[++d]),o=a,0!==s&&(r[h++]=s);for(;f=33306690738754716e-32*u?l:-function(e,t,n,i,r,o,a){let s,l,u,c,f,d,h,p,m,g,y,v,b,x,_,w,k,E;const A=e-r,$=n-r,D=t-o,S=i-o;x=A*S,d=eM*A,h=d-(d-A),p=A-h,d=eM*S,m=d-(d-S),g=S-m,_=p*g-(x-h*m-p*m-h*g),w=D*$,d=eM*D,h=d-(d-D),p=D-h,d=eM*$,m=d-(d-$),g=$-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,iM[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,iM[1]=b-(y+f)+(f-w),E=v+y,f=E-v,iM[2]=v-(E-f)+(y-f),iM[3]=E;let M=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,iM),C=22204460492503146e-32*a;if(M>=C||-M>=C)return M;if(f=e-A,s=e-(A+f)+(f-r),f=n-$,u=n-($+f)+(f-r),f=t-D,l=t-(D+f)+(f-o),f=i-S,c=i-(S+f)+(f-o),0===s&&0===l&&0===u&&0===c)return M;if(C=11093356479670487e-47*a+33306690738754706e-32*Math.abs(M),M+=A*c+S*s-(D*u+$*l),M>=C||-M>=C)return M;x=s*S,d=eM*s,h=d-(d-s),p=s-h,d=eM*S,m=d-(d-S),g=S-m,_=p*g-(x-h*m-p*m-h*g),w=l*$,d=eM*l,h=d-(d-l),p=l-h,d=eM*$,m=d-(d-$),g=$-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,sM[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,sM[1]=b-(y+f)+(f-w),E=v+y,f=E-v,sM[2]=v-(E-f)+(y-f),sM[3]=E;const F=tM(4,iM,4,sM,rM);x=A*c,d=eM*A,h=d-(d-A),p=A-h,d=eM*c,m=d-(d-c),g=c-m,_=p*g-(x-h*m-p*m-h*g),w=D*u,d=eM*D,h=d-(d-D),p=D-h,d=eM*u,m=d-(d-u),g=u-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,sM[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,sM[1]=b-(y+f)+(f-w),E=v+y,f=E-v,sM[2]=v-(E-f)+(y-f),sM[3]=E;const O=tM(F,rM,4,sM,oM);x=s*c,d=eM*s,h=d-(d-s),p=s-h,d=eM*c,m=d-(d-c),g=c-m,_=p*g-(x-h*m-p*m-h*g),w=l*u,d=eM*l,h=d-(d-l),p=l-h,d=eM*u,m=d-(d-u),g=u-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,sM[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,sM[1]=b-(y+f)+(f-w),E=v+y,f=E-v,sM[2]=v-(E-f)+(y-f),sM[3]=E;const N=tM(O,oM,4,sM,aM);return aM[N-1]}(e,t,n,i,r,o,u)}nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(8),nM(8),nM(8),nM(4),nM(8),nM(8),nM(8),nM(12),nM(192),nM(192),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(8),nM(8),nM(8),nM(8),nM(8),nM(8),nM(8),nM(8),nM(8),nM(4),nM(4),nM(4),nM(8),nM(16),nM(16),nM(16),nM(32),nM(32),nM(48),nM(64),nM(1152),nM(1152),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(4),nM(24),nM(24),nM(24),nM(24),nM(24),nM(24),nM(24),nM(24),nM(24),nM(24),nM(1152),nM(1152),nM(1152),nM(1152),nM(1152),nM(2304),nM(2304),nM(3456),nM(5760),nM(8),nM(8),nM(8),nM(16),nM(24),nM(48),nM(48),nM(96),nM(192),nM(384),nM(384),nM(384),nM(768),nM(96),nM(96),nM(96),nM(1152);const uM=Math.pow(2,-52),cM=new Uint32Array(512);class fM{static from(e,t=yM,n=vM){const i=e.length,r=new Float64Array(2*i);for(let o=0;o>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:i,_hullHash:r}=this,o=e.length>>1;let a=1/0,s=1/0,l=-1/0,u=-1/0;for(let t=0;tl&&(l=n),i>u&&(u=i),this._ids[t]=t}const c=(a+l)/2,f=(s+u)/2;let d,h,p,m=1/0;for(let t=0;t0&&(h=t,m=n)}let v=e[2*h],b=e[2*h+1],x=1/0;for(let t=0;ti&&(t[n++]=r,i=this._dists[r])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(lM(g,y,v,b,_,w)<0){const e=h,t=v,n=b;h=p,v=_,b=w,p=e,_=t,w=n}const k=function(e,t,n,i,r,o){const a=n-e,s=i-t,l=r-e,u=o-t,c=a*a+s*s,f=l*l+u*u,d=.5/(a*u-s*l);return{x:e+(u*c-s*f)*d,y:t+(a*f-l*c)*d}}(g,y,v,b,_,w);this._cx=k.x,this._cy=k.y;for(let t=0;t0&&Math.abs(u-o)<=uM&&Math.abs(c-a)<=uM)continue;if(o=u,a=c,l===d||l===h||l===p)continue;let f=0;for(let e=0,t=this._hashKey(u,c);e=0;)if(g=m,g===f){g=-1;break}if(-1===g)continue;let y=this._addTriangle(g,l,n[g],-1,-1,i[g]);i[l]=this._legalize(y+2),i[g]=y,E++;let v=n[g];for(;m=n[v],lM(u,c,e[2*v],e[2*v+1],e[2*m],e[2*m+1])<0;)y=this._addTriangle(v,l,m,i[l],-1,i[v]),i[l]=this._legalize(y+2),n[v]=v,E--,v=m;if(g===f)for(;m=t[g],lM(u,c,e[2*m],e[2*m+1],e[2*g],e[2*g+1])<0;)y=this._addTriangle(m,l,g,-1,i[g],i[m]),this._legalize(y+2),i[m]=y,n[g]=g,E--,g=m;this._hullStart=t[l]=g,n[g]=t[v]=l,n[l]=v,r[this._hashKey(u,c)]=l,r[this._hashKey(e[2*g],e[2*g+1])]=g}this.hull=new Uint32Array(E);for(let e=0,t=this._hullStart;e0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const a=n[e],s=e-e%3;if(o=s+(e+2)%3,-1===a){if(0===r)break;e=cM[--r];continue}const l=a-a%3,u=s+(e+1)%3,c=l+(a+2)%3,f=t[o],d=t[e],h=t[u],p=t[c];if(hM(i[2*f],i[2*f+1],i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1])){t[e]=p,t[a]=f;const i=n[c];if(-1===i){let t=this._hullStart;do{if(this._hullTri[t]===c){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,i),this._link(a,n[o]),this._link(o,c);const s=l+(a+1)%3;r=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=i}else{let r=n+1,o=i;gM(e,n+i>>1,r),t[e[n]]>t[e[i]]&&gM(e,n,i),t[e[r]]>t[e[i]]&&gM(e,r,i),t[e[n]]>t[e[r]]&&gM(e,n,r);const a=e[r],s=t[a];for(;;){do{r++}while(t[e[r]]s);if(o=o-n?(mM(e,t,r,i),mM(e,t,n,o-1)):(mM(e,t,n,o-1),mM(e,t,r,i))}}function gM(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function yM(e){return e[0]}function vM(e){return e[1]}const bM=1e-6;class xM{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){const i=(e=+e)+(n=+n),r=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${i},${r}`:(Math.abs(this._x1-i)>bM||Math.abs(this._y1-r)>bM)&&(this._+="L"+i+","+r),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=i},${this._y1=r}`)}rect(e,t,n,i){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+i}h${-n}Z`}value(){return this._||null}}class _M{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}class wM{constructor(e,[t,n,i,r]=[0,0,960,500]){if(!((i=+i)>=(t=+t)&&(r=+r)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=i,this.xmin=t,this.ymax=r,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:i}=this;let r,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let i,s,l=0,u=0,c=n.length;l1;)r-=2;for(let e=2;e0){if(t>=this.ymax)return null;(r=(this.ymax-t)/i)0){if(e>=this.xmax)return null;(r=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t2&&function(e){const{triangles:t,coords:n}=e;for(let e=0;e1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},((e,t)=>t)).sort(((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]));const e=this.collinear[0],n=this.collinear[this.collinear.length-1],i=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],r=1e-8*Math.hypot(i[3]-i[1],i[2]-i[0]);for(let e=0,n=t.length/2;e0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,2===i.length&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(e){return new wM(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:i,halfedges:r,triangles:o,collinear:a}=this;if(a){const t=a.indexOf(e);return t>0&&(yield a[t-1]),void(t=0&&r!==n&&r!==i;)n=r;return r}_step(e,t,n){const{inedges:i,hull:r,_hullIndex:o,halfedges:a,triangles:s,points:l}=this;if(-1===i[e]||!l.length)return(e+1)%(l.length>>1);let u=e,c=EM(t-l[2*e],2)+EM(n-l[2*e+1],2);const f=i[e];let d=f;do{let i=s[d];const f=EM(t-l[2*i],2)+EM(n-l[2*i+1],2);if(f>5<<5,l=~~Math.max(Math.abs(v+b),Math.abs(v-b))}else a=a+31>>5<<5;if(l>h&&(h=l),f+a>=NM<<5&&(f=0,d+=h,h=0),d+l>=TM)break;r.translate((f+(a>>1))/o,(d+(l>>1))/o),t.rotate&&r.rotate(t.rotate*OM),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=a,t.height=l,t.xoff=f,t.yoff=d,t.x1=a>>1,t.y1=l>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=a}for(var _=r.getImageData(0,0,(NM<<5)/o,TM/o).data,w=[];--i>=0;)if((t=n[i]).hasText){for(s=(a=t.width)>>5,l=t.y1-t.y0,u=0;u>5),$=_[(d+c)*(NM<<5)+(f+u)<<2]?1<<31-u%32:0;w[A]|=$,k|=$}k?E=c:(t.y0++,l--,c--,d++)}t.y1=t.y0+E,t.sprite=w.slice(0,(t.y1-t.y0)*s)}}}function RM(e,t,n){n>>=5;for(var i,r=e.sprite,o=e.width>>5,a=e.x-(o<<4),s=127&a,l=32-s,u=e.y1-e.y0,c=(e.y+e.y0)*n+(a>>5),f=0;f>>s:0))&t[c+d])return!0;c+=n}return!1}function PM(e,t){var n=e[0],i=e[1];t.x+t.x0i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function LM(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0=f));)if(t.x=a+r,t.y=u+o,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>s[0]||t.y+t.y1>s[1])&&(!n||!RM(t,e,s[0]))&&(!n||LM(t,n))){for(var m,g=t.sprite,y=t.width>>5,v=s[0]>>5,b=t.x-(y<<4),x=127&b,_=32-x,w=t.y1-t.y0,k=(t.y+t.y0)*v+(b>>5),E=0;E>>x:0);k+=v}return t.sprite=null,!0}return!1}return f.layout=function(){for(var l=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=(NM<<5)/t,e.height=TM/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(_f()),f=function(e){for(var t=[],n=-1;++n>5)*s[1]),h=null,p=u.length,m=-1,g=[],y=u.map((s=>({text:e(s),font:t(s),style:i(s),weight:r(s),rotate:o(s),size:~~(n(s)+1e-14),padding:a(s),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:s}))).sort(((e,t)=>t.size-e.size));++m>1,v.y=s[1]*(c()+.5)>>1,zM(l,v,y,m),v.hasText&&d(f,v,h)&&(g.push(v),h?PM(h,v):h=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=s[0]>>1,v.y-=s[1]>>1)}return g},f.words=function(e){return arguments.length?(u=e,f):u},f.size=function(e){return arguments.length?(s=[+e[0],+e[1]],f):s},f.font=function(e){return arguments.length?(t=jM(e),f):t},f.fontStyle=function(e){return arguments.length?(i=jM(e),f):i},f.fontWeight=function(e){return arguments.length?(r=jM(e),f):r},f.rotate=function(e){return arguments.length?(o=jM(e),f):o},f.text=function(t){return arguments.length?(e=jM(t),f):e},f.spiral=function(e){return arguments.length?(l=IM[e]||e,f):l},f.fontSize=function(e){return arguments.length?(n=jM(e),f):n},f.padding=function(e){return arguments.length?(a=jM(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f}(),e)}WM.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:UM}]},_t(WM,Es,{transform(e,t){!e.size||e.size[0]&&e.size[1]||me("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||qM.some((function(n){const i=e[n];return rt(i)&&t.modified(i.fields)}))))return;const i=t.materialize(t.SOURCE).source,r=this.value,o=e.as||UM;let a,s=e.fontSize||14;if(rt(s)?a=e.fontSizeRange:s=ft(s),a){const e=s,t=nm("sqrt")().domain(pt(i,e)).range(a);s=n=>t(e(n))}i.forEach((e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0}));const l=r.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(s).random(Us).layout(),u=r.size(),c=u[0]>>1,f=u[1]>>1,d=l.length;for(let e,t,n=0;nnew Uint8Array(e),GM=e=>new Uint16Array(e),VM=e=>new Uint32Array(e);function YM(e,t,n){const i=(t<257?HM:t<65537?GM:VM)(e);return n&&i.set(n),i}function XM(e,t,n){const i=1<{const i=e[t],r=e[n];return ir?1:0})),function(e,t){return Array.from(t,(t=>e[t]))}(e,t)}(d,l),a)u=t,c=e,t=Array(a+s),e=VM(a+s),function(e,t,n,i,r,o,a,s,l){let u,c=0,f=0;for(u=0;c0)for(f=0;fe,size:()=>n}}function QM(e){Es.call(this,function(){let e=8,t=[],n=VM(0),i=YM(0,e),r=YM(0,e);return{data:()=>t,seen:()=>n=function(e,t,n){return e.length>=t?e:((n=n||new e.constructor(t)).set(e),n)}(n,t.length),add(e){for(let n,i=0,r=t.length,o=e.length;it.length,curr:()=>i,prev:()=>r,reset:e=>r[e]=i[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){i[e]|=t},clear(e,t){i[e]&=~t},resize(t,n){(t>i.length||n>e)&&(e=Math.max(n,e),i=YM(t,e,i),r=YM(t,e))}}}(),e),this._indices=null,this._dims=null}function ZM(e){Es.call(this,null,e)}QM.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},_t(QM,Es,{transform(e,t){return this._dims?e.modified("fields")||e.fields.some((e=>t.modified(e.fields)))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){const n=e.fields,i=e.query,r=this._indices={},o=this._dims=[],a=i.length;let s,l,u=0;for(;u{const e=r.remove(t,n);for(const t in i)i[t].reindex(e)}))},update(e,t,n){const i=this._dims,r=e.query,o=t.stamp,a=i.length;let s,l,u=0;for(n.filters=0,l=0;lh)for(g=h,y=Math.min(f,p);gp)for(g=Math.max(f,p),y=d;gc)for(h=c,p=Math.min(l,f);hf)for(h=Math.max(l,f),p=u;hs[e]&n?null:a[e];return o.filter(o.MOD,u),r&r-1?(o.filter(o.ADD,(e=>{const t=s[e]&n;return!t&&t^l[e]&n?a[e]:null})),o.filter(o.REM,(e=>{const t=s[e]&n;return!t||t^t^l[e]&n?null:a[e]}))):(o.filter(o.ADD,u),o.filter(o.REM,(e=>(s[e]&n)===r?a[e]:null))),o.filter(o.SOURCE,(e=>u(e._index)))}});const KM="Literal",eC="CallExpression";function tC(e){this.type=e}var nC,iC,rC,oC,aC;tC.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case"ArrayExpression":return e.elements;case"BinaryExpression":case"LogicalExpression":return[e.left,e.right];case eC:return[e.callee].concat(e.arguments);case"ConditionalExpression":return[e.test,e.consequent,e.alternate];case"MemberExpression":return[e.object,e.property];case"ObjectExpression":return e.properties;case"Property":return[e.key,e.value];case"UnaryExpression":return[e.argument];default:return[]}}(this),n=0,i=t.length;n",nC[uC]="Identifier",nC[cC]="Keyword",nC[fC]="Null",nC[dC]="Numeric",nC[hC]="Punctuator",nC[pC]="String",nC[9]="RegularExpression";var mC="ArrayExpression",gC="BinaryExpression",yC="CallExpression",vC="ConditionalExpression",bC="Identifier",xC="Literal",_C="LogicalExpression",wC="MemberExpression",kC="ObjectExpression",EC="Property",AC="UnaryExpression",$C="Unexpected token %0",DC="Unexpected number",SC="Unexpected string",MC="Unexpected identifier",CC="Unexpected reserved word",FC="Unexpected end of input",OC="Invalid regular expression",NC="Invalid regular expression: missing /",TC="Octal literals are not allowed in strict mode.",zC="Duplicate data property in object literal not allowed in strict mode",RC="ILLEGAL",PC="Disabled.",LC=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),BC=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\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\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function jC(e,t){if(!e)throw new Error("ASSERT: "+t)}function IC(e){return e>=48&&e<=57}function UC(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function qC(e){return"01234567".indexOf(e)>=0}function WC(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function HC(e){return 10===e||13===e||8232===e||8233===e}function GC(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&LC.test(String.fromCharCode(e))}function VC(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&BC.test(String.fromCharCode(e))}const YC={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function XC(){for(;rC1114111||"}"!==e)&&cF({},$C,RC),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function ZC(){var e,t;for(e=iC.charCodeAt(rC++),t=String.fromCharCode(e),92===e&&(117!==iC.charCodeAt(rC)&&cF({},$C,RC),++rC,(e=JC("u"))&&"\\"!==e&&GC(e.charCodeAt(0))||cF({},$C,RC),t=e);rC>>="===(i=iC.substr(rC,4))?{type:hC,value:i,start:r,end:rC+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:hC,value:n,start:r,end:rC+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===t?{type:hC,value:t,start:r,end:rC+=2}:("//"===t&&cF({},$C,RC),"<>=!+-*%&|^/".indexOf(a)>=0?(++rC,{type:hC,value:a,start:r,end:rC}):void cF({},$C,RC))}function eF(){var e,t,n;if(jC(IC((n=iC[rC]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=rC,e="","."!==n){if(e=iC[rC++],n=iC[rC],"0"===e){if("x"===n||"X"===n)return++rC,function(e){let t="";for(;rC=oC)return{type:lC,start:rC,end:rC};const e=iC.charCodeAt(rC);return GC(e)?function(){var e,t;return e=rC,t=92===iC.charCodeAt(rC)?ZC():function(){var e,t;for(e=rC++;rC=0&&rC(jC(t=0&&cF({},OC,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";cF({},OC)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){cF({},OC)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:rC}}()),iF()):fF(nF())}return n}function bF(){const e=[];if(dF("("),!hF(")"))for(;rC":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function AF(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,l,u;if(e=aC,l=kF(),0===(r=EF(i=aC)))return l;for(i.prec=r,nF(),t=[e,aC],o=[l,i,a=kF()];(r=EF(aC))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,l=o.pop(),t.pop(),n=rF(s,l,a),o.push(n);(i=nF()).prec=r,o.push(i),t.push(aC),n=kF(),o.push(n)}for(n=o[u=o.length-1],t.pop();u>1;)t.pop(),n=rF(o[u-1].value,o[u-2],n),u-=2;return n}(),hF("?")&&(nF(),t=AF(),dF(":"),e=function(e,t,n){const i=new tC(vC);return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,AF())),e}function $F(){const e=AF();if(hF(","))throw new Error(PC);return e}function DF(e){rC=0,oC=(iC=e).length,aC=null,iF();const t=$F();if(aC.type!==lC)throw new Error("Unexpect token after expression.");return t}var SF={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function MF(e){function t(t,n,i){return r=>function(t,n,i,r){let o=e(n[0]);return i&&(o=i+"("+o+")",0===i.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+t+(r<0?"":0===r?"()":"("+n.slice(1).map(e).join(",")+")")}(t,r,n,i)}const n="new Date",i="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(t){t.length<3&&me("Missing arguments to clamp function."),t.length>3&&me("Too many arguments to clamp function.");const n=t.map(e);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",i,0),lower:t("toLowerCase",i,0),substring:t("substring",i),split:t("split",i),trim:t("trim",i,0),regexp:r,test:t("test",r),if:function(t){t.length<3&&me("Missing arguments to if function."),t.length>3&&me("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function CF(e){const t=(e=e||{}).allowed?Ut(e.allowed):{},n=e.forbidden?Ut(e.forbidden):{},i=e.constants||SF,r=(e.functions||MF)(f),o=e.globalvar,a=e.fieldvar,s=rt(o)?o:e=>`${o}["${e}"]`;let l={},u={},c=0;function f(e){if(St(e))return e;const t=d[e.type];return null==t&&me("Unsupported type: "+e.type),t(e)}const d={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return c>0?r:yt(n,r)?me("Illegal identifier: "+r):yt(i,r)?i[r]:yt(t,r)?r:(l[r]=1,s(r))},MemberExpression:e=>{const t=!e.computed,n=f(e.object);t&&(c+=1);const i=f(e.property);return n===a&&(u[function(e){const t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(i)]=1),t&&(c-=1),n+(t?"."+i:"["+i+"]")},CallExpression:e=>{"Identifier"!==e.callee.type&&me("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=yt(r,t)&&r[t];return i||me("Unrecognized function: "+t),rt(i)?i(n):i+"("+n.map(f).join(",")+")"},ArrayExpression:e=>"["+e.elements.map(f).join(",")+"]",BinaryExpression:e=>"("+f(e.left)+" "+e.operator+" "+f(e.right)+")",UnaryExpression:e=>"("+e.operator+f(e.argument)+")",ConditionalExpression:e=>"("+f(e.test)+"?"+f(e.consequent)+":"+f(e.alternate)+")",LogicalExpression:e=>"("+f(e.left)+e.operator+f(e.right)+")",ObjectExpression:e=>"{"+e.properties.map(f).join(",")+"}",Property:e=>{c+=1;const t=f(e.key);return c-=1,t+":"+f(e.value)}};function h(e){const t={code:f(e),globals:Object.keys(l),fields:Object.keys(u)};return l={},u={},t}return h.functions=r,h.constants=i,h}var FF,OF,NF,TF,zF,RF,PF,LF,BF,jF,IF,UF,qF,WF,HF,GF,VF=new Fw,YF=new Fw,XF={point:tk,lineStart:tk,lineEnd:tk,polygonStart:function(){VF=new Fw,XF.lineStart=JF,XF.lineEnd=QF},polygonEnd:function(){var e=+VF;YF.add(e<0?Pw+e:e),this.lineStart=this.lineEnd=this.point=tk},sphere:function(){YF.add(Pw)}};function JF(){XF.point=ZF}function QF(){KF(FF,OF)}function ZF(e,t){XF.point=KF,FF=e,OF=t,NF=e*=Bw,TF=qw(t=(t*=Bw)/2+Rw),zF=Xw(t)}function KF(e,t){var n=(e*=Bw)-NF,i=n>=0?1:-1,r=i*n,o=qw(t=(t*=Bw)/2+Rw),a=Xw(t),s=zF*a,l=TF*o+s*qw(r),u=s*i*Xw(r);VF.add(Uw(u,l)),NF=e,TF=o,zF=a}var eO,tO,nO,iO,rO,oO,aO,sO,lO,uO,cO,fO,dO,hO,pO,mO,gO={point:yO,lineStart:bO,lineEnd:xO,polygonStart:function(){gO.point=_O,gO.lineStart=wO,gO.lineEnd=kO,WF=new Fw,XF.polygonStart()},polygonEnd:function(){XF.polygonEnd(),gO.point=yO,gO.lineStart=bO,gO.lineEnd=xO,VF<0?(RF=-(LF=180),PF=-(BF=90)):WF>Ow?BF=90:WF<-Ow&&(PF=-90),GF[0]=RF,GF[1]=LF},sphere:function(){RF=-(LF=180),PF=-(BF=90)}};function yO(e,t){HF.push(GF=[RF=e,LF=e]),tBF&&(BF=t)}function vO(e,t){var n=pE([e*Bw,t*Bw]);if(qF){var i=gE(qF,n),r=gE([i[1],-i[0],0],i);bE(r),r=hE(r);var o,a=e-jF,s=a>0?1:-1,l=r[0]*Lw*s,u=jw(a)>180;u^(s*jFBF&&(BF=o):u^(s*jF<(l=(l+360)%360-180)&&lBF&&(BF=t)),u?eEO(RF,LF)&&(LF=e):EO(e,LF)>EO(RF,LF)&&(RF=e):LF>=RF?(eLF&&(LF=e)):e>jF?EO(RF,e)>EO(RF,LF)&&(LF=e):EO(e,LF)>EO(RF,LF)&&(RF=e)}else HF.push(GF=[RF=e,LF=e]);tBF&&(BF=t),qF=n,jF=e}function bO(){gO.point=vO}function xO(){GF[0]=RF,GF[1]=LF,gO.point=yO,qF=null}function _O(e,t){if(qF){var n=e-jF;WF.add(jw(n)>180?n+(n>0?360:-360):n)}else IF=e,UF=t;XF.point(e,t),vO(e,t)}function wO(){XF.lineStart()}function kO(){_O(IF,UF),XF.lineEnd(),jw(WF)>Ow&&(RF=-(LF=180)),GF[0]=RF,GF[1]=LF,qF=null}function EO(e,t){return(t-=e)<0?t+360:t}function AO(e,t){return e[0]-t[0]}function $O(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tt.indexOf(e)>=0)):t},R_union:function(e,t){var n=Le(t[0]),i=Le(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]i&&(n=t[1],i=t[0]),e.length?ii&&(e[1]=i),e):[n,i]}};function QO(e,t,n,i){t[0].type!==KM&&me("First argument to selection functions must be a string literal.");const r=t[0].value,o="unit",a="@"+o,s=":"+r;(t.length>=2&&Pe(t).value)!==IO||yt(i,a)||(i[a]=n.getData(r).indataRef(n,o)),yt(i,s)||(i[s]=n.getData(r).tuplesRef())}function ZO(e){const t=this.context.data[e];return t?t.values.value:[]}const KO=e=>function(t,n){return this.context.dataflow.locale()[e](n)(t)},eN=KO("format"),tN=KO("timeFormat"),nN=KO("utcFormat"),iN=KO("timeParse"),rN=KO("utcParse"),oN=new Date(2e3,0,1);function aN(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(oN.setYear(2e3),oN.setMonth(e),oN.setDate(t),tN.call(this,oN,n)):""}const sN="%",lN="$";function uN(e,t,n,i){t[0].type!==KM&&me("First argument to data functions must be a string literal.");const r=t[0].value,o=":"+r;if(!yt(o,i))try{i[o]=n.getData(r).tuplesRef()}catch(e){}}function cN(e,t,n,i){if(t[0].type===KM)fN(n,i,t[0].value);else for(e in n.scales)fN(n,i,e)}function fN(e,t,n){const i=sN+n;if(!yt(t,i))try{t[i]=e.scaleRef(n)}catch(e){}}function dN(e,t){if(rt(e))return e;if(St(e)){const i=t.scales[e];return i&&((n=i.value)&&!0===n[em])?i.value:void 0}var n}function hN(e,t){return function(n,i,r){if(n){const t=dN(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const pN=hN("area",(function(e){return YF=new Fw,Cw(e,XF),2*YF})),mN=hN("bounds",(function(e){var t,n,i,r,o,a,s;if(BF=LF=-(RF=PF=1/0),HF=[],Cw(e,gO),n=HF.length){for(HF.sort(AO),t=1,o=[i=HF[0]];tEO(i[0],i[1])&&(i[1]=r[1]),EO(r[0],i[1])>EO(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(a=-1/0,t=0,i=o[n=o.length-1];t<=n;i=r,++t)r=o[t],(s=EO(i[1],r[0]))>a&&(a=s,RF=r[0],LF=i[1])}return HF=GF=null,RF===1/0||PF===1/0?[[NaN,NaN],[NaN,NaN]]:[[RF,PF],[LF,BF]]})),gN=hN("centroid",(function(e){eO=tO=nO=iO=rO=oO=aO=sO=0,lO=new Fw,uO=new Fw,cO=new Fw,Cw(e,DO);var t=+lO,n=+uO,i=+cO,r=Gw(t,n,i);return r_N(e,t)}const kN={};function EN(e){return Fe(e)||ArrayBuffer.isView(e)?e:null}function AN(e){return EN(e)||(St(e)?e:null)}const $N=e=>e.data;function DN(e,t){const n=ZO.call(t,e);return n.root&&n.root.lookup||{}}const SN=()=>"undefined"!=typeof window&&window||null;function MN(e,t,n){if(!e)return[];const[i,r]=e,o=(new qg).set(i[0],i[1],r[0],r[1]);return Cx(n||this.context.dataflow.scenegraph().root,o,function(e){let t=null;if(e){const n=nt(e.marktype),i=nt(e.markname);t=e=>(!n.length||n.some((t=>e.marktype===t)))&&(!i.length||i.some((t=>e.name===t)))}return t}(t))}const CN={random:()=>Us(),cumulativeNormal:Ks,cumulativeLogNormal:ol,cumulativeUniform:fl,densityNormal:Zs,densityLogNormal:rl,densityUniform:cl,quantileNormal:el,quantileLogNormal:al,quantileUniform:dl,sampleNormal:Qs,sampleLogNormal:il,sampleUniform:ul,isArray:Fe,isBoolean:kt,isDate:Et,isDefined:e=>void 0!==e,isNumber:$t,isObject:Oe,isRegExp:Dt,isString:St,isTuple:Ha,isValid:e=>null!=e&&e==e,toBoolean:Lt,toDate:e=>jt(e),toNumber:Le,toString:It,indexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;ipt(e),inScope:function(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:MN,clampRange:it,pinchDistance:function(e){const t=e.touches,n=t[0].clientX-t[1].clientX,i=t[0].clientY-t[1].clientY;return Math.hypot(n,i)},pinchAngle:function(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){const e=SN();return e?e.screen:{}},containerSize:function(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){const e=SN();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return Dp(e||0,t||0,n||0)},setdata:function(e,t){const n=this.context.dataflow,i=this.context.data[e].input;return n.pulse(i,n.changeset().remove(we).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?dg(n,t=t||tg(e)):e}},panLinear:He,panLog:Ge,panPow:Ve,panSymlog:Ye,zoomLinear:Je,zoomLog:Qe,zoomPow:Ze,zoomSymlog:Ke,encode:function(e,t,n){if(e){const n=this.context.dataflow,i=e.mark.source;n.pulse(i,n.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,i,r,o){const a=this.context.dataflow,s=this.context.data[e],l=s.input,u=a.stamp();let c,f,d=s.changes;if(!1===a._trigger||!(l.value.length||t||i))return 0;if((!d||d.stamp{s.modified=!0,a.pulse(l,d).run()}),!0,1)),n&&(c=!0===n?we:Fe(n)||Ha(n)?n:wN(n),d.remove(c)),t&&d.insert(t),i&&(c=wN(i),l.value.some(c)?d.remove(c):d.insert(i)),r)for(f in o)d.modify(r,f,o[f]);return 1},lassoAppend:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const r=(e=nt(e))[e.length-1];return void 0===r||Math.hypot(r[0]-t,r[1]-n)>i?[...e,[t,n]]:e},lassoPath:function(e){return nt(e).reduce(((t,n,i)=>{let[r,o]=n;return t+(0==i?`M ${r},${o} `:i===e.length-1?" Z":`L ${r},${o} `)}),"")},intersectLasso:function(e,t,n){const{x:i,y:r,mark:o}=n,a=(new qg).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[e,n]of t)ea.x2&&(a.x2=e),na.y2&&(a.y2=n);return a.translate(i,r),MN([[a.x1,a.y1],[a.x2,a.y2]],e,o).filter((e=>function(e,t,n){let i=0;for(let r=0,o=n.length-1;rt!=s>t&&e<(a-l)*(t-u)/(s-u)+l&&i++}return 1&i}(e.x,e.y,t)))}},FN=["view","item","group","xy","x","y"],ON="this.",NN={},TN={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${Pt(lN+e)}]`,functions:function(e){const t=MF(e);FN.forEach((e=>t[e]="event.vega."+e));for(const e in CN)t[e]=ON+e;return ht(t,function(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=cN,n._range=cN,n._scale=cN;const i=t=>"_["+(t.type===KM?Pt(sN+t.value):Pt(sN)+"+"+e(t))+"]";return{_bandwidth:e=>`this.__bandwidth(${i(e[0])})`,_range:e=>`${i(e[0])}.range()`,_scale:t=>`${i(t[0])}(${e(t[1])})`}}(e,CN,NN)),t},constants:SF,visitors:NN},zN=CF(TN);function RN(e,t,n){return 1===arguments.length?CN[e]:(CN[e]=t,n&&(NN[e]=n),zN&&(zN.functions[e]=ON+e),this)}function PN(e,t){const n={};let i;try{i=DF(e=St(e)?e:Pt(e)+"")}catch(t){me("Expression parse error: "+e)}i.visit((e=>{if(e.type!==eC)return;const i=e.callee.name,r=TN.visitors[i];r&&r(i,e.arguments,t,n)}));const r=zN(i);return r.globals.forEach((e=>{const i=lN+e;!yt(n,i)&&t.getSignal(e)&&(n[i]=t.signalRef(e))})),{$expr:ht({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}RN("bandwidth",(function(e,t){const n=dN(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),cN),RN("copy",(function(e,t){const n=dN(e,(t||this).context);return n?n.copy():void 0}),cN),RN("domain",(function(e,t){const n=dN(e,(t||this).context);return n?n.domain():[]}),cN),RN("range",(function(e,t){const n=dN(e,(t||this).context);return n&&n.range?n.range():[]}),cN),RN("invert",(function(e,t,n){const i=dN(e,(n||this).context);return i?Fe(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}),cN),RN("scale",(function(e,t,n){const i=dN(e,(n||this).context);return i?i(t):void 0}),cN),RN("gradient",(function(e,t,n,i,r){e=dN(e,(r||this).context);const o=Vm(t,n);let a=e.domain(),s=a[0],l=Pe(a),u=be;return l-s?u=mm(e,s,l):e=(e.interpolator?nm("sequential")().interpolator(e.interpolator()):nm("linear")().interpolate(e.interpolate()).range(e.range())).domain([s=0,l=1]),e.ticks&&(a=e.ticks(+i||15),s!==a[0]&&a.unshift(s),l!==Pe(a)&&a.push(l)),a.forEach((t=>o.stop(u(t),e(t)))),o}),cN),RN("geoArea",pN,cN),RN("geoBounds",mN,cN),RN("geoCentroid",gN,cN),RN("geoShape",(function(e,t,n){const i=dN(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}}),cN),RN("geoScale",(function(e,t){const n=dN(e,(t||this).context);return n&&n.scale()}),cN),RN("indata",(function(e,t,n){const i=this.context.data[e]["index:"+t],r=i?i.value.get(n):void 0;return r?r.count:r}),(function(e,t,n,i){t[0].type!==KM&&me("First argument to indata must be a string literal."),t[1].type!==KM&&me("Second argument to indata must be a string literal.");const r=t[0].value,o=t[1].value,a="@"+o;yt(a,i)||(i[a]=n.getData(r).indataRef(n,o))})),RN("data",ZO,uN),RN("treePath",(function(e,t,n){const i=DN(e,this),r=i[t],o=i[n];return r&&o?r.path(o).map($N):void 0}),uN),RN("treeAncestors",(function(e,t){const n=DN(e,this)[t];return n?n.ancestors().map($N):void 0}),uN),RN("vlSelectionTest",(function(e,t,n){for(var i,r,o,a,s,l=this.context.data[e],u=l?l.values.value:[],c=l?l[HO]&&l[HO].value:void 0,f=n===IO,d=u.length,h=0;h(e[o[n].field]=t,e)),{}))}else l=qO,u=WO(r),(f=(c=v[l]||(v[l]={}))[s]||(c[s]=[])).push(u),n&&(f=b[s]||(b[s]=[])).push({[qO]:u});return t=t||UO,v[qO]?v[qO]=JO[`${qO}_${t}`](...Object.values(v[qO])):Object.keys(v).forEach((e=>{v[e]=Object.keys(v[e]).map((t=>v[e][t])).reduce(((n,i)=>void 0===n?i:JO[`${x[e]}_${t}`](n,i)))})),y=Object.keys(b),n&&y.length&&(v[i?"vlPoint":"vlMulti"]=t===UO?{or:y.reduce(((e,t)=>(e.push(...b[t]),e)),[])}:{and:y.map((e=>({or:b[e]})))}),v}),QO),RN("vlSelectionTuples",(function(e,t){return e.map((e=>ht(t.fields?{values:t.fields.map((t=>jO(t)(e.datum)))}:{[qO]:WO(e.datum)},t)))}));const LN=Ut(["rule"]),BN=Ut(["group","image","rect"]);function jN(e){return(e+"").toLowerCase()}function IN(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var UN={operator:(e,t)=>IN(e,["_"],t.code),parameter:(e,t)=>IN(e,["datum","_"],t.code),event:(e,t)=>IN(e,["event"],t.code),handler:(e,t)=>IN(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{const{marktype:n,channels:i}=t;let r="var o=item,datum=o.datum,m=0,$;";for(const e in i){const t="o["+Pt(e)+"]";r+=`$=${i[e].code};if(${t}!==$)${t}=$,m=1;`}return r+=function(e,t){let n="";return LN[t]||(e.x2&&(e.x?(BN[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(BN[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(i,n),r+="return m;",IN(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(Pt).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const i=Function("a","b","var u, v; return "+e.map(((e,i)=>{const r=t[i];let o,a;return e.path?(o=`a${e.path}`,a=`b${e.path}`):((n=n||{})["f"+i]=e,o=`this.f${i}(a)`,a=`this.f${i}(b)`),function(e,t,n,i){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${i}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${i} : `}(o,a,-r,r)})).join("")+"0;");return n?i.bind(n):i}}};function qN(e,t,n){if(!e||!Oe(e))return e;for(let i,r=0,o=WN.length;re&&e.$tupleid?Ga:e));return t.fn[n]||(t.fn[n]=at(i,e.$order,t.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const n=e.$subflow;return function(e,i,r){const o=t.fork().parse(n),a=o.get(n.operators[0].id),s=o.signals.parent;return s&&s.set(r),a.detachSubflow=()=>t.detach(o),a}}},{key:"$tupleid",parse:function(){return Ga}}];const HN={skip:!0};function GN(e,t,n,i){return new VN(e,t,n,i)}function VN(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||UN,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function YN(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}function XN(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}VN.prototype=YN.prototype={fork(){const e=new YN(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter((t=>t!==e));const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,i=n.dataflow,r=e.value;if(n.set(e.id,t),"collect"===jN(e.type)&&r&&(r.$ingest?i.ingest(t,r.$ingest,r.$format):r.$request?i.preload(t,r.$request,r.$format):i.pulse(t,i.changeset().insert(r))),e.root&&(n.root=t),e.parent){let r=n.get(e.parent.$ref);r?(i.connect(r,[t]),t.targets().add(r)):(n.unresolved=n.unresolved||[]).push((()=>{r=n.get(e.parent.$ref),i.connect(r,[t]),t.targets().add(r)}))}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const i in e.data){const r=n.data[i]||(n.data[i]={});e.data[i].forEach((e=>r[e]=t))}},resolve(){return(this.unresolved||[]).forEach((e=>e())),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[jN(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,i,r){this.dataflow.on(t,n,i,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach((e=>t.parseOperator(e))),n.forEach((e=>t.parseOperatorParameters(e))),(e.streams||[]).forEach((e=>t.parseStream(e))),(e.updates||[]).forEach((e=>t.parseUpdate(e))),t.resolve()},parseOperator:function(e){const t=this;"operator"!==jN(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const t=this;if(e.params){const n=t.get(e.id);n||me("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,t){t=t||{};const n=this;for(const i in e){const r=e[i];t[i]=Fe(r)?r.map((e=>qN(e,n,t))):qN(r,n,t)}return t},parseStream:function(e){var t,n=this,i=null!=e.filter?n.eventExpression(e.filter):void 0,r=null!=e.stream?n.get(e.stream):void 0;e.source?r=n.events(e.source,e.type,i):e.merge&&(r=(t=e.merge.map((e=>n.get(e))))[0].merge.apply(t[0],t.slice(1))),e.between&&(t=e.between.map((e=>n.get(e))),r=r.between(t[0],t[1])),e.filter&&(r=r.filter(i)),null!=e.throttle&&(r=r.throttle(+e.throttle)),null!=e.debounce&&(r=r.debounce(+e.debounce)),null==r&&me("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,i=Oe(i=e.source)?i.$ref:i,r=n.get(i),o=e.update,a=void 0;r||me("Source not defined: "+e.source),t=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(e,r,t,o,a)},getState:function(e){var t=this,n={};if(e.signals){var i=n.signals={};Object.keys(t.signals).forEach((n=>{const r=t.signals[n];e.signals(n,r)&&(i[n]=r.value)}))}if(e.data){var r=n.data={};Object.keys(t.data).forEach((n=>{const i=t.data[n];e.data(n,i)&&(r[n]=i.input.value)}))}return t.subcontext&&!1!==e.recurse&&(n.subcontext=t.subcontext.map((t=>t.getState(e)))),n},setState:function(e){var t=this,n=t.dataflow,i=e.data,r=e.signals;Object.keys(r||{}).forEach((e=>{n.update(t.signals[e],r[e],HN)})),Object.keys(i||{}).forEach((e=>{n.pulse(t.data[e].input,n.changeset().remove(we).insert(i[e]))})),(e.subcontext||[]).forEach(((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)}))}};const JN="default";function QN(e,t){const n=e.globalCursor()?"undefined"!=typeof document&&document.body:e.container();if(n)return null==t?n.style.removeProperty("cursor"):n.style.cursor=t}function ZN(e,t){var n=e._runtime.data;return yt(n,t)||me("Unrecognized data set: "+t),n[t]}function KN(e,t){Ka(t)||me("Second argument to changes must be a changeset.");const n=ZN(this,e);return n.modified=!0,this.pulse(n.input,t)}function eT(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function tT(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function nT(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}const iT="view",rT={trap:!1};function oT(e,t,n,i){e._eventListeners.push({type:n,sources:nt(t),handler:i})}function aT(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||Oe(i)&&!i[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function sT(e){return e.item}function lT(e){return e.item.mark.source}function uT(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function cT(e,t,n){const i=document.createElement(e);for(const e in t)i.setAttribute(e,t[e]);return null!=n&&(i.textContent=n),i}const fT="vega-bind-radio";function dT(e,t,n,i){const r=n.event||"input",o=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,o),oT(i,t,r,o),e.set=e=>{t.value=e,t.dispatchEvent(function(e){return"undefined"!=typeof Event?new Event(e):{type:e}}(r))}}function hT(e,t,n,i){const r=i.signal(n.signal),o=cT("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(cT("label"));a.appendChild(cT("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(o);let s=pT;switch(n.input){case"checkbox":s=mT;break;case"select":s=gT;break;case"radio":s=yT;break;case"range":s=vT}s(e,a,n,r)}function pT(e,t,n,i){const r=cT("input");for(const e in n)"signal"!==e&&"element"!==e&&r.setAttribute("input"===e?"type":e,n[e]);r.setAttribute("name",n.signal),r.value=i,t.appendChild(r),r.addEventListener("input",(()=>e.update(r.value))),e.elements=[r],e.set=e=>r.value=e}function mT(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const o=cT("input",r);t.appendChild(o),o.addEventListener("change",(()=>e.update(o.checked))),e.elements=[o],e.set=e=>o.checked=!!e||null}function gT(e,t,n,i){const r=cT("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((e,t)=>{const n={value:e};bT(e,i)&&(n.selected=!0),r.appendChild(cT("option",n,(o[t]||e)+""))})),t.appendChild(r),r.addEventListener("change",(()=>{e.update(n.options[r.selectedIndex])})),e.elements=[r],e.set=e=>{for(let t=0,i=n.options.length;t{const s={type:"radio",name:n.signal,value:t};bT(t,i)&&(s.checked=!0);const l=cT("input",s);l.addEventListener("change",(()=>e.update(t)));const u=cT("label",{},(o[a]||t)+"");return u.prepend(l),r.appendChild(u),l})),e.set=t=>{const n=e.elements,i=n.length;for(let e=0;e{l.textContent=s.value,e.update(+s.value)};s.addEventListener("input",u),s.addEventListener("change",u),e.elements=[s],e.set=e=>{s.value=e,l.textContent=e}}function bT(e,t){return e===t||e+""==t+""}function xT(e,t,n,i,r,o){return(t=t||new i(e.loader())).initialize(n,eT(e),tT(e),nT(e),r,o).background(e.background())}function _T(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function wT(e,t,n){if("string"==typeof t){if("undefined"==typeof document)return e.error("DOM document instance not found."),null;if(!(t=document.querySelector(t)))return e.error("Signal bind element not found: "+t),null}if(t&&n)try{t.textContent=""}catch(n){t=null,e.error(n)}return t}const kT=e=>+e||0;function ET(e){return Oe(e)?{top:kT(e.top),bottom:kT(e.bottom),left:kT(e.left),right:kT(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(kT(e))}async function AT(e,t,n,i){const r=Mx(t),o=r&&r.headless;return o||me("Unrecognized renderer type: "+t),await e.runAsync(),xT(e,null,null,o,n,i).renderAsync(e._scenegraph.root)}var $T="width",DT="height",ST="padding",MT={skip:!0};function CT(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===ST?i.left+i.right:0)}function FT(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===ST?i.top+i.bottom:0)}function OT(e,t){return t.modified&&Fe(t.input.value)&&e.indexOf("_:vega:_")}function NT(e,t){return!("parent"===e||t instanceof As.proxy)}function TT(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":Fe(e)?zT(e):Oe(e)&&!Et(e)?(t=e,Object.keys(t).map((e=>{const n=t[e];return e+": "+(Fe(n)?zT(n):RT(n))})).join("\n")):e+"";var t}(i))}function zT(e){return"["+e.map(RT).join(", ")+"]"}function RT(e){return Fe(e)?"[…]":Oe(e)&&!Et(e)?"{…}":e}function PT(e,t){const n=this;if(t=t||{},ws.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),null!=t.logLevel&&n.logLevel(t.logLevel),t.locale||e.locale){const i=ht({},e.locale,t.locale);n.locale(fa(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Dx.Canvas,n._scenegraph=new Yv;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||TT,n._redraw=!0,n._handler=(new Eb).scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=ht({defaults:{}},e),n=(e,t)=>{t.forEach((t=>{Fe(e[t])&&(e[t]=Ut(e[t]))}))};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const r=function(e,t,n){return GN(e,As,CN,n).parse(t)}(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((e=>({state:null,param:ht({},e)}))),r.root&&r.root.set(i),i.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(i.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=CT(n,n._width),n._viewHeight=FT(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[$T],i=t[DT],r=t[ST];function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(t=>{e._width=t.size,e._viewWidth=CT(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(t=>{e._height=t.size,e._viewHeight=FT(e,t.size),o()}),{size:i});const a=e.add(null,o,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,a.rank=r.rank+1}(n),function(e){e.add(null,(t=>(e._background=t.bg,e._resize=1,t.bg)),{bg:e._signals.background})}(n),function(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:JN,item:null}));e.on(e.events("view","mousemove"),t,((e,n)=>{const i=t.value,r=i?St(i)?i:i.user:JN,o=n.item&&n.item.cursor||null;return i&&r===i.user&&o==i.item?i:{user:r,item:o}})),e.add(null,(function(t){let n=t.cursor,i=this.value;return St(n)||(i=n.item,n=n.user),QN(e,n&&n!==JN?n:i||n),i}),{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind)}function LT(e,t){return yt(e._signals,t)?e._signals[t]:me("Unrecognized signal name: "+Pt(t))}function BT(e,t){const n=(e._targets||[]).filter((e=>e._update&&e._update.handler===t));return n.length?n[0]:null}function jT(e,t,n,i){let r=BT(n,i);return r||(r=_T(e,(()=>i(t,n.value))),r.handler=i,e.on(n,null,r)),e}function IT(e,t,n){const i=BT(t,n);return i&&t._targets.remove(i),e}_t(PT,ws,{async evaluate(e,t,n){if(await ws.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,r=nT(i=this),o=eT(i),a=tT(i),i._renderer.background(i.background()),i._renderer.resize(o,a,r),i._handler.origin(r),i._resizeListeners.forEach((e=>{try{e(o,a)}catch(e){i.error(e)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}var i,r,o,a;return n&&Ua(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=null!=e?e+"":null;return t!==this._desc&&XN(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const i=LT(this,e);return 1===arguments.length?i.value:this.update(i,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",ET(e)):ET(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(Mx(e)||me("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(ws.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(LT(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,n,i,r,o){this.runAfter((a=>{let s=0;a._autosize=0,a.width()!==n&&(s=1,a.signal($T,n,MT),a._resizeWidth.skip(!0)),a.height()!==i&&(s=1,a.signal(DT,i,MT),a._resizeHeight.skip(!0)),a._viewWidth!==e&&(a._resize=1,a._viewWidth=e),a._viewHeight!==t&&(a._resize=1,a._viewHeight=t),a._origin[0]===r[0]&&a._origin[1]===r[1]||(a._resize=1,a._origin=r),s&&a.run("enter"),o&&a.runAfter((e=>e.resize()))}),!1,1)},addEventListener(e,t,n){let i=t;return n&&!1===n.trap||(i=_T(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n,i,r=this._handler.handlers(e),o=r.length;--o>=0;)if(i=r[o].type,n=r[o].handler,e===i&&(t===n||t===n.raw)){this._handler.off(i,n);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.indexOf(e)<0&&t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return jT(this,e,LT(this,e),t)},removeSignalListener(e,t){return IT(this,LT(this,e),t)},addDataListener(e,t){return jT(this,e,ZN(this,e).values,t)},removeDataListener(e,t){return IT(this,ZN(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=QN(this,null);this._globalCursor=!!e,t&&QN(this,t)}return this}return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:function(e,t){this._timers.push(function(e,t,n){var i=new H$,r=t;return null==t?(i.restart(e,t,n),i):(i._restart=i.restart,i.restart=function(e,t,n){t=+t,n=null==n?q$():+n,i._restart((function o(a){a+=r,i._restart(o,r+=t,n),e(a)}),t,n)},i.restart(e,t,n),i)}((function(t){e({timestamp:Date.now(),elapsed:t})}),t))},events:function(e,t,n){var i,r=this,o=new ls(n),a=function(n,i){r.runAsync(null,(()=>{e===iT&&function(e,t){var n=e._eventConfig.defaults,i=n.prevent,r=n.allow;return!1!==i&&!0!==r&&(!0===i||!1===r||(i?i[t]:r?!r[t]:e.preventDefault()))}(r,t)&&n.preventDefault(),o.receive(function(e,t,n){var i,r,o=e._renderer,a=o&&o.canvas();return a&&(r=nT(e),(i=tb(t.changedTouches?t.changedTouches[0]:t,a))[0]-=r[0],i[1]-=r[1]),t.dataflow=e,t.item=n,t.vega=function(e,t,n){const i=t?"group"===t.mark.marktype?t:t.mark.group:null;function r(e){var n,r=i;if(e)for(n=t;n;n=n.mark.group)if(n.mark.name===e){r=n;break}return r&&r.mark&&r.mark.interactive?r:{}}function o(e){if(!e)return n;St(e)&&(e=r(e));const t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:ft(e),item:ft(t||{}),group:r,xy:o,x:e=>o(e)[0],y:e=>o(e)[1]}}(e,n,i),t}(r,n,i))}))};if("timer"===e)aT(r,"timer",t)&&r.timer(a,t);else if(e===iT)aT(r,"view",t)&&r.addEventListener(t,a,rT);else if("window"===e?aT(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&aT(r,"selector",t)&&(i=Array.from(document.querySelectorAll(e))),i){for(var s=0,l=i.length;s=0;)r[e].stop();for(e=o.length;--e>=0;)for(t=(n=o[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);return i&&i.call(this,this._handler,null,null,null),this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",sT),lT,uT(e)),this.on(this.events("view","mouseout",sT),lT,uT(t)),this},data:function(e,t){return arguments.length<2?ZN(this,e).values.value:KN.call(this,e,es().remove(we).insert(t))},change:KN,insert:function(e,t){return KN.call(this,e,es().insert(t))},remove:function(e,t){return KN.call(this,e,es().remove(t))},scale:function(e){var t=this._runtime.scales;return yt(t,e)||me("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,o=Mx(i);e=n._el=e?wT(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),XN(t,e.description()))}(n),o||n.error("Unrecognized renderer type: "+i);const a=o.handler||Eb,s=e?o.renderer:o.headless;return n._renderer=s?xT(n,n._renderer,e,s):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),_T(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,nT(e),e);return t&&t.handlers().forEach((e=>{r.on(e.type,e.handler)})),r}(n,n._handler,e,a),n._redraw=!0,e&&"none"!==r&&(t=t?n._elBind=wT(n,t,!0):e.appendChild(cT("form",{class:"vega-bindings"})),n._bind.forEach((e=>{e.param.element&&"container"!==r&&(e.element=wT(n,e.param.element,!!e.param.input))})),n._bind.forEach((e=>{!function(e,t,n){if(!t)return;const i=n.param;let r=n.state;r||(r=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(i.signal)&&e.runAsync(null,(()=>{r.source=!0,e.signal(i.signal,t)}))}},i.debounce&&(r.update=dt(i.debounce,r.update))),(null==i.input&&i.element?dT:hT)(r,t,i,e),r.active||(e.on(e._signals[i.signal],null,(()=>{r.source?r.source=!1:r.set(e.signal(i.signal))})),r.active=!0)}(n,e.element||t,e)}))),n},toImageURL:async function(e,t){e!==Dx.Canvas&&e!==Dx.SVG&&e!==Dx.PNG&&me("Unrecognized image type: "+e);const n=await AT(this,e,t);return e===Dx.SVG?function(e,t){const n=new Blob([e],{type:"image/svg+xml"});return window.URL.createObjectURL(n)}(n.svg()):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await AT(this,Dx.Canvas,e,t)).canvas()},toSVG:async function(e){return(await AT(this,Dx.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:OT,signals:NT,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(e=>{e._trigger=!0})),this}});const UT="view",qT="[",WT="]",HT="{",GT="}",VT=":",YT=",",XT="@",JT=">",QT=/[[\]{}]/,ZT={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let KT,ez;function tz(e,t,n){return KT=t||UT,ez=n||ZT,iz(e.trim()).map(rz)}function nz(e,t,n,i,r){const o=e.length;let a,s=0;for(;t=0?--s:i&&i.indexOf(a)>=0&&++s}return t}function iz(e){const t=[],n=e.length;let i=0,r=0;for(;r' after between selector: "+e;n=n.map(rz);const r=rz(e.slice(1).trim());return r.between?{between:n,stream:r}:(r.between=n,r)}(e):function(e){const t={source:KT},n=[];let i,r,o=[0,0],a=0,s=0,l=e.length,u=0;if(e[l-1]===GT){if(u=e.lastIndexOf(HT),!(u>=0))throw"Unmatched right brace: "+e;try{o=function(e){const t=e.split(YT);if(!e.length||t.length>2)throw e;return t.map((t=>{const n=+t;if(n!=n)throw e;return n}))}(e.substring(u+1,l-1))}catch(t){throw"Invalid throttle specification: "+e}l=(e=e.slice(0,u).trim()).length,u=0}if(!l)throw e;if(e[0]===XT&&(a=++u),i=nz(e,u,VT),i1?(t.type=n[1],a?t.markname=n[0].slice(1):(c=n[0],ez[c]?t.marktype=n[0]:t.source=n[0])):t.type=n[0],"!"===t.type.slice(-1)&&(t.consume=!0,t.type=t.type.slice(0,-1)),null!=r&&(t.filter=r),o[0]&&(t.throttle=o[0]),o[1]&&(t.debounce=o[1]),t}(e)}function oz(e){return Oe(e)?e:{type:e||"pad"}}const az=e=>+e||0,sz=e=>({top:e,bottom:e,left:e,right:e});function lz(e){return Oe(e)?e.signal?e:{top:az(e.top),bottom:az(e.bottom),left:az(e.left),right:az(e.right)}:sz(az(e))}const uz=e=>Oe(e)&&!Fe(e)?ht({},e):{value:e};function cz(e,t,n,i){return null!=n?(Oe(n)&&!Fe(n)||Fe(n)&&n.length&&Oe(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1):0}function fz(e,t,n){for(const n in t)cz(e,n,t[n]);for(const t in n)cz(e,t,n[t],"update")}function dz(e,t,n){for(const i in t)n&&yt(n,i)||(e[i]=ht(e[i]||{},t[i]));return e}function hz(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const pz="mark",mz="frame",gz="scope",yz="axis",vz="axis-domain",bz="axis-grid",xz="axis-label",_z="axis-tick",wz="axis-title",kz="legend",Ez="legend-band",Az="legend-entry",$z="legend-gradient",Dz="legend-label",Sz="legend-symbol",Mz="legend-title",Cz="title",Fz="title-text",Oz="title-subtitle";function Nz(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const Tz=e=>St(e)?Pt(e):e.signal?`(${e.signal})`:Lz(e);function zz(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map((e=>null==e?null:Pt(e)));for(;t.length&&null==Pe(t);)t.pop();return t.unshift(Tz(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?Rz("hcl",e.h,e.c,e.l):e.h||e.s?Rz("hsl",e.h,e.s,e.l):e.l||e.a?Rz("lab",e.l,e.a,e.b):e.r||e.g||e.b?Rz("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?Lz(e.field):void 0!==e.value?Pt(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=Tz(e.scale);return 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?"":"*"+Pz(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0")),t}(e,t)),void 0===t&&(t=null),null!=e.exponent&&(t=`pow(${t},${Pz(e.exponent)})`),null!=e.mult&&(t+=`*${Pz(e.mult)}`),null!=e.offset&&(t+=`+${Pz(e.offset)}`),e.round&&(t=`round(${t})`),t}const Rz=(e,t,n,i)=>`(${e}(${[t,n,i].map(zz).join(",")})+'')`;function Pz(e){return Oe(e)?"("+zz(e)+")":e}function Lz(e){return Bz(Oe(e)?e:{datum:e})}function Bz(e){let t,n,i;if(e.signal)t="datum",i=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(i=e.parent,t+=".datum"):i=e.group}else e.datum?(t="datum",i=e.datum):me("Invalid field reference: "+Pt(e));return e.signal||(i=St(i)?ge(i).map(Pt).join("]["):Bz(i)),t+"["+i+"]"}function jz(e,t,n,i,r,o){const a={};(o=o||{}).encoders={$encode:a},e=function(e,t,n,i,r){const o={},a={};let s,l,u,c;for(l in l="lineBreak","text"!==t||null==r[l]||hz(l,e)||Nz(o,l,r[l]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===mz?r.group:n===pz?ht({},r.mark,r[t]):null,c)u=hz(l,e)||("fill"===l||"stroke"===l)&&(hz("fill",e)||hz("stroke",e)),u||Nz(o,l,c[l]);for(l in nt(i).forEach((t=>{const n=r.style&&r.style[t];for(const t in n)hz(t,e)||Nz(o,t,n[t])})),e=ht({},e),o)c=o[l],c.signal?(s=s||{})[l]=c:a[l]=c;return e.enter=ht(a,e.enter),s&&(e.update=ht(s,e.update)),e}(e,t,n,i,r.config);for(const n in e)a[n]=Iz(e[n],t,o,r);return o}function Iz(e,t,n,i){const r={},o={};for(const t in e)null!=e[t]&&(r[t]=Uz((a=e[t],Fe(a)?function(e){let t="";return e.forEach((e=>{const n=zz(e);t+=e.test?`(${e.test})?${n}:`:n})),":"===Pe(t)&&(t+="null"),t}(a):zz(a)),i,n,o));var a;return{$expr:{marktype:t,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function Uz(e,t,n,i){const r=PN(e,t);return r.$fields.forEach((e=>i[e]=1)),ht(n,r.$params),r.$expr}const qz="outer",Wz=["value","update","init","react","bind"];function Hz(e,t){me(e+' for "outer" push: '+Pt(t))}function Gz(e,t){const n=e.name;if(e.push===qz)t.signals[n]||Hz("No prior signal definition",n),Wz.forEach((t=>{void 0!==e[t]&&Hz("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 Vz(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function Yz(e,t,n,i){return new Vz(e,t,n,i)}function Xz(e,t){return Yz("operator",e,t)}function Jz(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Qz(e,t){return t?{$field:e,$name:t}:{$field:e}}const Zz=Qz("key");function Kz(e,t){return{$compare:e,$order:t}}function eR(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const tR="scope",nR="view";function iR(e){return e&&e.signal}function rR(e){if(iR(e))return!0;if(Oe(e))for(const t in e)if(rR(e[t]))return!0;return!1}function oR(e,t){return null!=e?e:t}function aR(e){return e&&e.signal||e}const sR="timer";function lR(e,t){return(e.merge?uR:e.stream?cR:e.type?fR:me("Invalid stream specification: "+Pt(e)))(e,t)}function uR(e,t){const n=dR({merge:e.merge.map((e=>lR(e,t)))},e,t);return t.addStream(n).id}function cR(e,t){const n=dR({stream:lR(e.stream,t)},e,t);return t.addStream(n).id}function fR(e,t){let n;var i;e.type===sR?(n=t.event(sR,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===tR?nR:i||nR,e.type);const r=dR({stream:n},e,t);return 1===Object.keys(r).length?n:t.addStream(r).id}function dR(e,t,n){let i=t.between;return i&&(2!==i.length&&me('Stream "between" parameter must have 2 entries: '+Pt(t)),e.between=[lR(i[0],n),lR(i[1],n)]),i=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&i.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+"'":"")}(t.marktype,t.markname,t.markrole)),t.source===tR&&i.push("inScope(event.item)"),i.length&&(e.filter=PN("("+i.join(")&&(")+")",n).$expr),null!=(i=t.throttle)&&(e.throttle=+i),null!=(i=t.debounce)&&(e.debounce=+i),t.consume&&(e.consume=!0),e}const hR={code:"_.$value",ast:{type:"Identifier",value:"value"}};function pR(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}const mR=e=>(t,n,i)=>Yz(e,n,t||void 0,i),gR=mR("aggregate"),yR=mR("axisticks"),vR=mR("bound"),bR=mR("collect"),xR=mR("compare"),_R=mR("datajoin"),wR=mR("encode"),kR=mR("expression"),ER=mR("facet"),AR=mR("field"),$R=mR("key"),DR=mR("legendentries"),SR=mR("load"),MR=mR("mark"),CR=mR("multiextent"),FR=mR("multivalues"),OR=mR("overlap"),NR=mR("params"),TR=mR("prefacet"),zR=mR("projection"),RR=mR("proxy"),PR=mR("relay"),LR=mR("render"),BR=mR("scale"),jR=mR("sieve"),IR=mR("sortitems"),UR=mR("viewlayout"),qR=mR("values");let WR=0;const HR={min:"min",max:"max",count:"sum"};function GR(e,t){const n=t.getScale(e.name).params;let i;for(i in n.domain=JR(e.domain,e,t),null!=e.range&&(n.range=rP(e,t,n)),null!=e.interpolate&&function(e,t){t.interpolate=VR(e.type||e),null!=e.gamma&&(t.interpolateGamma=VR(e.gamma))}(e.interpolate,n),null!=e.nice&&(n.nice=function(e){return Oe(e)?{interval:VR(e.interval),step:VR(e.step)}:VR(e)}(e.nice)),null!=e.bins&&(n.bins=function(e,t){return e.signal||Fe(e)?YR(e,t):t.objectProperty(e)}(e.bins,t)),e)yt(n,i)||"name"===i||(n[i]=VR(e[i],t))}function VR(e,t){return Oe(e)?e.signal?t.signalRef(e.signal):me("Unsupported object: "+Pt(e)):e}function YR(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>VR(e,t)))}function XR(e){me("Can not find data set: "+Pt(e))}function JR(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(Fe(e)?QR:e.fields?KR:ZR)(e,t,n);null==t.domainMin&&null==t.domainMax||me("No scale domain defined for domainMin/domainMax to override.")}function QR(e,t,n){return e.map((e=>VR(e,n)))}function ZR(e,t,n){const i=n.getData(e.data);return i||XR(e.data),am(t.type)?i.valuesRef(n,e.field,tP(e.sort,!1)):cm(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function KR(e,t,n){const i=e.data,r=e.fields.reduce(((e,t)=>(t=St(t)?{data:i,field:t}:Fe(t)||t.signal?function(e,t){const n="_:vega:_"+WR++,i=bR({});if(Fe(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+Pt(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,jR({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e)),[]);return(am(t.type)?eP:cm(t.type)?nP:iP)(e,n,r)}function eP(e,t,n){const i=tP(e.sort,!0);let r,o;const a=n.map((e=>{const n=t.getData(e.data);return n||XR(e.data),n.countsRef(t,e.field,i)})),s={groupby:Zz,pulse:a};i&&(r=i.op||"count",o=i.field?eR(r,i.field):"count",s.ops=[HR[r]],s.fields=[t.fieldRef(o)],s.as=[o]),r=t.add(gR(s));const l=t.add(bR({pulse:Jz(r)}));return o=t.add(qR({field:Zz,sort:t.sortRef(i),pulse:Jz(l)})),Jz(o)}function tP(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!HR[e.op]&&me("Multiple domain scales can not be sorted using "+e.op):me("No field provided for sort aggregate op: "+e.op):Oe(e)?e.field="key":e={field:"key"}),e}function nP(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||XR(e.data),n.domainRef(t,e.field)}));return Jz(t.add(FR({values:i})))}function iP(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||XR(e.data),n.extentRef(t,e.field)}));return Jz(t.add(CR({extents:i})))}function rP(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(St(r)){if(i&&yt(i,r))return rP(e=ht({},e,{range:i[r]}),t,n);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=am(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:me("Unrecognized scale range value: "+Pt(r))}else{if(r.scheme)return n.scheme=Fe(r.scheme)?YR(r.scheme,t):VR(r.scheme,t),r.extent&&(n.schemeExtent=YR(r.extent,t)),void(r.count&&(n.schemeCount=VR(r.count,t)));if(r.step)return void(n.rangeStep=VR(r.step,t));if(am(e.type)&&!Fe(r))return JR(r,e,t);Fe(r)||me("Unsupported range type: "+Pt(r))}return r.map((e=>(Fe(e)?YR:VR)(e,t)))}function oP(e,t,n){return Fe(e)?e.map((e=>oP(e,t,n))):Oe(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:me("Unsupported parameter object: "+Pt(e)):e}const aP="top",sP="left",lP="right",uP="bottom",cP="center",fP="vertical",dP="start",hP="end",pP="index",mP="label",gP="offset",yP="perc",vP="perc2",bP="value",xP="guide-label",_P="guide-title",wP="group-title",kP="group-subtitle",EP="symbol",AP="gradient",$P="discrete",DP="size",SP=[DP,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],MP={name:1,style:1,interactive:1},CP={value:0},FP={value:1},OP="group",NP="rect",TP="rule",zP="symbol",RP="text";function PP(e){return e.type=OP,e.interactive=e.interactive||!1,e}function LP(e,t){const n=(n,i)=>oR(e[n],oR(t[n],i));return n.isVertical=n=>fP===oR(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>oR(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>oR(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>oR(e.columns,oR(t.columns,+n.isVertical(!0))),n}function BP(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 jP(e,t,n){return`item.anchor === '${dP}' ? ${e} : item.anchor === '${hP}' ? ${t} : ${n}`}const IP=jP(Pt(sP),Pt(lP),Pt(cP));function UP(e,t){return t?e?Oe(e)?Object.assign({},e,{offset:UP(e.offset,t)}):{value:e,offset:t}:t:e}function qP(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=dz(e.encode,t,MP)):e.interactive=!1,e}function WP(e,t,n,i){const r=LP(e,n),o=r.isVertical(),a=r.gradientThickness(),s=r.gradientLength();let l,u,c,f,d;o?(u=[0,1],c=[0,0],f=a,d=s):(u=[0,0],c=[1,0],f=s,d=a);const h={enter:l={opacity:CP,x:CP,y:CP,width:uz(f),height:uz(d)},update:ht({},l,{opacity:FP,fill:{gradient:t,start:u,stop:c}}),exit:{opacity:CP}};return fz(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),qP({type:NP,role:$z,encode:h},i)}function HP(e,t,n,i,r){const o=LP(e,n),a=o.isVertical(),s=o.gradientThickness(),l=o.gradientLength();let u,c,f,d,h="";a?(u="y",f="y2",c="x",d="width",h="1-"):(u="x",f="x2",c="y",d="height");const p={opacity:CP,fill:{scale:t,field:bP}};p[u]={signal:h+"datum."+yP,mult:l},p[c]=CP,p[f]={signal:h+"datum."+vP,mult:l},p[d]=uz(s);const m={enter:p,update:ht({},p,{opacity:FP}),exit:{opacity:CP}};return fz(m,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),qP({type:NP,role:Ez,key:bP,from:r,encode:m},i)}const GP=`datum.${yP}<=0?"${sP}":datum.${yP}>=1?"${lP}":"${cP}"`,VP=`datum.${yP}<=0?"${uP}":datum.${yP}>=1?"${aP}":"middle"`;function YP(e,t,n,i){const r=LP(e,t),o=r.isVertical(),a=uz(r.gradientThickness()),s=r.gradientLength();let l,u,c,f,d=r("labelOverlap"),h="";const p={enter:l={opacity:CP},update:u={opacity:FP,text:{field:mP}},exit:{opacity:CP}};return fz(p,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:oR(e.labelLimit,t.gradientLabelLimit)}),o?(l.align={value:"left"},l.baseline=u.baseline={signal:VP},c="y",f="x",h="1-"):(l.align=u.align={signal:GP},l.baseline={value:"top"},c="x",f="y"),l[c]=u[c]={signal:h+"datum."+yP,mult:s},l[f]=u[f]=a,a.offset=oR(e.labelOffset,t.gradientLabelOffset)||0,d=d?{separation:r("labelSeparation"),method:d,order:"datum."+pP}:void 0,qP({type:RP,role:Dz,style:xP,key:bP,from:i,encode:p,overlap:d},n)}function XP(e,t,n,i,r){const o=LP(e,t),a=n.entries,s=!(!a||!a.interactive),l=a?a.name:void 0,u=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.${gP} : datum.${DP}`,h=u?uz(u):{field:DP},p=`datum.${pP}`,m=`max(1, ${r})`;let g,y,v,b,x;h.mult=.5,g={enter:y={opacity:CP,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:FP,x:y.x,y:y.y},exit:{opacity:CP}};let _=null,w=null;e.fill||(_=t.symbolBaseFillColor,w=t.symbolBaseStrokeColor),fz(g,{fill:o("symbolFillColor",_),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",w),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),SP.forEach((t=>{e[t]&&(v[t]=y[t]={scale:e[t],field:bP})}));const k=qP({type:zP,role:Sz,key:bP,from:f,clip:!!u||void 0,encode:g},n.symbols),E=uz(c);E.offset=o("labelOffset"),g={enter:y={opacity:CP,x:{signal:d,offset:E},y:h},update:v={opacity:FP,text:{field:mP},x:y.x,y:y.y},exit:{opacity:CP}},fz(g,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const A=qP({type:RP,role:Dz,style:xP,key:bP,from:f,encode:g},n.labels);return g={enter:{noBound:{value:!u},width:CP,height:u?uz(u):CP,opacity:CP},exit:{opacity:CP},update:v={opacity:FP,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(b=`ceil(item.mark.items.length / ${m})`,v.row.signal=`${p}%${b}`,v.column.signal=`floor(${p} / ${b})`,x={field:["row",p]}):(v.row.signal=`floor(${p} / ${m})`,v.column.signal=`${p} % ${m}`,x={field:p}),v.column.signal=`(${r})?${v.column.signal}:${p}`,PP({role:gz,from:i={facet:{data:i,name:"value",groupby:pP}},encode:dz(g,a,MP),marks:[k,A],name:l,interactive:s,sort:x})}const JP='item.orient === "left"',QP='item.orient === "right"',ZP=`(${JP} || ${QP})`,KP=`datum.vgrad && ${ZP}`,eL=jP('"top"','"bottom"','"middle"'),tL=`datum.vgrad && ${QP} ? (${jP('"right"','"left"','"center"')}) : (${ZP} && !(datum.vgrad && ${JP})) ? "left" : ${IP}`,nL=`item._anchor || (${ZP} ? "middle" : "start")`,iL=`${KP} ? (${JP} ? -90 : 90) : 0`,rL=`${ZP} ? (datum.vgrad ? (${QP} ? "bottom" : "top") : ${eL}) : "top"`;function oL(e,t){let n;return Oe(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+aL(e.path)+")":e.sphere&&(n="geoShape("+aL(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function aL(e){return Oe(e)&&e.signal?e.signal:Pt(e)}function sL(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===OP?gz:t||pz:t}function lL(e){return{marktype:e.type,name:e.name||void 0,role:e.role||sL(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function uL(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function cL(e,t){const n=$s(e.type);n||me("Unrecognized transform type: "+Pt(e.type));const i=Yz(n.type.toLowerCase(),null,fL(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function fL(e,t,n){const i={},r=e.params.length;for(let o=0;opL(e,t,n)))):pL(e,i,n)}(e,t,n):"projection"===i?n.projectionRef(t[e.name]):e.array&&!iR(r)?r.map((t=>hL(e,t,n))):hL(e,r,n):void(e.required&&me("Missing required "+Pt(t.type)+" parameter: "+Pt(e.name)))}function hL(e,t,n){const i=e.type;if(iR(t))return vL(i)?me("Expression references can not be signals."):bL(i)?n.fieldRef(t):xL(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||bL(i);return r&&mL(t)?n.exprRef(t.expr,t.as):r&&gL(t)?Qz(t.field,t.as):vL(i)?PN(t,n):yL(i)?Jz(n.getData(t).values):bL(i)?Qz(t):xL(i)?n.compareRef(t):t}}function pL(e,t,n){const i=e.params.length;let r;for(let n=0;ne&&e.expr,gL=e=>e&&e.field,yL=e=>"data"===e,vL=e=>"expr"===e,bL=e=>"field"===e,xL=e=>"compare"===e;function _L(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:Jz(t.getData(e.data).output)}function wL(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function kL(e){return St(e)?e:null}function EL(e,t,n){const i=eR(n.op,n.field);let r;if(t.ops){for(let e=0,n=t.as.length;enull==e?"null":e)).join(",")+"),0)",t);l.update=u.$expr,l.params=u.$params}function DL(e,t){const n=sL(e),i=e.type===OP,r=e.from&&e.from.facet,o=e.overlap;let a,s,l,u,c,f,d,h=e.layout||n===gz||n===mz;const p=n===pz||h||r,m=function(e,t,n){let i,r,o,a,s;return e?(i=e.facet)&&(t||me("Only group marks can be faceted."),null!=i.field?a=s=_L(i,n):(e.data?s=Jz(n.getData(e.data).aggregate):(o=cL(ht({type:"aggregate",groupby:nt(i.groupby)},i.aggregate),n),o.params.key=n.keyRef(i.groupby),o.params.pulse=_L(i,n),a=s=Jz(n.add(o))),r=n.keyRef(i.groupby,!0))):a=Jz(n.add(bR(null,[{}]))),a||(a=_L(e,n)),{key:r,pulse:a,parent:s}}(e.from,i,t);s=t.add(_R({key:m.key||(e.key?Qz(e.key):void 0),pulse:m.pulse,clean:!i}));const g=Jz(s);s=l=t.add(bR({pulse:g})),s=t.add(MR({markdef:lL(e),interactive:uL(e.interactive,t),clip:oL(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:Jz(s)}));const y=Jz(s);s=u=t.add(wR(jz(e.encode,e.type,n,e.style,t,{mod:!1,pulse:y}))),s.params.parent=t.encode(),e.transform&&e.transform.forEach((e=>{const n=cL(e,t),i=n.metadata;(i.generates||i.changes)&&me("Mark transforms should not generate new data."),i.nomod||(u.params.mod=!0),n.params.pulse=Jz(s),t.add(s=n)})),e.sort&&(s=t.add(IR({sort:t.compareRef(e.sort),pulse:Jz(s)})));const v=Jz(s);(r||h)&&(h=t.add(UR({layout:t.objectProperty(e.layout),legends:t.legends,mark:y,pulse:v})),f=Jz(h));const b=t.add(vR({mark:y,pulse:f||v}));d=Jz(b),i&&(p&&(a=t.operators,a.pop(),h&&a.pop()),t.pushState(v,f||d,g),r?function(e,t,n){const i=e.from.facet,r=i.name,o=_L(i,t);let a;i.name||me("Facet must have a name: "+Pt(i)),i.data||me("Facet must reference a data set: "+Pt(i)),i.field?a=t.add(TR({field:t.fieldRef(i.field),pulse:o})):i.groupby?a=t.add(ER({key:t.keyRef(i.groupby),group:Jz(t.proxy(n.parent)),pulse:o})):me("Facet must specify groupby or field: "+Pt(i));const s=t.fork(),l=s.add(bR()),u=s.add(jR({pulse:Jz(l)}));s.addData(r,new wL(s,l,l,u)),s.addSignal("parent",null),a.params.subflow={$subflow:s.parse(e).toRuntime()}}(e,t,m):p?function(e,t,n){const i=t.add(TR({pulse:n.pulse})),r=t.fork();r.add(jR()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}(e,t,m):t.parse(e),t.popState(),p&&(h&&a.push(h),a.push(b))),o&&(d=function(e,t,n){const i=e.method,r=e.bound,o=e.separation,a={separation:iR(o)?n.signalRef(o.signal):o,method:iR(i)?n.signalRef(i.signal):i,pulse:t};if(e.order&&(a.sort=n.compareRef({field:e.order})),r){const e=r.tolerance;a.boundTolerance=iR(e)?n.signalRef(e.signal):+e,a.boundScale=n.scaleRef(r.scale),a.boundOrient=r.orient}return Jz(n.add(OR(a)))}(o,d,t));const x=t.add(LR({pulse:d})),_=t.add(jR({pulse:Jz(x)},void 0,t.parent()));null!=e.name&&(c=e.name,t.addData(c,new wL(t,l,x,_)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&me("Marks only support modify triggers."),$L(e,t,c)})))}function SL(e,t,n){const i={enter:{},update:{}};return fz(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 ML(e,t,n){return t[e]?`scale("${t[e]}",datum)`:BP(e,n[0].encode)}wL.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let o=t[0],a=null,s=1;for(o&&"load"===o.type&&(o=t[1]),e.add(t[0]);se===uP||e===aP,zL=(e,t,n)=>iR(e)?UL(e.signal,t,n):e===sP||e===aP?t:n,RL=(e,t,n)=>iR(e)?jL(e.signal,t,n):TL(e)?t:n,PL=(e,t,n)=>iR(e)?IL(e.signal,t,n):TL(e)?n:t,LL=(e,t,n)=>iR(e)?qL(e.signal,t,n):e===aP?{value:t}:{value:n},BL=(e,t,n)=>iR(e)?WL(e.signal,t,n):e===lP?{value:t}:{value:n},jL=(e,t,n)=>HL(`${e} === '${aP}' || ${e} === '${uP}'`,t,n),IL=(e,t,n)=>HL(`${e} !== '${aP}' && ${e} !== '${uP}'`,t,n),UL=(e,t,n)=>VL(`${e} === '${sP}' || ${e} === '${aP}'`,t,n),qL=(e,t,n)=>VL(`${e} === '${aP}'`,t,n),WL=(e,t,n)=>VL(`${e} === '${lP}'`,t,n),HL=(e,t,n)=>(t=null!=t?uz(t):t,n=null!=n?uz(n):n,GL(t)&&GL(n)?{signal:`${e} ? (${t=t?t.signal||Pt(t.value):null}) : (${n=n?n.signal||Pt(n.value):null})`}:[ht({test:e},t)].concat(n||[])),GL=e=>null==e||1===Object.keys(e).length,VL=(e,t,n)=>({signal:`${e} ? (${XL(t)}) : (${XL(n)})`}),YL=(e,t,n,i,r)=>({signal:(null!=i?`${e} === '${sP}' ? (${XL(i)}) : `:"")+(null!=n?`${e} === '${uP}' ? (${XL(n)}) : `:"")+(null!=r?`${e} === '${lP}' ? (${XL(r)}) : `:"")+(null!=t?`${e} === '${aP}' ? (${XL(t)}) : `:"")+"(null)"}),XL=e=>iR(e)?e.signal:null==e?null:Pt(e),JL=(e,t)=>0===t?0:iR(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},QL=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function ZL(e,t,n,i){let r;if(t&&yt(t,e))return t[e];if(yt(n,e))return n[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 i[_P][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i[xP][r]}return null}function KL(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function eB(e,t){return{scale:e.scale,range:t}}function tB(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function nB(e,t){const n=function(e,t){var n,i,r,o=t.config,a=o.style,s=o.axis,l="band"===t.scaleType(e.scale)&&o.axisBand,u=e.orient;if(iR(u)){const e=KL([o.axisX,o.axisY]),t=KL([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(r of(n={},e))n[r]=RL(u,ZL(r,o.axisX,s,a),ZL(r,o.axisY,s,a));for(r of(i={},t))i[r]=YL(u.signal,ZL(r,o.axisTop,s,a),ZL(r,o.axisBottom,s,a),ZL(r,o.axisLeft,s,a),ZL(r,o.axisRight,s,a))}else n=u===aP||u===uP?o.axisX:o.axisY,i=o["axis"+u[0].toUpperCase()+u.slice(1)];return n||i||l?ht({},s,n,i,l):s}(e,t),i=e.encode||{},r=i.axis||{},o=r.name||void 0,a=r.interactive,s=r.style,l=LP(e,n),u=function(e){const t=e("tickBand");let n,i,r=e("tickOffset");return t?t.signal?(n={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},Oe(r)||(r={signal:`(${t.signal}) === 'extent' ? 0 : ${r}`})):"extent"===t?(n=1,i=!0,r=0):(n=.5,i=!1):(n=e("bandPosition"),i=e("tickExtra")),{extra:i,band:n,offset:r}}(l),c={scale:e.scale,ticks:!!l("ticks"),labels:!!l("labels"),grid:!!l("grid"),domain:!!l("domain"),title:null!=e.title},f=Jz(t.add(bR({},[c]))),d=Jz(t.add(yR({scale:t.scaleRef(e.scale),extra:t.property(u.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),h=[];let p;return c.grid&&h.push(function(e,t,n,i,r){const o=LP(e,t),a=e.orient,s=e.gridScale,l=zL(a,1,-1),u=function(e,t){if(1===t);else if(Oe(e)){let n=e=ht({},e);for(;null!=n.mult;){if(!Oe(n.mult))return n.mult=iR(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=ht({},n.mult)}n.mult=t}else e=iR(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,l);let c,f,d;const h={enter:c={opacity:CP},update:d={opacity:FP},exit:f={opacity:CP}};fz(h,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:e.scale,field:bP,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},m=RL(a,{signal:"height"},{signal:"width"}),g=s?{scale:s,range:0,mult:l,offset:u}:{value:0,offset:u},y=s?{scale:s,range:1,mult:l,offset:u}:ht(m,{mult:l,offset:u});return c.x=d.x=RL(a,p,g),c.y=d.y=PL(a,p,g),c.x2=d.x2=PL(a,y),c.y2=d.y2=RL(a,y),f.x=RL(a,p),f.y=PL(a,p),qP({type:TP,role:bz,key:bP,from:i,encode:h},n)}(e,n,i.grid,d,u)),c.ticks&&(p=l("tickSize"),h.push(function(e,t,n,i,r,o){const a=LP(e,t),s=e.orient,l=zL(s,-1,1);let u,c,f;const d={enter:u={opacity:CP},update:f={opacity:FP},exit:c={opacity:CP}};fz(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=uz(r);h.mult=l;const p={scale:e.scale,field:bP,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=u.y=RL(s,CP,p),f.y2=u.y2=RL(s,h),c.x=RL(s,p),f.x=u.x=PL(s,CP,p),f.x2=u.x2=PL(s,h),c.y=PL(s,p),qP({type:TP,role:_z,key:bP,from:i,encode:d},n)}(e,n,i.ticks,d,p,u))),c.labels&&(p=c.ticks?p:0,h.push(function(e,t,n,i,r,o){const a=LP(e,t),s=e.orient,l=e.scale,u=zL(s,-1,1),c=aR(a("labelFlush")),f=aR(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let p,m=0===c||!!c;const g=uz(r);g.mult=u,g.offset=uz(a("labelPadding")||0),g.offset.mult=u;const y={scale:l,field:bP,band:.5,offset:UP(o.offset,a("labelOffset"))},v=RL(s,m?tB(l,c,'"left"','"right"','"center"'):{value:"center"},BL(s,"left","right")),b=RL(s,LL(s,"bottom","top"),m?tB(l,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=tB(l,c,`-(${f})`,f,0);m=m&&f;const _={opacity:CP,x:RL(s,y,g),y:PL(s,y,g)},w={enter:_,update:p={opacity:FP,text:{field:mP},x:_.x,y:_.y,align:v,baseline:b},exit:{opacity:CP,x:_.x,y:_.y}};fz(w,{dx:!d&&m?RL(s,x):null,dy:!h&&m?PL(s,x):null}),fz(w,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:d,baseline:h});const k=a("labelBound");let E=a("labelOverlap");return E=E||k?{separation:a("labelSeparation"),method:E,order:"datum.index",bound:k?{scale:l,orient:s,tolerance:k}:null}:void 0,p.align!==v&&(p.align=QL(p.align,v)),p.baseline!==b&&(p.baseline=QL(p.baseline,b)),qP({type:RP,role:xz,style:xP,key:bP,from:i,encode:w,overlap:E},n)}(e,n,i.labels,d,p,u))),c.domain&&h.push(function(e,t,n,i){const r=LP(e,t),o=e.orient;let a,s;const l={enter:a={opacity:CP},update:s={opacity:FP},exit:{opacity:CP}};fz(l,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const u=eB(e,0),c=eB(e,1);return a.x=s.x=RL(o,u,CP),a.x2=s.x2=RL(o,c),a.y=s.y=PL(o,u,CP),a.y2=s.y2=PL(o,c),qP({type:TP,role:vz,from:i,encode:l},n)}(e,n,i.domain,f)),c.title&&h.push(function(e,t,n,i){const r=LP(e,t),o=e.orient,a=zL(o,-1,1);let s,l;const u={enter:s={opacity:CP,anchor:uz(r("titleAnchor",null)),align:{signal:IP}},update:l=ht({},s,{opacity:FP,text:uz(e.title)}),exit:{opacity:CP}},c={signal:`lerp(range("${e.scale}"), ${jP(0,1,.5)})`};return l.x=RL(o,c),l.y=PL(o,c),s.angle=RL(o,CP,JL(a,90)),s.baseline=RL(o,LL(o,uP,aP),{value:uP}),l.angle=s.angle,l.baseline=s.baseline,fz(u,{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 r=(e,t)=>null!=e?(n.update[t]=QL(uz(e),n.update[t]),!1):!hz(t,i),o=r(e("titleX"),"x"),a=r(e("titleY"),"y");n.enter.auto=a===o?uz(a):RL(t,uz(a),uz(o))}(r,o,u,n),u.update.align=QL(u.update.align,s.align),u.update.angle=QL(u.update.angle,s.angle),u.update.baseline=QL(u.update.baseline,s.baseline),qP({type:RP,role:wz,style:_P,from:i,encode:u},n)}(e,n,i.title,f)),DL(PP({role:yz,from:f,encode:dz(iB(l,e),r,MP),marks:h,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:o,interactive:a,style:s}),t)}function iB(e,t){const n={enter:{},update:{}};return fz(n,{orient:e("orient"),offset:e("offset")||0,position:oR(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 rB(e,t,n){const i=nt(e.signals),r=nt(e.scales);return n||i.forEach((e=>Gz(e,t))),nt(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const n in e)"name"!==n&&(i[n]=oP(e[n],n,t));for(const e in n)null==i[e]&&(i[e]=oP(n[e],e,t));t.addProjection(e.name,i)}(e,t))),r.forEach((e=>function(e,t){const n=e.type||"linear";im(n)||me("Unrecognized scale type: "+Pt(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t))),nt(e.data).forEach((e=>function(e,t){const n=[];e.transform&&e.transform.forEach((e=>{n.push(cL(e,t))})),e.on&&e.on.forEach((n=>{$L(n,t,e.name)})),t.addDataPipeline(e.name,function(e,t,n){const i=[];let r,o,a,s,l,u=null,c=!1,f=!1;for(e.values?iR(e.values)||rR(e.format)?(i.push(NL(t,e)),i.push(u=OL())):i.push(u=OL({$ingest:e.values,$format:e.format})):e.url?rR(e.url)||rR(e.format)?(i.push(NL(t,e)),i.push(u=OL())):i.push(u=OL({$request:e.url,$format:e.format})):e.source&&(u=r=nt(e.source).map((e=>Jz(t.getData(e).output))),i.push(null)),o=0,a=n.length;oGR(e,t))),(n||i).forEach((e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?me("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=PN(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach((e=>function(e,t,n){const i=e.encode,r={target:n};let o=e.events,a=e.update,s=[];o||me("Signal update missing events specification."),St(o)&&(o=tz(o,t.isSubscope()?tR:nR)),o=nt(o).filter((e=>e.signal||e.scale?(s.push(e),0):1)),s.length>1&&(s=[pR(s)]),o.length&&s.push(o.length>1?{merge:o}:o[0]),null!=i&&(a&&me("Signal encode and update are mutually exclusive."),a="encode(item(),"+Pt(i)+")"),r.update=St(a)?PN(a,t):null!=a.expr?PN(a.expr,t):null!=a.value?a.value:null!=a.signal?{$expr:hR,$params:{$value:t.signalRef(a.signal)}}:me("Invalid signal update specification."),e.force&&(r.options={force:!0}),s.forEach((e=>t.addUpdate(ht(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):lR(e,t)}}(e,t),r))))}(e,t,n.id)))}(e,t))),nt(e.axes).forEach((e=>nB(e,t))),nt(e.marks).forEach((e=>DL(e,t))),nt(e.legends).forEach((e=>function(e,t){const n=t.config.legend,i=e.encode||{},r=LP(e,n),o=i.legend||{},a=o.name||void 0,s=o.interactive,l=o.style,u={};let c,f,d,h=0;SP.forEach((t=>e[t]?(u[t]=e[t],h=h||e[t]):0)),h||me("Missing valid scale for legend.");const p=function(e,t){let n=e.type||EP;return e.type||1!==function(e){return SP.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=om(t)?AP:sm(t)?$P:EP),n!==AP?n:sm(t)?$P:AP}(e,t.scaleType(h)),m={title:null!=e.title,scales:u,type:p,vgrad:"symbol"!==p&&r.isVertical()},g=Jz(t.add(bR(null,[m]))),y=Jz(t.add(DR(f={type:p,scale:t.scaleRef(h),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return p===AP?(d=[WP(e,h,n,i.gradient),YP(e,n,i.labels,y)],f.count=f.count||t.signalRef(`max(2,2*floor((${aR(r.gradientLength())})/100))`)):p===$P?d=[HP(e,h,n,i.gradient,y),YP(e,n,i.labels,y)]:(c=function(e,t){const n=LP(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),d=[XP(e,n,i,y,aR(c.columns))],f.size=function(e,t,n){const i=aR(ML("size",e,n)),r=aR(ML("strokeWidth",e,n)),o=aR(function(e,t,n){return BP("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i.fontSize}(0,t,n)}(n[1].encode,t,xP));return PN(`max(ceil(sqrt(${i})+${r}),${o})`,t)}(e,t,d[0].marks)),d=[PP({role:Az,from:g,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:c,interactive:s})],m.title&&d.push(function(e,t,n,i){const r=LP(e,t),o={enter:{opacity:CP},update:{opacity:FP,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:CP}};return fz(o,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:nL},angle:{signal:iL},align:{signal:tL},baseline:{signal:rL},text:e.title,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"),baseline:r("titleBaseline")}),qP({type:RP,role:Mz,style:_P,from:i,encode:o},n)}(e,n,i.title,g)),DL(PP({role:kz,from:g,encode:dz(SL(r,e,n),o,MP),marks:d,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:a,interactive:s,style:l}),t)}(e,t))),e.title&&function(e,t){const n=LP(e=St(e)?{text:e}:e,t.config.title),i=e.encode||{},r=i.group||{},o=r.name||void 0,a=r.interactive,s=r.style,l=[],u=Jz(t.add(bR(null,[{}])));l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return fz(o,{text:e.text,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")}),qP({type:RP,role:Fz,style:wP,from:i,encode:o},n)}(e,n,function(e){const t=e.encode;return t&&t.title||ht({name:e.name,interactive:e.interactive,style:e.style},t)}(e),u)),e.subtitle&&l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return fz(o,{text:e.subtitle,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")}),qP({type:RP,role:Oz,style:kP,from:i,encode:o},n)}(e,n,i.subtitle,u)),DL(PP({role:Cz,from:u,encode:FL(n,r),marks:l,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:a,style:s}),t)}(e.title,t),t.parseLambdas(),t}const oB=e=>dz({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function aB(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function sB(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 lB(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 uB(e){return(Fe(e)?cB:fB)(e)}function cB(e){const t=e.length;let n="[";for(let i=0;i0?",":"")+(Oe(t)?t.signal||uB(t):Pt(t))}return n+"]"}function fB(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+Pt(t)+":"+(Oe(n)?n.signal||uB(n):Pt(n));return i+"}"}function dB(e,t,n){return Oe(e)||me("Input Vega specification must be an object."),t=Te(function(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",r="#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:r},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:r,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:r,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"]}}}(),t,e.config),function(e,t){const n=t.config,i=Jz(t.root=t.add(Xz())),r=function(e,t){const n=n=>oR(e[n],t[n]),i=[aB("background",n("background")),aB("autosize",oz(n("autosize"))),aB("padding",lz(n("padding"))),aB("width",n("width")||0),aB("height",n("height")||0)],r=i.reduce(((e,t)=>(e[t.name]=t,e)),{}),o={};return nt(e.signals).forEach((e=>{yt(r,e.name)?e=ht(r[e.name],e):i.push(e),o[e.name]=e})),nt(t.signals).forEach((e=>{yt(o,e.name)||yt(r,e.name)||i.push(e)})),i}(e,n);r.forEach((e=>Gz(e,t))),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const o=t.add(bR()),a=t.add(wR(jz(oB(e.encode),OP,mz,e.style,t,{pulse:Jz(o)}))),s=t.add(UR({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:Jz(a)}));t.operators.pop(),t.pushState(Jz(a),Jz(s),null),rB(e,t,r),t.operators.push(s);let l=t.add(vR({mark:i,pulse:Jz(s)}));return l=t.add(LR({pulse:Jz(l)})),l=t.add(jR({pulse:Jz(l)})),t.addData("root",new wL(t,o,o,l)),t}(e,new sB(t,n)).toRuntime()}sB.prototype=lB.prototype={parse(e){return rB(e,this)},fork(){return new lB(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 Vz?Jz(e):e;return this.add(RR({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,r;e&&(i=e.data||(e.data={}),r=i[t]||(i[t]=[]),r.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(Jz(this.add(jR({pulse:e})))),this._parent.push(t),this._lookup.push(n?Jz(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return Pe(this._parent)},encode(){return Pe(this._encode)},lookup(){return Pe(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(St(e))return Qz(e,t);e.signal||me("Unsupported field reference: "+Pt(e));const n=e.signal;let i=this.field[n];if(!i){const e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=i=Jz(this.add(AR(e)))}return i},compareRef(e){let t=!1;const n=e=>iR(e)?(t=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(t=!0,this.exprRef(e.expr)):e,i=nt(e.field).map(n),r=nt(e.order).map(n);return t?Jz(this.add(xR({fields:i,orders:r}))):Kz(i,r)},keyRef(e,t){let n=!1;const i=this.signals;return e=nt(e).map((e=>iR(e)?(n=!0,Jz(i[e.signal])):e)),n?Jz(this.add($R({fields:e,flat:t}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,t)},sortRef(e){if(!e)return e;const t=eR(e.op,e.field),n=e.order||"ascending";return n.signal?Jz(this.add(xR({fields:t,orders:this.signalRef(n.signal)}))):Kz(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 yt(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&me("Duplicate signal name: "+Pt(e));const n=t instanceof Vz?t:this.add(Xz(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||me("Unrecognized signal name: "+Pt(e)),this.signals[e]},signalRef(e){return this.signals[e]?Jz(this.signals[e]):(yt(this.lambdas,e)||(this.lambdas[e]=this.add(Xz(null))),Jz(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;te*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},gB={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const yB=Array.prototype.slice,vB=(e,t,n)=>{const i=n?n(t[0]):t[0];return i[e].apply(i,yB.call(t,1))};var bB={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:(e,t,n,i,r,o,a)=>new Date(e,t||0,null!=n?n:1,i||0,r||0,o||0,a||0),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return vB("join",arguments)},indexof:function(){return vB("indexOf",arguments)},lastindexof:function(){return vB("lastIndexOf",arguments)},slice:function(){return vB("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return vB("substring",arguments,String)},split:function(){return vB("split",arguments,String)},replace:function(){return vB("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const xB=["view","item","group","xy","x","y"],_B=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&_B.add(setImmediate);const wB={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:"datum"===n?e.datum:"event"===n?e.event:"item"===n?e.item:pB[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,i=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);if(n&&(e.memberDepth-=1),!_B.has(i[r]))return i[r];console.error(`Prevented interpretation of member "${r}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let i=t.callee.name;return i.startsWith("_")&&(i=i.slice(1)),"if"===i?e(n[0])?e(n[1]):e(n[2]):(e.fn[i]||bB[i]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>mB[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>gB[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>"&&"===t.operator?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce(((t,n)=>{e.memberDepth+=1;const i=e(n.key);return e.memberDepth-=1,_B.has(e(n.value))?console.error(`Prevented interpretation of property "${i}" which could lead to insecure code execution`):t[i]=e(n.value),t}),{})};function kB(e,t,n,i,r,o){const a=e=>wB[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=i,a.event=r,a.item=o,xB.forEach((e=>a.fn[e]=function(){return r.vega[e](...arguments)})),a(e)}var EB={operator(e,t){const n=t.ast,i=e.functions;return e=>kB(n,i,e)},parameter(e,t){const n=t.ast,i=e.functions;return(e,t)=>kB(n,i,t,e)},event(e,t){const n=t.ast,i=e.functions;return e=>kB(n,i,void 0,void 0,e)},handler(e,t){const n=t.ast,i=e.functions;return(e,t)=>{const r=t.item&&t.item.datum;return kB(n,i,e,r,t)}},encode(e,t){const{marktype:n,channels:i}=t,r=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,l=0;for(const n in i)s=kB(i[n].ast,r,t,a,void 0,e),e[n]!==s&&(e[n]=s,l=1);return"rule"!==n&&function(e,t,n){let i;t.x2&&(t.x?(n&&e.x>e.x2&&(i=e.x,e.x=e.x2,e.x2=i),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(i=e.y,e.y=e.y2,e.y2=i),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,i,o),l}}};function AB(e){return!!e.or}function $B(e){return!!e.and}function DB(e){return!!e.not}function SB(e,t){if(DB(e))SB(e.not,t);else if($B(e))for(const n of e.and)SB(n,t);else if(AB(e))for(const n of e.or)SB(n,t);else t(e)}function MB(e,t){return DB(e)?{not:MB(e.not,t)}:$B(e)?{and:e.and.map((e=>MB(e,t)))}:AB(e)?{or:e.or.map((e=>MB(e,t)))}:t(e)}const CB=structuredClone;function FB(e){throw new Error(e)}function OB(e,t){const n={};for(const i of t)yt(e,i)&&(n[i]=e[i]);return n}function NB(e,t){const n={...e};for(const e of t)delete n[e];return n}function TB(e){if($t(e))return e;const t=St(e)?e:bj(e);if(t.length<250)return t;let n=0;for(let e=0;e0===t?e:`[${e}]`)),i=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const e of i)t.add(e)}return t}function GB(e,t){return void 0===e||void 0===t||WB(HB(e),HB(t))}function VB(e){return 0===YB(e).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>bj(e))).join(",")})`};const YB=Object.keys,XB=Object.values,JB=Object.entries;function QB(e){return!0===e||!1===e}function ZB(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function KB(e,t){return DB(e)?`!(${KB(e.not,t)})`:$B(e)?`(${e.and.map((e=>KB(e,t))).join(") && (")})`:AB(e)?`(${e.or.map((e=>KB(e,t))).join(") || (")})`:t(e)}function ej(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&ej(e[n],t)&&delete e[n],VB(e)}function tj(e){return e.charAt(0).toUpperCase()+e.substr(1)}function nj(e,t="datum"){const n=ge(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map(Pt).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function ij(e,t="datum"){return`${t}[${Pt(ge(e).join("."))}]`}function rj(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function oj(e){return`${ge(e).map(rj).join("\\.")}`}function aj(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function sj(e){return`${ge(e).join(".")}`}function lj(e){return e?ge(e).length:0}function uj(...e){for(const t of e)if(void 0!==t)return t}let cj=42;function fj(e){const t=++cj;return e?String(e)+t:t}function dj(){cj=42}function hj(e){return pj(e)?e:`__${e}`}function pj(e){return e.startsWith("__")}function mj(e){if(void 0!==e)return(e%360+360)%360}function gj(e){return!!$t(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const yj=Object.getPrototypeOf(structuredClone({}));function vj(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(!vj(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;for(i of e.entries())if(!vj(i[1],t.get(i[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==yj.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==yj.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;0!=i--;){const n=r[i];if(!vj(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function bj(e){const t=[];return function e(n){if(n&&n.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===n)return;if("number"==typeof n)return isFinite(n)?""+n:"null";if("object"!=typeof n)return JSON.stringify(n);let i,r;if(Array.isArray(n)){for(r="[",i=0;iNU(e[t])?ZB(`_${t}_${JB(e[t])}`):ZB(`_${t}_${e[t]}`))).join("")}function CU(e){return!0===e||OU(e)&&!e.binned}function FU(e){return"binned"===e||OU(e)&&!0===e.binned}function OU(e){return Oe(e)}function NU(e){return e?.param}function TU(e){switch(e){case xj:case _j:case Ij:case Pj:case Lj:case Bj:case Gj:case qj:case Wj:case Hj:case jj:return 6;case Vj:return 4;default:return 10}}function zU(e){return!!e?.expr}function RU(e){const t=YB(e||{}),n={};for(const i of t)n[i]=GU(e[i]);return n}function PU(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:l,subtitleFont:u,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:p,...m}=e,g={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},y={...l?{subtitleColor:l}:{},...u?{subtitleFont:u}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:OB(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function LU(e){return St(e)||Fe(e)&&St(e[0])}function BU(e){return!!e?.signal}function jU(e){return!!e.step}function IU(e){return!Fe(e)&&"field"in e&&"data"in e}const UU=YB({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),qU={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},WU=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function HU(e){const t=Fe(e.condition)?e.condition.map(VU):VU(e.condition);return{...GU(e),condition:t}}function GU(e){if(zU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function VU(e){if(zU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function YU(e){if(zU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return BU(e)?e:void 0!==e?{value:e}:void 0}function XU(e){return BU(e)?e.signal:Pt(e)}function JU(e){return BU(e)?e.signal:Pt(e.value)}function QU(e){return BU(e)?e.signal:null==e?null:Pt(e)}function ZU(e,t,n){for(const i of n){const n=tq(i,t.markDef,t.config);void 0!==n&&(e[i]=YU(n))}return e}function KU(e){return[].concat(e.type,e.style??[])}function eq(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&void 0!==t[r]?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?tq(e,t,n,i):void 0}function tq(e,t,n,{vgChannel:i}={}){return uj(i?nq(e,t,n.style):void 0,nq(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function nq(e,t,n){return iq(e,KU(t),n)}function iq(e,t,n){let i;t=nt(t);for(const r of t){const t=n[r];t&&void 0!==t[e]&&(i=t[e])}return i}function rq(e,t){return nt(e).reduce(((e,n)=>(e.field.push(xG(n,t)),e.order.push(n.sort??"ascending"),e)),{field:[],order:[]})}function oq(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(vj(t,e))return;n.push(e)})),n}function aq(e,t){return vj(e,t)||!t?e:e?[...nt(e),...nt(t)].join(", "):t}function sq(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((LU(n)||BU(n))&&(LU(i)||BU(i)))return{explicit:e.explicit,value:aq(n,i)};if(LU(n)||BU(n))return{explicit:e.explicit,value:n};if(LU(i)||BU(i))return{explicit:e.explicit,value:i};if(!(LU(n)||BU(n)||LU(i)||BU(i)))return{explicit:e.explicit,value:oq(n,i)};throw new Error("It should never reach here")}function lq(e){return`Invalid specification ${bj(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const uq='Autosize "fit" only works for single views and layered views.';function cq(e){return("width"==e?"Width":"Height")+' "container" only works for single views and layered views.'}function fq(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function dq(e){return e?`Dropping "fit-${e}" because spec has discrete ${SI(e)}.`:'Dropping "fit" because spec has discrete size.'}function hq(e){return`Unknown field for ${e}. Cannot calculate view size.`}function pq(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function mq(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function gq(e){return`Selection not supported for ${e} yet.`}function yq(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function vq(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function bq(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function xq(e){return`${e}Offset dropped because ${e} is continuous`}function _q(e){return`Invalid field type "${e}".`}function wq(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function kq(e,t){return`Dropping ${bj(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function Eq(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function Aq(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function $q(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function Dq(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function Sq(e){return`Using unaggregated domain with raw field has no effect (${bj(e)}).`}function Mq(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function Cq(e){return`Unaggregated domain is currently unsupported for log scale (${bj(e)}).`}function Fq(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function Oq(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const Nq="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function Tq(e,t){return`Invalid ${e}: ${bj(t)}.`}function zq(e){return`1D error band does not support ${e}.`}function Rq(e){return`Channel ${e} is required for "binned" bin.`}const Pq=Ce(De);let Lq=Pq;function Bq(...e){Lq.warn(...e)}function jq(e){if(e&&Oe(e))for(const t of Yq)if(t in e)return!0;return!1}new WeakMap;const Iq=["january","february","march","april","may","june","july","august","september","october","november","december"],Uq=Iq.map((e=>e.substr(0,3))),qq=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Wq=qq.map((e=>e.substr(0,3)));function Hq(e,t){const n=[];if(t&&void 0!==e.day&&YB(e).length>1&&(Bq(function(e){return`Dropping day from datetime ${bj(e)} as day cannot be combined with other units.`}(e)),delete(e=CB(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(gj(e)&&(e=+e),$t(e))return e-1;{const t=e.toLowerCase(),n=Iq.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Uq.indexOf(i);if(-1!==r)return r;throw new Error(Tq("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(gj(e)&&(e=+e),$t(e))return e>4&&Bq(Tq("quarter",e)),e-1;throw new Error(Tq("quarter",e))}(e.quarter):e.quarter;n.push($t(i)?3*i:`${i}*3`)}else n.push(0);if(void 0!==e.date)n.push(e.date);else if(void 0!==e.day){const i=t?function(e){if(gj(e)&&(e=+e),$t(e))return e%7;{const t=e.toLowerCase(),n=qq.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Wq.indexOf(i);if(-1!==r)return r;throw new Error(Tq("day",e))}}(e.day):e.day;n.push($t(i)?i+1:`${i}+1`)}else n.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const i=e[t];n.push(void 0===i?0:i)}return n}function Gq(e){const t=Hq(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const Vq={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Yq=YB(Vq);function Xq(e){return Oe(e)?e.binned:Jq(e)}function Jq(e){return e&&e.startsWith("binned")}function Qq(e){return e.startsWith("utc")}const Zq={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Kq(e){return Yq.filter((t=>tW(e,t)))}function eW(e){const t=Kq(e);return t[t.length-1]}function tW(e,t){const n=e.indexOf(t);return!(n<0||n>0&&"seconds"===t&&"i"===e.charAt(n-1)||e.length>n+3&&"day"===t&&"o"===e.charAt(n+3)||n>0&&"year"===t&&"f"===e.charAt(n-1))}function nW(e){if(e)return`timeUnitSpecifier(${bj(Kq(e))}, ${bj(Zq)})`}function iW(e){if(!e)return;let t;return St(e)?t=Jq(e)?{unit:e.substring(6),binned:!0}:{unit:e}:Oe(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),Qq(t.unit)&&(t.utc=!0,t.unit=function(e){return e.substring(3)}(t.unit)),t}function rW(e,t=(e=>e)){const n=iW(e),i=eW(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:r,part:o}=aW(i,n.step);return`${t(Gq({...e,[o]:+e[o]+r}))} - ${t(Gq(e))}`}}const oW={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function aW(e,t=1){if(function(e){return!!oW[e]}(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:3*t};case"week":return{part:"date",step:7*t}}}function sW(e){return!!e?.field&&void 0!==e.equal}function lW(e){return!!e?.field&&void 0!==e.lt}function uW(e){return!!e?.field&&void 0!==e.lte}function cW(e){return!!e?.field&&void 0!==e.gt}function fW(e){return!!e?.field&&void 0!==e.gte}function dW(e){if(e?.field){if(Fe(e.range)&&2===e.range.length)return!0;if(BU(e.range))return!0}return!1}function hW(e){return!!e?.field&&(Fe(e.oneOf)||Fe(e.in))}function pW(e){return hW(e)||sW(e)||dW(e)||lW(e)||cW(e)||uW(e)||fW(e)}function mW(e,t){return PG(e,{timeUnit:t,wrapTime:!0})}function gW(e,t=!0){const{field:n}=e,i=iW(e.timeUnit),{unit:r,binned:o}=i||{},a=xG(e,{expr:"datum"}),s=r?`time(${o?a:function(e,t,{end:n}={end:!1}){const i=nj(t),r=Qq(e)?"utc":"";let o;const a={};for(const t of Yq)tW(e,t)&&(a[t]="quarter"===(s=t)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=t);var s;return n&&(a[o]+="+1"),function(e){const t=Hq(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}(r,n)})`:a;if(sW(e))return`${s}===${mW(e.equal,r)}`;if(lW(e))return`${s}<${mW(e.lt,r)}`;if(cW(e))return`${s}>${mW(e.gt,r)}`;if(uW(e))return`${s}<=${mW(e.lte,r)}`;if(fW(e))return`${s}>=${mW(e.gte,r)}`;if(hW(e))return`indexof([${function(e,t){return e.map((e=>mW(e,t)))}(e.oneOf,r).join(",")}], ${s}) !== -1`;if(function(e){return!!e?.field&&void 0!==e.valid}(e))return yW(s,e.valid);if(dW(e)){const{range:n}=e,i=BU(n)?{signal:`${n.signal}[0]`}:n[0],o=BU(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==o&&t)return"inrange("+s+", ["+mW(i,r)+", "+mW(o,r)+"])";const a=[];return null!==i&&a.push(`${s} >= ${mW(i,r)}`),null!==o&&a.push(`${s} <= ${mW(o,r)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${bj(e)}`)}function yW(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function vW(e){return pW(e)&&e.timeUnit?{...e,timeUnit:iW(e.timeUnit)}:e}const bW={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function xW(e){return"ordinal"===e||"nominal"===e}const _W=bW.quantitative,wW=bW.ordinal,kW=bW.temporal,EW=bW.nominal,AW=bW.geojson;YB(bW);const $W={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},DW={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function SW(e,t){const n=DW[e],i=DW[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}YB(DW);const MW={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function CW(e){return MW[e]}const FW=new Set(["linear","log","pow","sqrt","symlog"]),OW=new Set([...FW,"time","utc"]);function NW(e){return FW.has(e)}const TW=new Set(["quantile","quantize","threshold"]),zW=new Set([...OW,...TW,"sequential","identity"]),RW=new Set(["ordinal","bin-ordinal","point","band"]);function PW(e){return RW.has(e)}function LW(e){return zW.has(e)}function BW(e){return OW.has(e)}function jW(e){return TW.has(e)}function IW(e){return e?.param}new Set(["time","utc"]);const UW={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},{type:qW,domain:WW,range:HW,rangeMax:GW,rangeMin:VW,scheme:YW,...XW}=(YB(UW),UW),JW=YB(XW);function QW(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return BW(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return BW(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return BW(e);case"nice":return BW(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return LW(e)&&!RB(["log","time","utc","threshold","quantile"],e)}}function ZW(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return uI(e)?void 0:`Cannot use the scale property "${t}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const KW={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},eH=KW.arc,tH=KW.area,nH=KW.bar,iH=KW.image,rH=KW.line,oH=KW.point,aH=KW.rect,sH=KW.rule,lH=KW.text,uH=KW.tick,cH=KW.trail,fH=KW.circle,dH=KW.square,hH=KW.geoshape;function pH(e){return["line","area","trail"].includes(e)}function mH(e){return["rect","bar","image","arc"].includes(e)}const gH=new Set(YB(KW));function yH(e){return e.type}const vH=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],bH=YB({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),xH=YB({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function _H(e){return e&&null!=e.band}const wH={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]};function kH(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,a=SH(e);return aG(n)&&!$U(n.aggregate)&&r&&BW(r.get("type"))?function({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(pH(n.type))return i;return null===eq("invalid",n,r)?[EH(e,t),i]:i}({fieldDef:n,channel:t,markDef:i,ref:a,config:o}):a}function EH(e,t){return{test:AH(e,!0),..."y"===AI(t)?{field:{group:"height"}}:{value:0}}}function AH(e,t=!0){return yW(St(e)?e:xG(e,{expr:"datum"}),!t)}function $H(e,t,n,i){const r={};if(t&&(r.scale=t),lG(e)){const{datum:t}=e;jq(t)?r.signal=Gq(t):BU(t)?r.signal=t.signal:zU(t)?r.signal=t.expr:r.value=t}else r.field=xG(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function DH({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,endSuffix:o="end",bandPosition:a=.5}){const s=!BU(a)&&0ZB(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+YB(n).map((e=>ZB(`_${e}_${n[e]}`))).join("")}(l),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}i&&(n=n?`${i}_${n}`:i)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?sj(n):t.expr?ij(n,t.expr)+o:oj(n)+o}function _G(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return aG(e)&&!!e.bin;case"temporal":return!1}throw new Error(_q(e.type))}const wG=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(kU(t))return`${r} for argmax(${t.argmax})`;if(wU(t))return`${r} for argmin(${t.argmin})`;const o=i&&!Xq(i)?iW(i):void 0,a=t||o?.unit||o?.maxbins&&"timeunit"||CU(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if("count"===o)return t.countTitle;if(CU(i))return`${n} (binned)`;if(r&&!Xq(r)){const e=iW(r)?.unit;if(e)return`${n} (${Kq(e).join("-")})`}else if(o)return kU(o)?`${n} for max ${o.argmax}`:wU(o)?`${n} for min ${o.argmin}`:`${tj(o)} of ${n}`;return n}(e,t)}};let kG=wG;function EG(e){kG=e}function AG(e,t,{allowDisabling:n,includeDefault:i=!0}){const r=$G(e)?.title;if(!aG(e))return r??e.title;const o=e,a=i?DG(o,t):void 0;return n?uj(r,o.title,a):r??o.title??a}function $G(e){return gG(e)&&e.axis?e.axis:yG(e)&&e.legend?e.legend:XH(e)&&e.header?e.header:void 0}function DG(e,t){return kG(e,t)}function SG(e){if(vG(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=$G(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function MG(e){return aG(e)?e:rG(e)?e.condition:void 0}function CG(e){return dG(e)?e:oG(e)?e.condition:void 0}function FG(e,t,n,i={}){return St(e)||$t(e)||kt(e)?(Bq(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${bj(n)}}.`}(t,St(e)?"string":$t(e)?"number":"boolean",e)),{value:e}):dG(e)?OG(e,t,n,i):oG(e)?{...e,condition:OG(e.condition,t,n,i)}:e}function OG(e,t,n,i){if(vG(e)){const{format:r,formatType:o,...a}=e;if(CH(o)&&!n.customFormatTypes)return Bq(bq(t)),OG(a,t,n,i)}else{const r=gG(e)?"axis":yG(e)?"legend":XH(e)?"header":null;if(r&&e[r]){const{format:o,formatType:a,...s}=e[r];if(CH(a)&&!n.customFormatTypes)return Bq(bq(t)),OG({...e,[r]:s},t,n,i)}}return aG(e)?NG(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=$t(n)?"quantitative":St(n)?"nominal":jq(n)?"temporal":void 0,{...e,type:t}}(e)}function NG(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:a}=e,s={...e};if(n||!i||EU(i)||kU(i)||wU(i)||(Bq(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete s.aggregate),r&&(s.timeUnit=iW(r)),a&&(s.field=`${a}`),CU(o)&&(s.bin=TG(o,t)),FU(o)&&!QI(t)&&Bq(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),hG(s)){const{type:e}=s,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case _W:return"quantitative";case"t":case kW:return"temporal";case"o":case wW:return"ordinal";case"n":case EW:return"nominal";case AW:return"geojson"}}(e);e!==t&&(s.type=t),"quantitative"!==e&&$U(i)&&(Bq(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),s.type="quantitative")}else if(!EI(t)){const e=function(e,t){switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(ZH(e)&&Fe(e.sort))return"ordinal";const{aggregate:n,bin:i,timeUnit:r}=e;if(r)return"temporal";if(i||n&&!kU(n)&&!wU(n))return"quantitative";if(mG(e)&&e.scale?.type)switch(DW[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(s,t);s.type=e}if(hG(s)){const{compatible:e,warning:n}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case xj:case _j:case wj:return _G(e)?zG:{compatible:!1,warning:Aq(t)};case kj:case Ej:case Dj:case Sj:case Pj:case Lj:case Bj:case Yj:case Jj:case Qj:case Zj:case Kj:case eI:case Uj:case Fj:case Mj:case tI:return zG;case Tj:case Rj:case Nj:case zj:return n!==_W?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:zG;case qj:case Wj:case Hj:case Gj:case Ij:case Oj:case Cj:case Aj:case $j:return"nominal"!==n||e.sort?zG:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case jj:case Vj:return _G(e)||function(e){return mG(e)&&jW(e.scale?.type)}(e)?zG:{compatible:!1,warning:$q(t)};case Xj:return"nominal"!==e.type||"sort"in e?zG:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(s,t)||{};!1===e&&Bq(n)}if(ZH(s)&&St(s.sort)){const{sort:e}=s;if(WH(e))return{...s,sort:{encoding:e}};const t=e.substr(1);if("-"===e.charAt(0)&&WH(t))return{...s,sort:{encoding:t,order:"descending"}}}if(XH(s)){const{header:e}=s;if(e){const{orient:t,...n}=e;if(t)return{...s,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return s}function TG(e,t){return kt(e)?{maxbins:TU(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:TU(t)}}const zG={compatible:!0};function RG(e){const{formatType:t}=SG(e);return"time"===t||!t&&function(e){return e&&("temporal"===e.type||aG(e)&&!!e.timeUnit)}(e)}function PG(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){const o=t&&iW(t)?.unit;let a,s=o||"temporal"===n;return zU(e)?a=e.expr:BU(e)?a=e.signal:jq(e)?(s=!0,a=Gq(e)):(St(e)||$t(e))&&s&&(a=`datetime(${bj(e)})`,function(e){return!!Vq[e]}(o)&&($t(e)&&e<1e4||St(e)&&isNaN(Date.parse(e)))&&(a=Gq({[o]:e}))),a?i&&s?`time(${a})`:a:r?void 0:bj(e)}function LG(e,t){const{type:n}=e;return t.map((t=>{const i=PG(t,{timeUnit:aG(e)&&!Xq(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function BG(e,t){return CU(e.bin)?mU(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const jG={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function IG(e){return e?.condition}const UG=["domain","grid","labels","ticks","title"],qG={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},WG={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},HG={...WG,style:1,labelExpr:1,encoding:1};function GG(e){return!!HG[e]}YB(HG);const VG=YB({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function YG(e){return"mark"in e}class XG{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!YG(e)&&function(e){return yH(e)?e.type:e}(e.mark)===this.name}}function JG(e,t){const n=e&&e[t];return!!n&&(Fe(n)?PB(n,(e=>!!e.field)):aG(n)||rG(n))}function QG(e,t){const n=e&&e[t];return!!n&&(Fe(n)?PB(n,(e=>!!e.field)):aG(n)||lG(n)||oG(n))}function ZG(e,t){if(QI(t)){const n=e[t];if((aG(n)||lG(n))&&(xW(n.type)||aG(n)&&n.timeUnit))return QG(e,CI(t))}return!1}function KG(e){return PB(hI,(t=>{if(JG(e,t)){const n=e[t];if(Fe(n))return PB(n,(e=>!!e.aggregate));{const e=MG(n);return e&&!!e.aggregate}}return!1}))}function eV(e,t){const n=[],i=[],r=[],o=[],a={};return iV(e,((s,l)=>{if(aG(s)){const{field:u,aggregate:c,bin:f,timeUnit:d,...h}=s;if(c||d||f){const e=$G(s),p=e?.title;let m=xG(s,{forAs:!0});const g={...p?[]:{title:AG(s,t,{allowDisabling:!0})},...h,field:m};if(c){let e;if(kU(c)?(e="argmax",m=xG({op:"argmax",field:c.argmax},{forAs:!0}),g.field=`${m}.${u}`):wU(c)?(e="argmin",m=xG({op:"argmin",field:c.argmin},{forAs:!0}),g.field=`${m}.${u}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:m};u&&(t.field=u),o.push(t)}}else if(n.push(m),hG(s)&&CU(f)){if(i.push({bin:f,field:u,as:m}),n.push(xG(s,{binSuffix:"end"})),BG(s,l)&&n.push(xG(s,{binSuffix:"range"})),QI(l)){const e={field:`${m}_end`};a[`${l}2`]=e}g.bin="binned",EI(l)||(g.type=_W)}else if(d&&!Xq(d)){r.push({timeUnit:d,field:u,as:m});const e=hG(s)&&s.type!==kW&&"time";e&&(l===Yj||l===Zj?g.formatType=e:function(e){return!!VI[e]}(l)?g.legend={formatType:e,...g.legend}:QI(l)&&(g.axis={formatType:e,...g.axis}))}a[l]=g}else n.push(u),a[l]=e[l]}else a[l]=e[l]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function tV(e,t,n){const i=function(e,t){return function(e){switch(e){case Pj:case Lj:case Bj:case tI:case Jj:case Qj:case Zj:case Kj:case Xj:case qj:case Wj:case Hj:case Gj:case wj:case xj:case _j:return gU;case kj:case Ej:case Dj:case Sj:case Nj:case Tj:return vU;case Aj:case $j:case zj:case Rj:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Ij:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Vj:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case jj:return{point:"always",geoshape:"always"};case Yj:return{text:"always"};case Uj:return{point:"always",square:"always",text:"always"};case eI:return{image:"always"};case Fj:case Mj:return{text:"always",arc:"always"};case Oj:case Cj:return{arc:"always"}}}(e)[t]}(t,n);if(!i)return!1;if("binned"===i){const n=e[t===Aj?kj:Ej];return!!(aG(n)&&aG(e[t])&&FU(n.bin))}return!0}function nV(e,t){const n={};for(const i of YB(e)){const r=FG(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function iV(e,t,n){if(e)for(const i of YB(e)){const r=e[i];if(Fe(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function rV(e,t){return YB(t).reduce(((n,i)=>{switch(i){case kj:case Ej:case Kj:case tI:case eI:case Aj:case $j:case Dj:case Sj:case Fj:case Oj:case Mj:case Cj:case Nj:case Tj:case zj:case Rj:case Yj:case jj:case Uj:case Zj:return n;case Xj:if("line"===e||"trail"===e)return n;case Jj:case Qj:{const e=t[i];if(Fe(e)||aG(e))for(const t of nt(e))t.aggregate||n.push(xG(t,{}));return n}case Ij:if("trail"===e)return n;case Pj:case Lj:case Bj:case qj:case Wj:case Hj:case Vj:case Gj:{const e=MG(t[i]);return e&&!e.aggregate&&n.push(xG(e,{})),n}}}),[])}function oV(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};const r=e.map((({fieldPrefix:e,titlePrefix:n})=>{const r=i?` of ${aV(t)}`:"";return{field:e+t.field,type:t.type,title:BU(n)?{signal:`${n}"${escape(r)}"`}:n+r}})),o=function(e){const t=[];for(const n of YB(e))if(JG(e,n)){const i=nt(e[n]);for(const e of i)aG(e)?t.push(e):rG(e)&&t.push(e.condition)}return t}(n).map(bG);return{tooltip:[...r,...IB(o,TB)]}}function aV(e){const{title:t,field:n}=e;return uj(t,n)}function sV(e,t,n,i,r){const{scale:o,axis:a}=n;return({partName:s,mark:l,positionPrefix:u,endPositionPrefix:c,extraEncoding:f={}})=>{const d=aV(n);return lV(e,s,r,{mark:l,encoding:{[t]:{field:`${u}_${n.field}`,type:n.type,...void 0!==d?{title:d}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...St(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function lV(e,t,n,i){const{clip:r,color:o,opacity:a}=e,s=e.type;return e[t]||void 0===e[t]&&n[t]?[{...i,mark:{...n[t],...r?{clip:r}:{},...o?{color:o}:{},...a?{opacity:a}:{},...yH(i.mark)?i.mark:{type:i.mark},style:`${s}-${String(t)}`,...kt(e[t])?{}:e[t]}}]:[]}function uV(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],l=i[`${r}Error2`];return{continuousAxisChannelDef:cV(o,n),continuousAxisChannelDef2:cV(a,n),continuousAxisChannelDefError:cV(s,n),continuousAxisChannelDefError2:cV(l,n),continuousAxis:r}}function cV(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&Bq(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function fV(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(yH(n)&&n.orient)return n.orient;if(uG(r)){if(uG(o)){const e=aG(r)&&r.aggregate,n=aG(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return RG(o)&&!RG(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(uG(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const dV="boxplot",hV=new XG(dV,mV);function pV(e){return $t(e)?"tukey":e}function mV(e,{config:t}){e={...e,encoding:nV(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:o,...a}=e,s=yH(n)?n:{type:n};r&&Bq(gq("boxplot"));const l=s.extent??t.boxplot.extent,u=eq("size",s,t),c=s.invalid,f=pV(l),{bins:d,timeUnits:h,transform:p,continuousAxisChannelDef:m,continuousAxis:g,groupby:y,aggregate:v,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:_,customTooltipWithoutAggregatedField:w}=function(e,t,n){const i=fV(e,dV),{continuousAxisChannelDef:r,continuousAxis:o}=uV(e,i,dV),a=r.field,s=pV(t),l=[...gV(a),{op:"median",field:a,as:`mid_box_${a}`},{op:"min",field:a,as:("min-max"===s?"lower_whisker_":"min_")+a},{op:"max",field:a,as:("min-max"===s?"upper_whisker_":"max_")+a}],u="min-max"===s||"tukey"===s?[]:[{calculate:`datum["upper_box_${a}"] - datum["lower_box_${a}"]`,as:`iqr_${a}`},{calculate:`min(datum["upper_box_${a}"] + datum["iqr_${a}"] * ${t}, datum["max_${a}"])`,as:`upper_whisker_${a}`},{calculate:`max(datum["lower_box_${a}"] - datum["iqr_${a}"] * ${t}, datum["min_${a}"])`,as:`lower_whisker_${a}`}],{[o]:c,...f}=e.encoding,{customTooltipWithoutAggregatedField:d,filteredEncoding:h}=function(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(Fe(t)){for(const e of t)e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return Fe(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(f),{bins:p,timeUnits:m,aggregate:g,groupby:y,encoding:v}=eV(h,n),b="vertical"===i?"horizontal":"vertical",x=i;return{bins:p,timeUnits:m,transform:[...p,...m,{aggregate:[...g,...l],groupby:y},...u],groupby:y,aggregate:g,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:v,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:d}}(e,l,t),{color:k,size:E,...A}=b,$=e=>sV(s,g,m,e,t.boxplot),D=$(A),S=$(b),M=$({...A,...E?{size:E}:{}}),C=oV([{fieldPrefix:"min-max"===f?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===f?"lower_whisker_":"min_",titlePrefix:"Min"}],m,b),F={type:"tick",color:"black",opacity:1,orient:x,invalid:c,aria:!1},O="min-max"===f?C:oV([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],m,b),N=[...D({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:O}),...D({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:O}),...D({partName:"ticks",mark:F,positionPrefix:"lower_whisker",extraEncoding:O}),...D({partName:"ticks",mark:F,positionPrefix:"upper_whisker",extraEncoding:O})],T=[..."tukey"!==f?N:[],...S({partName:"box",mark:{type:"bar",...u?{size:u}:{},orient:_,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:C}),...M({partName:"median",mark:{type:"tick",invalid:c,...Oe(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...u?{size:u}:{},orient:x,aria:!1},positionPrefix:"mid_box",extraEncoding:C})];if("min-max"===f)return{...a,transform:(a.transform??[]).concat(p),layer:T};const z=`datum["lower_box_${m.field}"]`,R=`datum["upper_box_${m.field}"]`,P=`(${R} - ${z})`,L=`${z} - ${l} * ${P}`,B=`${R} + ${l} * ${P}`,j=`datum["${m.field}"]`,I={joinaggregate:gV(m.field),groupby:y},U={transform:[{filter:`(${L} <= ${j}) && (${j} <= ${B})`},{aggregate:[{op:"min",field:m.field,as:`lower_whisker_${m.field}`},{op:"max",field:m.field,as:`upper_whisker_${m.field}`},{op:"min",field:`lower_box_${m.field}`,as:`lower_box_${m.field}`},{op:"max",field:`upper_box_${m.field}`,as:`upper_box_${m.field}`},...v],groupby:y}],layer:N},{tooltip:q,...W}=A,{scale:H,axis:G}=m,V=aV(m),Y=NB(G,["title"]),X=lV(s,"outliers",t.boxplot,{transform:[{filter:`(${j} < ${L}) || (${j} > ${B})`}],mark:"point",encoding:{[g]:{field:m.field,type:m.type,...void 0!==V?{title:V}:{},...void 0!==H?{scale:H}:{},...VB(Y)?{}:{axis:Y}},...W,...k?{color:k}:{},...w?{tooltip:w}:{}}})[0];let J;const Q=[...d,...h,I];return X?J={transform:Q,layer:[X,U]}:(J=U,J.transform.unshift(...Q)),{...a,layer:[J,{transform:p,layer:T}]}}function gV(e){return[{op:"q1",field:e,as:`lower_box_${e}`},{op:"q3",field:e,as:`upper_box_${e}`}]}const yV="errorbar",vV=new XG(yV,bV);function bV(e,{config:t}){e={...e,encoding:nV(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:l,tooltipEncoding:u}=xV(e,yV,t);delete o.size;const c=sV(s,r,i,o,t.errorbar),f=s.thickness,d=s.size,h={type:"tick",orient:a,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},p=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:u}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return{...l,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function xV(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,l=yH(i)?i:{type:i};o&&Bq(gq(t));const{orient:u,inputType:c}=function(e,t){const{encoding:n}=e;if(function(e){return(dG(e.x)||dG(e.y))&&!dG(e.x2)&&!dG(e.y2)&&!dG(e.xError)&&!dG(e.xError2)&&!dG(e.yError)&&!dG(e.yError2)}(n))return{orient:fV(e,t),inputType:"raw"};const i=function(e){return dG(e.x2)||dG(e.y2)}(n),r=function(e){return dG(e.xError)||dG(e.xError2)||dG(e.yError)||dG(e.yError2)}(n),o=n.x,a=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const e=n.x2,i=n.y2;if(dG(e)&&dG(i))throw new Error(`${t} cannot have both x2 and y2`);if(dG(e)){if(uG(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(dG(i)){if(uG(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,s=n.yError2;if(dG(i)&&!dG(e))throw new Error(`${t} cannot have xError2 without xError`);if(dG(s)&&!dG(r))throw new Error(`${t} cannot have yError2 without yError`);if(dG(e)&&dG(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(dG(e)){if(uG(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(dG(r)){if(uG(a))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=uV(e,u,t),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let l=[],u=[];const c=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":s.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&Bq(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)l=[{op:n,field:c,as:`extent_${c}`},{op:t,field:c,as:`center_${c}`}],u=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:`upper_${c}`},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:tj(t)},{fieldPrefix:"upper_",titlePrefix:_V(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:_V(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),l=[{op:t,field:c,as:`lower_${c}`},{op:i,field:c,as:`upper_${c}`},{op:e,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:AG({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:AG({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:AG({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Bq(function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}(e.center,e.extent)),"aggregated-upper-lower"===o?(f=[],u=[{calculate:`datum["${n.field}"]`,as:`upper_${c}`},{calculate:`datum["${c}"]`,as:`lower_${c}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],u=[{calculate:`datum["${c}"] + datum["${i.field}"]`,as:`upper_${c}`}],r?u.push({calculate:`datum["${c}"] + datum["${r.field}"]`,as:`lower_${c}`}):u.push({calculate:`datum["${c}"] - datum["${i.field}"]`,as:`lower_${c}`}));for(const e of u)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:aj(aj(e.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:u,errorBarSpecificAggregate:l,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,f,d,h,p,c,t,n),{[m]:x,["x"===m?"x2":"y2"]:_,["x"===m?"xError":"yError"]:w,["x"===m?"xError2":"yError2"]:k,...E}=r,{bins:A,timeUnits:$,aggregate:D,groupby:S,encoding:M}=eV(E,n),C=[...D,...g],F="raw"!==c?[]:S,O=oV(v,f,M,b);return{transform:[...s.transform??[],...A,...$,...0===C.length?[]:[{aggregate:C,groupby:F}],...y],groupby:F,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:M,ticksOrient:"vertical"===u?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:O}}function _V(e,t,n){return`${tj(e)} ${n} ${t}`}const wV="errorband",kV=new XG(wV,EV);function EV(e,{config:t}){e={...e,encoding:nV(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:l}=xV(e,wV,t),u=a,c=sV(u,r,i,o,t.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const p={...u.interpolate?{interpolate:u.interpolate}:{},...u.tension&&u.interpolate?{tension:u.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):u.interpolate?Bq(zq("interpolate")):u.tension&&Bq(zq("tension")),{...s,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:l})]}}const AV={};function $V(e,t,n){const i=new XG(e,t);AV[e]={normalizer:i,parts:n}}$V(dV,mV,["box","median","outliers","rule","ticks"]),$V(yV,bV,["ticks","rule"]),$V(wV,EV,["band","borders"]);const DV=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],SV={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},MV={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},CV=YB(SV),FV=YB(MV),OV=YB({header:1,headerRow:1,headerColumn:1,headerFacet:1}),NV=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],TV={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},zV=(YB(TV),"_vgsid_"),RV={point:{on:"click",fields:[zV],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function PV(e){return"legend"===e||!!e?.legend}function LV(e){return PV(e)&&Oe(e)}function BV(e){return!!e?.select}function jV(e){const t=[];for(const n of e||[]){if(BV(n))continue;const{expr:e,bind:i,...r}=n;if(i&&e){const n={...r,bind:i,init:e};t.push(n)}else{const n={...r,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function IV(e){return"concat"in e}function UV(e){return"vconcat"in e}function qV(e){return"hconcat"in e}function WV({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function HV(e){return Oe(e)&&void 0!==e.step}function GV(e){return e.view||e.width||e.height}const VV=YB({align:1,bounds:1,center:1,columns:1,spacing:1});function YV(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function XV(e,t){const n=JV(e,t);return HV(n)?n.step:QV}function JV(e,t){return uj(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const QV=20,ZV={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:QV},mark:{color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},arc:{},area:{},bar:{binSpacing:1,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},circle:{},geoshape:{},image:{},line:{},point:{},rect:{binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:RV,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},KV=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],eY={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},tY={blue:KV[0],orange:KV[1],red:KV[2],teal:KV[3],green:KV[4],yellow:KV[5],purple:KV[6],pink:KV[7],brown:KV[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function nY(e){const t=YB(e||{}),n={};for(const i of t){const t=e[i];n[i]=IG(t)?HU(t):GU(t)}return n}const iY=[...xH,...VG,...OV,"background","padding","legend","lineBreak","scale","style","title","view"];function rY(e={}){const{color:t,font:n,fontSize:i,selection:r,...o}=e,a=Te({},CB(ZV),n?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(n):{},t?function(e={}){return{signals:[{name:"color",value:Oe(e)?{...tY,...e}:tY}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(t):{},i?function(e){return{signals:[{name:"fontSize",value:Oe(e)?{...eY,...e}:eY}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(i):{},o||{});r&&ze(a,"selection",r,!0);const s=NB(a,iY);for(const e of["background","lineBreak","padding"])a[e]&&(s[e]=GU(a[e]));for(const e of xH)a[e]&&(s[e]=RU(a[e]));for(const e of VG)a[e]&&(s[e]=nY(a[e]));for(const e of OV)a[e]&&(s[e]=RU(a[e]));return a.legend&&(s.legend=RU(a.legend)),a.scale&&(s.scale=RU(a.scale)),a.style&&(s.style=function(e){const t=YB(e),n={};for(const i of t)n[i]=nY(e[i]);return n}(a.style)),a.title&&(s.title=RU(a.title)),a.view&&(s.view=RU(a.view)),s}const oY=new Set(["view",...gH]),aY=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],sY={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],line:["point"],tick:["bandSize","thickness"]};function lY(e,t,n,i){"view"===t&&(n="cell");const r={...i?e[t][i]:e[t],...e.style[n??t]};VB(r)||(e.style[n??t]=r),i||delete e[t]}function uY(e){return"layer"in e}class cY{map(e,t){return JH(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):qV(e)?this.mapHConcat(e,t):UV(e)?this.mapVConcat(e,t):IV(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(uY(e))return this.mapLayer(e,t);if(YG(e))return this.mapUnit(e,t);throw new Error(lq(e))}mapLayer(e,t){return{...e,layer:e.layer.map((e=>this.mapLayerOrUnit(e,t)))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map((e=>this.map(e,t)))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map((e=>this.map(e,t)))}}mapConcat(e,t){const{concat:n,...i}=e;return{...i,concat:n.map((e=>this.map(e,t)))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}}const fY={zero:1,center:1,normalize:1},dY=new Set([eH,nH,tH,sH,oH,fH,dH,rH,lH,uH]),hY=new Set([nH,tH,eH]);function pY(e){return aG(e)&&"quantitative"===sG(e)&&!e.bin}function mY(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",o="x"===t&&["bar","area"].includes(i),a=e[t],s=e[r];if(aG(a)&&aG(s))if(pY(a)&&pY(s)){if(a.stack)return t;if(s.stack)return r;const e=aG(a)&&!!a.aggregate;if(e!==(aG(s)&&!!s.aggregate))return e?t:r;if(o){if("vertical"===n)return r;if("horizontal"===n)return t}}else{if(pY(a))return t;if(pY(s))return r}else{if(pY(a)){if(o&&"vertical"===n)return;return t}if(pY(s)){if(o&&"horizontal"===n)return;return r}}}function gY(e,t){const n=yH(e)?e:{type:e},i=n.type;if(!dY.has(i))return null;const r=mY(t,"x",n)||mY(t,"theta",n);if(!r)return null;const o=t[r],a=aG(o)?xG(o,{}):void 0,s=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(r),l=[],u=new Set;if(t[s]){const e=t[s],n=aG(e)?xG(e,{}):void 0;n&&n!==a&&(l.push(s),u.add(n))}const c="x"===s?"xOffset":"yOffset",f=t[c],d=aG(f)?xG(f,{}):void 0;d&&d!==a&&(l.push(c),u.add(d));const h=YI.reduce(((e,n)=>{if("tooltip"!==n&&JG(t,n)){const i=t[n];for(const t of nt(i)){const i=MG(t);if(i.aggregate)continue;const r=xG(i,{});r&&u.has(r)||e.push({channel:n,fieldDef:i})}}return e}),[]);let p;return void 0!==o.stack?p=kt(o.stack)?o.stack?"zero":null:o.stack:hY.has(i)&&(p="zero"),p&&p in fY?KG(t)&&0===h.length?null:o?.scale?.type&&o?.scale?.type!==$W.LINEAR?(o?.stack&&Bq(function(e){return`Cannot stack non-linear scale (${e}).`}(o.scale.type)),null):dG(t[DI(r)])?(void 0!==o.stack&&Bq(`Cannot stack "${m=r}" if there is already "${m}2".`),null):(aG(o)&&o.aggregate&&!DU.has(o.aggregate)&&Bq(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannels:l,groupbyFields:u,fieldChannel:r,impute:null!==o.impute&&pH(i),stackBy:h,offset:p}):null;var m}function yY(e,t,n){const i=RU(e),r=eq("orient",i,n);if(i.orient=function(e,t,n){switch(e){case oH:case fH:case dH:case lH:case aH:case iH:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case nH:if(aG(i)&&(FU(i.bin)||aG(r)&&r.aggregate&&!i.aggregate))return"vertical";if(aG(r)&&(FU(r.bin)||aG(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(aG(i)&&i.type===_W&&!CU(i.bin)||fG(i))&&aG(r)&&FU(r.bin)?"horizontal":"vertical";if(!a)return(aG(r)&&r.type===_W&&!CU(r.bin)||fG(r))&&aG(i)&&FU(i.bin)?"vertical":"horizontal"}case sH:if(o&&(!aG(i)||!FU(i.bin))&&a&&(!aG(r)||!FU(r.bin)))return;case tH:if(a)return aG(r)&&FU(r.bin)?"horizontal":"vertical";if(o)return aG(i)&&FU(i.bin)?"vertical":"horizontal";if(e===sH){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case rH:case uH:{const t=cG(i),o=cG(r);if(n)return n;if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o)return"vertical";{const e=hG(i)&&i.type===kW,t=hG(r)&&r.type===kW;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&Bq(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=eq("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:wH[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}return void 0===eq("opacity",i,n)&&(i.opacity=function(e,t){if(RB([oH,uH,fH,dH],e)&&!KG(t))return.7}(i.type,t)),void 0===eq("cursor",i,n)&&(i.cursor=function(e,t,n){return t.href||e.href||eq("href",e,n)?"pointer":e.cursor}(i,t,n)),i}function vY(e){const{point:t,line:n,...i}=e;return YB(i).length>1?i:i.type}function bY(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:NB(e[t],["point","line"])});return e}function xY(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?Oe(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?Oe(t.point)?t.point:{}:void 0}function _Y(e,t={}){return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class wY{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(YG(e)){const{mark:n,encoding:i}=e,r=yH(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!xY(r,t[r.type],i);case"area":return!!xY(r,t[r.type],i)||!!_Y(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:l,...u}=e,c=nV(l,i),f=yH(a)?a:{type:a},d=xY(f,i[f.type],c),h="area"===f.type&&_Y(f,i[f.type]),p=[{name:s,...r?{params:r}:{},mark:vY({..."area"===f.type&&void 0===f.opacity&&void 0===f.fillOpacity?{opacity:.7}:{},...f}),encoding:NB(c,["shape"])}],m=gY(yY(f,c,i),c);let g=c;if(m){const{fieldChannel:e,offset:t}=m;g={...c,[e]:{...c[e],...t?{stack:t}:{}}}}return g=NB(g,["y2","x2"]),h&&p.push({...o?{projection:o}:{},mark:{type:"line",...OB(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&p.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...OB(f,["clip","tooltip"]),...d},encoding:g}),n({...u,layer:p},{...t,config:bY(i)})}}function kY(e,t){return t?YH(e)?MY(e,t):$Y(e,t):e}function EY(e,t){return t?MY(e,t):e}function AY(e,t,n){const i=t[e];return function(e){return e&&!St(e)&&"repeat"in e}(i)?i.repeat in n?{...t,[e]:n[i.repeat]}:void Bq(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t}function $Y(e,t){if(void 0!==(e=AY("field",e,t))){if(null===e)return null;if(ZH(e)&&GH(e.sort)){const n=AY("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function DY(e,t){if(aG(e))return $Y(e,t);{const n=AY("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function SY(e,t){if(!dG(e)){if(oG(e)){const n=DY(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=DY(e,t);if(n)return n;if(iG(e))return{condition:e.condition}}}function MY(e,t){const n={};for(const i in e)if(yt(e,i)){const r=e[i];if(Fe(r))n[i]=r.map((e=>SY(e,t))).filter((e=>e));else{const e=SY(r,t);void 0!==e&&(n[i]=e)}}return n}class CY{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(YG(e)){const{encoding:t,mark:n}=e;if("line"===n||yH(n)&&"line"===n.type)for(const e of kI){const n=t[AI(e)];if(t[e]&&(aG(n)&&!FU(n.bin)||lG(n)))return!0}}return!1}run(e,t,n){const{encoding:i,mark:r}=e;var o,a;return Bq((o=!!i.x2,a=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${o&&a?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),n({...e,mark:Oe(r)?{...r,type:"rule"}:"rule"},t)}}function FY({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...YB(e),...YB(t)]);for(const o of r){const r=t[o],a=e[o];if(dG(r)){const e={...a,...r};i[o]=e}else oG(r)?i[o]={...r,condition:{...a,...r.condition}}:r||null===r?i[o]=r:(n||pG(a)||BU(a)||dG(a)||Fe(a))&&(i[o]=a)}}else i=t;return!i||VB(i)?void 0:i}function OY(e){const{parentProjection:t,projection:n}=e;return t&&n&&Bq(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${bj(t)} is overridden by a child projection ${bj(n)}.`}({parentProjection:t,projection:n})),n??t}function NY(e){return"filter"in e}function TY(e){return void 0!==e?.stop}function zY(e){return"lookup"in e}function RY(e){return"pivot"in e}function PY(e){return"density"in e}function LY(e){return"quantile"in e}function BY(e){return"regression"in e}function jY(e){return"loess"in e}function IY(e){return"sample"in e}function UY(e){return"window"in e}function qY(e){return"joinaggregate"in e}function WY(e){return"flatten"in e}function HY(e){return"calculate"in e}function GY(e){return"bin"in e}function VY(e){return"impute"in e}function YY(e){return"timeUnit"in e}function XY(e){return"aggregate"in e}function JY(e){return"stack"in e}function QY(e){return"fold"in e}function ZY(e){return"extent"in e&&!("density"in e)}function KY(e,t){const{transform:n,...i}=e;if(n){const e=n.map((e=>{if(NY(e))return{filter:nX(e,t)};if(GY(e)&&OU(e.bin))return{...e,bin:tX(e.bin)};if(zY(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}));return{...i,transform:e}}return e}function eX(e,t){const n=CB(e);if(aG(n)&&OU(n.bin)&&(n.bin=tX(n.bin)),mG(n)&&n.scale?.domain?.selection){const{selection:e,...t}=n.scale.domain;n.scale.domain={...t,...e?{param:e}:{}}}if(iG(n))if(Fe(n.condition))n.condition=n.condition.map((e=>{const{selection:n,param:i,test:r,...o}=e;return i?e:{...o,test:nX(e,t)}}));else{const{selection:e,param:i,test:r,...o}=eX(n.condition,t);n.condition=i?n.condition:{...o,test:nX(n.condition,t)}}return n}function tX(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function nX(e,t){const n=e=>MB(e,(e=>{var n;const i={param:e,empty:t.emptySelections[e]??!0};return(n=t.selectionPredicates)[e]??(n[e]=[]),t.selectionPredicates[e].push(i),i}));return e.selection?n(e.selection):MB(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class iX extends cY{map(e,t){const n=t.selections??[];if(e.params&&!YG(e)){const t=[];for(const i of e.params)BV(i)?n.push(i):t.push(i);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,t){const n=t.selections;if(!n||!n.length)return e;const i=(t.path??[]).concat(e.name),r=[];for(const t of n)if(t.views&&t.views.length)for(const n of t.views)(St(n)&&(n===e.name||i.includes(n))||Fe(n)&&n.map((e=>i.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&r.push(t);else r.push(t);return r.length&&(e.params=r),e}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=iX.prototype[e];iX.prototype[e]=function(e,n){return t.call(this,e,rX(e,n))}}function rX(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function oX(e,t){void 0===t&&(t=rY(e.config));const n=function(e,t={}){const n={config:t};return lX.map(aX.map(sX.map(e,n),n),n)}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=YG(e)||uY(e),a={};o?"container"==i&&"container"==r?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==r&&(a.type="fit-y",a.contains="padding"):("container"==i&&(Bq(cq("width")),i=void 0),"container"==r&&(Bq(cq("height")),r=void 0));const s={type:"pad",...a,...n?uX(n.autosize):{},...uX(e.autosize)};if("fit"!==s.type||o||(Bq(uq),s.type="pad"),"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&Bq(fq("width")),"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&Bq(fq("height")),!vj(s,{type:"pad"}))return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const aX=new class extends cY{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[hV,vV,kV,new wY,new CY]}map(e,t){if(YG(e)){const n=JG(e.encoding,xj),i=JG(e.encoding,_j),r=JG(e.encoding,wj);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=EY(e.encoding,t.repeater),o={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{},...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const a=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,a);return o}mapRepeat(e,t){return function(e){return!Fe(e.repeat)&&e.repeat.layer}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:o,column:a,layer:s}=n,{repeater:l={},repeaterPrefix:u=""}=t;return o||a?this.mapRepeat({...e,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map((e=>{const n={...l,layer:e},r=`${(i.name?`${i.name}_`:"")+u}child__layer_${ZB(e)}`,o=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return o.name=r,o}))}}mapNonLayerRepeat(e,t){const{repeat:n,spec:i,data:r,...o}=e;!Fe(n)&&e.columns&&(e=NB(e,["columns"]),Bq(yq("repeat")));const a=[],{repeater:s={},repeaterPrefix:l=""}=t,u=!Fe(n)&&n.row||[s?s.row:null],c=!Fe(n)&&n.column||[s?s.column:null],f=Fe(n)&&n||[s?s.repeat:null];for(const e of f)for(const r of u)for(const o of c){const u={repeat:e,row:r,column:o,layer:s.layer},c=(i.name?`${i.name}_`:"")+l+"child__"+(Fe(n)?`${ZB(e)}`:(n.row?`row_${ZB(r)}`:"")+(n.column?`column_${ZB(o)}`:"")),f=this.map(i,{...t,repeater:u,repeaterPrefix:c});f.name=c,a.push(NB(f,["data"]))}const d=Fe(n)?e.columns:n.column?n.column.length:1;return{data:i.data??r,align:"all",...o,columns:d,concat:a}}mapFacet(e,t){const{facet:n}=e;return YH(n)&&e.columns&&(e=NB(e,["columns"]),Bq(yq("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=OY({parentProjection:o,projection:i}),l=FY({parentEncoding:r,encoding:EY(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...l?{encoding:l}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:l,height:u,view:c,params:f,encoding:d,...h}=e,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),g=EY(o,t.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...u?{height:u}:{},...c?{view:c}:{},...l?{projection:l}:{},mark:a,encoding:g,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&Bq(`Facet encoding dropped as ${(o=[...n?[xj]:[],...i?[_j]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[xj,_j]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...l}=i;t[n]=l;for(const e of["align","center","spacing"])void 0!==i[e]&&(a[e]??(a[e]={}),a[e][n]=i[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:kY(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...o?{columns:o}:{}}}}var o}mapLayer(e,{parentEncoding:t,parentProjection:n,...i}){const{encoding:r,projection:o,...a}=e,s={...i,parentEncoding:FY({parentEncoding:t,encoding:r,layer:!0}),parentProjection:OY({parentProjection:n,projection:o})};return super.mapLayer({...a,...e.name?{name:[s.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},s)}},sX=new class extends cY{map(e,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),e=KY(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=KY(e,t)).encoding){const n={};for(const[i,r]of JB(e.encoding))n[i]=eX(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:JB(n).map((([e,n])=>{const{init:i,bind:r,empty:o,...a}=n;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),t.emptySelections[e]="none"!==o;for(const n of XB(t.selectionPredicates[e]??{}))n.empty="none"!==o;return{name:e,value:i,select:a,bind:r}}))}:e}},lX=new iX;function uX(e){return St(e)?{type:e}:e??{}}const cX=["background","padding"];function fX(e,t){const n={};for(const t of cX)e&&void 0!==e[t]&&(n[t]=GU(e[t]));return t&&(n.params=e.params),n}class dX{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new dX(CB(this.explicit),CB(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return uj(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,{value:t,explicit:n}){void 0!==t&&this.set(e,t,n)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){void 0!==t[e]?this.set(e,t[e],!0):void 0!==n[e]&&this.set(e,n[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of YB(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function hX(e){return{explicit:!0,value:e}}function pX(e){return{explicit:!1,value:e}}function mX(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:gX(t,n,i,r)}}function gX(e,t,n,i){return e.explicit&&t.explicit&&Bq(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${bj(n)} and ${bj(i)}). Using ${bj(n)}.`}(n,i,e.value,t.value)),e}function yX(e,t,n,i,r=gX){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:vj(e.value,t.value)?e:r(e,t,n,i)}class vX extends dX{constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function bX(e){return"url"in e}function xX(e){return"values"in e}function _X(e){return"name"in e&&!bX(e)&&!xX(e)&&!wX(e)}function wX(e){return e&&(kX(e)||EX(e)||AX(e))}function kX(e){return"sequence"in e}function EX(e){return"sphere"in e}function AX(e){return"graticule"in e}var $X;function DX(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=oj(r.field),r}function SX(e,t=!0,n=be){if(Fe(e)){const i=e.map((e=>SX(e,t,n)));return t?`[${i.join(", ")}]`:i}return jq(e)?n(t?Gq(e):function(e){const t=Hq(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(bj(e)):e}function MX(e,t){for(const n of XB(e.component.selection??{})){const i=n.name;let r=`${i}${eQ}, ${"global"===n.resolve?"true":`{unit: ${rQ(e)}}`}`;for(const i of iQ)i.defined(n)&&(i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(r=i.modifyExpr(e,n,r)));t.push({name:i+tQ,on:[{events:{signal:n.name+eQ},update:`modify(${Pt(n.name+KJ)}, ${r})`}]})}return OX(t)}function CX(e,t){if(e.component.selection&&YB(e.component.selection).length){const n=Pt(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:tz("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return OX(t)}function FX(e,t){for(const n of XB(e.component.selection??{}))for(const i of iQ)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function OX(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}!function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup"}($X||($X={}));class NX{constructor(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.includes(e)?Bq("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class TX extends NX{clone(){const e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${fj()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function zX(e){return void 0!==e.as}function RX(e){return`${e}_end`}class PX extends NX{clone(){return new PX(null,CB(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{const{field:r,timeUnit:o}=n;if(o){let a;if(Xq(o)){if(RK(t)){const{mark:e,markDef:i,config:s}=t,l=KH({fieldDef:n,markDef:i,config:s});(mH(e)||l)&&(a={timeUnit:iW(o),field:r})}}else a={as:xG(n,{forAs:!0}),field:r,timeUnit:o};if(RK(t)){const{mark:e,markDef:r,config:o}=t,s=KH({fieldDef:n,markDef:r,config:o});mH(e)&&QI(i)&&.5!==s&&(a.rectBandPosition=s)}a&&(e[TB(a)]=a)}return e}),{});return VB(n)?null:new PX(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:iW(n)};return new PX(e,{[TB(r)]:r})}merge(e){this.timeUnits={...this.timeUnits};for(const t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of JB(this.timeUnits)){const r=zX(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.timeUnits=t}producedFields(){return new Set(XB(this.timeUnits).map((e=>zX(e)?e.as:RX(e.field))))}dependentFields(){return new Set(XB(this.timeUnits).map((e=>e.field)))}hash(){return`TimeUnit ${TB(this.timeUnits)}`}assemble(){const e=[];for(const t of XB(this.timeUnits)){const{rectBandPosition:n}=t,i=iW(t.timeUnit);if(zX(t)){const{field:r,as:o}=t,{unit:a,utc:s,...l}=i,u=[o,`${o}_end`];e.push({field:oj(r),type:"timeunit",...a?{units:Kq(a)}:{},...s?{timezone:"utc"}:{},...l,as:u}),e.push(...IX(u,n,i))}else if(t){const{field:r}=t,o=r.replaceAll("\\.","."),a=jX({timeUnit:i,field:o}),s=RX(o);e.push({type:"formula",expr:a,as:s}),e.push(...IX([o,s],n,i))}}return e}}const LX="offsetted_rect_start",BX="offsetted_rect_end";function jX({timeUnit:e,field:t,reverse:n}){const{unit:i,utc:r}=e,o=eW(i),{part:a,step:s}=aW(o,e.step);return`${r?"utcOffset":"timeOffset"}('${a}', datum['${t}'], ${n?-s:s})`}function IX([e,t],n,i){if(void 0!==n&&.5!==n){const r=`datum['${e}']`,o=`datum['${t}']`;return[{type:"formula",expr:UX([jX({timeUnit:i,field:e,reverse:!0}),r],n+.5),as:`${e}_${LX}`},{type:"formula",expr:UX([r,o],n+.5),as:`${e}_${BX}`}]}return[]}function UX([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const qX="_tuple_fields";class WX{constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const HX={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??(t.project=new WX),o={},a={},s=new Set,l=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=ZB(`${i}_${n}`);for(let e=1;s.has(r);e++)r=ZB(`${i}_${n}_${e}`);return s.add(r),{[t]:r}},u=t.type,c=e.config.selection[u],f=void 0!==n.value?nt(n.value):null;let{fields:d,encodings:h}=Oe(n.select)?n.select:{};if(!d&&!h&&f)for(const e of f)if(Oe(e))for(const t of YB(e))_I[t]?(h||(h=[])).push(t):"interval"===u?(Bq('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),h=c.encodings):(d??(d=[])).push(t);d||h||(h=c.encodings,"fields"in c&&(d=c.fields));for(const t of h??[]){const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){Bq(mq(t,n.aggregate));continue}if(!i){Bq(pq(t));continue}if(n.timeUnit&&!Xq(n.timeUnit)){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};a[TB(r)]=r}if(!o[i]){const a={field:i,channel:t,type:"interval"===u&&mU(t)&&LW(e.getScaleComponent(t).get("type"))?"R":n.bin?"R-RE":"E",index:r.items.length};a.signals={...l(a,"data"),...l(a,"visual")},r.items.push(o[i]=a),r.hasField[i]=o[i],r.hasSelectionId=r.hasSelectionId||i===zV,aI(t)?(a.geoChannel=t,a.channel=oI(t),r.hasChannel[a.channel]=o[i]):r.hasChannel[t]=o[i]}}else Bq(pq(t))}for(const e of d??[]){if(r.hasField[e])continue;const t={type:"E",field:e,index:r.items.length};t.signals={...l(t,"data")},r.items.push(t),r.hasField[e]=t,r.hasSelectionId=r.hasSelectionId||e===zV}f&&(t.init=f.map((e=>r.items.map((t=>Oe(e)?void 0!==e[t.geoChannel||t.channel]?e[t.geoChannel||t.channel]:e[t.field]:e))))),VB(a)||(r.timeUnit=new PX(null,a))},signals:(e,t,n)=>{const i=t.name+qX;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(DX)})}},GX=HX,VX={defined:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!mU(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;o&&LW(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):Bq("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter((e=>0===n.filter((t=>t.name===e.signals.data)).length));if(!e.parent||JX(e)||0===i.length)return n;const r=n.filter((e=>e.name===t.name))[0];let o=r.update;if(o.indexOf(nQ)>=0)r.update=`{${i.map((e=>`${Pt(oj(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of i){const t=`${Pt(oj(e.field))}: ${e.signals.data}`;o.includes(t)||(o=`${o.substring(0,o.length-1)}, ${t}}`)}r.update=o}return n.concat(i.map((e=>({name:e.signals.data}))))},signals:(e,t,n)=>{if(e.parent&&!JX(e))for(const e of t.scales){const t=n.filter((t=>t.name===e.signals.data))[0];t.push="outer",delete t.value,delete t.update}return n}},YX=VX;function XX(e,t){return`domain(${Pt(e.scaleName(t))})`}function JX(e){return e.parent&&BK(e.parent)&&(!e.parent.parent??JX(e.parent.parent))}const QX="_brush",ZX="_scale_trigger",KX="geo_interval_init_tick",eJ="_init",tJ={defined:e=>"interval"===e.type,parse:(e,t,n)=>{var i;if(e.hasProjection){const e={...Oe(n.select)?n.select:{}};e.fields=[zV],e.encodings||(e.encodings=n.value?YB(n.value):[Tj,Nj]),n.select={type:"interval",...e}}if(t.translate&&!YX.defined(t)){const e=`!event.item || event.item.mark.name !== ${Pt(t.name+QX)}`;for(const n of t.events){if(!n.between){Bq(`${n} is not an ordered event stream for interval selections.`);continue}const t=nt((i=n.between[0]).filter??(i.filter=[]));t.indexOf(e)<0&&t.push(e)}}},signals:(e,t,n)=>{const i=t.name,r=i+eQ,o=XB(t.project.hasChannel).filter((e=>e.channel===kj||e.channel===Ej)),a=t.init?t.init[0]:null;if(n.push(...o.reduce(((n,i)=>n.concat(function(e,t,n,i){const r=!e.hasProjection,o=n.channel,a=n.signals.visual,s=Pt(r?e.scaleName(o):e.projectionName()),l=e=>`scale(${s}, ${e})`,u=e.getSizeSignalRef(o===kj?"width":"height").signal,c=`${o}(unit)`,f=t.events.reduce(((e,t)=>[...e,{events:t.between[0],update:`[${c}, ${c}]`},{events:t,update:`[${a}[0], clamp(${c}, 0, ${u})]`}]),[]);if(r){const r=n.signals.data,u=YX.defined(t),c=e.getScaleComponent(o),d=c?c.get("type"):void 0,h=i?{init:SX(i,!0,l)}:{value:[]};return f.push({events:{signal:t.name+ZX},update:LW(d)?`[${l(`${r}[0]`)}, ${l(`${r}[1]`)}]`:"[0, 0]"}),u?[{name:r,on:[]}]:[{name:a,...h,on:f},{name:r,...i?{init:SX(i)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${s}, ${a})`}]}]}{const e=o===kj?0:1,n=t.name+eJ;return[{name:a,...i?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:f}]}}(e,t,i,a&&a[i.index]))),[])),e.hasProjection){const s=Pt(e.projectionName()),l=e.projectionName()+"_center",{x:u,y:c}=t.project.hasChannel,f=u&&u.signals.visual,d=c&&c.signals.visual,h=u?a&&a[u.index]:`${l}[0]`,p=c?a&&a[c.index]:`${l}[1]`,m=t=>e.getSizeSignalRef(t).signal,g=`[[${f?f+"[0]":"0"}, ${d?d+"[0]":"0"}],[${f?f+"[1]":m("width")}, ${d?d+"[1]":m("height")}]]`;if(a&&(n.unshift({name:i+eJ,init:`[scale(${s}, [${u?h[0]:h}, ${c?p[0]:p}]), scale(${s}, [${u?h[1]:h}, ${c?p[1]:p}])]`}),!u||!c)){n.find((e=>e.name===l))||n.unshift({name:l,update:`invert(${s}, [${m("width")}/2, ${m("height")}/2])`})}const y=`vlSelectionTuples(intersect(${g}, {markname: ${Pt(e.getName("marks"))}}, unit.mark), {unit: ${rQ(e)}})`,v=o.map((e=>e.signals.visual));return n.concat({name:r,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...a?[{signal:KX}]:[]],update:y}]})}{if(!YX.defined(t)){const t=i+ZX,r=o.map((t=>{const n=t.channel,{data:i,visual:r}=t.signals,o=Pt(e.scaleName(n)),a=LW(e.getScaleComponent(n).get("type"))?"+":"";return`(!isArray(${i}) || (${a}invert(${o}, ${r})[0] === ${a}${i}[0] && ${a}invert(${o}, ${r})[1] === ${a}${i}[1]))`}));r.length&&n.push({name:t,value:{},on:[{events:o.map((t=>({scale:e.scaleName(t.channel)}))),update:r.join(" && ")+` ? ${t} : {}`}]})}const s=o.map((e=>e.signals.data)),l=`unit: ${rQ(e)}, fields: ${i+qX}, values`;return n.concat({name:r,...a?{init:`{${l}: ${SX(a)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${l}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(RK(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===KX)).length||n.unshift({name:KX,value:null,on:[{events:"timer{1}",update:`${KX} === null ? {} : ${KX}`}]})}return n},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,a=r?.signals.visual,s=o?.signals.visual,l=`data(${Pt(t.name+KJ)})`;if(YX.defined(t)||!r&&!o)return n;const u={x:void 0!==r?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${s}[0]`}:{value:0},x2:void 0!==r?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${s}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const t of YB(u))u[t]=[{test:`${l}.length && ${l}[0].unit === ${rQ(e)}`,...u[t]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=YB(h).reduce(((e,t)=>(e[t]=[{test:[void 0!==r&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${s}[0] !== ${s}[1]`].filter((e=>e)).join(" && "),value:h[t]},{value:null}],e)),{});return[{name:`${i+QX}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:u}},...n,{name:i+QX,type:"rect",clip:!0,encode:{enter:{...d?{cursor:{value:d}}:{},fill:{value:"transparent"}},update:{...u,...p}}}]}},nJ=tJ,iJ={defined:e=>"point"===e.type,signals:(e,t,n)=>{const i=t.name,r=i+qX,o=t.project,a="(item().isVoronoi ? datum.datum : datum)",s=XB(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+QX):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),l="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let u=`unit: ${rQ(e)}, `;t.project.hasSelectionId?u+=`${zV}: ${a}[${Pt(zV)}]`:u+=`fields: ${r}, values: [${o.items.map((t=>{const n=e.fieldDef(t.channel);return n?.bin?`[${a}[${Pt(e.vgField(t.channel,{}))}], ${a}[${Pt(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${a}[${Pt(t.field)}]`})).join(", ")}]`;const c=t.events;return n.concat([{name:i+eQ,on:c?[{events:c,update:`${l} ? {${u}} : null`,force:!0}]:[]}])}},rJ=iJ;function oJ(e,t,n,i){const r=iG(t)&&t.condition,o=i(t);if(r){const t=nt(r).map((t=>{const n=i(t);if(function(e){return e.param}(t)){const{param:i,empty:r}=t;return{test:fQ(e,{param:i,empty:r}),...n}}return{test:hQ(e,t.test),...n}}));return{[n]:[...t,...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function aJ(e,t="text"){const n=e.encoding[t];return oJ(e,n,t,(t=>sJ(t,e.config)))}function sJ(e,t,n="datum"){if(e){if(pG(e))return YU(e.value);if(dG(e)){const{format:i,formatType:r}=SG(e);return NH({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function lJ(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,a=n.tooltip;if(Fe(a))return{tooltip:cJ({tooltip:a},o,r,t)};{const s=t.reactiveGeom?"datum.datum":"datum";return oJ(e,a,"tooltip",(e=>{const a=sJ(e,r,s);if(a)return a;if(null===e)return;let l=eq("tooltip",i,r);return!0===l&&(l={content:"encoding"}),St(l)?{value:l}:Oe(l)?BU(l)?l:"encoding"===l.content?cJ(n,o,r,t):{signal:s}:void 0}))}}function uJ(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},o={},a=i?"datum.datum":"datum",s=[];function l(n,i){const l=AI(i),u=hG(n)?n:{...n,type:e[l].type},c=nt(u.title||DG(u,r)).join(", ").replaceAll(/"/g,'\\"');let f;if(QI(i)){const t="x"===i?"x2":"y2",n=MG(e[t]);if(FU(u.bin)&&n){const e=xG(u,{expr:a}),i=xG(n,{expr:a}),{format:s,formatType:l}=SG(u);f=IH(e,i,s,l,r),o[t]=!0}}if((QI(i)||i===Fj||i===Mj)&&t&&t.fieldChannel===i&&"normalize"===t.offset){const{format:e,formatType:t}=SG(u);f=NH({fieldOrDatumDef:u,format:e,formatType:t,expr:a,config:r,normalizeStack:!0}).signal}f??(f=sJ(u,r,a).signal),s.push({channel:i,key:c,value:f})}iV(e,((e,t)=>{aG(e)?l(e,t):rG(e)&&l(e.condition,t)}));const u={};for(const{channel:e,key:t,value:n}of s)o[e]||u[t]||(u[t]=n);return u}function cJ(e,t,n,{reactiveGeom:i}={}){const r=uJ(e,t,n,{reactiveGeom:i}),o=JB(r).map((([e,t])=>`"${e}": ${t}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function fJ(e){const{markDef:t,config:n}=e,i=eq("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...dJ(e),...hJ(e)}}function dJ(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=eq("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:t in qU?{}:{ariaRoleDescription:{value:t}}}function hJ(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return oJ(e,o,"description",(t=>sJ(t,e.config)));const a=eq("description",n,i);if(null!=a)return{description:YU(a)};if(!1===i.aria)return{};const s=uJ(t,r,i);return VB(s)?void 0:{description:{signal:JB(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function pJ(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:l}=n;void 0===s&&(l??(l=eq(e,i,o,{vgChannel:a,ignoreVgConfig:!0})),void 0!==l&&(s=YU(l)));const u=r[e];return oJ(t,u,a??e,(n=>SH({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:s})))}function mJ(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??eq("filled",n,r),s=RB(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,l=eq(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,u=eq(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],c=a?"fill":"stroke",f={...l?{fill:YU(l)}:{},...u?{stroke:YU(u)}:{}};return n.color&&(a?n.fill:n.stroke)&&Bq(wq("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...pJ("color",e,{vgChannel:c,defaultValue:a?l:u}),...pJ("fill",e,{defaultValue:i.fill?l:void 0}),...pJ("stroke",e,{defaultValue:i.stroke?u:void 0})}}function gJ(e){const{encoding:t,mark:n}=e,i=t.order;return!pH(n)&&pG(i)?oJ(e,i,"zindex",(e=>YU(e.value))):{}}function yJ({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const o=`${e}Offset`,a=t[o],s=n[o];if(("xOffset"===o||"yOffset"===o)&&s)return{offsetType:"encoding",offset:SH({channel:o,channelDef:s,markDef:t,config:i?.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:YU(a),bandPosition:r})};const l=t[o];return l?{offsetType:"visual",offset:l}:{}}function vJ(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,l=r[e],u=r[DI(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=yJ({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),p=bJ({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!l&&QI(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:a}=e;if(dG(n)&&r&&t===r.fieldChannel){if(aG(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return DH({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return $H(n,i,{suffix:"end"},{offset:o})}return kH(e)}({channel:e,channelDef:l,channel2Def:u,markDef:o,config:a,scaleName:c,scale:f,stack:s,offset:d,defaultRef:p,bandPosition:"encoding"===h?0:void 0});return m?{[i||e]:m}:void 0}function bJ({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=AI(n),l=$I(n),u=eq(n,o,a,{vgChannel:l});if(void 0!==u)return MH(n,u);switch(t){case"zeroOrMin":case"zeroOrMax":if(i){const e=r.get("type");if(RB([$W.LOG,$W.TIME,$W.UTC],e));else if(r.domainDefinitelyIncludesZero())return{scale:i,value:0}}if("zeroOrMin"===t)return"y"===s?{field:{group:"height"}}:{value:0};switch(s){case"radius":return{signal:`min(${e.width.signal},${e.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":return{...e[SI(n)],mult:.5}}}}const xJ={left:"x",center:"xc",right:"x2"},_J={top:"y",middle:"yc",bottom:"y2"};function wJ(e,t,n,i="middle"){if("radius"===e||"theta"===e)return $I(e);const r="x"===e?"align":"baseline",o=eq(r,t,n);let a;return BU(o)?(Bq(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?xJ[a||("top"===i?"left":"center")]:_J[a||i]}function kJ(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?EJ(e,t,{defaultPos:n,defaultPos2:i}):vJ(e,t,{defaultPos:n})}function EJ(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=DI(e),s=SI(e),l=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,l=AI(n),u=SI(n),c=$I(n),f=i[l],d=e.scaleName(l),h=e.getScaleComponent(l),{offset:p}=yJ(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:l,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=SI(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[c]:{field:e.getName(n)}}}const m=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:l,defaultRef:u}){return dG(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0)?$H(t,o,{suffix:"start"},{offset:l}):kH({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:l,defaultRef:u})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:h,stack:a,offset:p,defaultRef:void 0});return void 0!==m?{[c]:m}:AJ(n,o)||AJ(n,{[n]:nq(n,o,s.style),[u]:nq(u,o,s.style)})||AJ(n,s[r])||AJ(n,s.mark)||{[c]:bJ({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}(t,i,a);return{...vJ(e,t,{defaultPos:n,vgChannel:l[s]?wJ(e,r,o):$I(e)}),...l}}function AJ(e,t){const n=SI(e),i=$I(e);if(void 0!==t[i])return{[i]:MH(e,t[i])};if(void 0!==t[e])return{[i]:MH(e,t[e])};if(t[n]){const i=t[n];if(!_H(i))return{[n]:MH(e,i)};Bq(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function $J(e,t){const{config:n,encoding:i,markDef:r}=e,o=r.type,a=DI(t),s=SI(t),l=i[t],u=i[a],c=e.getScaleComponent(t),f=c?c.get("type"):void 0,d=r.orient,h=i[s]??i.size??eq("size",r,n,{vgChannel:s}),p=MI(t),m="bar"===o&&("x"===t?"vertical"===d:"horizontal"===d);return!aG(l)||!(CU(l.bin)||FU(l.bin)||l.timeUnit&&!u)||h&&!_H(h)||i[p]||PW(f)?(dG(l)&&PW(f)||m)&&!u?function(e,t,n){const{markDef:i,encoding:r,config:o,stack:a}=n,s=i.orient,l=n.scaleName(t),u=n.getScaleComponent(t),c=SI(t),f=DI(t),d=MI(t),h=n.scaleName(d),p=n.getScaleComponent(CI(t)),m="horizontal"===s&&"y"===t||"vertical"===s&&"x"===t;let g;(r.size||i.size)&&(m?g=pJ("size",n,{vgChannel:c,defaultRef:YU(i.size)}):Bq(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(i.type)));const y=!!g,v=eG({channel:t,fieldDef:e,markDef:i,config:o,scaleType:(u||p)?.get("type"),useVlSizeChannel:m});g=g||{[c]:DJ(c,h||l,p||u,o,v,!!e,i.type)};const b=wJ(t,i,o,"band"===(u||p)?.get("type")&&_H(v)&&!y?"top":"middle"),x="xc"===b||"yc"===b,{offset:_,offsetType:w}=yJ({channel:t,markDef:i,encoding:r,model:n,bandPosition:x?.5:0}),k=kH({channel:t,channelDef:e,markDef:i,config:o,scaleName:l,scale:u,stack:a,offset:_,defaultRef:bJ({model:n,defaultPos:"mid",channel:t,scaleName:l,scale:u}),bandPosition:x?"encoding"===w?0:.5:BU(v)?{signal:`(1-${v})/2`}:_H(v)?(1-v.band)/2:0});if(c)return{[b]:k,...g};{const e=$I(f),t=g[c],n=_?{...t,offset:_}:t;return{[b]:k,[e]:Fe(k)?[k[0],{...k[1],offset:n}]:{...k,offset:n}}}}(l,t,e):EJ(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:e,fieldDef2:t,channel:n,model:i}){const{config:r,markDef:o,encoding:a}=i,s=i.getScaleComponent(n),l=i.scaleName(n),u=s?s.get("type"):void 0,c=s.get("reverse"),f=eG({channel:n,fieldDef:e,markDef:o,config:r,scaleType:u}),d=i.component.axes[n]?.[0],h=d?.get("translate")??.5,p=QI(n)?eq("binSpacing",o,r)??0:0,m=DI(n),g=$I(n),y=$I(m),v=tq("minBandSize",o,r),{offset:b}=yJ({channel:n,markDef:o,encoding:a,model:i,bandPosition:0}),{offset:x}=yJ({channel:m,markDef:o,encoding:a,model:i,bandPosition:0}),_=function({scaleName:e,fieldDef:t}){const n=xG(t,{expr:"datum"});return`abs(scale("${e}", ${xG(t,{expr:"datum",suffix:"end"})}) - scale("${e}", ${n}))`}({fieldDef:e,scaleName:l}),w=SJ(n,p,c,h,b,v,_),k=SJ(m,p,c,h,x??b,v,_),E=BU(f)?{signal:`(1-${f.signal})/2`}:_H(f)?(1-f.band)/2:.5,A=KH({fieldDef:e,fieldDef2:t,markDef:o,config:r});if(CU(e.bin)||e.timeUnit){const t=e.timeUnit&&.5!==A;return{[y]:MJ({fieldDef:e,scaleName:l,bandPosition:E,offset:k,useRectOffsetField:t}),[g]:MJ({fieldDef:e,scaleName:l,bandPosition:BU(E)?{signal:`1-${E.signal}`}:1-E,offset:w,useRectOffsetField:t})}}if(FU(e.bin)){const n=$H(e,l,{},{offset:k});if(aG(t))return{[y]:n,[g]:$H(t,l,{},{offset:w})};if(OU(e.bin)&&e.bin.step)return{[y]:n,[g]:{signal:`scale("${l}", ${xG(e,{expr:"datum"})} + ${e.bin.step})`,offset:w}}}Bq(Rq(m))}({fieldDef:l,fieldDef2:u,channel:t,model:e})}function DJ(e,t,n,i,r,o,a){if(_H(r)){if(!n)return{mult:r.band,field:{group:e}};{const e=n.get("type");if("band"===e){let e=`bandwidth('${t}')`;1!==r.band&&(e=`${r.band} * ${e}`);const n=tq("minBandSize",{type:a},i);return{signal:n?`max(${QU(n)}, ${e})`:e}}1!==r.band&&(Bq(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),r=void 0)}}else{if(BU(r))return r;if(r)return{value:r}}if(n){const e=n.get("range");if(jU(e)&&$t(e.step))return{value:e.step-2}}if(!o){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r}=i.scale,o=uj(t,"bar"===a?n:r);if(BU(o))return{signal:`(1 - (${o.signal})) * ${e}`};if($t(o))return{signal:`${1-o} * ${e}`}}return{value:XV(i.view,e)-2}}function SJ(e,t,n,i,r,o,a){if(iI(e))return 0;const s="x"===e||"y2"===e,l=s?-t/2:t/2;if(BU(n)||BU(r)||BU(i)||o){const e=QU(n),t=QU(r),u=QU(i),c=QU(o),f=o?`(${a} < ${c} ? ${s?"":"-"}0.5 * (${c} - (${a})) : ${l})`:l;return{signal:(u?`${u} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${f})`:f)}}return r=r||0,i+(n?-r-l:+r+l)}function MJ({fieldDef:e,scaleName:t,bandPosition:n,offset:i,useRectOffsetField:r}){return DH({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i,...r?{startSuffix:LX,endSuffix:BX}:{}})}const CJ=new Set(["aria","width","height"]);function FJ(e,t){const{fill:n,stroke:i}="include"===t.color?mJ(e):{};return{...NJ(e.markDef,t),...OJ(e,"fill",n),...OJ(e,"stroke",i),...pJ("opacity",e),...pJ("fillOpacity",e),...pJ("strokeOpacity",e),...pJ("strokeWidth",e),...pJ("strokeDash",e),...gJ(e),...lJ(e),...aJ(e,"href"),...fJ(e)}}function OJ(e,t,n){const{config:i,mark:r,markDef:o}=e;if("hide"===eq("invalid",o,i)&&n&&!pH(r)){const i=function(e,{invalid:t=!1,channels:n}){const i=n.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&LW(r)&&(t[o]=!0)}return t}),{}),r=YB(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>AH(e,t))).join(` ${e} `)}}(e,{invalid:!0,channels:pU});if(i)return{[t]:[{test:i,value:null},...nt(n)]}}return n?{[t]:n}:{}}function NJ(e,t){return UU.reduce(((n,i)=>(CJ.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=YU(e[i])),n)),{})}function TJ(e){const{config:t,markDef:n}=e;if(eq("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const i=n.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});o&&LW(r)&&(t[o]=!0)}return t}),{}),r=YB(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>AH(e,t))).join(` ${e} `)}}(e,{channels:JI});if(t)return{defined:{signal:t}}}return{}}function zJ(e,t){if(void 0!==t)return{[e]:YU(t)}}const RJ="voronoi",PJ={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(RJ)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(pH(o))return Bq(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(RJ),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...lJ(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let s=0,l=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.indexOf(RJ)>=0&&(l=!0)})),l||n.splice(s+1,0,a),n}},LJ=PJ,BJ={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!PV(e.bind),parse:(e,t,n)=>aQ(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,a=t.init&&t.init[0],s=LJ.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const l=ZB(`${i}_${e.field}`);n.filter((e=>e.name===l)).length||n.unshift({name:l,...a?{init:SX(a[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${Pt(e.field)}] : null`}]:[],bind:o[e.field]??o[e.channel]??o})})),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.filter((e=>e.name===i+eQ))[0],a=i+qX,s=r.items.map((e=>ZB(`${i}_${e.field}`))),l=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${l} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},jJ=BJ,IJ="_toggle",UJ={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+IJ,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+eQ,i=t.name+IJ;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${rQ(e)}}, `)+`${i} ? ${n} : null`}},qJ={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t)=>{t.clear&&(t.clear=St(t.clear)?tz(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(jJ.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===ZB(`${t.name}_${e.field}`)));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)for(const e of t.project.items){const t=n.findIndex((t=>t.name===e.signals.visual));i(t,"[0, 0]"),-1===t&&i(n.findIndex((t=>t.name===e.signals.data)),"null")}else{let e=n.findIndex((e=>e.name===t.name+eQ));i(e,"null"),UJ.defined(t)&&(e=n.findIndex((e=>e.name===t.name+IJ)),i(e,"false"))}return n}},WJ={defined:e=>{const t="global"===e.resolve&&e.bind&&PV(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==zV;return t&&!n&&Bq("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n)=>{const i=CB(n);if(i.select=St(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},aQ(t,i),Oe(n.select)&&(n.select.on||n.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=nt(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}const r=LV(t.bind)?t.bind.legend:"click",o=St(r)?tz(r,"view"):nt(r);t.bind={legend:{merge:o}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=LV(t.bind)&&t.bind.legend,o=e=>t=>{const n=CB(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${ZB(e.field)}_legend`,s=`${i}_${a}`;if(0===n.filter((e=>e.name===s)).length){const e=r.merge.map(o(`${a}_symbols`)).concat(r.merge.map(o(`${a}_labels`))).concat(r.merge.map(o(`${a}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+eQ)),a=i+qX,s=r.items.filter((e=>e.hasLegend)).map((e=>ZB(`${i}_${ZB(e.field)}_legend`))),l=`${s.map((e=>`${e} !== null`)).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?o.on.push({events:s.map((e=>({signal:e}))),update:l}):s.length>0&&(o.update=l,delete o.value,delete o.on);const u=n.find((e=>e.name===i+IJ)),c=LV(t.bind)&&t.bind.legend;return u&&(t.events?u.on.push({...u.on[0],events:c}):u.on[0].events=c),n}},HJ="_translate_anchor",GJ="_translate_delta",VJ={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=YX.defined(t),o=i+HJ,{x:a,y:s}=t.project.hasChannel;let l=tz(t.translate,"scope");return r||(l=l.map((e=>(e.between[0].markname=i+QX,e)))),n.push({name:o,value:{},on:[{events:l.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${r?XX(e,kj):`slice(${a.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?XX(e,Ej):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+GJ,value:{},on:[{events:l,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&YJ(e,t,a,"width",n),void 0!==s&&YJ(e,t,s,"height",n),n}};function YJ(e,t,n,i,r){const o=t.name,a=o+HJ,s=o+GJ,l=n.channel,u=YX.defined(t),c=r.filter((e=>e.name===n.signals[u?"data":"visual"]))[0],f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(l),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${a}.extent_${l}`,g=`${u&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${m}, ${u?l===kj?p?"":"-":p?"-":"":""}${s}.${l} / ${u?`${f}`:`span(${m})`}${u?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:u?g:`clampRange(${g}, 0, ${f})`})}const XJ="_zoom_anchor",JJ="_zoom_delta",QJ={defined:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=YX.defined(t),o=i+JJ,{x:a,y:s}=t.project.hasChannel,l=Pt(e.scaleName(kj)),u=Pt(e.scaleName(Ej));let c=tz(t.zoom,"scope");return r||(c=c.map((e=>(e.markname=i+QX,e)))),n.push({name:i+XJ,on:[{events:c,update:r?"{"+[l?`x: invert(${l}, x(unit))`:"",u?`y: invert(${u}, y(unit))`:""].filter((e=>e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==a&&ZJ(e,t,a,"width",n),void 0!==s&&ZJ(e,t,s,"height",n),n}};function ZJ(e,t,n,i,r){const o=t.name,a=n.channel,s=YX.defined(t),l=r.filter((e=>e.name===n.signals[s?"data":"visual"]))[0],u=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(a),f=c&&c.get("type"),d=s?XX(e,a):l.name,h=o+JJ,p=`${s&&c?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${o}${XJ}.${a}, ${h}${s?"pow"===f?`, ${c.get("exponent")??1}`:"symlog"===f?`, ${c.get("constant")??1}`:"":""})`;l.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${u})`})}const KJ="_store",eQ="_tuple",tQ="_modify",nQ="vlSelectionResolve",iQ=[rJ,nJ,GX,UJ,jJ,YX,WJ,qJ,VJ,QJ,LJ];function rQ(e,{escape:t}={escape:!0}){let n=t?Pt(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!PK(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of fI)e[t]&&(n+=` + '__facet_${t}_' + (facet[${Pt(i.vgField(t))}])`)}return n}function oQ(e){return XB(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function aQ(e,t){!St(t.select)&&t.select.on||delete e.events,!St(t.select)&&t.select.clear||delete e.clear,!St(t.select)&&t.select.toggle||delete e.toggle}function sQ(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...sQ(e.object)),t.push(...sQ(e.property))),t)}function lQ(e){return"MemberExpression"===e.object.type?lQ(e.object):"datum"===e.object.name}function uQ(e){const t=DF(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&lQ(e)&&n.add(sQ(e).slice(1).join("."))})),n}class cQ extends NX{clone(){return new cQ(null,this.model,CB(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=hQ(this.model,this.filter,this),this._dependentFields=uQ(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function fQ(e,t,n,i="datum"){const r=St(t)?t:t.param,o=ZB(r),a=Pt(o+KJ);let s;try{s=e.getSelectionComponent(o,r)}catch(e){return`!!${o}`}if(s.project.timeUnit){const t=n??e.component.data.raw,i=s.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}const l=`${s.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${i}${"global"===s.resolve?")":`, ${Pt(s.resolve)})`}`,u=`length(data(${a}))`;return!1===t.empty?`${u} && ${l}`:`!${u} || ${l}`}function dQ(e,t,n){const i=ZB(t),r=n.encoding;let o,a=n.field;try{o=e.getSelectionComponent(i,t)}catch(e){return i}if(r||a){if(r&&!a){const e=o.project.items.filter((e=>e.channel===r));!e.length||e.length>1?(a=o.project.items[0].field,Bq((e.length?"Multiple ":"No ")+`matching ${Pt(r)} encoding found for selection ${Pt(n.param)}. `+`Using "field": ${Pt(a)}.`)):a=e[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&Bq(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${Pt(a)}.`);return`${o.name}[${Pt(oj(a))}]`}function hQ(e,t,n){return KB(t,(t=>St(t)?t:function(e){return e?.param}(t)?fQ(e,t,n):gW(t)))}function pQ(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}function mQ(e,t,n,i={header:!1}){const{disable:r,orient:o,scale:a,labelExpr:s,title:l,zindex:u,...c}=e.combine();if(!r){for(const e in c){const n=qG[e],i=c[e];if(n&&n!==t&&"both"!==n)delete c[e];else if(IG(i)){const{condition:t,...n}=i,r=nt(t),o=jG[e];if(o){const{vgProp:t,part:i}=o,a=[...r.map((e=>{const{test:t,...n}=e;return{test:hQ(null,t),...n}})),n];pQ(c,i,t,a),delete c[e]}else if(null===o){const t={signal:r.map((e=>{const{test:t,...n}=e;return`${hQ(null,t)} ? ${JU(n)} : `})).join("")+JU(n)};c[e]=t}}else if(BU(i)){const t=jG[e];if(t){const{vgProp:n,part:r}=t;pQ(c,r,n,i),delete c[e]}}RB(["labelAlign","labelBaseline"],e)&&null===c[e]&&delete c[e]}if("grid"===t){if(!c.grid)return;if(c.encode){const{grid:e}=c.encode;c.encode={...e?{grid:e}:{}},VB(c.encode)&&delete c.encode}return{scale:a,orient:o,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:uj(u,0)}}{if(!i.header&&e.mainExtracted)return;if(void 0!==s){let e=s;c.encode?.labels?.update&&BU(c.encode.labels.update.text)&&(e=aj(s,"datum.label",c.encode.labels.update.text.signal)),pQ(c,"labels","text",{signal:e})}if(null===c.labelAlign&&delete c.labelAlign,c.encode){for(const t of UG)e.hasAxisPart(t)||delete c.encode[t];VB(c.encode)&&delete c.encode}const t=function(e,t){if(e)return Fe(e)&&!LU(e)?e.map((e=>DG(e,t))).join(", "):e}(l,n);return{scale:a,orient:o,grid:!1,...t?{title:t}:{},...c,...!1===n.aria?{aria:!1}:{},zindex:uj(u,0)}}}}function gQ(e){const{axes:t}=e.component,n=[];for(const i of JI)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}function yQ(e,t,n,i){return Object.assign.apply(null,[{},...e.map((e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},a=new Set([...YB(r),...YB(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${QU(r[t])} : ${QU(o[t])}`};return s}return t[e]}))])}function vQ(e,t){const n=[{}];for(const i of e){let e=t[i]?.style;if(e){e=nt(e);for(const i of e)n.push(t.style[i])}}return Object.assign.apply(null,n)}function bQ(e,t,n,i={}){const r=iq(e,n,t);if(void 0!==r)return{configFrom:"style",configValue:r};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==i[t]?.[e])return{configFrom:t,configValue:i[t][e]};return{}}const xQ={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??function(e,t){return!PW(e)&&aG(t)&&!CU(t?.bin)&&!FU(t?.bin)}(n,e),gridScale:({model:e,channel:t})=>function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||kQ(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||wQ(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&RB(["quantitative","temporal"],e))return!0}(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??function(e,t,n,i){if(n&&!Oe(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t&&"symlog"!==t||"greedy"}(t.type,n,aG(t)&&!!t.timeUnit,aG(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const o="x"===e?"width":"y"===e?"height":void 0,a=o?t.getSizeSignalRef(o):void 0;return n.tickCount??function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){if(!i&&!PW(t)&&"log"!==t){if(aG(e)){if(CU(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&RB(["month","hours","day","quarter"],iW(e.timeUnit)?.unit))return}return{signal:`ceil(${n.signal}/40)`}}}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},tickMinStep:function({format:e,fieldOrDatumDef:t}){if("d"===e)return 1;if(aG(t)){const{timeUnit:e}=t;if(e){const t=rW(e);if(t)return{signal:t}}}},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=EQ(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return oq(r?[QH(r)]:[],aG(a)?[QH(a)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;return Fe(n)?LG(t,n):BU(n)?n:void 0}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){return"rect"===e&&_G(t)?1:0}(n,t)};function _Q(e){return`(((${e.signal} % 360) + 360) % 360)`}function wQ(e,t,n,i){if(void 0!==e){if("x"===n){if(BU(e)){const n=_Q(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${BU(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45{if(mG(t)&&VH(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${gW({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new AQ(e,{calculate:a,as:$Q(t,n,{forAs:!0})})}})),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${TB(this.transform)}`}}function $Q(e,t,n){return xG(e,{prefix:t,suffix:"sort_index",...n??{}})}function DQ(e,t){return RB(["top","bottom"],t)?"column":RB(["left","right"],t)||"row"===e?"row":"column"}function SQ(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return uj((t||{})[e],r[e],n.header[e])}function MQ(e,t,n,i){const r={};for(const o of e){const e=SQ(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const CQ=["row","column"],FQ=["header","footer"];function OQ(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:s}=MQ(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),l=DQ(t,s),u=mj(a);return{name:`${t}-title`,type:"group",role:`${l}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...TQ(u,l),...NQ(l,u,o),...IQ(i,r,t,CV,SV)}}}function NQ(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=kQ(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function TQ(e,t){const n=wQ(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function zQ(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of FQ)if(n[r])for(const o of n[r]){const a=LQ(e,t,r,n,o);null!=a&&i.push(a)}return i}function RQ(e,t){const{sort:n}=e;return GH(n)?{field:xG(n,{expr:"datum"}),order:n.order??"ascending"}:Fe(n)?{field:$Q(e,t,{expr:"datum"}),order:"ascending"}:{field:xG(e,{expr:"datum"}),order:n??"ascending"}}function PQ(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:l}=MQ(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),u=NH({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=DQ(t,s);return{text:{signal:l?aj(aj(l,"datum.label",u),"datum.value",xG(e,{expr:"parent"})):u},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...TQ(o,c),...NQ(c,o,a),...IQ(n,e,t,FV,MV)}}function LQ(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=MQ(["labelOrient"],a.header,s,t);("row"===t&&!RB(["top","bottom"],e)||"column"===t&&!RB(["left","right"],e))&&(o=PQ(a,t,s))}const l=PK(e)&&!YH(e.facet),u=r.axes,c=u?.length>0;if(o||c){const s="row"===t?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:RQ(a,t)}:{},...c&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...c?{axes:u}:{}}}}return null}const BQ={column:{start:0,end:1},row:{start:1,end:0}};function jQ(e,t){return BQ[t][e]}function IQ(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=SQ(a,t?.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function UQ(e){return[...qQ(e,"width"),...qQ(e,"height"),...qQ(e,"childWidth"),...qQ(e,"childHeight")]}function qQ(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(PW(i)&&jU(o)){const i=e.scaleName(n);return PK(e.parent)&&"independent"===e.parent.component.resolve.scale[n]?[WQ(i,o)]:[WQ(i,o),{name:r,update:HQ(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${YV(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function WQ(e,t){const n=`${e}_step`;return BU(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function HQ(e,t,n){const i=t.get("type"),r=t.get("padding"),o=uj(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${QU(a)}, ${QU(o)}) * ${e}_step`}function GQ(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function VQ(e,t){return YB(e).reduce(((n,i)=>{const r=e[i];return{...n,...oJ(t,r,i,(e=>YU(e.value)))}}),{})}function YQ(e,t){if(PK(t))return"theta"===e?"independent":"shared";if(BK(t))return"shared";if(LK(t))return QI(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function XQ(e,t){const n=e.scale[t],i=QI(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&Bq(function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}(t)),"independent"):e[i][t]||"shared"}const JQ={...TV,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},QQ=YB(JQ);class ZQ extends dX{}const KQ={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:s,config:l,mark:u}=n,c=a.filled&&"trail"!==u;let f={...ZU({},n,vH),...mJ(n,{filled:c})};const d=r.get("symbolOpacity")??l.legend.symbolOpacity,h=r.get("symbolFillColor")??l.legend.symbolFillColor,p=r.get("symbolStrokeColor")??l.legend.symbolStrokeColor,m=void 0===d?eZ(s.opacity)??a.opacity:void 0;if(f.fill)if("fill"===i||c&&i===Pj)delete f.fill;else if(f.fill.field)h?delete f.fill:(f.fill=YU(l.legend.symbolBaseFillColor??"black"),f.fillOpacity=YU(m??1));else if(Fe(f.fill)){const e=tZ(s.fill??s.color)??a.fill??(c&&a.color);e&&(f.fill=YU(e))}if(f.stroke)if("stroke"===i||!c&&i===Pj)delete f.stroke;else if(f.stroke.field||p)delete f.stroke;else if(Fe(f.stroke)){const e=uj(tZ(s.stroke||s.color),a.stroke,c?a.color:void 0);e&&(f.stroke={value:e})}if(i!==qj){const e=aG(t)&&iZ(0,r,t);e?f.opacity=[{test:e,...YU(m??1)},YU(l.legend.unselectedOpacity)]:m&&(f.opacity=YU(m))}return f={...f,...e},VB(f)?void 0:f},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){if("gradient"!==n)return;const{config:r,markDef:o,encoding:a}=t;let s={};const l=void 0===(i.get("gradientOpacity")??r.legend.gradientOpacity)?eZ(a.opacity)||o.opacity:void 0;return l&&(s.opacity=YU(l)),s={...s,...e},VB(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=aG(t)?iZ(0,r,t):void 0,l=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:u,formatType:c}=o;let f;CH(c)?f=zH({fieldOrDatumDef:t,field:"datum.value",format:u,formatType:c,config:a}):void 0===u&&void 0===c&&a.customFormatTypes&&("quantitative"===t.type&&a.numberFormatType?f=zH({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===t.type&&a.timeFormatType&&aG(t)&&void 0===t.timeUnit&&(f=zH({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...l?{opacity:l}:{},...f?{text:f}:{},...e};return VB(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return n?.length?{...e,fill:{value:"transparent"}}:e}};function eZ(e){return nZ(e,((e,t)=>Math.max(e,t.value)))}function tZ(e){return nZ(e,((e,t)=>uj(e,t.value)))}function nZ(e,t){return function(e){const t=e?.condition;return!!t&&(Fe(t)||pG(t))}(e)?nt(e.condition).reduce(t,e.value):pG(e)?e.value:void 0}function iZ(e,t,n){const i=t.get("selections");if(!i?.length)return;const r=Pt(n.field);return i.map((e=>`(!length(data(${Pt(ZB(e)+KJ)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`)).join(" || ")}const rZ={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return RH(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return PH(i,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:s,gradientVerticalMinLength:l}=e;if(BW(r))return"horizontal"===n?"top"===i||"bottom"===i?aZ(t,"width",a,o):a:aZ(t,"height",l,s)}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(RB(["quantile","threshold","log","symlog"],e))return"greedy"}(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??function(e,t,n,i){if("shape"!==t){const e=tZ(n)??i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,n,i.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>AG(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(uI(n)&&BW(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;return Fe(n)?LG(t,n):BU(n)?n:void 0}(t,e)};function oZ({legendConfig:e,legendType:t,orient:n,legend:i}){return i.direction??e[t?"gradientDirection":"symbolDirection"]??function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(n,t)}function aZ(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function sZ(e){const t=RK(e)?function(e){const{encoding:t}=e,n={};for(const i of[Pj,...NV]){const r=CG(t[i]);r&&e.getScaleComponent(i)&&(i===jj&&aG(r)&&r.type===AW||(n[i]=uZ(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){sZ(i);for(const r of YB(i.component.legends))n.legend[r]=XQ(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=cZ(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of YB(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function lZ(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!n?.values;case"title":if("title"===t&&e===i?.title)return!0}return e===(n||{})[t]}function uZ(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:o}=e,a=o.legend,s=new ZQ({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){const i=e.fieldDef(t)?.field;for(const r of XB(e.component.selection??{})){const e=r.project.hasField[i]??r.project.hasChannel[t];if(e&&WJ.defined(r)){const t=n.get("selections")??[];t.push(r.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,s);const l=void 0!==n?!n:a.disable;if(s.set("disable",l,void 0!==n),l)return s;n=n||{};const u=e.getScaleComponent(t).get("type"),c=CG(r[t]),f=aG(c)?iW(c.timeUnit)?.unit:void 0,d=n.orient||o.legend.orient||"right",h=function(e){const{legend:t}=e;return uj(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(uI(e)){if(RB(["quarter","month","day"],t))return"symbol";if(BW(n))return"gradient"}return"symbol"}(e))}({legend:n,channel:t,timeUnit:f,scaleType:u}),p={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:c,legendConfig:a,config:o,scaleType:u,orient:d,legendType:h,direction:oZ({legend:n,legendType:h,orient:d,legendConfig:a})};for(const i of QQ){if("gradient"===h&&i.startsWith("symbol")||"symbol"===h&&i.startsWith("gradient"))continue;const r=i in rZ?rZ[i](p):n[i];if(void 0!==r){const a=lZ(r,i,n,e.fieldDef(t));(a||void 0===o.legend[i])&&s.set(i,r,a)}}const m=n?.encoding??{},g=s.get("selections"),y={},v={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:s,legendType:h};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=VQ(m[t]??{},e),i=t in KQ?KQ[t](n,v):n;void 0===i||VB(i)||(y[t]={...g?.length&&aG(c)?{name:`${ZB(c.field)}_legend_${t}`}:{},...g?.length?{interactive:!!g}:{},update:i})}return VB(y)||s.set("encode",y,!!n?.encoding),s}function cZ(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const n of QQ){const i=yX(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",((e,t)=>{switch(n){case"symbolType":return i=e,"circle"===(o=t).value?o:i;case"title":return sq(e,t);case"type":return r=!0,pX("symbol")}var i,o;return gX(e,t,n,"legend")}));e.setWithExplicit(n,i)}return r&&(e.implicit?.encode?.gradient&&ej(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&ej(e.explicit,["encode","gradient"])),e}function fZ(e){const t=e.component.legends,n={};for(const i of YB(t)){const r=bj(e.getScaleComponent(i).get("domains"));if(n[r])for(const e of n[r])cZ(e,t[i])||n[r].push(t[i]);else n[r]=[t[i].clone()]}const i=XB(n).flat().map((t=>function(e,t){const{disable:n,labelExpr:i,selections:r,...o}=e.combine();if(!n){if(!1===t.aria&&null==o.aria&&(o.aria=!1),o.encode?.symbols){const e=o.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||o.stroke||(e.stroke={value:"transparent"});for(const t of NV)o[t]&&delete e[t]}if(o.title||delete o.title,void 0!==i){let e=i;o.encode?.labels?.update&&BU(o.encode.labels.update.text)&&(e=aj(i,"datum.label",o.encode.labels.update.text.signal)),function(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update.text=i}(o,"labels",0,{signal:e})}return o}}(t,e.config))).filter((e=>void 0!==e));return i}function dZ(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map((e=>e.signal)).join(", ")}]`},o=t.data.reduce(((t,n)=>{const i=BU(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return RB(t,i)||t.push(i),t}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const hZ=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class pZ extends dX{constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function mZ(e){e.component.projection=RK(e)?function(e){if(e.hasProjection){const t=RU(e.specifiedProjection),n=!(t&&(null!=t.scale||null!=t.translate)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?function(e){const t=[],{encoding:n}=e;for(const i of[[Tj,Nj],[Rj,zj]])(CG(n[i[0]])||CG(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(jj)&&e.typedFieldDef(jj).type===AW&&t.push({signal:e.getName(`geojson_${t.length}`)}),0===t.length&&t.push(e.requestDataName($X.Main)),t}(e):void 0,o=new pZ(e.projectionName(!0),{...RU(e.config.projection)??{},...t??{}},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}}(e):function(e){if(0===e.children.length)return;let t;for(const t of e.children)mZ(t);const n=LB(e.children,(e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=LB(hZ,(n=>!yt(e.explicit,n)&&!yt(t.explicit,n)||!!(yt(e.explicit,n)&&yt(t.explicit,n)&&vj(e.get(n),t.get(n)))));if(vj(e.size,t.size)){if(n)return e;if(vj(e.explicit,{}))return t;if(vj(t.explicit,{}))return e}return null}(t,n);return e&&(t=e),!!e}return t=n,!0}return!0}));if(t&&n){const n=e.projectionName(!0),i=new pZ(n,t.specifiedProjection,t.size,CB(t.data));for(const t of e.children){const e=t.component.projection;e&&(e.isFit&&i.data.push(...t.component.projection.data),t.renameProjection(e.get("name"),n),e.merged=!0)}return i}}(e)}function gZ(e,t,n,i){if(BG(t,n)){const r=RK(e)?e.axis(n)??e.legend(n)??{}:{},o=xG(t,{expr:"datum"}),a=xG(t,{expr:"datum",binSuffix:"end"});return{formulaAs:xG(t,{binSuffix:"range",forAs:!0}),formula:IH(o,a,r.format,r.formatType,i)}}return{}}function yZ(e,t){return`${MU(e)}_${t}`}function vZ(e,t,n){const i=yZ(TG(n,void 0)??{},t);return e.getName(`${i}_bins`)}function bZ(e,t,n){let i,r;i=function(e){return"as"in e}(e)?St(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[xG(e,{forAs:!0}),xG(e,{binSuffix:"end",forAs:!0})];const o={...TG(t,void 0)},a=yZ(o,e.field),{signal:s,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(NU(o.extent)){const e=o.extent;r=dQ(n,e.param,e),delete o.extent}return{key:a,binComponent:{bin:o,field:e.field,as:[i],...s?{signal:s}:{},...l?{extentSignal:l}:{},...r?{span:r}:{}}}}class xZ extends NX{clone(){return new xZ(null,CB(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(hG(n)&&CU(n.bin)){const{key:r,binComponent:o}=bZ(n,n.bin,t);e[r]={...o,...e[r],...gZ(t,n,i,t.config)}}return e}),{});return VB(n)?null:new xZ(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=bZ(t,t.bin,n);return new xZ(e,{[i]:r})}merge(e,t){for(const n of YB(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=IB([...this.bins[n].as,...e.bins[n].as],TB)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(XB(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(XB(this.bins).map((e=>e.field)))}hash(){return`Bin ${TB(this.bins)}`}assemble(){return XB(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:oj(e.field),as:n,signal:e.signal,...NU(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:oj(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:xG({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}class _Z extends NX{clone(){return new _Z(null,new Set(this.dimensions),CB(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef((e=>{e.aggregate&&(n=!0)}));const i={},r=new Set;return n?(t.forEachFieldDef(((e,n)=>{const{aggregate:o,field:a}=e;if(o)if("count"===o)i["*"]??(i["*"]={}),i["*"].count=new Set([xG(e,{forAs:!0})]);else{if(wU(o)||kU(o)){const e=wU(o)?"argmin":"argmax",t=o[e];i[t]??(i[t]={}),i[t][e]=new Set([xG({op:e,field:t},{forAs:!0})])}else i[a]??(i[a]={}),i[a][o]=new Set([xG(e,{forAs:!0})]);mU(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??(i[a]={}),i[a].min=new Set([xG({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([xG({field:a,aggregate:"max"},{forAs:!0})]))}else!function(e,t,n,i){const r=RK(i)?i.encoding[DI(t)]:void 0;if(hG(n)&&RK(i)&&tG(n,r,i.markDef,i.config)){e.add(xG(n,{})),e.add(xG(n,{suffix:"end"}));const{mark:r,markDef:o,config:a}=i,s=KH({fieldDef:n,markDef:o,config:a});mH(r)&&.5!==s&&QI(t)&&(e.add(xG(n,{suffix:LX})),e.add(xG(n,{suffix:BX}))),n.bin&&BG(n,t)&&e.add(xG(n,{binSuffix:"range"}))}else if(aI(t)){const n=oI(t);e.add(i.getName(n))}else e.add(xG(n));mG(n)&&function(e){return Oe(e)&&"field"in e}(n.scale?.range)&&e.add(n.scale.range.field)}(r,n,e,t)})),r.size+YB(i).length===0?null:new _Z(e,r,i)):null}static makeFromTransform(e,t){const n=new Set,i={};for(const e of t.aggregate){const{op:t,field:n,as:r}=e;t&&("count"===t?(i["*"]??(i["*"]={}),i["*"].count=new Set([r||xG(e,{forAs:!0})])):(i[n]??(i[n]={}),i[n][t]=new Set([r||xG(e,{forAs:!0})])))}for(const e of t.groupby??[])n.add(e);return n.size+YB(i).length===0?null:new _Z(e,n,i)}merge(e){return qB(this.dimensions,e.dimensions)?(function(e,t){for(const n of YB(t)){const i=t[n];for(const t of YB(i))n in e?e[n][t]=new Set([...e[n][t]??[],...i[t]]):e[n]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(...e){Lq.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...YB(this.measures)])}producedFields(){const e=new Set;for(const t of YB(this.measures))for(const n of YB(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${TB({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of YB(this.measures))for(const r of YB(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:oj(i));return{type:"aggregate",groupby:[...this.dimensions].map(oj),ops:e,fields:t,as:n}}}class wZ extends NX{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of fI){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]={name:t.getName(`${e}_domain`),fields:[xG(n),...CU(i)?[xG(n,{binSuffix:"end"})]:[]],...GH(r)?{sortField:r}:Fe(r)?{sortIndexField:$Q(n,e)}:{}}}}this.childModel=t.child}hash(){let e="Facet";for(const t of fI)this[t]&&(e+=` ${t.charAt(0)}:${TB(this[t])}`);return e}get fields(){const e=[];for(const t of fI)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){const e=new Set(this.fields);for(const t of fI)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of JI){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(PW(i)&&jU(r)){const n=dK(hK(this.childModel,t));n?e[t]=n:Bq(hq(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],o=[],a=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:l}=this[e];if(s){const{op:e=UH,field:t}=s;r.push(t),o.push(e),a.push(xG(s,{forAs:!0}))}else l&&(r.push(l),o.push("max"),a.push(l));return{name:this[e].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:o,as:a}:{}}]}}assembleFacetHeaderData(e){const{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,i=[],r={};for(const e of CQ){for(const t of FQ){const i=(n[e]&&n[e][t])??[];for(const t of i)if(t.axes?.length>0){r[e]=!0;break}}if(r[e]){const n=`length(data("${this.facet.name}"))`,r="row"===e?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};i.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:r}]})}}const{row:o,column:a}=r;return(o||a)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,e)),i}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:o}=this;if(i&&r&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;const i=[].concat(n.x??[],n.y??[]),r=i.map((()=>"distinct"));e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:r}]})}for(const i of[_j,xj])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function kZ(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function EZ(e){const t={};return SB(e.filter,(e=>{if(pW(e)){let n=null;sW(e)?n=GU(e.equal):uW(e)?n=GU(e.lte):lW(e)?n=GU(e.lt):cW(e)?n=GU(e.gt):fW(e)?n=GU(e.gte):dW(e)?n=e.range[0]:hW(e)&&(n=(e.oneOf??e.in)[0]),n&&(jq(n)?t[e.field]="date":$t(n)?t[e.field]="number":St(n)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}})),t}class AZ extends NX{clone(){return new AZ(null,CB(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${TB(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!wX(r)&&r?.format?.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of YB(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:Bq(vq(e,n[e],t.value)))}for(const e of YB(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:Bq(vq(e,t[e],n)))}const r=new dX(t,n);i.copyAll(r);const o={};for(const e of YB(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===YB(o).length||i.parseNothing?null:new AZ(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of YB(this._parse)){const n=this._parse[t];1===lj(t)&&(e[t]=n)}return e}producedFields(){return new Set(YB(this._parse))}dependentFields(){return new Set(YB(this._parse))}assembleTransforms(e=!1){return YB(this._parse).filter((t=>!e||lj(t)>1)).map((e=>{const t=function(e,t){const n=nj(e);return"number"===t?`toNumber(${n})`:"boolean"===t?`toBoolean(${n})`:"string"===t?`toString(${n})`:"date"===t?`toDate(${n})`:"flatten"===t?n:t.startsWith("date:")?`timeParse(${n},'${kZ(t.slice(5,t.length))}')`:t.startsWith("utc:")?`utcParse(${n},'${kZ(t.slice(4,t.length))}')`:(Bq(`Unrecognized parse "${t}".`),null)}(e,this._parse[e]);return t?{type:"formula",expr:t,as:sj(e)}:null})).filter((e=>null!==e))}}class $Z extends NX{clone(){return new $Z(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([zV])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:zV}}}class DZ extends NX{clone(){return new DZ(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${TB(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class SZ extends NX{clone(){return new SZ(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${TB(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class MZ extends NX{constructor(e){let t;if(super(null),e??(e={name:"source"}),wX(e)||(t=e.format?{...NB(e.format,["parse"])}:{}),xX(e))this._data={values:e.values};else if(bX(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];RB(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else EX(e)?this._data={values:[{type:"Sphere"}]}:(_X(e)||wX(e))&&(this._data={});this._generator=wX(e),e.name&&(this._name=e.name),t&&!VB(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}var CZ,FZ=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};function OZ(e){return e instanceof MZ||e instanceof DZ||e instanceof SZ}class NZ{constructor(){CZ.set(this,void 0),FZ(this,CZ,!1,"f")}setModified(){FZ(this,CZ,!0,"f")}get modifiedFlag(){return function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}(this,CZ,"f")}}CZ=new WeakMap;class TZ extends NZ{getNodeDepths(e,t,n){n.set(e,t);for(const i of e.children)this.getNodeDepths(i,t+1,n);return n}optimize(e){const t=[...this.getNodeDepths(e,0,new Map).entries()].sort(((e,t)=>t[1]-e[1]));for(const e of t)this.run(e[0]);return this.modifiedFlag}}class zZ extends NZ{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class RZ extends zZ{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map((e=>e.hash())),n={};for(let i=0;i1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class PZ extends zZ{constructor(e){super(),this.requiresSelectionId=e&&oQ(e)}run(e){e instanceof $Z&&(this.requiresSelectionId&&(OZ(e.parent)||e.parent instanceof _Z||e.parent instanceof AZ)||(this.setModified(),e.remove()))}}class LZ extends NZ{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof PX&&(n=e.producedFields(),WB(n,t)&&(this.setModified(),e.removeFormulas(t),0===e.producedFields.length&&e.remove()));for(const i of e.children)this.run(i,new Set([...t,...n]))}}class BZ extends zZ{constructor(){super()}run(e){e instanceof TX&&!e.isRequired()&&(this.setModified(),e.remove())}}class jZ extends TZ{run(e){if(!(OZ(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof AZ)if(e instanceof AZ)this.setModified(),e.merge(t);else{if(GB(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class IZ extends TZ{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof AZ));if(e.numChildren()>1&&n.length>=1){const i={},r=new Set;for(const e of n){const t=e.parse;for(const e of YB(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!VB(i)){this.setModified();const n=new AZ(e,i);for(const r of t){if(r instanceof AZ)for(const e of YB(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof AZ&&0===YB(r.parse).length&&r.remove()}}}}}class UZ extends TZ{run(e){e instanceof TX||e.numChildren()>0||e instanceof wZ||e instanceof MZ||(this.setModified(),e.remove())}}class qZ extends TZ{run(e){const t=e.children.filter((e=>e instanceof PX)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class WZ extends TZ{run(e){const t=e.children.filter((e=>e instanceof _Z)),n={};for(const e of t){const t=TB(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of YB(n)){const i=n[t];if(i.length>1){const t=i.pop();for(const n of i)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}}class HZ extends TZ{constructor(e){super(),this.model=e}run(e){const t=!(OZ(e)||e instanceof cQ||e instanceof AZ||e instanceof $Z),n=[],i=[];for(const r of e.children)r instanceof xZ&&(t&&!GB(e.producedFields(),r.dependentFields())?n.push(r):i.push(r));if(n.length>0){const t=n.pop();for(const e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof xZ?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}}class GZ extends TZ{run(e){const t=[...e.children];if(!PB(t,(e=>e instanceof TX))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof TX){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof TX))break;t=e}n.push(...t.children),i?(e.removeChild(r),r.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(r);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class VZ extends NX{clone(){return new VZ(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=IB(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??xG(e)}hash(){return`JoinAggregateTransform ${TB(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class YZ extends NX{clone(){return new YZ(null,CB(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:o="zero"}=t,a=[],s=[];if(void 0!==t.sort)for(const e of t.sort)a.push(e.field),s.push(uj(e.order,"ascending"));const l={field:a,order:s};let u;return u=function(e){return Fe(e)&&e.every((e=>St(e)))&&e.length>1}(r)?r:St(r)?[r,`${r}_end`]:[`${t.stack}_start`,`${t.stack}_end`],new YZ(e,{dimensionFieldDefs:[],stackField:n,groupby:i,offset:o,sort:l,facetby:[],as:u})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;const{groupbyChannels:r,fieldChannel:o,offset:a,impute:s}=n,l=r.map((e=>MG(i[e]))).filter((e=>!!e)),u=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=xG(t.fieldDef);return n&&e.push(n),e}),[])}(t),c=t.encoding.order;let f;if(Fe(c)||aG(c))f=rq(c);else{const e=nG(c)?c.sort:"y"===o?"descending":"ascending";f=u.reduce(((t,n)=>(t.field.push(n),t.order.push(e),t)),{field:[],order:[]})}return new YZ(e,{dimensionFieldDefs:l,stackField:t.vgField(o),facetby:[],stackby:u,sort:f,offset:a,impute:s,as:[t.vgField(o,{suffix:"start",forAs:!0}),t.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${TB(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[xG(e,{binSuffix:"mid"})]:[xG(e,{}),xG(e,{binSuffix:"end"})]:[xG(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:l}=this._stack;if(s)for(const o of n){const{bandPosition:n=.5,bin:a}=o;if(a){const t=xG(o,{expr:"datum"}),i=xG(o,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${n}*${t}+${1-n}*${i}`,as:xG(o,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:xG(o,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:l,offset:a}),e}}class XZ extends NX{clone(){return new XZ(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=IB(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach((t=>e.add(t.field))),this.transform.window.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??xG(e)}hash(){return`WindowTransform ${TB(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const r of this.transform.window)t.push(r.op),n.push(this.getDefaultName(r)),i.push(void 0===r.param?null:r.param),e.push(void 0===r.field?null:r.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>EU(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==o?{groupby:o}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const e of this.transform.sort)a.push(e.field),s.push(e.order??"ascending");const l={field:a,order:s},u=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:l,...void 0!==u?{ignorePeers:u}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function JZ(e){if(e instanceof wZ)if(1!==e.numChildren()||e.children[0]instanceof TX){const n=e.model.component.data.main;QZ(n);const i=(t=e,function e(n){if(!(n instanceof wZ)){const i=n.clone();if(i instanceof TX){const e=ZZ+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof _Z||i instanceof YZ||i instanceof XZ||i instanceof VZ)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof _Z||t instanceof YZ||t instanceof XZ||t instanceof VZ)&&t.addDimensions(e.fields),t.swapWithParent(),JZ(e)}else e.children.map(JZ);var t}function QZ(e){if(e instanceof TX&&e.type===$X.Main&&1===e.numChildren()){const t=e.children[0];t instanceof wZ||(t.swapWithParent(),QZ(e))}}const ZZ="scale_",KZ=5;function eK(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!eK(t.children))return!1}return!0}function tK(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function nK(e,t,n){let i=e.sources,r=!1;return r=tK(new BZ,i)||r,r=tK(new PZ(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=tK(new UZ,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=tK(new jZ,i)||r,r=tK(new HZ(t),i)||r,r=tK(new LZ,i)||r,r=tK(new IZ,i)||r,r=tK(new WZ,i)||r,r=tK(new qZ,i)||r,r=tK(new RZ,i)||r,r=tK(new GZ,i)||r),e.sources=i,r}class iK{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new iK((()=>e(t)))}}function rK(e){RK(e)?function(e){const t=e.component.scales;for(const n of YB(t)){const i=oK(e,n);if(t[n].setWithExplicit("domains",i),uK(e,n),e.component.data.isFaceted){let t=e;for(;!PK(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)IU(e)&&(e.data=ZZ+e.data.replace(ZZ,""))}}}(e):function(e){for(const t of e.children)rK(t);const t=e.component.scales;for(const n of YB(t)){let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):yX(i,e.getWithExplicit("domains"),"domains","scale",fK);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&Bq("The same selection must be used to override scale domains in a layered view."),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function oK(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=cK(t,n);if(!e)return void Bq(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=cK(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),"x"===t&&CG(i.x2)?CG(i.x)?yX(sK(n,r,e,"x"),sK(n,r,e,"x2"),"domain","scale",fK):sK(n,r,e,"x2"):"y"===t&&CG(i.y2)?CG(i.y)?yX(sK(n,r,e,"y"),sK(n,r,e,"y2"),"domain","scale",fK):sK(n,r,e,"y2"):sK(n,r,e,t)}function aK(e,t,n){const i=iW(n)?.unit;return"temporal"===t||i?function(e,t,n){return e.map((e=>({signal:`{data: ${PG(e,{timeUnit:n,type:t})}}`})))}(e,t,i):[e]}function sK(e,t,n,i){const{encoding:r,markDef:o,mark:a,config:s,stack:l}=n,u=CG(r[i]),{type:c}=u,f=u.timeUnit;if(function(e){return e?.unionWith}(t)){const r=sK(e,void 0,n,i);return hX([...aK(t.unionWith,c,f),...r.value])}if(BU(t))return hX([t]);if(t&&"unaggregated"!==t&&!IW(t))return hX(aK(t,c,f));if(l&&i===l.fieldChannel){if("normalize"===l.offset)return pX([[0,1]]);const e=n.requestDataName($X.Main);return pX([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const d=mU(i)&&aG(u)?function(e,t,n){if(!PW(n))return;const i=e.fieldDef(t),r=i.sort;if(VH(r))return{op:"min",field:$Q(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(GH(r))return lK(r,o&&!a.has(r.field));if(HH(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:l}=i,u=o&&!a.has(l);if(wU(s)||kU(s))return lK({field:xG(i),order:n},u);if(EU(s)||!s)return lK({op:s,field:l,order:n},u)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(RB(["ascending",void 0],r))return!0}}(n,i,e):void 0;if(lG(u))return pX(aK([u.datum],c,f));const h=u;if("unaggregated"===t){const e=n.requestDataName($X.Main),{field:t}=u;return pX([{data:e,field:xG({field:t,aggregate:"min"})},{data:e,field:xG({field:t,aggregate:"max"})}])}if(CU(h.bin)){if(PW(e))return pX("bin-ordinal"===e?[]:[{data:QB(d)?n.requestDataName($X.Main):n.requestDataName($X.Raw),field:n.vgField(i,BG(h,i)?{binSuffix:"range"}:{}),sort:!0!==d&&Oe(d)?d:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=h;if(CU(e)){const t=vZ(n,h.field,e);return pX([new iK((()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return pX([{data:n.requestDataName($X.Main),field:n.vgField(i,{})}])}}if(h.timeUnit&&RB(["time","utc"],e)){const e=r[DI(i)];if(tG(h,e,o,s)){const t=n.requestDataName($X.Main),r=KH({fieldDef:h,fieldDef2:e,markDef:o,config:s}),l=mH(a)&&.5!==r&&QI(i);return pX([{data:t,field:n.vgField(i,l?{suffix:LX}:{})},{data:t,field:n.vgField(i,{suffix:l?BX:"end"})}])}}return pX(d?[{data:QB(d)?n.requestDataName($X.Main):n.requestDataName($X.Raw),field:n.vgField(i),sort:d}]:[{data:n.requestDataName($X.Main),field:n.vgField(i)}])}function lK(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":UH),...i?{field:oj(i)}:{},...r?{order:r}:{}}}function uK(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,o=IW(i)&&i,a=OU(r)&&NU(r.extent)&&r.extent;(o||a)&&n.set("selectionExtent",o??a,!0)}function cK(e,t){const{aggregate:n,type:i}=e;return n?St(n)&&!SU.has(n)?{valid:!1,reason:Mq(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:Cq(e)}:{valid:!0}:{valid:!1,reason:Sq(e)}}function fK(e,t,n,i){return e.explicit&&t.explicit&&Bq(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${bj(n)} and ${bj(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function dK(e){if(IU(e)&&St(e.field))return e.field;if(function(e){return!Fe(e)&&"fields"in e&&!("data"in e)}(e)){let t;for(const n of e.fields)if(IU(n)&&St(n.field))if(t){if(t!==n.field)return Bq("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),t}else t=n.field;return Bq("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),t}if(function(e){return!Fe(e)&&"fields"in e&&"data"in e}(e)){Bq("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const t=e.fields[0];return St(t)?t:void 0}}function hK(e,t){return function(e){const t=IB(e.map((e=>{if(IU(e)){const{sort:t,...n}=e;return n}return e})),TB),n=IB(e.map((e=>{if(IU(e)){const t=e.sort;return void 0===t||QB(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),TB);if(0===t.length)return;if(1===t.length){const t=e[0];if(IU(t)&&n.length>0){let e=n[0];if(n.length>1){Bq(Nq);const t=n.filter((e=>Oe(e)&&"op"in e&&"min"!==e.op));e=!n.every((e=>Oe(e)&&"op"in e))||1!==t.length||t[0]}else if(Oe(e)&&"field"in e){const n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}const i=IB(n.map((e=>QB(e)||!("op"in e)||St(e.op)&&e.op in _U?e:(Bq(function(e){return`Dropping sort property ${bj(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),TB);let r;1===i.length?r=i[0]:i.length>1&&(Bq(Nq),r=!0);const o=IB(e.map((e=>IU(e)?e.data:null)),(e=>e));return 1===o.length&&null!==o[0]?{data:o[0],fields:t.map((e=>e.field)),...r?{sort:r}:{}}:{fields:t,...r?{sort:r}:{}}}(e.component.scales[t].get("domains").map((t=>(IU(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function pK(e){return BK(e)||LK(e)?e.children.reduce(((e,t)=>e.concat(pK(t))),mK(e)):mK(e)}function mK(e){return YB(e.component.scales).reduce(((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:o,type:a,selectionExtent:s,domains:l,range:u,reverse:c,...f}=r,d=function(e,t,n,i){if(QI(n)){if(jU(e))return{step:{signal:`${t}_step`}}}else if(Oe(e)&&IU(e))return{...e,data:i.lookupDataSource(e.data)};return e}(r.range,o,n,e),h=hK(e,n),p=s?function(e,t,n,i){const r=dQ(e,t.param,t);return{signal:LW(n.get("type"))&&Fe(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}(e,s,i,h):null;return t.push({name:o,type:a,...h?{domain:h}:{},...p?{domainRaw:p}:{},range:d,...void 0!==c?{reverse:c}:{},...f}),t}),[])}class gK extends dX{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||PB(this.get("domains"),(e=>Fe(e)&&2===e.length&&$t(e[0])&&e[0]<=0&&$t(e[1])&&e[1]>=0))}}const yK=["range","scheme"];function vK(e,t){const n=e.fieldDef(t);if(n?.bin){const{bin:i,field:r}=n,o=SI(t),a=e.getName(o);if(Oe(i)&&i.binned&&void 0!==i.step)return new iK((()=>{const n=e.scaleName(t),r=`(domain("${n}")[1] - domain("${n}")[0]) / ${i.step}`;return`${e.getSignalName(a)} / (${r})`}));if(CU(i)){const t=vZ(e,r,i);return new iK((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(a)} / (${i})`}))}}}function bK(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const i of yK)if(void 0!==n[i]){const o=QW(r,i),a=ZW(e,i);if(o)if(a)Bq(a);else switch(i){case"range":{const i=n.range;if(Fe(i)){if(QI(e))return hX(i.map((e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return iK.fromName(i,n)}return e})))}else if(Oe(i))return hX({data:t.requestDataName($X.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return hX(i)}case"scheme":return hX(xK(n[i]))}else Bq(Fq(r,i,e))}const o=e===kj||"xOffset"===e?"width":"height",a=i[o];if(HV(a))if(QI(e))if(PW(r)){const n=wK(a,t,e);if(n)return hX({step:n})}else Bq(Oq(o));else if(nU(e)){const n=e===Dj?"x":"y";if("band"===t.getScaleComponent(n).get("type")){const e=kK(a,r);if(e)return hX(e)}}const{rangeMin:s,rangeMax:l}=n,u=function(e,t){const{size:n,config:i,mark:r,encoding:o}=t,{type:a}=CG(o[e]),s=t.getScaleComponent(e).get("type"),{domain:l,domainMid:u}=t.specifiedScales[e];switch(e){case kj:case Ej:if(RB(["point","band"],s)){const r=EK(e,n,i.view);if(HV(r))return{step:wK(r,t,e)}}return _K(e,t,s);case Dj:case Sj:return function(e,t,n){const i=e===Dj?"x":"y",r=t.getScaleComponent(i);if(!r)return _K(i,t,n,{center:!0});const o=r.get("type"),a=t.scaleName(i),{markDef:s,config:l}=t;if("band"===o){const e=EK(i,t.size,t.config.view);if(HV(e)){const t=kK(e,n);if(t)return t}return[0,{signal:`bandwidth('${a}')`}]}{const n=t.encoding[i];if(aG(n)&&n.timeUnit){const e=rW(n.timeUnit,(e=>`scale('${a}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner,r=KH({fieldDef:n,markDef:s,config:l})-.5,o=0!==r?` + ${r}`:"";return i?[{signal:`${BU(i)?`${i.signal}/2`+o:`${i/2+r}`} * (${e})`},{signal:`${BU(i)?`(1 - ${i.signal}/2)`+o:`${1-i/2+r}`} * (${e})`}]:[0,{signal:e}]}return FB(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,t,s);case Ij:{const o=AK(r,t.component.scales[e].get("zero"),i),a=function(e,t,n,i){const r={x:vK(n,"x"),y:vK(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=DK(t,r,i.view);return $t(e)?e-1:new iK((()=>`${e.signal} - 1`))}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const e=DK(t,r,i.view);return $t(e)?Math.pow($K*e,2):new iK((()=>`pow(${$K} * ${e.signal}, 2)`))}}throw new Error(Eq("size",e))}(r,n,t,i);return jW(s)?function(e,t,n){const i=()=>{const i=QU(t),r=QU(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return BU(t)?new iK(i):{signal:i()}}(o,a,function(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&Fe(n)?n.length+1:(Bq(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(s,i,l,e)):[o,a]}case Fj:return[0,2*Math.PI];case Uj:return[0,360];case Mj:return[0,new iK((()=>`min(${t.getSignalName("width")},${t.getSignalName("height")})/2`))];case Gj:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case Vj:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case jj:return"symbol";case Pj:case Lj:case Bj:return"ordinal"===s?"nominal"===a?"category":"ordinal":void 0!==u?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case qj:case Wj:case Hj:return[i.scale.minOpacity,i.scale.maxOpacity]}}(e,t);return(void 0!==s||void 0!==l)&&QW(r,"rangeMin")&&Fe(u)&&2===u.length?hX([s??u[0],l??u[1]]):pX(u)}function xK(e){return function(e){return!St(e)&&!!e.name}(e)?{scheme:e.name,...NB(e,["name"])}:{scheme:e}}function _K(e,t,n,{center:i}={}){const r=SI(e),o=t.getName(r),a=t.getSignalName.bind(t);return e===Ej&&LW(n)?i?[iK.fromName((e=>`${a(e)}/2`),o),iK.fromName((e=>`-${a(e)}/2`),o)]:[iK.fromName(a,o),0]:i?[iK.fromName((e=>`-${a(e)}/2`),o),iK.fromName((e=>`${a(e)}/2`),o)]:[0,iK.fromName(a,o)]}function wK(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=CI(n),a=i[o];if("offset"===WV({step:e,offsetIsDiscrete:dG(a)&&xW(a.type)})&&QG(i,o)){const n=t.getScaleComponent(o);let i=`domain('${t.scaleName(o)}').length`;"band"===n.get("type")&&(i=`bandspace(${i}, ${n.get("paddingInner")??n.get("padding")??0}, ${n.get("paddingOuter")??n.get("padding")??0})`);const a=r.get("paddingInner")??r.get("padding");return{signal:`${e.step} * ${i} / (1-${XU(a)})`}}return e.step}function kK(e,t){if("offset"===WV({step:e,offsetIsDiscrete:PW(t)}))return{step:e.step}}function EK(e,t,n){const i=e===kj?"width":"height";return t[i]||JV(n,i)}function AK(e,t,n){if(t)return BU(t)?{signal:`${t.signal} ? 0 : ${AK(e,!1,n)}`}:0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(Eq("size",e))}const $K=.95;function DK(e,t,n){const i=HV(e.width)?e.width.step:XV(n,"width"),r=HV(e.height)?e.height.step:XV(n,"height");return t.x||t.y?new iK((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function SK(e,t){RK(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of YB(n)){const l=a[s],u=n[s],c=e.getScaleComponent(s),f=CG(r[s]),d=l[t],h=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),g=QW(h,t),y=ZW(s,t);if(void 0!==d&&(g?y&&Bq(y):Bq(Fq(h,t,s))),g&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":jq(l[t])||"temporal"===n||e?u.set(t,{signal:PG(l[t],{type:n,timeUnit:e})},!0):u.set(t,l[t],!0);break;default:u.copyKeyFromObject(t,l)}}else{const n=t in MK?MK[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:h,scalePadding:p,scalePaddingInner:m,domain:l.domain,domainMin:l.domainMin,domainMax:l.domainMax,markDef:o,config:i,hasNestedOffsetScale:ZG(r,s),hasSecondaryRangeChannel:!!r[DI(s)]}):i.scale[t];void 0!==n&&u.set(t,n,!1)}}}(e,t):FK(e,t)}const MK={bins:({model:e,fieldOrDatumDef:t})=>aG(t)?function(e,t){const n=t.bin;if(CU(n)){const i=vZ(e,t.field,n);return new iK((()=>e.getSignalName(i)))}if(FU(n)&&OU(n)&&void 0!==n.step)return{step:n.step}}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(RB([Pj,Lj,Bj],e)&&"nominal"!==t)return"hcl"}(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:o})=>function(e,t,n,i,r,o){if(!(MG(o)?.bin||Fe(n)||null!=r||null!=i||RB([$W.TIME,$W.UTC],e)))return!!QI(t)||void 0}(e,t,n,i,r,o),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,o){if(QI(e)){if(BW(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!aG(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===$W.POINT)return n.pointPadding}}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0===e){if(QI(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,bandWithNestedOffsetPaddingInner:a}=r;return o?a:uj(e,"bar"===n?t:i)}return nU(t)&&i===$W.BAND?r.offsetBandPaddingInner:void 0}}(e,t,n.type,i,r.scale,o),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0===e)if(QI(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===$W.BAND)return uj(e,BU(i)?{signal:`${i.signal}/2`}:i/2)}else if(nU(t)){if(n===$W.POINT)return.5;if(n===$W.BAND)return r.offsetBandPaddingOuter}}(e,t,n,i,r.scale,o),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){return"x"===n&&void 0!==i.xReverse?LW(e)&&"descending"===t?BU(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse:!(!LW(e)||"descending"!==t)||void 0}(t,aG(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r,config:o,hasSecondaryRangeChannel:a})=>function(e,t,n,i,r,o,a){if(n&&"unaggregated"!==n&&LW(r)){if(Fe(n)){const e=n[0],t=n[n.length-1];if($t(e)&&e<=0&&$t(t)&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!jW(r))return!0;if((!aG(t)||!t.bin)&&RB([...JI,...KI],e)){const{orient:t,type:n}=i;return(!RB(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!RB(["bar","area"],n)||a)||o?.zero)}return!1}(e,t,n,i,r,o.scale,a)};function CK(e){RK(e)?function(e){const t=e.component.scales;for(const n of pU){const i=t[n];if(!i)continue;const r=bK(n,e);i.setWithExplicit("range",r)}}(e):FK(e,"range")}function FK(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?CK(n):SK(n,t);for(const i of YB(n)){let r;for(const n of e.children){const e=n.component.scales[i];e&&(r=yX(r,e.getWithExplicit(t),t,"scale",mX(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0))))}n[i].setWithExplicit(t,r)}}function OK(e,t,n,i,r=!1){const o=function(e,t,n,i){switch(t.type){case"nominal":case"ordinal":if(uI(e)||"discrete"===bU(e))return"shape"===e&&"ordinal"===t.type&&Bq(Dq(e,"ordinal")),"ordinal";if(QI(e)||nU(e)){if(RB(["rect","bar","image","rule"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in ZI)return"band";return _H(n[SI(e)])||gG(t)&&t.axis?.tickBand?"band":"point";case"temporal":return uI(e)?"time":"discrete"===bU(e)?(Bq(Dq(e,"temporal")),"ordinal"):aG(t)&&t.timeUnit&&iW(t.timeUnit).utc?"utc":"time";case"quantitative":return uI(e)?aG(t)&&CU(t.bin)?"bin-ordinal":"linear":"discrete"===bU(e)?(Bq(Dq(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(_q(t.type))}(t,n,i,r),{type:a}=e;return mU(t)?void 0!==a?function(e,t,n=!1){if(!mU(e))return!1;switch(e){case kj:case Ej:case Dj:case Sj:case Fj:case Mj:return!!BW(t)||"band"===t||"point"===t&&!n;case Ij:case Gj:case qj:case Wj:case Hj:case Uj:return BW(t)||jW(t)||RB(["band","point","ordinal"],t);case Pj:case Lj:case Bj:return"band"!==t;case Vj:case jj:return"ordinal"===t||jW(t)}}(t,a)?aG(n)&&(s=a,l=n.type,!(RB([wW,EW],l)?void 0===s||PW(s):l===kW?RB([$W.TIME,$W.UTC,void 0],s):l!==_W||NW(s)||jW(s)||void 0===s))?(Bq(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(a,o)),o):a:(Bq(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,a,o)),o):o:null;var s,l}function NK(e){RK(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of pU){const a=CG(t[o]);if(a&&n===hH&&o===jj&&a.type===AW)continue;let s=a&&a.scale;if(a&&null!==s&&!1!==s){s??(s={});const n=OK(s,o,a,i,ZG(t,o));r[o]=new gK(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}return r}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const n of e.children){NK(n);for(const o of YB(n.component.scales))if((t=r.scale)[o]??(t[o]=YQ(o,e)),"shared"===r.scale[o]){const e=i[o],t=n.component.scales[o].getWithExplicit("type");e?SW(e.value,t.value)?i[o]=yX(e,t,"type","scale",TK):(r.scale[o]="independent",delete i[o]):i[o]=t}}for(const t of YB(i)){const r=e.scaleName(t,!0),o=i[t];n[t]=new gK(r,o);for(const n of e.children){const e=n.component.scales[t];e&&(n.renameScale(e.get("name"),r),e.merged=!0)}}return n}(e)}const TK=mX(((e,t)=>CW(e)-CW(t)));class zK{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function RK(e){return"unit"===e?.type}function PK(e){return"facet"===e?.type}function LK(e){return"concat"===e?.type}function BK(e){return"layer"===e?.type}class jK{constructor(e,t,n,i,r,o,a){this.type=t,this.parent=n,this.config=r,this.correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=r,this.view=RU(a),this.name=e.name??i,this.title=LU(e.title)?{text:e.title}:e.title?RU(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new zK,this.projectionNameMap=n?n.projectionNameMap:new zK,this.signalNameMap=n?n.signalNameMap:new zK,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>NY(e)?{filter:MB(e.filter,vW)}:e)),this.layout="layer"===t||"unit"===t?{}:function(e,t,n){const i=n[t],r={},{spacing:o,columns:a}=i;void 0!==o&&(r.spacing=o),void 0!==a&&(JH(e)&&!YH(e.facet)||IV(e))&&(r.columns=a),UV(e)&&(r.columns=1);for(const t of VV)if(void 0!==e[t])if("spacing"===t){const n=e[t];r[t]=$t(n)?n:{row:n.row??o,column:n.column??o}}else r[t]=e[t];return r}(e,t,r),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:JH(e)||n?.component.data.isFaceted&&void 0===e.data},layoutSize:new dX,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?CB(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e,{ignoreRange:t}={}){NK(e),rK(e);for(const t of JW)SK(e,t);t||CK(e)}(this)}parseProjection(){mZ(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){sZ(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of YB(n)){const t=n[e];void 0!==t&&(i[e]=YU(t))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=YU(this.description)),"unit"!==this.type&&"layer"!==this.type)?VB(t)?void 0:t:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...t??{}}}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,r=function(e,t){const n={};for(const i of fI){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:e,titleOrient:o}=MQ(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=DQ(i,o),s=jQ(e,a);void 0!==s&&(n[a]=s)}}return VB(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of fI)e[n].title&&t.push(OQ(this,n));for(const e of CQ)t=t.concat(zQ(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>mQ(e,"grid",t))),...i.map((e=>mQ(e,"grid",t))),...n.map((e=>mQ(e,"main",t))),...i.map((e=>mQ(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return fZ(this)}assembleProjections(){return BK(e=this)||LK(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),dZ(e))}(e):dZ(e);var e}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...PU(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return RB(["unit","layer"],this.type)?RB(["middle",void 0],n.anchor)&&(n.frame??(n.frame="group")):n.anchor??(n.anchor="start"),VB(n)?void 0:n}assembleGroup(e=[]){const t={};(e=e.concat(this.assembleSignals())).length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||PK(this.parent)?pK(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}getName(e){return ZB((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName($X[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(PK(this.parent)){const t=eU(GQ(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(PW(e)&&jU(i)){const e=n.get("name"),i=dK(hK(this,t));return i?{signal:HQ(e,n,xG({aggregate:"distinct",field:i},{expr:"datum"}))}:(Bq(hq(t)),null)}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):wI(e)&&mU(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(`Cannot find a selection named "${t}".`);return n}hasAxisOrientSignalRef(){return this.component.axes.x?.some((e=>e.hasOrientSignalRef()))||this.component.axes.y?.some((e=>e.hasOrientSignalRef()))}}class IK extends jK{vgField(e,t={}){const n=this.fieldDef(e);if(n)return xG(n,t)}reduceFieldDef(e,t){return function(e,t,n,i){return e?YB(e).reduce(((n,r)=>{const o=e[r];return Fe(o)?o.reduce(((e,n)=>t.call(i,e,n,r)),n):t.call(i,n,o,r)}),n):n}(this.getMapping(),((t,n,i)=>{const r=MG(n);return r?e(t,r,i):t}),t)}forEachFieldDef(e,t){iV(this.getMapping(),((t,n)=>{const i=MG(t);i&&e(i,n)}),t)}}class UK extends NX{clone(){return new UK(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=CB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"]}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${TB(this.transform)}`}assemble(){const{density:e,...t}=this.transform,n={type:"kde",field:e,...t};return this.transform.groupby&&(n.resolve="shared"),n}}class qK extends NX{clone(){return new qK(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=CB(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${TB(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class WK extends NX{clone(){return new WK(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==eq("invalid",r,n))return null;const o=t.reduceFieldDef(((e,n,r)=>{const o=mU(r)&&t.getScaleComponent(r);return o&&LW(o.get("type"))&&"count"!==n.aggregate&&!pH(i)&&(e[n.field]=n),e}),{});return YB(o).length?new WK(e,o):null}dependentFields(){return new Set(YB(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${TB(this.filter)}`}assemble(){const e=YB(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=xG(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class HK extends NX{clone(){return new HK(this.parent,CB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=CB(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map(((e,t)=>i[t]??e))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${TB(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class GK extends NX{clone(){return new GK(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=CB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"key",n[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${TB(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class VK extends NX{clone(){return new VK(null,CB(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[Tj,Nj],[Rj,zj]]){const r=i.map((e=>{const n=CG(t.encoding[e]);return aG(n)?n.field:lG(n)?{expr:`${n.datum}`}:pG(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new VK(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(jj)){const i=t.typedFieldDef(jj);i.type===AW&&(e=new VK(e,null,i.field,t.getName("geojson_"+n++)))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){const e=(this.fields??[]).filter(St);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${TB(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class YK extends NX{clone(){return new YK(null,this.projection,CB(this.fields),CB(this.as))}constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[Tj,Nj],[Rj,zj]]){const i=n.map((e=>{const n=CG(t.encoding[e]);return aG(n)?n.field:lG(n)?{expr:`${n.datum}`}:pG(n)?{expr:`${n.value}`}:void 0})),r=n[0]===Rj?"2":"";(i[0]||i[1])&&(e=new YK(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(St))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${TB(this.fields)} ${TB(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class XK extends NX{clone(){return new XK(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new XK(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(aG(i)&&aG(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const a=i.impute?r:r.impute?i:void 0,{method:s,value:l,frame:u,keyvals:c}=o.impute,f=rV(t.mark,n);return new XK(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==l?{value:l}:{},...u?{frame:u}:{},...void 0!==c?{keyvals:c}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${TB(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:a=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:TY(n)?this.processSequence(n):n}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};return i&&"value"!==i?[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]:[s]}}class JK extends NX{clone(){return new JK(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=CB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${TB(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class QK extends NX{clone(){return new QK(null,CB(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let a=null;if(function(e){return"data"in e}(o)){let e=f0(o.data,r);e||(e=new MZ(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new TX(e,n,$X.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return"param"in e}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(ZB(e),e)}catch(t){throw new Error(`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`)}if(a=i.materialized,!a)throw new Error(`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new QK(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?nt(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${TB({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:nt(this.transform.as)}:{}};else{let t=this.transform.as;St(t)||(Bq('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),t="_lookup"),e={as:[t]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class ZK extends NX{clone(){return new ZK(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=CB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"prob",n[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${TB(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class KK extends NX{clone(){return new KK(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=CB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${TB(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class e0 extends NX{clone(){return new e0(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=IB((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${TB(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==r?{op:r}:{},...void 0!==n?{groupby:n}:{}}}}class t0 extends NX{clone(){return new t0(null,CB(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${TB(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function n0(e){let t=0;return function n(i,r){if(i instanceof MZ&&!i.isGenerator&&!bX(i.data)&&(e.push(r),r={name:null,source:r.name,transform:[]}),i instanceof AZ&&(i.parent instanceof MZ&&!r.source?(r.format={...r.format??{},parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof wZ)return r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,void e.push(...i.assemble());switch((i instanceof DZ||i instanceof SZ||i instanceof WK||i instanceof cQ||i instanceof AQ||i instanceof YK||i instanceof _Z||i instanceof QK||i instanceof XZ||i instanceof VZ||i instanceof GK||i instanceof HK||i instanceof UK||i instanceof JK||i instanceof ZK||i instanceof KK||i instanceof $Z||i instanceof t0||i instanceof e0||i instanceof qK)&&r.transform.push(i.assemble()),(i instanceof xZ||i instanceof PX||i instanceof XK||i instanceof YZ||i instanceof VK)&&r.transform.push(...i.assemble()),i instanceof TX&&(r.source&&0===r.transform.length?i.setSource(r.source):i.parent instanceof TX?i.setSource(r.name):(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()&&(e.push(r),r={name:null,source:r.name,transform:[]}))),i.numChildren()){case 0:i instanceof TX&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const e of i.children)n(e,{name:null,source:o,transform:[]});break}}}}function i0(e,t){const{facet:n,config:i,child:r,component:o}=e;if(e.channelHasField(t)){const a=n[t],s=SQ("title",null,i,t);let l=AG(a,i,{allowDisabling:!0,includeDefault:void 0===s||!!s});r.component.layoutHeaders[t].title&&(l=Fe(l)?l.join(", "):l,l+=` / ${r.component.layoutHeaders[t].title}`,r.component.layoutHeaders[t].title=null);const u=SQ("labelOrient",a.header,i,t),c=null!==a.header&&uj(a.header?.labels,i.header.labels,!0),f=RB(["bottom","right"],u)?"footer":"header";o.layoutHeaders[t]={title:null!==a.header?l:null,facetFieldDef:a,[f]:"facet"===t?[]:[r0(e,t,c)]}}}function r0(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function o0(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=XQ(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",a=r[o];for(const r of n.component.axes[t]){const t="top"===(i=r.get("orient"))||"left"===i||BU(i)?"header":"footer";a[t]??(a[t]=[r0(e,o,!1)]);const n=mQ(r,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}var i}function a0(e){for(const t of e.children)t.parseLayoutSize()}function s0(e,t){const n=GQ(t),i=eU(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const t of e.children){const o=t.component.layoutSize.getWithExplicit(n),s=r.scale[i]??YQ(i,e);if("independent"===s&&"step"===o.value){a=void 0;break}if(a){if("independent"===s&&a.value!==o.value){a=void 0;break}a=yX(a,o,n,"")}else a=o}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,a)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function l0(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(PW(e)){const e=JV(i.view,t);return jU(n)||HV(e)?"step":e}return YV(i.view,t)}if(e.hasProjection||"arc"===e.mark)return YV(i.view,t);{const e=JV(i.view,t);return HV(e)?e.step:e}}function u0(e,t,n){return xG(t,{suffix:`by_${xG(e)}`,...n??{}})}class c0 extends IK{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=T0(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!YH(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=YB(e),n={};for(const i of t){if(![xj,_j].includes(i)){Bq(Eq(i,"facet"));break}const t=e[i];if(void 0===t.field){Bq(kq(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=NG(e,t);return n.header?n.header=RU(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=d0(this),this.child.parseData()}parseLayoutSize(){a0(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of fI)i0(e,t);o0(e,"x"),o0(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){const e={};for(const t of fI)for(const n of FQ){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=SQ("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=DQ(t,n);e.titleAnchor??(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(r?.[0]){const r="row"===t?"height":"width",o="header"===n?"headerBand":"footerBand";"facet"===t||this.child.component.layoutSize.get(r)||(e[o]??(e[o]={}),e[o][t]=.5),i.title&&(e.offset??(e.offset={}),e.offset["row"===t?"rowTitle":"columnTitle"]=10)}}return e}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof c0))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof c0?{...this.channelHasField("column")?{encode:{update:{columns:{field:xG(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof c0){if(this.child.channelHasField("column")){const i=xG(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of JI){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(PW(o)&&jU(a)){const r=dK(hK(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):Bq(hq(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:i}=this.facet,{fields:r,ops:o,as:a}=this.getCardinalityAggregateForChild(),s=[];for(const e of fI){const t=this.facet[e];if(t){s.push(xG(t));const{bin:l,sort:u}=t;if(CU(l)&&s.push(xG(t,{binSuffix:"end"})),GH(u)){const{field:e,op:s=UH}=u,l=u0(t,u);n&&i?(r.push(l),o.push("max"),a.push(l)):(r.push(e),o.push(s),a.push(l))}else if(Fe(u)){const n=$Q(t,e);r.push(n),o.push("max"),a.push(n)}}}const l=!!n&&!!i;return{name:e,data:t,groupby:s,...l||r.length>0?{aggregate:{...l?{cross:l}:{},...r.length?{fields:r,ops:o,as:a}:{}}}:{}}}facetSortFields(e){const{facet:t}=this,n=t[e];return n?GH(n.sort)?[u0(n,n.sort,{expr:"datum"})]:Fe(n.sort)?[$Q(n,e,{expr:"datum"})]:[xG(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(GH(e)?e.order:!Fe(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return PQ(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of CQ)if(e[i]){const r=SQ("labelOrient",e[i]?.header,t,i);if(n[i].includes(r))return PQ(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=n0(t);for(const t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...r?{style:r}:{},from:{facet:this.assembleFacet()},sort:{field:fI.map((e=>this.facetSortFields(e))).flat(),order:fI.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(CX(this,[]))}]}getMapping(){return this.facet}}function f0(e,t){for(const n of t){const t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;const i=e.format?.mesh,r=t.format?.feature;if(i&&r)continue;const o=e.format?.feature;if((o||r)&&o!==r)continue;const a=t.format?.mesh;if(!i&&!a||i===a)if(xX(e)&&xX(t)){if(vj(e.values,t.values))return n}else if(bX(e)&&bX(t)){if(e.url===t.url)return n}else if(_X(e)&&e.name===n.dataName)return n}return null}function d0(e){let t=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new MZ({values:[]});return t.push(e),e}const n=f0(e.data,t);if(n)return wX(e.data)||(n.data.format=BB({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new MZ(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:i}=e.component.data,r=e.data,o=r&&(wX(r)||bX(r)||xX(r))||!e.parent?new vX:e.parent.component.data.ancestorParse.clone();wX(r)?(kX(r)?t=new SZ(t,r.sequence):AX(r)&&(t=new DZ(t,r.graticule)),o.parseNothing=!0):null===r?.format?.parse&&(o.parseNothing=!0),t=AZ.makeExplicit(t,e,o)??t,t=new $Z(t);const a=e.parent&&BK(e.parent);(RK(e)||PK(e))&&a&&(t=xZ.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(HY(r))a=e=new AQ(e,r),o="derived";else if(NY(r)){const i=EZ(r);a=e=AZ.makeWithAncestors(e,{},i,n)??e,e=new cQ(e,t,r.filter)}else if(GY(r))a=e=xZ.makeFromTransform(e,r,t),o="number";else if(YY(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new AZ(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=PX.makeFromTransform(e,r);else if(XY(r))a=e=_Z.makeFromTransform(e,r),o="number",oQ(t)&&(e=new $Z(e));else if(zY(r))a=e=QK.make(e,t,r,i++),o="derived";else if(UY(r))a=e=new XZ(e,r),o="number";else if(qY(r))a=e=new VZ(e,r),o="number";else if(JY(r))a=e=YZ.makeFromTransform(e,r),o="derived";else if(QY(r))a=e=new GK(e,r),o="derived";else if(ZY(r))a=e=new qK(e,r),o="derived";else if(WY(r))a=e=new HK(e,r),o="derived";else if(RY(r))a=e=new e0(e,r),o="derived";else if(IY(r))e=new t0(e,r);else if(VY(r))a=e=XK.makeFromTransform(e,r),o="derived";else if(PY(r))a=e=new UK(e,r),o="derived";else if(LY(r))a=e=new ZK(e,r),o="derived";else if(BY(r))a=e=new KK(e,r),o="derived";else{if(!jY(r)){Bq(`Ignoring an invalid transform: ${bj(r)}.`);continue}a=e=new JK(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(t,e,o));const s=function(e){const t={};if(RK(e)&&e.component.selection)for(const n of YB(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&lj(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=function(e){const t={};function n(e){var n;RG(e)?t[e.field]="date":"quantitative"===e.type&&St(n=e.aggregate)&&RB(["min","max"],n)?t[e.field]="number":lj(e.field)>1?e.field in t||(t[e.field]="flatten"):mG(e)&&GH(e.sort)&&lj(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((RK(e)||PK(e))&&e.forEachFieldDef(((t,i)=>{if(hG(t))n(t);else{const r=AI(i),o=e.fieldDef(r);n({...t,type:o.type})}})),RK(e)){const{mark:n,markDef:i,encoding:r}=e;if(pH(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];aG(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}(e);t=AZ.makeWithAncestors(t,{},{...s,...l},o)??t,RK(e)&&(t=VK.parseAll(t,e),t=YK.parseAll(t,e)),(RK(e)||PK(e))&&(a||(t=xZ.makeFromEncoding(t,e)??t),t=PX.makeFromEncoding(t,e)??t,t=AQ.parseAllForSortIndex(t,e));const u=e.getDataName($X.Raw),c=new TX(t,u,$X.Raw,i);if(n[u]=c,t=c,RK(e)){const n=_Z.makeFromEncoding(t,e);n&&(t=n,oQ(e)&&(t=new $Z(t))),t=XK.makeFromEncoding(t,e)??t,t=YZ.makeFromEncoding(t,e)??t}RK(e)&&(t=WK.make(t,e)??t);const f=e.getDataName($X.Main),d=new TX(t,f,$X.Main,i);n[f]=d,t=d,RK(e)&&function(e,t){for(const[n,i]of JB(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new TX(new cQ(t,e,{param:n}),r,$X.Lookup,e.component.data.outputNodeRefCounts)}}(e,d);let h=null;if(PK(e)){const i=e.getName("facet");t=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(GH(r.sort)){const{field:n,op:i=UH}=r.sort;e=t=new VZ(e,{joinaggregate:[{op:i,field:n,as:u0(r,r.sort,{forAs:!0})}],groupby:[xG(r)]})}return t}return null}(t,e.facet)??t,h=new wZ(t,e,i,d.getSource()),n[i]=h}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:c,main:d,facetRoot:h,ancestorParse:o}}class h0 extends jK{constructor(e,t,n,i){super(e,"concat",t,n,i,e.resolve),"shared"!==e.resolve?.axis?.x&&"shared"!==e.resolve?.axis?.y||Bq("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map(((e,t)=>T0(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=d0(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of YB(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return UV(e)?e.vconcat:qV(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){a0(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";s0(e,t),s0(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.forEach((e=>e.assembleSignals())),[]}assembleLayoutSignals(){const e=UQ(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleMarks(){return this.children.map((e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return{type:"group",name:e.getName("group"),...t?{title:t}:{},...n?{style:n}:{},...i?{encode:{update:i}}:{},...e.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const e=this.layout.columns;return{...null!=e?{columns:e}:{},bounds:"full",align:"each"}}}const p0={disable:1,gridScale:1,scale:1,...WG,labelExpr:1,encode:1},m0=YB(p0);class g0 extends dX{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new g0(CB(this.explicit),CB(this.implicit),this.mainExtracted)}hasAxisPart(e){return!("axis"!==e&&("grid"===e||"title"===e?!this.get(e):(t=this.get(e),!1===t||null===t)));var t}hasOrientSignalRef(){return BU(this.explicit.orient)}}const y0={bottom:"top",top:"bottom",left:"right",right:"left"};function v0(e,t){if(!e)return t.map((e=>e.clone()));{if(e.length!==t.length)return;const n=e.length;for(let i=0;i{switch(n){case"title":return sq(e,t);case"gridScale":return{explicit:e.explicit,value:uj(e.value,t.value)}}return gX(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function x0(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(BU(n.labelAngle)?n.labelAngle:mj(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===EQ(i,r))return!0}return e===n[t]}const _0=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function w0(e,t){let n=t.axis(e);const i=new g0,r=CG(t.encoding[e]),{mark:o,config:a}=t,s=n?.orient||a["x"===e?"axisX":"axisY"]?.orient||a.axis?.orient||function(e){return"x"===e?"bottom":"left"}(e),l=t.getScaleComponent(e).get("type"),u=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:NW(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=BU(n)?"axisOrient":`axis${tj(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],l=["axis",a,o];return{vlOnlyAxisConfig:yQ(s,i,e,n),vgAxisConfig:yQ(l,i,e,n),axisConfigStyle:vQ([...l,...s],i)}}(e,l,s,t.config),c=void 0!==n?!n:bQ("disable",a.style,n?.style,u).configValue;if(i.set("disable",c,void 0!==n),c)return i;n=n||{};const f=function(e,t,n,i,r){const o=t?.labelAngle;if(void 0!==o)return BU(o)?o:mj(o);{const{configValue:o}=bQ("labelAngle",i,t?.style,r);return void 0!==o?mj(o):n!==kj||!RB([EW,wW],e.type)||aG(e)&&e.timeUnit?void 0:270}}(r,n,e,a.style,u),d=PH(n.formatType,r,l),h=RH(r,r.type,n.format,n.formatType,a,!0),p={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:l,orient:s,labelAngle:f,format:h,formatType:d,mark:o,config:a};for(const r of m0){const o=r in xQ?xQ[r](p):GG(r)?n[r]:void 0,s=void 0!==o,l=x0(o,r,n,t,e);if(s&&l)i.set(r,o,l);else{const{configValue:e,configFrom:t}=GG(r)&&"values"!==r?bQ(r,a.style,n.style,u):{},c=void 0!==e;s&&!c?i.set(r,o,l):("vgAxisConfig"!==t||_0.has(r)&&c||IG(e)||BU(e))&&i.set(r,e,!1)}}const m=n.encoding??{},g=UG.reduce(((n,r)=>{if(!i.hasAxisPart(r))return n;const o=VQ(m[r]??{},t),a="labels"===r?function(e,t,n){const{encoding:i,config:r}=e,o=CG(i[t])??CG(i[DI(t)]),a=e.axis(t)||{},{format:s,formatType:l}=a;if(CH(l))return{text:zH({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:l,config:r}),...n};if(void 0===s&&void 0===l&&r.customFormatTypes){if("quantitative"===sG(o)){if(gG(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:zH({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:zH({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===sG(o)&&r.timeFormatType&&aG(o)&&!o.timeUnit)return{text:zH({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,o):o;return void 0===a||VB(a)||(n[r]={update:a}),n}),{});return VB(g)||i.set("encode",g,!!n.encoding||void 0!==n.labelAngle),i}function k0(e,t){const{config:n}=e;return{...FJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...vJ("x",e,{defaultPos:"mid"}),...vJ("y",e,{defaultPos:"mid"}),...pJ("size",e),...pJ("angle",e),...E0(e,0,t)}}function E0(e,t,n){return n?{shape:{value:n}}:pJ("shape",e)}function A0(e,t,n){if(void 0===eq("align",e,n))return"center"}function $0(e,t,n){if(void 0===eq("baseline",e,n))return"middle"}function D0(e){const{config:t,markDef:n}=e,{orient:i}=n,r="horizontal"===i?"width":"height",o=e.getScaleComponent("horizontal"===i?"x":"y"),a=eq("size",n,t,{vgChannel:r})??t.tick.bandSize;if(void 0!==a)return a;{const e=o?o.get("range"):void 0;return e&&jU(e)&&$t(e.step)?3*e.step/4:3*XV(t.view,r)/4}}const S0={arc:{vgMark:"arc",encodeEntry:e=>({...FJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...vJ("x",e,{defaultPos:"mid"}),...vJ("y",e,{defaultPos:"mid"}),...$J(e,"radius"),...$J(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...FJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...kJ("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...kJ("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...TJ(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...FJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...$J(e,"x"),...$J(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>k0(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...FJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&aG(n)&&n.type===AW?{field:xG(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...FJ(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...$J(e,"x"),...$J(e,"y"),...aJ(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...FJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...vJ("x",e,{defaultPos:"mid"}),...vJ("y",e,{defaultPos:"mid"}),...pJ("size",e,{vgChannel:"strokeWidth"}),...TJ(e)})},point:{vgMark:"symbol",encodeEntry:e=>k0(e)},rect:{vgMark:"rect",encodeEntry:e=>({...FJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...$J(e,"x"),...$J(e,"y")})},rule:{vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?{...FJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...kJ("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...kJ("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...pJ("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>k0(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...FJ(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...vJ("x",e,{defaultPos:"mid"}),...vJ("y",e,{defaultPos:"mid"}),...aJ(e),...pJ("size",e,{vgChannel:"fontSize"}),...pJ("angle",e),...zJ("align",A0(e.markDef,0,t)),...zJ("baseline",$0(e.markDef,0,t)),...vJ("radius",e,{defaultPos:null}),...vJ("theta",e,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",o="horizontal"===i?"height":"width";return{...FJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...vJ("x",e,{defaultPos:"mid",vgChannel:"xc"}),...vJ("y",e,{defaultPos:"mid",vgChannel:"yc"}),...pJ("size",e,{defaultValue:D0(e),vgChannel:r}),[o]:YU(eq("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...FJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...vJ("x",e,{defaultPos:"mid"}),...vJ("y",e,{defaultPos:"mid"}),...pJ("size",e),...TJ(e)})}};const M0="faceted_path_",C0="stack_group_";function F0(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,a=uj(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!t?.get("selectionExtent")&&!n?.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),s=KU(i),l=r.key,u=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,a=t.order;if(!(!Fe(a)&&pG(a)&&zB(a.value)||!a&&zB(eq("order",r,o)))){if((Fe(a)||aG(a))&&!n)return rq(a,{expr:"datum"});if(pH(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(aG(i)){const t=i.sort;return Fe(t)?{field:xG(i,{prefix:n,suffix:"sort_index",expr:"datum"})}:GH(t)?{field:xG({aggregate:KG(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})}:HH(t)?{field:xG(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}:null===t?void 0:{field:xG(i,{binSuffix:e.stack?.impute?"mid":void 0,expr:"datum"})}}}}}(e),c=function(e){if(!e.component.selection)return null;const t=YB(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=YB(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip}:null}(e),f=eq("aria",i,o),d=S0[n].postEncodingTransform?S0[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:S0[n].vgMark,...a?{clip:!0}:{},...s?{style:s}:{},...l?{key:l.field}:{},...u?{sort:u}:{},...c||{},...!1===f?{aria:f}:{},from:{data:t.fromPrefix+e.requestDataName($X.Main)},encode:{update:S0[n].encodeEntry(e)},...d?{transform:d}:{}}]}class O0 extends IK{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,GV(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[];const o=yH(e.mark)?{...e.mark}:{type:e.mark},a=o.type;void 0===o.filled&&(o.filled=function(e,t,{graticule:n}){if(n)return!1;const i=tq("filled",e,t),r=e.type;return uj(i,r!==oH&&r!==rH&&r!==sH)}(o,r,{graticule:e.data&&AX(e.data)}));const s=this.encoding=function(e,t,n,i){const r={};for(const t of YB(e))wI(t)||Bq(`${o=t}-encoding is dropped as ${o} is not a valid encoding channel.`);var o,a;for(let o of OI){if(!e[o])continue;const s=e[o];if(nU(o)){const e=FI(o),t=r[e];if(aG(t)&&("quantitative"===(a=t.type)||"temporal"===a)&&aG(s)&&!t.timeUnit){Bq(xq(e));continue}}if("angle"!==o||"arc"!==t||e.theta||(Bq("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=Fj),tV(e,o,t)){if(o===Ij&&"line"===t){const t=MG(e[o]);if(t?.aggregate){Bq("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(o===Pj&&(n?"fill"in e:"stroke"in e))Bq(wq("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(o===Jj||o===Xj&&!Fe(s)&&!pG(s)||o===Zj&&Fe(s)){if(s){if(o===Xj){const t=e[o];if(nG(t)){r[o]=t;continue}}r[o]=nt(s).reduce(((e,t)=>(aG(t)?e.push(NG(t,o)):Bq(kq(t,o)),e)),[])}}else{if(o===Zj&&null===s)r[o]=null;else if(!(aG(s)||lG(s)||pG(s)||iG(s)||BU(s))){Bq(kq(s,o));continue}r[o]=FG(s,o,i)}}else Bq(Eq(o,t))}return r}(e.encoding||{},a,o.filled,r);this.markDef=yY(o,s,r),this.size=function({encoding:e,size:t}){for(const n of JI){const i=SI(n);HV(t[i])&&uG(e[n])&&(delete t[i],Bq(Oq(i)))}return t}({encoding:s,size:GV(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=gY(this.markDef,s),this.specifiedScales=this.initScales(a,s),this.specifiedAxes=this.initAxes(s),this.specifiedLegends=this.initLegends(s),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter((e=>BV(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===hH,n=e&&sI.some((t=>dG(e[t])));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return pU.reduce(((e,n)=>{const i=CG(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:t,range:n}=e,i=RU(e);return Fe(t)&&(i.domain=t.map(GU)),Fe(n)&&(i.range=n.map(GU)),i}initAxes(e){return JI.reduce(((t,n)=>{const i=e[n];if(dG(i)||n===kj&&dG(e.x2)||n===Ej&&dG(e.y2)){const e=dG(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=YB(e),n={};for(const i of t){const t=e[i];n[i]=IG(t)?HU(t):GU(t)}return n}initLegends(e){return dU.reduce(((t,n)=>{const i=CG(e[n]);if(i&&function(e){switch(e){case Pj:case Lj:case Bj:case Ij:case jj:case qj:case Gj:case Vj:return!0;case Wj:case Hj:case Uj:return!1}}(n)){const e=i.legend;t[n]=e?RU(e):e}return t}),{})}parseData(){this.component.data=d0(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of JI){const r=SI(i);if(t[r]){const e=t[r];n.layoutSize.set(r,HV(e)?"step":e,!0)}else{const t=l0(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){const n={},i=e.config.selection;if(!t||!t.length)return n;for(const r of t){const t=ZB(r.name),o=r.select,a=St(o)?o:o.type,s=Oe(o)?CB(o):{type:a},l=i[a];for(const e in l)"fields"!==e&&"encodings"!==e&&("mark"===e&&(s[e]={...l[e],...s[e]}),void 0!==s[e]&&!0!==s[e]||(s[e]=CB(l[e]??s[e])));const u=n[t]={...s,name:t,type:a,init:r.value,bind:r.bind,events:St(s.on)?tz(s.on,"scope"):nt(CB(s.on))},c=CB(r);for(const t of iQ)t.defined(u)&&t.parse&&t.parse(e,u,c)}return n}(this,this.selection)}parseMarkGroup(){this.component.mark=function(e){if(RB([rH,tH,cH],e.mark)){const t=rV(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:M0+e.requestDataName($X.Main),data:e.requestDataName($X.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:F0(e,{fromPrefix:M0})}]}(e,t)}else if(e.mark===nH){const t=WU.some((t=>eq(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=F0(e,{fromPrefix:C0}),n=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),r=(e,t)=>`${e}(${[i({prefix:"min",suffix:"start",expr:t}),i({prefix:"max",suffix:"start",expr:t}),i({prefix:"min",suffix:"end",expr:t}),i({prefix:"max",suffix:"end",expr:t})].map((e=>`scale('${n}',${e})`)).join(",")})`;let o,a;"x"===e.stack.fieldChannel?(o={...OB(t.encode.update,["y","yc","y2","height",...WU]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...NB(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...OB(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...NB(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const n of WU){const i=tq(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=YU(i)),i&&(t.encode.update[n]={value:0})}const s=[];if(e.stack.groupbyChannels?.length>0)for(const t of e.stack.groupbyChannels){const n=e.fieldDef(t),i=xG(n);i&&s.push(i),(n?.bin||n?.timeUnit)&&s.push(xG(n,{binSuffix:"end"}))}return o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((n,i)=>{if(t.encode.update[i])return{...n,[i]:t.encode.update[i]};{const t=tq(i,e.markDef,e.config);return void 0!==t?{...n,[i]:YU(t)}:n}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName($X.Main),name:C0+e.requestDataName($X.Main),groupby:s,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[t]}]}]}(e)}return F0(e)}(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,JI.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[w0(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;for(const i of XB(e.component.selection??{})){const r=i.name,o=Pt(r+KJ);if(0===t.filter((e=>e.name===r)).length){const e="global"===i.resolve?"union":i.resolve,n="point"===i.type?", true, true)":")";t.push({name:i.name,update:`${nQ}(${o}, ${Pt(e)}${n}`})}n=!0;for(const n of iQ)n.defined(i)&&n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))}if(n){0===t.filter((e=>"unit"===e.name)).length&&t.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]})}return OX(t)}(this,e)}assembleSignals(){return[...gQ(this),...MX(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t],i=rQ(e,{escape:!1});for(const t of XB(e.component.selection??{})){const e={name:t.name+KJ};if(t.project.hasSelectionId&&(e.transform=[{type:"collect",sort:{field:zV}}]),t.init){const n=t.project.items.map(DX);e.values=t.project.hasSelectionId?t.init.map((e=>({unit:i,[zV]:SX(e,!1)[0]}))):t.init.map((e=>({unit:i,fields:n,values:SX(e,!1)})))}n.filter((e=>e.name===t.name+KJ)).length||n.push(e)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return UQ(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&BK(this.parent)||(e=FX(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){const{style:e}=this.view||{};return void 0!==e?e:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return JG(this.encoding,e)}fieldDef(e){return MG(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return hG(t)?t:null}}class N0 extends jK{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const o={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(uY(e))return new N0(e,this,this.getName(`layer_${t}`),o,r);if(YG(e))return new O0(e,this,this.getName(`layer_${t}`),o,r);throw new Error(lq(e))}))}parseData(){this.component.data=d0(this);for(const e of this.children)e.parseData()}parseLayoutSize(){a0(this),s0(this,"width"),s0(this,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of YB(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const i of e.children){i.parseAxesAndHeaders();for(const r of YB(i.component.axes))n.axis[r]=XQ(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=v0(t[r],i.component.axes[r]),t[r]||(n.axis[r]="independent",delete t[r]))}for(const r of JI){for(const o of e.children)if(o.component.axes[r]){if("independent"===n.axis[r]){t[r]=(t[r]??[]).concat(o.component.axes[r]);for(const e of o.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!BU(t)){if(i[t]>0&&!n){const n=y0[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete o.component.axes[r]}if("independent"===n.axis[r]&&t[r]&&t[r].length>1)for(const[e,n]of(t[r]||[]).entries())e>0&&n.get("grid")&&!n.explicit.grid&&(n.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleSignals())),gQ(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),UQ(this))}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleGroupStyle(){const e=new Set;for(const t of this.children)for(const n of nt(t.assembleGroupStyle()))e.add(n);const t=Array.from(e);return t.length>1?t:1===t.length?t[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)RK(n)&&(t=FX(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),fZ(this))}}function T0(e,t,n,i,r){if(JH(e))return new c0(e,t,n,r);if(uY(e))return new N0(e,t,n,i,r);if(YG(e))return new O0(e,t,n,i,r);if(function(e){return UV(e)||qV(e)||IV(e)}(e))return new h0(e,t,n,r);throw new Error(lq(e))}function z0(e,t={}){var n;t.logger&&(n=t.logger,Lq=n),t.fieldTitle&&EG(t.fieldTitle);try{const n=rY(Te(t.config,e.config)),i=oX(e,n),r=T0(i,null,"",void 0,n);r.parse(),function(e,t){eK(e.sources);let n=0,i=0;for(let i=0;i"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:f,...d}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...d,...s?{title:s}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([]),...jV(f)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}(r,function(e,t,n,i){const r=i.component.layoutSize.get("width"),o=i.component.layoutSize.get("height");if(void 0===t?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):St(t)&&(t={type:t}),r&&o&&("fit"===(a=t.type)||"fit-x"===a||"fit-y"===a))if("step"===r&&"step"===o)Bq(dq()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";Bq(dq(eU(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${eU(e)}`:"fit"}(n)}var a;return{...1===YB(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t},...fX(n,!1),...fX(e,!0)}}(e,i.autosize,n,r),e.datasets,e.usermeta);return{spec:o,normalized:i}}finally{t.logger&&(Lq=Pq),t.fieldTitle&&EG(wG)}}const R0="5.16.3",P0=function(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}};const L0="#fff",B0="#888",j0={background:"#333",view:{stroke:B0},title:{color:L0,subtitleColor:L0},style:{"guide-label":{fill:L0},"guide-title":{fill:L0}},axis:{domainColor:L0,gridColor:B0,tickColor:L0}},I0="#4572a7",U0={background:"#fff",arc:{fill:I0},area:{fill:I0},line:{stroke:I0,strokeWidth:2},path:{stroke:I0},rect:{fill:I0},shape:{stroke:I0},symbol:{fill:I0,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},q0="#30a2da",W0="#cbcbcb",H0="#f0f0f0",G0="#333",V0={arc:{fill:q0},area:{fill:q0},axis:{domainColor:W0,grid:!0,gridColor:W0,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:W0,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:H0,group:{fill:H0},legend:{labelColor:G0,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:G0,titleFontSize:14,titlePadding:10},line:{stroke:q0,strokeWidth:2},path:{stroke:q0,strokeWidth:.5},rect:{fill:q0},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:q0},bar:{binSpacing:2,fill:q0,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Y0="#000",X0={group:{fill:"#e5e5e5"},arc:{fill:Y0},area:{fill:Y0},line:{stroke:Y0},path:{stroke:Y0},rect:{fill:Y0},shape:{stroke:Y0},symbol:{fill:Y0,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},J0="Benton Gothic, sans-serif",Q0="#82c6df",Z0="Benton Gothic Bold, sans-serif",K0="normal",e1={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},t1={background:"#ffffff",title:{anchor:"start",color:"#000000",font:Z0,fontSize:22,fontWeight:"normal"},arc:{fill:Q0},area:{fill:Q0},line:{stroke:Q0,strokeWidth:2},path:{stroke:Q0},rect:{fill:Q0},shape:{stroke:Q0},symbol:{fill:Q0,size:30},axis:{labelFont:J0,labelFontSize:11.5,labelFontWeight:"normal",titleFont:Z0,titleFontSize:13,titleFontWeight:K0},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:J0,labelFontSize:11.5,symbolType:"square",titleFont:Z0,titleFontSize:13,titleFontWeight:K0},range:{category:e1["category-6"],diverging:e1["fireandice-6"],heatmap:e1["fire-7"],ordinal:e1["fire-7"],ramp:e1["fire-7"]}},n1="#ab5787",i1="#979797",r1={background:"#f9f9f9",arc:{fill:n1},area:{fill:n1},line:{stroke:n1},path:{stroke:n1},rect:{fill:n1},shape:{stroke:n1},symbol:{fill:n1,size:30},axis:{domainColor:i1,domainWidth:.5,gridWidth:.2,labelColor:i1,tickColor:i1,tickWidth:.2,titleColor:i1},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},o1="#3e5c69",a1={background:"#fff",arc:{fill:o1},area:{fill:o1},line:{stroke:o1},path:{stroke:o1},rect:{fill:o1},shape:{stroke:o1},symbol:{fill:o1},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},s1="#1696d2",l1="#000000",u1="Lato",c1="Lato",f1={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},d1={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:u1},axisX:{domain:!0,domainColor:l1,domainWidth:1,grid:!1,labelFontSize:12,labelFont:c1,labelAngle:0,tickColor:l1,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:u1},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:c1,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:u1,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:c1,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:u1,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:f1["six-groups-cat-1"],diverging:f1["diverging-colors"],heatmap:f1["diverging-colors"],ordinal:f1["six-groups-seq"],ramp:f1["shades-blue"]},area:{fill:s1},rect:{fill:s1},line:{color:s1,stroke:s1,strokeWidth:5},trail:{color:s1,stroke:s1,strokeWidth:0,size:1},path:{stroke:s1,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:s1,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:s1,stroke:null}},arc:{fill:s1},shape:{stroke:s1},symbol:{fill:s1,size:30}},h1="#3366CC",p1="#ccc",m1="Arial, sans-serif",g1={arc:{fill:h1},area:{fill:h1},path:{stroke:h1},rect:{fill:h1},shape:{stroke:h1},symbol:{stroke:h1},circle:{fill:h1},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:m1,fontSize:12},"guide-title":{font:m1,fontSize:12},"group-title":{font:m1,fontSize:12}},title:{font:m1,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:p1,tickColor:p1,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},y1=e=>e*(1/3+1),v1=y1(9),b1=y1(10),x1=y1(12),_1="Segoe UI",w1="wf_standard-font, helvetica, arial, sans-serif",k1="#252423",E1="#605E5C",A1="transparent",$1="#118DFF",D1="#DEEFFF",S1=[D1,$1],M1={view:{stroke:A1},background:A1,font:_1,header:{titleFont:w1,titleFontSize:x1,titleColor:k1,labelFont:_1,labelFontSize:b1,labelColor:E1},axis:{ticks:!1,grid:!1,domain:!1,labelColor:E1,labelFontSize:v1,titleFont:w1,titleColor:k1,titleFontSize:x1,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:$1},line:{stroke:$1,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:_1,fontSize:v1,fill:E1},arc:{fill:$1},area:{fill:$1,line:!0,opacity:.6},path:{stroke:$1},rect:{fill:$1},point:{fill:$1,filled:!0,size:75},shape:{stroke:$1},symbol:{fill:$1,strokeWidth:1.5,size:50},legend:{titleFont:_1,titleFontWeight:"bold",titleColor:E1,labelFont:_1,labelFontSize:b1,labelColor:E1,symbolType:"circle",symbolSize:75},range:{category:[$1,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:S1,heatmap:S1,ordinal:[D1,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",$1]}},C1='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',F1=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],O1=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function N1({type:e,background:t}){const n="dark"===e?"#161616":"#ffffff",i="dark"===e?"#f4f4f4":"#161616",r="dark"===e?"#d4bbff":"#6929c4";return{background:t,arc:{fill:r},area:{fill:r},path:{stroke:r},rect:{fill:r},shape:{stroke:r},symbol:{stroke:r},circle:{fill:r},view:{fill:n,stroke:n},group:{fill:n},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:C1,fontWeight:600},axis:{labelColor:i,labelFontSize:12,grid:!0,gridColor:"#525252",titleColor:i,labelAngle:0},style:{"guide-label":{font:C1,fill:i,fontWeight:400},"guide-title":{font:C1,fill:i,fontWeight:400}},range:{category:"dark"===e?F1:O1,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const T1=N1({type:"light",background:"#ffffff"}),z1=N1({type:"light",background:"#f4f4f4"}),R1=N1({type:"dark",background:"#262626"}),P1=N1({type:"dark",background:"#161616"}),L1="2.14.0";function B1(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,i){if("object"!=typeof i||null===i)return i;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(i)>=0?"[Circular]":(t.push(i),i)}}(t))}const j1="vg-tooltip-element",I1={offsetX:10,offsetY:10,id:j1,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/t(St(e)?e:B1(e,n)))).join(", ")}]`;if(Oe(e)){let i="";const{title:r,image:o,...a}=e;r&&(i+=`

${t(r)}

`),o&&(i+=``);const s=Object.keys(a);if(s.length>0){i+="";for(const e of s){let r=a[e];void 0!==r&&(Oe(r)&&(r=B1(r,n)),i+=``)}i+="
${t(e)}${t(r)}
"}return i||"{}"}return t(e)}};class U1{constructor(e){this.options={...I1,...e};const t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return"#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n".toString().replace(j1,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,i){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),null==i||""===i)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(i,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:r,y:o}=function(e,t,n,i){let r=e.clientX+n;r+t.width>window.innerWidth&&(r=+e.clientX-n-t.width);let o=e.clientY+i;return o+t.height>window.innerHeight&&(o=+e.clientY-i-t.height),{x:r,y:o}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.style.top=`${o}px`,this.el.style.left=`${r}px`}}function q1(e){return q1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q1(e)}function W1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==q1(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==q1(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===q1(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var G1,V1,Y1=X1;function X1(e){var t=this;if(t instanceof X1||(t=new X1),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,i=arguments.length;n1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,n=this.head.value}for(var r=0;null!==i;r++)n=e(n,i.value,r),i=i.next;return n},X1.prototype.reduceReverse=function(e,t){var n,i=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,n=this.tail.value}for(var r=this.length-1;null!==i;r--)n=e(n,i.value,r),i=i.prev;return n},X1.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},X1.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},X1.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new X1;if(tthis.length&&(t=this.length);for(var i=0,r=this.head;null!==r&&ithis.length&&(t=this.length);for(var i=this.length,r=this.tail;null!==r&&i>t;i--)r=r.prev;for(;null!==r&&i>e;i--,r=r.prev)n.push(r.value);return n},X1.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,r=this.head;null!==r&&i1,d2=(e,t,n)=>{const i=e[u2].get(t);if(i){const t=i.value;if(h2(e,t)){if(m2(e,i),!e[r2])return}else n&&(e[c2]&&(i.value.now=Date.now()),e[l2].unshiftNode(i));return t.value}},h2=(e,t)=>{if(!t||!t.maxAge&&!e[o2])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[o2]&&n>e[o2]},p2=e=>{if(e[n2]>e[t2])for(let t=e[l2].tail;e[n2]>e[t2]&&null!==t;){const n=t.prev;m2(e,t),t=n}},m2=(e,t)=>{if(t){const n=t.value;e[a2]&&e[a2](n.key,n.value),e[n2]-=n.length,e[u2].delete(n.key),e[l2].removeNode(t)}};class g2{constructor(e,t,n,i,r){this.key=e,this.value=t,this.length=n,this.now=i,this.maxAge=r||0}}const y2=(e,t,n,i)=>{let r=n.value;h2(e,r)&&(m2(e,n),e[r2]||(r=void 0)),r&&t.call(i,r.value,r.key,e)};var v2=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[t2]=e.max||1/0;const t=e.length||f2;if(this[i2]="function"!=typeof t?f2:t,this[r2]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[o2]=e.maxAge||0,this[a2]=e.dispose,this[s2]=e.noDisposeOnSet||!1,this[c2]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[t2]=e||1/0,p2(this)}get max(){return this[t2]}set allowStale(e){this[r2]=!!e}get allowStale(){return this[r2]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[o2]=e,p2(this)}get maxAge(){return this[o2]}set lengthCalculator(e){"function"!=typeof e&&(e=f2),e!==this[i2]&&(this[i2]=e,this[n2]=0,this[l2].forEach((e=>{e.length=this[i2](e.value,e.key),this[n2]+=e.length}))),p2(this)}get lengthCalculator(){return this[i2]}get length(){return this[n2]}get itemCount(){return this[l2].length}rforEach(e,t){t=t||this;for(let n=this[l2].tail;null!==n;){const i=n.prev;y2(this,e,n,t),n=i}}forEach(e,t){t=t||this;for(let n=this[l2].head;null!==n;){const i=n.next;y2(this,e,n,t),n=i}}keys(){return this[l2].toArray().map((e=>e.key))}values(){return this[l2].toArray().map((e=>e.value))}reset(){this[a2]&&this[l2]&&this[l2].length&&this[l2].forEach((e=>this[a2](e.key,e.value))),this[u2]=new Map,this[l2]=new e2,this[n2]=0}dump(){return this[l2].map((e=>!h2(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[l2]}set(e,t,n){if((n=n||this[o2])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const i=n?Date.now():0,r=this[i2](t,e);if(this[u2].has(e)){if(r>this[t2])return m2(this,this[u2].get(e)),!1;const o=this[u2].get(e).value;return this[a2]&&(this[s2]||this[a2](e,o.value)),o.now=i,o.maxAge=n,o.value=t,this[n2]+=r-o.length,o.length=r,this.get(e),p2(this),!0}const o=new g2(e,t,r,i,n);return o.length>this[t2]?(this[a2]&&this[a2](e,t),!1):(this[n2]+=o.length,this[l2].unshift(o),this[u2].set(e,this[l2].head),p2(this),!0)}has(e){if(!this[u2].has(e))return!1;const t=this[u2].get(e).value;return!h2(this,t)}get(e){return d2(this,e,!0)}peek(e){return d2(this,e,!1)}pop(){const e=this[l2].tail;return e?(m2(this,e),e.value):null}del(e){m2(this,this[u2].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const i=e[n],r=i.e||0;if(0===r)this.set(i.k,i.v);else{const e=r-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[u2].forEach(((e,t)=>d2(this,t,!1)))}};const b2=Object.freeze({loose:!0}),x2=Object.freeze({});var _2=e=>e?"object"!=typeof e?b2:e:x2,w2={exports:{}},k2={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},E2="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:r}=k2,o=E2,a=(t=e.exports={}).re=[],s=t.safeRe=[],l=t.src=[],u=t.t={};let c=0;const f="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",r],[f,i]],h=(e,t,n)=>{const i=(e=>{for(const[t,n]of d)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),r=c++;o(e,r,t),u[e]=r,l[r]=t,a[r]=new RegExp(t,n?"g":void 0),s[r]=new RegExp(i,n?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),h("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${l[u.NUMERICIDENTIFIER]}|${l[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NUMERICIDENTIFIERLOOSE]}|${l[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${f}+`),h("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`),h("FULL",`^${l[u.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`),h("LOOSE",`^${l[u.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`),h("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`),h("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),h("COERCERTL",l[u.COERCE],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(w2,w2.exports);var A2=w2.exports;const $2=/^[0-9]+$/,D2=(e,t)=>{const n=$2.test(e),i=$2.test(t);return n&&i&&(e=+e,t=+t),e===t?0:n&&!i?-1:i&&!n?1:eD2(t,e)};const M2=E2,{MAX_LENGTH:C2,MAX_SAFE_INTEGER:F2}=k2,{safeRe:O2,t:N2}=A2,T2=_2,{compareIdentifiers:z2}=S2;var R2=class e{constructor(t,n){if(n=T2(n),t instanceof e){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>C2)throw new TypeError(`version is longer than ${C2} characters`);M2("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const i=t.trim().match(n.loose?O2[N2.LOOSE]:O2[N2.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>F2||this.major<0)throw new TypeError("Invalid major version");if(this.minor>F2||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>F2||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let i=[t,e];!1===n&&(i=[t]),0===z2(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const P2=R2;var L2=(e,t,n)=>new P2(e,n).compare(new P2(t,n));const B2=L2;const j2=L2;const I2=L2;const U2=L2;const q2=L2;const W2=L2;const H2=(e,t,n)=>0===B2(e,t,n),G2=(e,t,n)=>0!==j2(e,t,n),V2=(e,t,n)=>I2(e,t,n)>0,Y2=(e,t,n)=>U2(e,t,n)>=0,X2=(e,t,n)=>q2(e,t,n)<0,J2=(e,t,n)=>W2(e,t,n)<=0;var Q2,Z2,K2,e3,t3=(e,t,n,i)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return H2(e,n,i);case"!=":return G2(e,n,i);case">":return V2(e,n,i);case">=":return Y2(e,n,i);case"<":return X2(e,n,i);case"<=":return J2(e,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const n3=function e(){if(e3)return K2;e3=1;class t{constructor(e,n){if(n=i(n),e instanceof t)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new t(e.raw,n);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&d)|(this.options.loose&&h))+":"+e,i=n.get(t);if(i)return i;const a=this.options.loose,m=a?s[l.HYPHENRANGELOOSE]:s[l.HYPHENRANGE];e=e.replace(m,D(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(s[l.COMPARATORTRIM],u),o("comparator trim",e),e=e.replace(s[l.TILDETRIM],c),o("tilde trim",e),e=e.replace(s[l.CARETTRIM],f),o("caret trim",e);let g=e.split(" ").map((e=>y(e,this.options))).join(" ").split(/\s+/).map((e=>$(e,this.options)));a&&(g=g.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(s[l.COMPARATORLOOSE]))))),o("range list",g);const v=new Map,b=g.map((e=>new r(e,this.options)));for(const e of b){if(p(e))return[e];v.set(e.value,e)}v.size>1&&v.has("")&&v.delete("");const x=[...v.values()];return n.set(t,x),x}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((t=>g(t,n)&&e.set.some((e=>g(e,n)&&t.every((t=>e.every((e=>t.intersects(e,n)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(a(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(a(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}Q2=n;const i=_2,{safeRe:r,t:o}=A2,a=t3,s=E2,l=R2,u=e();return Q2}(),o=E2,a=R2,{safeRe:s,t:l,comparatorTrimReplace:u,tildeTrimReplace:c,caretTrimReplace:f}=A2,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:h}=k2,p=e=>"<0.0.0-0"===e.value,m=e=>""===e.value,g=(e,t)=>{let n=!0;const i=e.slice();let r=i.pop();for(;n&&i.length;)n=i.every((e=>r.intersects(e,t))),r=i.pop();return n},y=(e,t)=>(o("comp",e,t),e=_(e,t),o("caret",e),e=b(e,t),o("tildes",e),e=k(e,t),o("xrange",e),e=A(e,t),o("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>x(e,t))).join(" "),x=(e,t)=>{const n=t.loose?s[l.TILDELOOSE]:s[l.TILDE];return e.replace(n,((t,n,i,r,a)=>{let s;return o("tilde",e,t,n,i,r,a),v(n)?s="":v(i)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(r)?s=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(o("replaceTilde pr",a),s=`>=${n}.${i}.${r}-${a} <${n}.${+i+1}.0-0`):s=`>=${n}.${i}.${r} <${n}.${+i+1}.0-0`,o("tilde return",s),s}))},_=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{o("caret",e,t);const n=t.loose?s[l.CARETLOOSE]:s[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(n,((t,n,r,a,s)=>{let l;return o("caret",e,t,n,r,a,s),v(n)?l="":v(r)?l=`>=${n}.0.0${i} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${r}.0${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.0${i} <${+n+1}.0.0-0`:s?(o("replaceCaret pr",s),l="0"===n?"0"===r?`>=${n}.${r}.${a}-${s} <${n}.${r}.${+a+1}-0`:`>=${n}.${r}.${a}-${s} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${a}-${s} <${+n+1}.0.0-0`):(o("no pr"),l="0"===n?"0"===r?`>=${n}.${r}.${a}${i} <${n}.${r}.${+a+1}-0`:`>=${n}.${r}.${a}${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${a} <${+n+1}.0.0-0`),o("caret return",l),l}))},k=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>E(e,t))).join(" ")),E=(e,t)=>{e=e.trim();const n=t.loose?s[l.XRANGELOOSE]:s[l.XRANGE];return e.replace(n,((n,i,r,a,s,l)=>{o("xRange",e,n,i,r,a,s,l);const u=v(r),c=u||v(a),f=c||v(s),d=f;return"="===i&&d&&(i=""),l=t.includePrerelease?"-0":"",u?n=">"===i||"<"===i?"<0.0.0-0":"*":i&&d?(c&&(a=0),s=0,">"===i?(i=">=",c?(r=+r+1,a=0,s=0):(a=+a+1,s=0)):"<="===i&&(i="<",c?r=+r+1:a=+a+1),"<"===i&&(l="-0"),n=`${i+r}.${a}.${s}${l}`):c?n=`>=${r}.0.0${l} <${+r+1}.0.0-0`:f&&(n=`>=${r}.${a}.0${l} <${r}.${+a+1}.0-0`),o("xRange return",n),n}))},A=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[l.STAR],"")),$=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(s[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),D=e=>(t,n,i,r,o,a,s,l,u,c,f,d,h)=>`${n=v(i)?"":v(r)?`>=${i}.0.0${e?"-0":""}`:v(o)?`>=${i}.${r}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(u)?"":v(c)?`<${+u+1}.0.0-0`:v(f)?`<${u}.${+c+1}.0-0`:d?`<=${u}.${c}.${f}-${d}`:e?`<${u}.${c}.${+f+1}-0`:`<=${l}`}`.trim(),S=(e,t,n)=>{for(let n=0;n0){const i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0};return K2}();var i3=(e,t,n)=>{try{t=new n3(t,n)}catch(e){return!1}return t.test(e)},r3=H1(i3);function o3(e,...t){for(const n of t)a3(e,n);return e}function a3(e,t){for(const n of Object.keys(t))ze(e,n,t[n],!0)}function s3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l3(e){for(var t=1;te,"vega-lite":(e,t)=>c3.compile(e,{config:t}).spec};function y3(e,t,n,i){const r=`${t}
`,o=`
${n}`,a=window.open("");a.document.write(r+e+o),a.document.title=`${p3[i]} JSON Source`}function v3(e){return(t=e)&&"load"in t?e:u3.loader(e);var t}async function b3(e,t){const n=St(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=St(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return l3(l3(l3({},e),i?{patch:i}:{}),n?{config:n}:{})}function x3(){}function _3(e){return null==e?x3:function(){return this.querySelector(e)}}function w3(){return[]}function k3(e){return null==e?w3:function(){return this.querySelectorAll(e)}}function E3(e){return function(){return this.matches(e)}}function A3(e){return function(t){return t.matches(e)}}var $3=Array.prototype.find;function D3(){return this.firstElementChild}var S3=Array.prototype.filter;function M3(){return Array.from(this.children)}function C3(e){return new Array(e.length)}function F3(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function O3(e,t,n,i,r,o){for(var a,s=0,l=t.length,u=o.length;st?1:e>=t?0:NaN}F3.prototype={constructor:F3,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var P3="http://www.w3.org/1999/xhtml";const L3={svg:"http://www.w3.org/2000/svg",xhtml:P3,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function B3(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),L3.hasOwnProperty(t)?{space:L3[t],local:e}:e}function j3(e){return function(){this.removeAttribute(e)}}function I3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function U3(e,t){return function(){this.setAttribute(e,t)}}function q3(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function W3(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function H3(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function G3(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function V3(e){return function(){this.style.removeProperty(e)}}function Y3(e,t,n){return function(){this.style.setProperty(e,t,n)}}function X3(e,t,n){return function(){var i=t.apply(this,arguments);null==i?this.style.removeProperty(e):this.style.setProperty(e,i,n)}}function J3(e,t){return e.style.getPropertyValue(t)||G3(e).getComputedStyle(e,null).getPropertyValue(t)}function Q3(e){return function(){delete this[e]}}function Z3(e,t){return function(){this[e]=t}}function K3(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function e5(e){return e.trim().split(/^|\s+/)}function t5(e){return e.classList||new n5(e)}function n5(e){this._node=e,this._names=e5(e.getAttribute("class")||"")}function i5(e,t){for(var n=t5(e),i=-1,r=t.length;++i=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var S5=[null];function M5(e,t){this._groups=e,this._parents=t}function C5(){return new M5([[document.documentElement]],S5)}M5.prototype=C5.prototype={constructor:M5,select:function(e){"function"!=typeof e&&(e=_3(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r=x&&(x=b+1);!(v=g[x])&&++x=0;)(i=r[o])&&(a&&4^i.compareDocumentPosition(a)&&a.parentNode.insertBefore(i,a),a=i);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=R3);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o1?this.each((null==t?V3:"function"==typeof t?X3:Y3)(e,t,null==n?"":n)):J3(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Q3:"function"==typeof t?K3:Z3)(e,t)):this.node()[e]},classed:function(e,t){var n=e5(e+"");if(arguments.length<2){for(var i=t5(this.node()),r=-1,o=n.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}(e+""),a=o.length;if(!(arguments.length<2)){for(s=t?E5:k5,i=0;i{i.stop(),e(n+t)}),t,n),i}var N5=F$("start","end","cancel","interrupt"),T5=[],z5=0,R5=3;function P5(e,t,n,i,r,o){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var i,r=e.__transition;function o(l){var u,c,f,d;if(1!==n.state)return s();for(u in r)if((d=r[u]).name===n.name){if(d.state===R5)return O5(o);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete r[u]):+uz5)throw new Error("too late; already scheduled");return n}function B5(e,t){var n=j5(e,t);if(n.state>R5)throw new Error("too late; already running");return n}function j5(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function I5(e,t){var n,i;return function(){var r=B5(this,e),o=r.tween;if(o!==n)for(var a=0,s=(i=n=o).length;a=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?L5:B5;return function(){var a=o(this,e),s=a.on;s!==i&&(r=(i=s).copy()).on(t,n),a.on=r}}(n,e,t))},attr:function(e,t){var n=B3(e),i="transform"===n?Lh:W5;return this.attrTween(e,"function"==typeof t?(n.local?J5:X5)(n,i,q5(this,"attr."+e,t)):null==t?(n.local?G5:H5)(n):(n.local?Y5:V5)(n,i,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var i=B3(e);return this.tween(n,(i.local?Q5:Z5)(i,t))},style:function(e,t,n){var i="transform"==(e+="")?Ph:W5;return null==t?this.styleTween(e,function(e,t){var n,i,r;return function(){var o=J3(this,e),a=(this.style.removeProperty(e),J3(this,e));return o===a?null:o===n&&a===i?r:r=t(n=o,i=a)}}(e,i)).on("end.style."+e,r6(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var i,r,o;return function(){var a=J3(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=J3(this,e)),a===l?null:a===i&&l===r?o:(r=l,o=t(i=a,s))}}(e,i,q5(this,"style."+e,t))).each(function(e,t){var n,i,r,o,a="style."+t,s="end."+a;return function(){var l=B5(this,e),u=l.on,c=null==l.value[a]?o||(o=r6(t)):void 0;u===n&&r===c||(i=(n=u).copy()).on(s,r=c),l.on=i}}(this._id,e)):this.styleTween(e,function(e,t,n){var i,r,o=n+"";return function(){var a=J3(this,e);return a===o?null:a===i?r:r=t(i=a,n)}}(e,i,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==t)return this.tween(i,null);if("function"!=typeof t)throw new Error;return this.tween(i,function(e,t,n){var i,r;function o(){var o=t.apply(this,arguments);return o!==r&&(i=(r=o)&&function(e,t,n){return function(i){this.style.setProperty(e,t.call(this,i),n)}}(e,o,n)),i}return o._value=t,o}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(q5(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function i(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&function(e){return function(t){this.textContent=e.call(this,t)}}(i)),t}return i._value=e,i}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var i,r=j5(this.node(),n).tween,o=0,a=r.length;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[r]):a=!1;a&&delete e.__transition}}(this,e)}))},F5.prototype.transition=function(e){var t,n;e instanceof a6?(t=e._id,e=e._name):(t=s6(),(n=u6).time=q$(),e=null==e?null:e+"");for(var i=this._groups,r=i.length,o=0;o :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n'.toString():n.defaultStyle,i.appendChild(t)}}const f=function(e,t){if(e.$schema){const n=P0(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${p3[n.library]}, but mode argument sets ${p3[t]??t}.`);const i=n.library;return r3(m3[i],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${p3[i]} ${n.version}, but the current version of ${p3[i]} is v${m3[i]}.`),i}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}(t,n.mode);let d=g3[f](t,r);if("vega-lite"===f&&d.$schema){const e=P0(d.$schema);r3(m3.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${m3.vega}.`)}c.classList.add("vega-embed"),o&&c.classList.add("has-actions"),c.innerHTML="";let h=c;if(o){const e=document.createElement("div");e.classList.add("chart-wrapper"),c.appendChild(e),h=e}const p=n.patch;if(p&&(d=p instanceof Function?p(d):Y(d,p,!0,!1).newDocument),n.formatLocale&&u3.formatLocale(n.formatLocale),n.timeFormatLocale&&u3.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const e in n.expressionFunctions){const t=n.expressionFunctions[e];"fn"in t?u3.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&u3.expressionFunction(e,t)}const{ast:m}=n,g=u3.parse(d,"vega-lite"===f?{}:r,{ast:m}),y=new(n.viewClass||u3.View)(g,l3({loader:i,logLevel:l,renderer:s},m?{expr:u3.expressionInterpreter??n.expr??EB}:{}));if(y.addSignalListener("autosize",((e,t)=>{const{type:n}=t;"fit-x"==n?(h.classList.add("fit-x"),h.classList.remove("fit-y")):"fit-y"==n?(h.classList.remove("fit-x"),h.classList.add("fit-y")):"fit"==n?h.classList.add("fit-x","fit-y"):h.classList.remove("fit-x","fit-y")})),!1!==n.tooltip){const e="function"==typeof n.tooltip?n.tooltip:new U1(!0===n.tooltip?{}:n.tooltip).call;y.tooltip(e)}let v,{hover:x}=n;if(void 0===x&&(x="vega"===f),x){const{hoverSet:e,updateSet:t}="boolean"==typeof x?{}:x;y.hover(e,t)}if(n&&(null!=n.width&&y.width(n.width),null!=n.height&&y.height(n.height),null!=n.padding&&y.padding(n.padding)),await y.initialize(h,n.bind).runAsync(),!1!==o){let e=c;if(!1!==n.defaultStyle||n.forceActionsMenu){const t=document.createElement("details");t.title=a.CLICK_TO_VIEW_ACTIONS,c.append(t),e=t;const n=document.createElement("summary");n.innerHTML='\n\n \n \n \n',t.append(n),v=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",v)}const i=document.createElement("div");if(e.append(i),i.classList.add("vega-actions"),!0===o||!1!==o.export)for(const e of["svg","png"])if(!0===o||!0===o.export||o.export[e]){const t=a[`${e.toUpperCase()}_ACTION`],r=document.createElement("a"),o=Oe(n.scaleFactor)?n.scaleFactor[e]:n.scaleFactor;r.text=t,r.href="#",r.target="_blank",r.download=`${u}.${e}`,r.addEventListener("mousedown",(async function(t){t.preventDefault();const n=await y.toImageURL(e,o);this.href=n})),i.append(r)}if(!0===o||!1!==o.source){const e=document.createElement("a");e.text=a.SOURCE_ACTION,e.href="#",e.addEventListener("click",(function(e){y3(le()(t),n.sourceHeader??"",n.sourceFooter??"",f),e.preventDefault()})),i.append(e)}if("vega-lite"===f&&(!0===o||!1!==o.compiled)){const e=document.createElement("a");e.text=a.COMPILED_ACTION,e.href="#",e.addEventListener("click",(function(e){y3(le()(d),n.sourceHeader??"",n.sourceFooter??"","vega"),e.preventDefault()})),i.append(e)}if(!0===o||!1!==o.editor){const e=n.editorUrl??"https://vega.github.io/editor/",o=document.createElement("a");o.text=a.EDITOR_ACTION,o.href="#",o.addEventListener("click",(function(n){!function(e,t,n){const i=e.open(t),{origin:r}=new URL(t);let o=40;e.addEventListener("message",(function t(n){n.source===i&&(o=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){o<=0||(i.postMessage(n,r),setTimeout(e,250),o-=1)}),250)}(window,e,{config:r,mode:f,renderer:s,spec:le()(t)}),n.preventDefault()})),i.append(o)}}return{view:y,spec:t,vgSpec:d,finalize:function(){v&&document.removeEventListener("click",v),y.finalize()},embedOptions:n}}(e,i,u,r)}(this.el,this.props.spec,this.props.opt).then((function(t){e.finalize=t.finalize,e.vegaView=t.view;var n=e.vegaView.getState().signals||{};"unit"in n&&delete n.unit;var i={};if("all"===e.props.signalsToObserve[0])i=n;else for(var r in n)e.props.signalsToObserve.includes(r)&&(i[r]=n[r]);n=i,e.props.setProps({signalData:n});var o=e.props.debounceWait,a=o,s=function(t,n){var i=e.cleanJson(n),r=function(e){for(var t=1;t{var i=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt,l="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,u="object"==typeof self&&self&&self.Object===Object&&self,c=l||u||Function("return this")(),f=Object.prototype.toString,d=Math.max,h=Math.min,p=function(){return c.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==f.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var n=o.test(e);return n||a.test(e)?s(e.slice(2),n?2:8):r.test(e)?NaN:+e}e.exports=function(e,t,n){var i,r,o,a,s,l,u=0,c=!1,f=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=i,o=r;return i=r=void 0,u=t,a=e.apply(o,n)}function b(e){var n=e-l;return void 0===l||n>=t||n<0||f&&e-u>=o}function x(){var e=p();if(b(e))return _(e);s=setTimeout(x,function(e){var n=t-(e-l);return f?h(n,o-(e-u)):n}(e))}function _(e){return s=void 0,y&&i?v(e):(i=r=void 0,a)}function w(){var e=p(),n=b(e);if(i=arguments,r=this,l=e,n){if(void 0===s)return function(e){return u=e,s=setTimeout(x,t),c?v(e):a}(l);if(f)return s=setTimeout(x,t),v(l)}return void 0===s&&(s=setTimeout(x,t)),a}return t=g(t)||0,m(n)&&(c=!!n.leading,o=(f="maxWait"in n)?d(g(n.maxWait)||0,t):o,y="trailing"in n?!!n.trailing:y),w.cancel=function(){void 0!==s&&clearTimeout(s),u=0,i=l=r=s=void 0},w.flush=function(){return void 0===s?a:_(p())},w}},801:e=>{"use strict";var t=/("(?:[^\\"]|\\.)*")|[:,]/g;e.exports=function(e,n){var i,r,o;return n=n||{},i=JSON.stringify([1],void 0,void 0===n.indent?2:n.indent).slice(2,-3),r=""===i?1/0:void 0===n.maxLength?80:n.maxLength,o=n.replacer,function e(n,a,s){var l,u,c,f,d,h,p,m,g,y,v,b;if(n&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===(v=JSON.stringify(n,o)))return v;if(p=r-a.length-s,v.length<=p&&(g=v.replace(t,(function(e,t){return t||e+" "}))).length<=p)return g;if(null!=o&&(n=JSON.parse(v),o=void 0),"object"==typeof n&&null!==n){if(m=a+i,c=[],u=0,Array.isArray(n))for(y="[",l="]",p=n.length;u0)return[y,i+c.join(",\n"+m),l].join("\n"+a)}return v}(e,"",0)}}}]); //# sourceMappingURL=async-Vega.js.map \ No newline at end of file diff --git a/dash_vega_components/async-Vega.js.map b/dash_vega_components/async-Vega.js.map index 8250319..339a07b 100644 --- a/dash_vega_components/async-Vega.js.map +++ b/dash_vega_components/async-Vega.js.map @@ -1 +1 @@ -{"version":3,"file":"async-Vega.js","mappings":";4pPAAA,MACA,GACEA,WAFmC,oBAAXC,QAA0BA,OAAOD,YAAcC,OAAOD,WAAWE,KAAKD,SCGhG,IAAIE,EACJ,MAAMC,EAAQ,IAAIC,WAAW,IACd,SAASC,IAEtB,IAAKH,IAEHA,EAAoC,oBAAXF,QAA0BA,OAAOE,iBAAmBF,OAAOE,gBAAgBD,KAAKD,SAEpGE,GACH,MAAM,IAAII,MAAM,4GAIpB,OAAOJ,EAAgBC,EACzB,CCXA,MAAMI,EAAY,GAElB,IAAK,IAAIC,EAAI,EAAGA,EAAI,MAAOA,EACzBD,EAAUE,MAAMD,EAAI,KAAOE,SAAS,IAAIC,MAAM,ICmBhD,QAxBA,SAAYC,EAASC,EAAKC,GACxB,GAAI,EAAOf,aAAec,IAAQD,EAChC,OAAO,EAAOb,aAI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,KACJ8wJ,EAAWpvJ,EAAIqC,GAAQwuO,EAAYxuO,IAAU/B,EAAS,EAAI,EAAI,IAC5D,aAQN,IAJAkZ,EAAQ,IACRC,EAAM,IAENnZ,GADAE,EAAOpB,OAAOoB,KAAKR,IACLM,OACP+B,EAAQ/B,EAAQ+B,IACrBpC,EAAMO,EAAK6B,GACXuuO,EAAUlwO,KAAKE,UAAUX,GAAO,UAMlBuB,KALdQ,EAAQotJ,EACNpvJ,EAAIC,GACJ4wO,EACAD,EAAQtwO,QAAU+B,IAAU/B,EAAS,EAAI,EAAI,MAG7C6uE,EAAM7wE,KAAKsyO,EAAU5uO,GAK3B,GAAImtE,EAAM7uE,OAAS,EACjB,MAAO,CAACkZ,EAAO0iE,EAAS/M,EAAMltE,KAAK,MAAQ4uO,GAAap3N,GAAKxX,KAC3D,KAAOyuO,EAGb,CAEA,OAAOnkN,CACR,CA3EM,CA2EJikN,EAAW,GAAI,EACpB","sources":["webpack:///./node_modules/uuid/dist/esm-browser/native.js","webpack:///./node_modules/uuid/dist/esm-browser/rng.js","webpack:///./node_modules/uuid/dist/esm-browser/stringify.js","webpack:///./node_modules/uuid/dist/esm-browser/v4.js","webpack:///./node_modules/fast-json-patch/module/helpers.mjs","webpack:///./node_modules/fast-json-patch/module/core.mjs","webpack:///./node_modules/fast-json-patch/module/duplex.mjs","webpack:///./node_modules/fast-json-patch/index.mjs","webpack:///./node_modules/vega-util/build/vega-util.module.js","webpack:///./node_modules/d3-dsv/src/dsv.js","webpack:///./node_modules/topojson-client/src/identity.js","webpack:///./node_modules/topojson-client/src/feature.js","webpack:///./node_modules/topojson-client/src/transform.js","webpack:///./node_modules/topojson-client/src/reverse.js","webpack:///./node_modules/topojson-client/src/stitch.js","webpack:///./node_modules/topojson-client/src/mesh.js","webpack:///./node_modules/d3-array/src/ticks.js","webpack:///./node_modules/d3-format/src/formatSpecifier.js","webpack:///./node_modules/d3-format/src/formatPrefixAuto.js","webpack:///./node_modules/d3-format/src/formatDecimal.js","webpack:///./node_modules/d3-format/src/exponent.js","webpack:///./node_modules/d3-format/src/precisionPrefix.js","webpack:///./node_modules/d3-format/src/precisionRound.js","webpack:///./node_modules/d3-format/src/precisionFixed.js","webpack:///./node_modules/d3-format/src/formatRounded.js","webpack:///./node_modules/d3-format/src/formatTypes.js","webpack:///./node_modules/d3-format/src/identity.js","webpack:///./node_modules/d3-format/src/locale.js","webpack:///./node_modules/d3-format/src/defaultLocale.js","webpack:///./node_modules/d3-format/src/formatGroup.js","webpack:///./node_modules/d3-format/src/formatNumerals.js","webpack:///./node_modules/d3-format/src/formatTrim.js","webpack:///./node_modules/d3-time/src/interval.js","webpack:///./node_modules/d3-time/src/duration.js","webpack:///./node_modules/d3-time/src/day.js","webpack:///./node_modules/d3-time/src/week.js","webpack:///./node_modules/d3-time/src/year.js","webpack:///./node_modules/d3-time/src/month.js","webpack:///./node_modules/d3-time/src/hour.js","webpack:///./node_modules/d3-time/src/minute.js","webpack:///./node_modules/d3-time/src/second.js","webpack:///./node_modules/d3-time/src/millisecond.js","webpack:///./node_modules/d3-array/src/ascending.js","webpack:///./node_modules/d3-array/src/descending.js","webpack:///./node_modules/d3-array/src/bisector.js","webpack:///./node_modules/vega-time/build/vega-time.module.js","webpack:///./node_modules/d3-time-format/src/locale.js","webpack:///./node_modules/d3-time-format/src/defaultLocale.js","webpack:///./node_modules/vega-format/build/vega-format.module.js","webpack:///./node_modules/vega-loader/build/vega-loader.browser.module.js","webpack:///./node_modules/vega-dataflow/build/vega-dataflow.module.js","webpack:///./node_modules/d3-array/src/max.js","webpack:///./node_modules/d3-array/src/min.js","webpack:///./node_modules/d3-array/src/sort.js","webpack:///./node_modules/d3-array/src/quickselect.js","webpack:///./node_modules/d3-array/src/number.js","webpack:///./node_modules/d3-array/src/quantile.js","webpack:///./node_modules/d3-array/src/median.js","webpack:///./node_modules/vega-statistics/build/vega-statistics.module.js","webpack:///./node_modules/d3-array/src/deviation.js","webpack:///./node_modules/d3-array/src/variance.js","webpack:///./node_modules/d3-array/src/range.js","webpack:///./node_modules/vega-transforms/build/vega-transforms.module.js","webpack:///./node_modules/d3-array/src/mean.js","webpack:///./node_modules/d3-shape/src/curve/basis.js","webpack:///./node_modules/d3-shape/src/noop.js","webpack:///./node_modules/d3-shape/src/curve/basisClosed.js","webpack:///./node_modules/d3-shape/src/curve/basisOpen.js","webpack:///./node_modules/d3-shape/src/curve/bundle.js","webpack:///./node_modules/d3-shape/src/curve/cardinal.js","webpack:///./node_modules/d3-shape/src/curve/cardinalOpen.js","webpack:///./node_modules/d3-shape/src/curve/cardinalClosed.js","webpack:///./node_modules/d3-shape/src/math.js","webpack:///./node_modules/d3-shape/src/curve/catmullRom.js","webpack:///./node_modules/d3-shape/src/curve/catmullRomClosed.js","webpack:///./node_modules/d3-shape/src/curve/catmullRomOpen.js","webpack:///./node_modules/d3-shape/src/curve/linear.js","webpack:///./node_modules/d3-shape/src/curve/linearClosed.js","webpack:///./node_modules/d3-shape/src/curve/monotone.js","webpack:///./node_modules/d3-shape/src/curve/natural.js","webpack:///./node_modules/d3-shape/src/curve/step.js","webpack:///./node_modules/d3-shape/src/constant.js","webpack:///./node_modules/d3-path/src/path.js","webpack:///./node_modules/d3-shape/src/path.js","webpack:///./node_modules/d3-shape/src/arc.js","webpack:///./node_modules/d3-shape/src/array.js","webpack:///./node_modules/d3-shape/src/point.js","webpack:///./node_modules/d3-shape/src/line.js","webpack:///./node_modules/d3-shape/src/area.js","webpack:///./node_modules/d3-shape/src/symbol/asterisk.js","webpack:///./node_modules/d3-shape/src/symbol/circle.js","webpack:///./node_modules/d3-shape/src/symbol/diamond.js","webpack:///./node_modules/d3-shape/src/symbol/star.js","webpack:///./node_modules/vega-canvas/build/vega-canvas.browser.module.js","webpack:///./node_modules/d3-shape/src/symbol/triangle.js","webpack:///./node_modules/d3-shape/src/symbol/triangle2.js","webpack:///./node_modules/d3-shape/src/symbol/wye.js","webpack:///./node_modules/d3-array/src/bisect.js","webpack:///./node_modules/d3-color/src/define.js","webpack:///./node_modules/d3-color/src/color.js","webpack:///./node_modules/d3-interpolate/src/basis.js","webpack:///./node_modules/d3-interpolate/src/basisClosed.js","webpack:///./node_modules/d3-interpolate/src/constant.js","webpack:///./node_modules/d3-interpolate/src/color.js","webpack:///./node_modules/d3-interpolate/src/rgb.js","webpack:///./node_modules/d3-interpolate/src/numberArray.js","webpack:///./node_modules/d3-interpolate/src/array.js","webpack:///./node_modules/d3-interpolate/src/date.js","webpack:///./node_modules/d3-interpolate/src/number.js","webpack:///./node_modules/d3-interpolate/src/object.js","webpack:///./node_modules/d3-interpolate/src/string.js","webpack:///./node_modules/d3-interpolate/src/value.js","webpack:///./node_modules/d3-interpolate/src/round.js","webpack:///./node_modules/d3-scale/src/number.js","webpack:///./node_modules/d3-scale/src/continuous.js","webpack:///./node_modules/d3-scale/src/constant.js","webpack:///./node_modules/d3-scale/src/init.js","webpack:///./node_modules/d3-scale/src/tickFormat.js","webpack:///./node_modules/d3-scale/src/linear.js","webpack:///./node_modules/d3-scale/src/nice.js","webpack:///./node_modules/d3-scale/src/log.js","webpack:///./node_modules/d3-scale/src/pow.js","webpack:///./node_modules/d3-scale/src/symlog.js","webpack:///./node_modules/d3-time/src/ticks.js","webpack:///./node_modules/d3-scale/src/time.js","webpack:///./node_modules/d3-scale/src/sequential.js","webpack:///./node_modules/d3-interpolate/src/piecewise.js","webpack:///./node_modules/d3-scale/src/diverging.js","webpack:///./node_modules/internmap/src/index.js","webpack:///./node_modules/d3-scale/src/ordinal.js","webpack:///./node_modules/d3-interpolate/src/discrete.js","webpack:///./node_modules/d3-interpolate/src/hue.js","webpack:///./node_modules/d3-interpolate/src/transform/decompose.js","webpack:///./node_modules/d3-interpolate/src/transform/parse.js","webpack:///./node_modules/d3-interpolate/src/transform/index.js","webpack:///./node_modules/d3-interpolate/src/zoom.js","webpack:///./node_modules/d3-interpolate/src/hsl.js","webpack:///./node_modules/d3-color/src/math.js","webpack:///./node_modules/d3-color/src/lab.js","webpack:///./node_modules/d3-interpolate/src/lab.js","webpack:///./node_modules/d3-interpolate/src/hcl.js","webpack:///./node_modules/d3-color/src/cubehelix.js","webpack:///./node_modules/d3-interpolate/src/cubehelix.js","webpack:///./node_modules/d3-interpolate/src/quantize.js","webpack:///./node_modules/vega-scale/build/vega-scale.module.js","webpack:///./node_modules/d3-scale/src/identity.js","webpack:///./node_modules/d3-scale/src/utcTime.js","webpack:///./node_modules/d3-scale/src/quantile.js","webpack:///./node_modules/d3-scale/src/quantize.js","webpack:///./node_modules/d3-scale/src/threshold.js","webpack:///./node_modules/vega-scenegraph/build/vega-scenegraph.module.js","webpack:///./node_modules/d3-shape/src/symbol.js","webpack:///./node_modules/vega-view-transforms/build/vega-view-transforms.module.js","webpack:///./node_modules/d3-array/src/sum.js","webpack:///./node_modules/vega-encode/build/vega-encode.module.js","webpack:///./node_modules/d3-geo/src/identity.js","webpack:///./node_modules/d3-geo/src/stream.js","webpack:///./node_modules/d3-array/src/fsum.js","webpack:///./node_modules/d3-geo/src/math.js","webpack:///./node_modules/d3-geo/src/noop.js","webpack:///./node_modules/d3-geo/src/path/area.js","webpack:///./node_modules/d3-geo/src/path/bounds.js","webpack:///./node_modules/d3-geo/src/path/centroid.js","webpack:///./node_modules/d3-geo/src/path/context.js","webpack:///./node_modules/d3-geo/src/path/measure.js","webpack:///./node_modules/d3-geo/src/path/string.js","webpack:///./node_modules/d3-geo/src/path/index.js","webpack:///./node_modules/d3-geo/src/clip/buffer.js","webpack:///./node_modules/d3-geo/src/pointEqual.js","webpack:///./node_modules/d3-geo/src/clip/rejoin.js","webpack:///./node_modules/d3-geo/src/cartesian.js","webpack:///./node_modules/d3-geo/src/polygonContains.js","webpack:///./node_modules/d3-array/src/merge.js","webpack:///./node_modules/d3-geo/src/clip/index.js","webpack:///./node_modules/d3-geo/src/clip/antimeridian.js","webpack:///./node_modules/d3-geo/src/circle.js","webpack:///./node_modules/d3-geo/src/clip/rectangle.js","webpack:///./node_modules/d3-geo/src/clip/line.js","webpack:///./node_modules/d3-geo/src/compose.js","webpack:///./node_modules/d3-geo/src/rotation.js","webpack:///./node_modules/d3-geo/src/transform.js","webpack:///./node_modules/d3-geo/src/projection/fit.js","webpack:///./node_modules/d3-geo/src/projection/resample.js","webpack:///./node_modules/d3-geo/src/projection/index.js","webpack:///./node_modules/d3-geo/src/clip/circle.js","webpack:///./node_modules/d3-geo/src/projection/conic.js","webpack:///./node_modules/d3-geo/src/projection/conicEqualArea.js","webpack:///./node_modules/d3-geo/src/projection/cylindricalEqualArea.js","webpack:///./node_modules/d3-geo/src/projection/albers.js","webpack:///./node_modules/d3-geo/src/projection/azimuthal.js","webpack:///./node_modules/d3-geo/src/projection/azimuthalEqualArea.js","webpack:///./node_modules/d3-geo/src/projection/azimuthalEquidistant.js","webpack:///./node_modules/d3-geo/src/projection/mercator.js","webpack:///./node_modules/d3-geo/src/projection/conicConformal.js","webpack:///./node_modules/d3-geo/src/projection/equirectangular.js","webpack:///./node_modules/d3-geo/src/projection/conicEquidistant.js","webpack:///./node_modules/d3-geo/src/projection/equalEarth.js","webpack:///./node_modules/d3-geo/src/projection/gnomonic.js","webpack:///./node_modules/d3-geo/src/projection/naturalEarth1.js","webpack:///./node_modules/d3-geo/src/projection/orthographic.js","webpack:///./node_modules/d3-geo/src/projection/stereographic.js","webpack:///./node_modules/d3-geo/src/projection/transverseMercator.js","webpack:///./node_modules/d3-geo-projection/src/math.js","webpack:///./node_modules/d3-geo-projection/src/mollweide.js","webpack:///./node_modules/vega-projection/build/vega-projection.module.js","webpack:///./node_modules/d3-geo/src/projection/albersUsa.js","webpack:///./node_modules/d3-geo/src/projection/identity.js","webpack:///./node_modules/d3-geo/src/graticule.js","webpack:///./node_modules/vega-geo/build/vega-geo.module.js","webpack:///./node_modules/d3-quadtree/src/add.js","webpack:///./node_modules/d3-quadtree/src/quad.js","webpack:///./node_modules/d3-quadtree/src/x.js","webpack:///./node_modules/d3-quadtree/src/y.js","webpack:///./node_modules/d3-quadtree/src/quadtree.js","webpack:///./node_modules/d3-force/src/constant.js","webpack:///./node_modules/d3-force/src/jiggle.js","webpack:///./node_modules/d3-force/src/collide.js","webpack:///./node_modules/d3-quadtree/src/cover.js","webpack:///./node_modules/d3-quadtree/src/data.js","webpack:///./node_modules/d3-quadtree/src/extent.js","webpack:///./node_modules/d3-quadtree/src/find.js","webpack:///./node_modules/d3-quadtree/src/remove.js","webpack:///./node_modules/d3-quadtree/src/root.js","webpack:///./node_modules/d3-quadtree/src/size.js","webpack:///./node_modules/d3-quadtree/src/visit.js","webpack:///./node_modules/d3-quadtree/src/visitAfter.js","webpack:///./node_modules/d3-dispatch/src/dispatch.js","webpack:///./node_modules/d3-timer/src/timer.js","webpack:///./node_modules/d3-force/src/lcg.js","webpack:///./node_modules/d3-force/src/simulation.js","webpack:///./node_modules/d3-force/src/link.js","webpack:///./node_modules/vega-force/build/vega-force.module.js","webpack:///./node_modules/d3-force/src/center.js","webpack:///./node_modules/d3-force/src/manyBody.js","webpack:///./node_modules/d3-force/src/x.js","webpack:///./node_modules/d3-force/src/y.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/count.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/index.js","webpack:///./node_modules/d3-hierarchy/src/accessors.js","webpack:///./node_modules/d3-hierarchy/src/constant.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/each.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/eachAfter.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/eachBefore.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/find.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/sum.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/sort.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/path.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/ancestors.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/descendants.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/leaves.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/links.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/iterator.js","webpack:///./node_modules/d3-hierarchy/src/lcg.js","webpack:///./node_modules/d3-hierarchy/src/pack/enclose.js","webpack:///./node_modules/d3-hierarchy/src/pack/siblings.js","webpack:///./node_modules/d3-hierarchy/src/array.js","webpack:///./node_modules/d3-hierarchy/src/pack/index.js","webpack:///./node_modules/d3-hierarchy/src/treemap/round.js","webpack:///./node_modules/d3-hierarchy/src/treemap/dice.js","webpack:///./node_modules/d3-hierarchy/src/stratify.js","webpack:///./node_modules/d3-hierarchy/src/tree.js","webpack:///./node_modules/d3-hierarchy/src/cluster.js","webpack:///./node_modules/d3-hierarchy/src/treemap/slice.js","webpack:///./node_modules/d3-hierarchy/src/treemap/squarify.js","webpack:///./node_modules/d3-hierarchy/src/treemap/resquarify.js","webpack:///./node_modules/vega-hierarchy/build/vega-hierarchy.module.js","webpack:///./node_modules/d3-hierarchy/src/partition.js","webpack:///./node_modules/d3-hierarchy/src/treemap/binary.js","webpack:///./node_modules/d3-hierarchy/src/treemap/sliceDice.js","webpack:///./node_modules/d3-hierarchy/src/treemap/index.js","webpack:///./node_modules/vega-label/build/vega-label.module.js","webpack:///./node_modules/vega-regression/build/vega-regression.module.js","webpack:///./node_modules/robust-predicates/esm/util.js","webpack:///./node_modules/robust-predicates/esm/orient2d.js","webpack:///./node_modules/robust-predicates/esm/orient3d.js","webpack:///./node_modules/robust-predicates/esm/incircle.js","webpack:///./node_modules/robust-predicates/esm/insphere.js","webpack:///./node_modules/delaunator/index.js","webpack:///./node_modules/d3-delaunay/src/path.js","webpack:///./node_modules/d3-delaunay/src/polygon.js","webpack:///./node_modules/d3-delaunay/src/voronoi.js","webpack:///./node_modules/d3-delaunay/src/delaunay.js","webpack:///./node_modules/vega-voronoi/build/vega-voronoi.module.js","webpack:///./node_modules/vega-wordcloud/build/vega-wordcloud.module.js","webpack:///./node_modules/vega-crossfilter/build/vega-crossfilter.module.js","webpack:///./node_modules/d3-array/src/permute.js","webpack:///./node_modules/vega-expression/build/vega-expression.module.js","webpack:///./node_modules/d3-geo/src/area.js","webpack:///./node_modules/d3-geo/src/bounds.js","webpack:///./node_modules/d3-geo/src/centroid.js","webpack:///./node_modules/d3-array/src/intersection.js","webpack:///./node_modules/vega-selections/build/vega-selection.module.js","webpack:///./node_modules/d3-array/src/union.js","webpack:///./node_modules/vega-functions/build/vega-functions.module.js","webpack:///./node_modules/vega-runtime/build/vega-runtime.module.js","webpack:///./node_modules/vega-view/build/vega-view.module.js","webpack:///./node_modules/d3-timer/src/interval.js","webpack:///./node_modules/vega-event-selector/build/vega-event-selector.module.js","webpack:///./node_modules/vega-parser/build/vega-parser.module.js","webpack:///./node_modules/vega/build/vega.module.js","webpack:///./node_modules/vega-interpreter/build/vega-interpreter.module.js","webpack:///./node_modules/vega-lite/build/src/logical.js","webpack:///./node_modules/vega-lite/build/src/util.js","webpack:///./node_modules/vega-lite/build/src/channel.js","webpack:///./node_modules/vega-lite/build/src/aggregate.js","webpack:///./node_modules/vega-lite/build/src/bin.js","webpack:///./node_modules/vega-lite/build/src/expr.js","webpack:///./node_modules/vega-lite/build/src/title.js","webpack:///./node_modules/vega-lite/build/src/vega.schema.js","webpack:///./node_modules/vega-lite/build/src/compile/common.js","webpack:///./node_modules/vega-lite/build/src/log/message.js","webpack:///./node_modules/vega-lite/build/src/log/index.js","webpack:///./node_modules/vega-lite/build/src/datetime.js","webpack:///./node_modules/vega-lite/build/src/timeunit.js","webpack:///./node_modules/vega-lite/build/src/predicate.js","webpack:///./node_modules/vega-lite/build/src/type.js","webpack:///./node_modules/vega-lite/build/src/scale.js","webpack:///./node_modules/vega-lite/build/src/mark.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/valueref.js","webpack:///./node_modules/vega-lite/build/src/compile/format.js","webpack:///./node_modules/vega-lite/build/src/sort.js","webpack:///./node_modules/vega-lite/build/src/spec/facet.js","webpack:///./node_modules/vega-lite/build/src/channeldef.js","webpack:///./node_modules/vega-lite/build/src/axis.js","webpack:///./node_modules/vega-lite/build/src/spec/unit.js","webpack:///./node_modules/vega-lite/build/src/compositemark/base.js","webpack:///./node_modules/vega-lite/build/src/encoding.js","webpack:///./node_modules/vega-lite/build/src/compositemark/common.js","webpack:///./node_modules/vega-lite/build/src/compositemark/boxplot.js","webpack:///./node_modules/vega-lite/build/src/compositemark/errorbar.js","webpack:///./node_modules/vega-lite/build/src/compositemark/errorband.js","webpack:///./node_modules/vega-lite/build/src/compositemark/index.js","webpack:///./node_modules/vega-lite/build/src/guide.js","webpack:///./node_modules/vega-lite/build/src/header.js","webpack:///./node_modules/vega-lite/build/src/legend.js","webpack:///./node_modules/vega-lite/build/src/selection.js","webpack:///./node_modules/vega-lite/build/src/parameter.js","webpack:///./node_modules/vega-lite/build/src/spec/concat.js","webpack:///./node_modules/vega-lite/build/src/spec/base.js","webpack:///./node_modules/vega-lite/build/src/config.js","webpack:///./node_modules/vega-lite/build/src/spec/layer.js","webpack:///./node_modules/vega-lite/build/src/spec/map.js","webpack:///./node_modules/vega-lite/build/src/spec/repeat.js","webpack:///./node_modules/vega-lite/build/src/stack.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/init.js","webpack:///./node_modules/vega-lite/build/src/normalize/pathoverlay.js","webpack:///./node_modules/vega-lite/build/src/normalize/repeater.js","webpack:///./node_modules/vega-lite/build/src/normalize/ruleforrangedline.js","webpack:///./node_modules/vega-lite/build/src/normalize/core.js","webpack:///./node_modules/vega-lite/build/src/transform.js","webpack:///./node_modules/vega-lite/build/src/normalize/selectioncompat.js","webpack:///./node_modules/vega-lite/build/src/normalize/toplevelselection.js","webpack:///./node_modules/vega-lite/build/src/normalize/index.js","webpack:///./node_modules/vega-lite/build/src/spec/toplevel.js","webpack:///./node_modules/vega-lite/build/src/compile/split.js","webpack:///./node_modules/vega-lite/build/src/compile/data/index.js","webpack:///./node_modules/vega-lite/build/src/data.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/data/dataflow.js","webpack:///./node_modules/vega-lite/build/src/compile/data/timeunit.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/project.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/scales.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/interval.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/point.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/conditional.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/text.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/tooltip.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/aria.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/nonposition.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/color.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/zindex.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/offset.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/position-point.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/position-align.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/position-range.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/position-rect.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/base.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/defined.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/nearest.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/inputs.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/toggle.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/clear.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/legends.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/translate.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/zoom.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/index.js","webpack:///./node_modules/vega-lite/build/src/compile/data/expressions.js","webpack:///./node_modules/vega-lite/build/src/compile/data/filter.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/predicate.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/config.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/properties.js","webpack:///./node_modules/vega-lite/build/src/compile/data/calculate.js","webpack:///./node_modules/vega-lite/build/src/compile/header/common.js","webpack:///./node_modules/vega-lite/build/src/compile/header/component.js","webpack:///./node_modules/vega-lite/build/src/compile/header/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/layoutsize/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/layoutsize/component.js","webpack:///./node_modules/vega-lite/build/src/compile/guide.js","webpack:///./node_modules/vega-lite/build/src/compile/resolve.js","webpack:///./node_modules/vega-lite/build/src/compile/legend/component.js","webpack:///./node_modules/vega-lite/build/src/compile/legend/encode.js","webpack:///./node_modules/vega-lite/build/src/compile/legend/properties.js","webpack:///./node_modules/vega-lite/build/src/compile/legend/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/legend/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/projection/assemble.js","webpack:///./node_modules/vega-lite/build/src/projection.js","webpack:///./node_modules/vega-lite/build/src/compile/projection/component.js","webpack:///./node_modules/vega-lite/build/src/compile/projection/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/data/bin.js","webpack:///./node_modules/vega-lite/build/src/compile/data/aggregate.js","webpack:///./node_modules/vega-lite/build/src/compile/data/facet.js","webpack:///./node_modules/vega-lite/build/src/compile/data/formatparse.js","webpack:///./node_modules/vega-lite/build/src/compile/data/identifier.js","webpack:///./node_modules/vega-lite/build/src/compile/data/graticule.js","webpack:///./node_modules/vega-lite/build/src/compile/data/sequence.js","webpack:///./node_modules/vega-lite/build/src/compile/data/source.js","webpack:///./node_modules/vega-lite/build/src/compile/data/optimizer.js","webpack:///./node_modules/vega-lite/build/src/compile/data/optimizers.js","webpack:///./node_modules/vega-lite/build/src/compile/data/joinaggregate.js","webpack:///./node_modules/vega-lite/build/src/compile/data/stack.js","webpack:///./node_modules/vega-lite/build/src/compile/data/window.js","webpack:///./node_modules/vega-lite/build/src/compile/data/subtree.js","webpack:///./node_modules/vega-lite/build/src/compile/data/optimize.js","webpack:///./node_modules/vega-lite/build/src/compile/signal.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/domain.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/component.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/range.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/properties.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/type.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/model.js","webpack:///./node_modules/vega-lite/build/src/compile/data/density.js","webpack:///./node_modules/vega-lite/build/src/compile/data/extent.js","webpack:///./node_modules/vega-lite/build/src/compile/data/filterinvalid.js","webpack:///./node_modules/vega-lite/build/src/compile/data/flatten.js","webpack:///./node_modules/vega-lite/build/src/compile/data/fold.js","webpack:///./node_modules/vega-lite/build/src/compile/data/geojson.js","webpack:///./node_modules/vega-lite/build/src/compile/data/geopoint.js","webpack:///./node_modules/vega-lite/build/src/compile/data/impute.js","webpack:///./node_modules/vega-lite/build/src/compile/data/loess.js","webpack:///./node_modules/vega-lite/build/src/compile/data/lookup.js","webpack:///./node_modules/vega-lite/build/src/compile/data/quantile.js","webpack:///./node_modules/vega-lite/build/src/compile/data/regression.js","webpack:///./node_modules/vega-lite/build/src/compile/data/pivot.js","webpack:///./node_modules/vega-lite/build/src/compile/data/sample.js","webpack:///./node_modules/vega-lite/build/src/compile/data/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/header/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/layoutsize/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/facet.js","webpack:///./node_modules/vega-lite/build/src/compile/data/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.js","webpack:///./node_modules/vega-lite/build/src/compile/concat.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/component.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/encode.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/point.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/text.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/tick.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/mark.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/arc.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/area.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/bar.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/geoshape.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/image.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/line.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/rect.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/rule.js","webpack:///./node_modules/vega-lite/build/src/compile/unit.js","webpack:///./node_modules/vega-lite/build/src/compile/layoutsize/init.js","webpack:///./node_modules/vega-lite/build/src/compile/layer.js","webpack:///./node_modules/vega-lite/build/src/compile/buildmodel.js","webpack:///./node_modules/vega-lite/build/src/compile/compile.js","webpack:///./node_modules/vega-lite/build/src/index.js","webpack:///./node_modules/vega-schema-url-parser/dist/parser.module.js","webpack:///./node_modules/vega-themes/build/vega-themes.module.js","webpack:///./node_modules/vega-tooltip/build/vega-tooltip.module.js","webpack:///./node_modules/vega-embed/build/vega-embed.module.js","webpack:///./node_modules/d3-selection/src/selector.js","webpack:///./node_modules/d3-selection/src/selectorAll.js","webpack:///./node_modules/d3-selection/src/matcher.js","webpack:///./node_modules/d3-selection/src/selection/selectChild.js","webpack:///./node_modules/d3-selection/src/selection/selectChildren.js","webpack:///./node_modules/d3-selection/src/selection/sparse.js","webpack:///./node_modules/d3-selection/src/selection/enter.js","webpack:///./node_modules/d3-selection/src/selection/data.js","webpack:///./node_modules/d3-selection/src/selection/sort.js","webpack:///./node_modules/d3-selection/src/namespaces.js","webpack:///./node_modules/d3-selection/src/namespace.js","webpack:///./node_modules/d3-selection/src/selection/attr.js","webpack:///./node_modules/d3-selection/src/window.js","webpack:///./node_modules/d3-selection/src/selection/style.js","webpack:///./node_modules/d3-selection/src/selection/property.js","webpack:///./node_modules/d3-selection/src/selection/classed.js","webpack:///./node_modules/d3-selection/src/selection/text.js","webpack:///./node_modules/d3-selection/src/selection/html.js","webpack:///./node_modules/d3-selection/src/selection/raise.js","webpack:///./node_modules/d3-selection/src/selection/lower.js","webpack:///./node_modules/d3-selection/src/creator.js","webpack:///./node_modules/d3-selection/src/selection/insert.js","webpack:///./node_modules/d3-selection/src/selection/remove.js","webpack:///./node_modules/d3-selection/src/selection/clone.js","webpack:///./node_modules/d3-selection/src/selection/on.js","webpack:///./node_modules/d3-selection/src/selection/dispatch.js","webpack:///./node_modules/d3-selection/src/selection/index.js","webpack:///./node_modules/d3-selection/src/selection/select.js","webpack:///./node_modules/d3-selection/src/selection/selectAll.js","webpack:///./node_modules/d3-selection/src/array.js","webpack:///./node_modules/d3-selection/src/selection/filter.js","webpack:///./node_modules/d3-selection/src/constant.js","webpack:///./node_modules/d3-selection/src/selection/exit.js","webpack:///./node_modules/d3-selection/src/selection/join.js","webpack:///./node_modules/d3-selection/src/selection/merge.js","webpack:///./node_modules/d3-selection/src/selection/order.js","webpack:///./node_modules/d3-selection/src/selection/call.js","webpack:///./node_modules/d3-selection/src/selection/nodes.js","webpack:///./node_modules/d3-selection/src/selection/node.js","webpack:///./node_modules/d3-selection/src/selection/size.js","webpack:///./node_modules/d3-selection/src/selection/empty.js","webpack:///./node_modules/d3-selection/src/selection/each.js","webpack:///./node_modules/d3-selection/src/selection/append.js","webpack:///./node_modules/d3-selection/src/selection/datum.js","webpack:///./node_modules/d3-selection/src/selection/iterator.js","webpack:///./node_modules/d3-timer/src/timeout.js","webpack:///./node_modules/d3-transition/src/transition/schedule.js","webpack:///./node_modules/d3-transition/src/transition/tween.js","webpack:///./node_modules/d3-transition/src/transition/interpolate.js","webpack:///./node_modules/d3-transition/src/transition/attr.js","webpack:///./node_modules/d3-transition/src/transition/attrTween.js","webpack:///./node_modules/d3-transition/src/transition/delay.js","webpack:///./node_modules/d3-transition/src/transition/duration.js","webpack:///./node_modules/d3-transition/src/transition/selection.js","webpack:///./node_modules/d3-transition/src/transition/style.js","webpack:///./node_modules/d3-transition/src/transition/index.js","webpack:///./node_modules/d3-transition/src/transition/select.js","webpack:///./node_modules/d3-transition/src/transition/selectAll.js","webpack:///./node_modules/d3-transition/src/transition/filter.js","webpack:///./node_modules/d3-transition/src/transition/merge.js","webpack:///./node_modules/d3-transition/src/transition/transition.js","webpack:///./node_modules/d3-transition/src/transition/on.js","webpack:///./node_modules/d3-transition/src/transition/styleTween.js","webpack:///./node_modules/d3-transition/src/transition/text.js","webpack:///./node_modules/d3-transition/src/transition/textTween.js","webpack:///./node_modules/d3-transition/src/transition/remove.js","webpack:///./node_modules/d3-transition/src/transition/ease.js","webpack:///./node_modules/d3-transition/src/transition/easeVarying.js","webpack:///./node_modules/d3-transition/src/transition/end.js","webpack:///./node_modules/d3-transition/src/selection/transition.js","webpack:///./node_modules/d3-ease/src/cubic.js","webpack:///./node_modules/d3-transition/src/selection/index.js","webpack:///./node_modules/d3-transition/src/selection/interrupt.js","webpack:///./node_modules/d3-transition/src/interrupt.js","webpack:///./node_modules/d3-brush/src/brush.js","webpack:///./node_modules/d3-zoom/src/transform.js","webpack:///./src/lib/fragments/Vega.react.js","webpack:///./node_modules/d3-selection/src/select.js","webpack:///./node_modules/lodash.debounce/index.js","webpack:///./node_modules/json-stringify-pretty-compact/index.js"],"sourcesContent":["const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","/*!\n * https://github.com/Starcounter-Jack/JSON-Patch\n * (c) 2017-2022 Joachim Wester\n * MIT licensed\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function hasOwnProperty(obj, key) {\n return _hasOwnProperty.call(obj, key);\n}\nexport function _objectKeys(obj) {\n if (Array.isArray(obj)) {\n var keys_1 = new Array(obj.length);\n for (var k = 0; k < keys_1.length; k++) {\n keys_1[k] = \"\" + k;\n }\n return keys_1;\n }\n if (Object.keys) {\n return Object.keys(obj);\n }\n var keys = [];\n for (var i in obj) {\n if (hasOwnProperty(obj, i)) {\n keys.push(i);\n }\n }\n return keys;\n}\n;\n/**\n* Deeply clone the object.\n* https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)\n* @param {any} obj value to clone\n* @return {any} cloned obj\n*/\nexport function _deepClone(obj) {\n switch (typeof obj) {\n case \"object\":\n return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n case \"undefined\":\n return null; //this is how JSON.stringify behaves for array items\n default:\n return obj; //no need to clone primitives\n }\n}\n//3x faster than cached /^\\d+$/.test(str)\nexport function isInteger(str) {\n var i = 0;\n var len = str.length;\n var charCode;\n while (i < len) {\n charCode = str.charCodeAt(i);\n if (charCode >= 48 && charCode <= 57) {\n i++;\n continue;\n }\n return false;\n }\n return true;\n}\n/**\n* Escapes a json pointer path\n* @param path The raw pointer\n* @return the Escaped path\n*/\nexport function escapePathComponent(path) {\n if (path.indexOf('/') === -1 && path.indexOf('~') === -1)\n return path;\n return path.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n/**\n * Unescapes a json pointer path\n * @param path The escaped pointer\n * @return The unescaped path\n */\nexport function unescapePathComponent(path) {\n return path.replace(/~1/g, '/').replace(/~0/g, '~');\n}\nexport function _getPathRecursive(root, obj) {\n var found;\n for (var key in root) {\n if (hasOwnProperty(root, key)) {\n if (root[key] === obj) {\n return escapePathComponent(key) + '/';\n }\n else if (typeof root[key] === 'object') {\n found = _getPathRecursive(root[key], obj);\n if (found != '') {\n return escapePathComponent(key) + '/' + found;\n }\n }\n }\n }\n return '';\n}\nexport function getPath(root, obj) {\n if (root === obj) {\n return '/';\n }\n var path = _getPathRecursive(root, obj);\n if (path === '') {\n throw new Error(\"Object not found in root\");\n }\n return \"/\" + path;\n}\n/**\n* Recursively checks whether an object has any undefined values inside.\n*/\nexport function hasUndefined(obj) {\n if (obj === undefined) {\n return true;\n }\n if (obj) {\n if (Array.isArray(obj)) {\n for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {\n if (hasUndefined(obj[i_1])) {\n return true;\n }\n }\n }\n else if (typeof obj === \"object\") {\n var objKeys = _objectKeys(obj);\n var objKeysLength = objKeys.length;\n for (var i = 0; i < objKeysLength; i++) {\n if (hasUndefined(obj[objKeys[i]])) {\n return true;\n }\n }\n }\n }\n return false;\n}\nfunction patchErrorMessageFormatter(message, args) {\n var messageParts = [message];\n for (var key in args) {\n var value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print\n if (typeof value !== 'undefined') {\n messageParts.push(key + \": \" + value);\n }\n }\n return messageParts.join('\\n');\n}\nvar PatchError = /** @class */ (function (_super) {\n __extends(PatchError, _super);\n function PatchError(message, name, index, operation, tree) {\n var _newTarget = this.constructor;\n var _this = _super.call(this, patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree })) || this;\n _this.name = name;\n _this.index = index;\n _this.operation = operation;\n _this.tree = tree;\n Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359\n _this.message = patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree });\n return _this;\n }\n return PatchError;\n}(Error));\nexport { PatchError };\n","import { PatchError, _deepClone, isInteger, unescapePathComponent, hasUndefined } from './helpers.mjs';\nexport var JsonPatchError = PatchError;\nexport var deepClone = _deepClone;\n/* We use a Javascript hash to store each\n function. Each hash entry (property) uses\n the operation identifiers specified in rfc6902.\n In this way, we can map each patch operation\n to its dedicated function in efficient way.\n */\n/* The operations applicable to an object */\nvar objOps = {\n add: function (obj, key, document) {\n obj[key] = this.value;\n return { newDocument: document };\n },\n remove: function (obj, key, document) {\n var removed = obj[key];\n delete obj[key];\n return { newDocument: document, removed: removed };\n },\n replace: function (obj, key, document) {\n var removed = obj[key];\n obj[key] = this.value;\n return { newDocument: document, removed: removed };\n },\n move: function (obj, key, document) {\n /* in case move target overwrites an existing value,\n return the removed value, this can be taxing performance-wise,\n and is potentially unneeded */\n var removed = getValueByPointer(document, this.path);\n if (removed) {\n removed = _deepClone(removed);\n }\n var originalValue = applyOperation(document, { op: \"remove\", path: this.from }).removed;\n applyOperation(document, { op: \"add\", path: this.path, value: originalValue });\n return { newDocument: document, removed: removed };\n },\n copy: function (obj, key, document) {\n var valueToCopy = getValueByPointer(document, this.from);\n // enforce copy by value so further operations don't affect source (see issue #177)\n applyOperation(document, { op: \"add\", path: this.path, value: _deepClone(valueToCopy) });\n return { newDocument: document };\n },\n test: function (obj, key, document) {\n return { newDocument: document, test: _areEquals(obj[key], this.value) };\n },\n _get: function (obj, key, document) {\n this.value = obj[key];\n return { newDocument: document };\n }\n};\n/* The operations applicable to an array. Many are the same as for the object */\nvar arrOps = {\n add: function (arr, i, document) {\n if (isInteger(i)) {\n arr.splice(i, 0, this.value);\n }\n else { // array props\n arr[i] = this.value;\n }\n // this may be needed when using '-' in an array\n return { newDocument: document, index: i };\n },\n remove: function (arr, i, document) {\n var removedList = arr.splice(i, 1);\n return { newDocument: document, removed: removedList[0] };\n },\n replace: function (arr, i, document) {\n var removed = arr[i];\n arr[i] = this.value;\n return { newDocument: document, removed: removed };\n },\n move: objOps.move,\n copy: objOps.copy,\n test: objOps.test,\n _get: objOps._get\n};\n/**\n * Retrieves a value from a JSON document by a JSON pointer.\n * Returns the value.\n *\n * @param document The document to get the value from\n * @param pointer an escaped JSON pointer\n * @return The retrieved value\n */\nexport function getValueByPointer(document, pointer) {\n if (pointer == '') {\n return document;\n }\n var getOriginalDestination = { op: \"_get\", path: pointer };\n applyOperation(document, getOriginalDestination);\n return getOriginalDestination.value;\n}\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the {newDocument, result} of the operation.\n * It modifies the `document` and `operation` objects - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return `{newDocument, result}` after the operation\n */\nexport function applyOperation(document, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {\n if (validateOperation === void 0) { validateOperation = false; }\n if (mutateDocument === void 0) { mutateDocument = true; }\n if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }\n if (index === void 0) { index = 0; }\n if (validateOperation) {\n if (typeof validateOperation == 'function') {\n validateOperation(operation, 0, document, operation.path);\n }\n else {\n validator(operation, 0);\n }\n }\n /* ROOT OPERATIONS */\n if (operation.path === \"\") {\n var returnValue = { newDocument: document };\n if (operation.op === 'add') {\n returnValue.newDocument = operation.value;\n return returnValue;\n }\n else if (operation.op === 'replace') {\n returnValue.newDocument = operation.value;\n returnValue.removed = document; //document we removed\n return returnValue;\n }\n else if (operation.op === 'move' || operation.op === 'copy') { // it's a move or copy to root\n returnValue.newDocument = getValueByPointer(document, operation.from); // get the value by json-pointer in `from` field\n if (operation.op === 'move') { // report removed item\n returnValue.removed = document;\n }\n return returnValue;\n }\n else if (operation.op === 'test') {\n returnValue.test = _areEquals(document, operation.value);\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n returnValue.newDocument = document;\n return returnValue;\n }\n else if (operation.op === 'remove') { // a remove on root\n returnValue.removed = document;\n returnValue.newDocument = null;\n return returnValue;\n }\n else if (operation.op === '_get') {\n operation.value = document;\n return returnValue;\n }\n else { /* bad operation */\n if (validateOperation) {\n throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);\n }\n else {\n return returnValue;\n }\n }\n } /* END ROOT OPERATIONS */\n else {\n if (!mutateDocument) {\n document = _deepClone(document);\n }\n var path = operation.path || \"\";\n var keys = path.split('/');\n var obj = document;\n var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift\n var len = keys.length;\n var existingPathFragment = undefined;\n var key = void 0;\n var validateFunction = void 0;\n if (typeof validateOperation == 'function') {\n validateFunction = validateOperation;\n }\n else {\n validateFunction = validator;\n }\n while (true) {\n key = keys[t];\n if (key && key.indexOf('~') != -1) {\n key = unescapePathComponent(key);\n }\n if (banPrototypeModifications &&\n (key == '__proto__' ||\n (key == 'prototype' && t > 0 && keys[t - 1] == 'constructor'))) {\n throw new TypeError('JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');\n }\n if (validateOperation) {\n if (existingPathFragment === undefined) {\n if (obj[key] === undefined) {\n existingPathFragment = keys.slice(0, t).join('/');\n }\n else if (t == len - 1) {\n existingPathFragment = operation.path;\n }\n if (existingPathFragment !== undefined) {\n validateFunction(operation, 0, document, existingPathFragment);\n }\n }\n }\n t++;\n if (Array.isArray(obj)) {\n if (key === '-') {\n key = obj.length;\n }\n else {\n if (validateOperation && !isInteger(key)) {\n throw new JsonPatchError(\"Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index\", \"OPERATION_PATH_ILLEGAL_ARRAY_INDEX\", index, operation, document);\n } // only parse key when it's an integer for `arr.prop` to work\n else if (isInteger(key)) {\n key = ~~key;\n }\n }\n if (t >= len) {\n if (validateOperation && operation.op === \"add\" && key > obj.length) {\n throw new JsonPatchError(\"The specified index MUST NOT be greater than the number of elements in the array\", \"OPERATION_VALUE_OUT_OF_BOUNDS\", index, operation, document);\n }\n var returnValue = arrOps[operation.op].call(operation, obj, key, document); // Apply patch\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return returnValue;\n }\n }\n else {\n if (t >= len) {\n var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return returnValue;\n }\n }\n obj = obj[key];\n // If we have more keys in the path, but the next value isn't a non-null object,\n // throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.\n if (validateOperation && t < len && (!obj || typeof obj !== \"object\")) {\n throw new JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);\n }\n }\n }\n}\n/**\n * Apply a full JSON Patch array on a JSON document.\n * Returns the {newDocument, result} of the patch.\n * It modifies the `document` object and `patch` - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.\n *\n * @param document The document to patch\n * @param patch The patch to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return An array of `{newDocument, result}` after the patch\n */\nexport function applyPatch(document, patch, validateOperation, mutateDocument, banPrototypeModifications) {\n if (mutateDocument === void 0) { mutateDocument = true; }\n if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }\n if (validateOperation) {\n if (!Array.isArray(patch)) {\n throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');\n }\n }\n if (!mutateDocument) {\n document = _deepClone(document);\n }\n var results = new Array(patch.length);\n for (var i = 0, length_1 = patch.length; i < length_1; i++) {\n // we don't need to pass mutateDocument argument because if it was true, we already deep cloned the object, we'll just pass `true`\n results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);\n document = results[i].newDocument; // in case root was replaced\n }\n results.newDocument = document;\n return results;\n}\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the updated document.\n * Suitable as a reducer.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @return The updated document\n */\nexport function applyReducer(document, operation, index) {\n var operationResult = applyOperation(document, operation);\n if (operationResult.test === false) { // failed test\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return operationResult.newDocument;\n}\n/**\n * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.\n * @param {object} operation - operation object (patch)\n * @param {number} index - index of operation in the sequence\n * @param {object} [document] - object where the operation is supposed to be applied\n * @param {string} [existingPathFragment] - comes along with `document`\n */\nexport function validator(operation, index, document, existingPathFragment) {\n if (typeof operation !== 'object' || operation === null || Array.isArray(operation)) {\n throw new JsonPatchError('Operation is not an object', 'OPERATION_NOT_AN_OBJECT', index, operation, document);\n }\n else if (!objOps[operation.op]) {\n throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);\n }\n else if (typeof operation.path !== 'string') {\n throw new JsonPatchError('Operation `path` property is not a string', 'OPERATION_PATH_INVALID', index, operation, document);\n }\n else if (operation.path.indexOf('/') !== 0 && operation.path.length > 0) {\n // paths that aren't empty string should start with \"/\"\n throw new JsonPatchError('Operation `path` property must start with \"/\"', 'OPERATION_PATH_INVALID', index, operation, document);\n }\n else if ((operation.op === 'move' || operation.op === 'copy') && typeof operation.from !== 'string') {\n throw new JsonPatchError('Operation `from` property is not present (applicable in `move` and `copy` operations)', 'OPERATION_FROM_REQUIRED', index, operation, document);\n }\n else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && operation.value === undefined) {\n throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_REQUIRED', index, operation, document);\n }\n else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && hasUndefined(operation.value)) {\n throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED', index, operation, document);\n }\n else if (document) {\n if (operation.op == \"add\") {\n var pathLen = operation.path.split(\"/\").length;\n var existingPathLen = existingPathFragment.split(\"/\").length;\n if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {\n throw new JsonPatchError('Cannot perform an `add` operation at the desired path', 'OPERATION_PATH_CANNOT_ADD', index, operation, document);\n }\n }\n else if (operation.op === 'replace' || operation.op === 'remove' || operation.op === '_get') {\n if (operation.path !== existingPathFragment) {\n throw new JsonPatchError('Cannot perform the operation at a path that does not exist', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);\n }\n }\n else if (operation.op === 'move' || operation.op === 'copy') {\n var existingValue = { op: \"_get\", path: operation.from, value: undefined };\n var error = validate([existingValue], document);\n if (error && error.name === 'OPERATION_PATH_UNRESOLVABLE') {\n throw new JsonPatchError('Cannot perform the operation from a path that does not exist', 'OPERATION_FROM_UNRESOLVABLE', index, operation, document);\n }\n }\n }\n}\n/**\n * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.\n * If error is encountered, returns a JsonPatchError object\n * @param sequence\n * @param document\n * @returns {JsonPatchError|undefined}\n */\nexport function validate(sequence, document, externalValidator) {\n try {\n if (!Array.isArray(sequence)) {\n throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');\n }\n if (document) {\n //clone document and sequence so that we can safely try applying operations\n applyPatch(_deepClone(document), _deepClone(sequence), externalValidator || true);\n }\n else {\n externalValidator = externalValidator || validator;\n for (var i = 0; i < sequence.length; i++) {\n externalValidator(sequence[i], i, document, undefined);\n }\n }\n }\n catch (e) {\n if (e instanceof JsonPatchError) {\n return e;\n }\n else {\n throw e;\n }\n }\n}\n// based on https://github.com/epoberezkin/fast-deep-equal\n// MIT License\n// Copyright (c) 2017 Evgeny Poberezkin\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\nexport function _areEquals(a, b) {\n if (a === b)\n return true;\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key;\n if (arrA && arrB) {\n length = a.length;\n if (length != b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (!_areEquals(a[i], b[i]))\n return false;\n return true;\n }\n if (arrA != arrB)\n return false;\n var keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length)\n return false;\n for (i = length; i-- !== 0;)\n if (!b.hasOwnProperty(keys[i]))\n return false;\n for (i = length; i-- !== 0;) {\n key = keys[i];\n if (!_areEquals(a[key], b[key]))\n return false;\n }\n return true;\n }\n return a !== a && b !== b;\n}\n;\n","/*!\n * https://github.com/Starcounter-Jack/JSON-Patch\n * (c) 2017-2021 Joachim Wester\n * MIT license\n */\nimport { _deepClone, _objectKeys, escapePathComponent, hasOwnProperty } from './helpers.mjs';\nimport { applyPatch } from './core.mjs';\nvar beforeDict = new WeakMap();\nvar Mirror = /** @class */ (function () {\n function Mirror(obj) {\n this.observers = new Map();\n this.obj = obj;\n }\n return Mirror;\n}());\nvar ObserverInfo = /** @class */ (function () {\n function ObserverInfo(callback, observer) {\n this.callback = callback;\n this.observer = observer;\n }\n return ObserverInfo;\n}());\nfunction getMirror(obj) {\n return beforeDict.get(obj);\n}\nfunction getObserverFromMirror(mirror, callback) {\n return mirror.observers.get(callback);\n}\nfunction removeObserverFromMirror(mirror, observer) {\n mirror.observers.delete(observer.callback);\n}\n/**\n * Detach an observer from an object\n */\nexport function unobserve(root, observer) {\n observer.unobserve();\n}\n/**\n * Observes changes made to an object, which can then be retrieved using generate\n */\nexport function observe(obj, callback) {\n var patches = [];\n var observer;\n var mirror = getMirror(obj);\n if (!mirror) {\n mirror = new Mirror(obj);\n beforeDict.set(obj, mirror);\n }\n else {\n var observerInfo = getObserverFromMirror(mirror, callback);\n observer = observerInfo && observerInfo.observer;\n }\n if (observer) {\n return observer;\n }\n observer = {};\n mirror.value = _deepClone(obj);\n if (callback) {\n observer.callback = callback;\n observer.next = null;\n var dirtyCheck = function () {\n generate(observer);\n };\n var fastCheck = function () {\n clearTimeout(observer.next);\n observer.next = setTimeout(dirtyCheck);\n };\n if (typeof window !== 'undefined') { //not Node\n window.addEventListener('mouseup', fastCheck);\n window.addEventListener('keyup', fastCheck);\n window.addEventListener('mousedown', fastCheck);\n window.addEventListener('keydown', fastCheck);\n window.addEventListener('change', fastCheck);\n }\n }\n observer.patches = patches;\n observer.object = obj;\n observer.unobserve = function () {\n generate(observer);\n clearTimeout(observer.next);\n removeObserverFromMirror(mirror, observer);\n if (typeof window !== 'undefined') {\n window.removeEventListener('mouseup', fastCheck);\n window.removeEventListener('keyup', fastCheck);\n window.removeEventListener('mousedown', fastCheck);\n window.removeEventListener('keydown', fastCheck);\n window.removeEventListener('change', fastCheck);\n }\n };\n mirror.observers.set(callback, new ObserverInfo(callback, observer));\n return observer;\n}\n/**\n * Generate an array of patches from an observer\n */\nexport function generate(observer, invertible) {\n if (invertible === void 0) { invertible = false; }\n var mirror = beforeDict.get(observer.object);\n _generate(mirror.value, observer.object, observer.patches, \"\", invertible);\n if (observer.patches.length) {\n applyPatch(mirror.value, observer.patches);\n }\n var temp = observer.patches;\n if (temp.length > 0) {\n observer.patches = [];\n if (observer.callback) {\n observer.callback(temp);\n }\n }\n return temp;\n}\n// Dirty check if obj is different from mirror, generate patches and update mirror\nfunction _generate(mirror, obj, patches, path, invertible) {\n if (obj === mirror) {\n return;\n }\n if (typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n var newKeys = _objectKeys(obj);\n var oldKeys = _objectKeys(mirror);\n var changed = false;\n var deleted = false;\n //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if (hasOwnProperty(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {\n var newVal = obj[key];\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {\n _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key), invertible);\n }\n else {\n if (oldVal !== newVal) {\n changed = true;\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(oldVal) });\n }\n patches.push({ op: \"replace\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(newVal) });\n }\n }\n }\n else if (Array.isArray(mirror) === Array.isArray(obj)) {\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(oldVal) });\n }\n patches.push({ op: \"remove\", path: path + \"/\" + escapePathComponent(key) });\n deleted = true; // property has been deleted\n }\n else {\n if (invertible) {\n patches.push({ op: \"test\", path: path, value: mirror });\n }\n patches.push({ op: \"replace\", path: path, value: obj });\n changed = true;\n }\n }\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!hasOwnProperty(mirror, key) && obj[key] !== undefined) {\n patches.push({ op: \"add\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(obj[key]) });\n }\n }\n}\n/**\n * Create an array of patches from the differences in two objects\n */\nexport function compare(tree1, tree2, invertible) {\n if (invertible === void 0) { invertible = false; }\n var patches = [];\n _generate(tree1, tree2, patches, '', invertible);\n return patches;\n}\n","export * from './module/core.mjs';\nexport * from './module/duplex.mjs';\nexport {\n PatchError as JsonPatchError,\n _deepClone as deepClone,\n escapePathComponent,\n unescapePathComponent\n} from './module/helpers.mjs';\n\n\n/**\n * Default export for backwards compat\n */\n\nimport * as core from './module/core.mjs';\nimport * as duplex from './module/duplex.mjs';\nimport {\n PatchError as JsonPatchError,\n _deepClone as deepClone,\n escapePathComponent,\n unescapePathComponent\n} from './module/helpers.mjs';\n\nexport default Object.assign({}, core, duplex, {\n JsonPatchError,\n deepClone,\n escapePathComponent,\n unescapePathComponent\n});","function accessor (fn, fields, name) {\n fn.fields = fields || [];\n fn.fname = name;\n return fn;\n}\nfunction accessorName(fn) {\n return fn == null ? null : fn.fname;\n}\nfunction accessorFields(fn) {\n return fn == null ? null : fn.fields;\n}\n\nfunction getter (path) {\n return path.length === 1 ? get1(path[0]) : getN(path);\n}\nconst get1 = field => function (obj) {\n return obj[field];\n};\nconst getN = path => {\n const len = path.length;\n return function (obj) {\n for (let i = 0; i < len; ++i) {\n obj = obj[path[i]];\n }\n return obj;\n };\n};\n\nfunction error (message) {\n throw Error(message);\n}\n\nfunction splitAccessPath (p) {\n const path = [],\n n = p.length;\n let q = null,\n b = 0,\n s = '',\n i,\n j,\n c;\n p = p + '';\n function push() {\n path.push(s + p.substring(i, j));\n s = '';\n i = j + 1;\n }\n for (i = j = 0; j < n; ++j) {\n c = p[j];\n if (c === '\\\\') {\n s += p.substring(i, j++);\n i = j;\n } else if (c === q) {\n push();\n q = null;\n b = -1;\n } else if (q) {\n continue;\n } else if (i === b && c === '\"') {\n i = j + 1;\n q = c;\n } else if (i === b && c === \"'\") {\n i = j + 1;\n q = c;\n } else if (c === '.' && !b) {\n if (j > i) {\n push();\n } else {\n i = j + 1;\n }\n } else if (c === '[') {\n if (j > i) push();\n b = i = j + 1;\n } else if (c === ']') {\n if (!b) error('Access path missing open bracket: ' + p);\n if (b > 0) push();\n b = 0;\n i = j + 1;\n }\n }\n if (b) error('Access path missing closing bracket: ' + p);\n if (q) error('Access path missing closing quote: ' + p);\n if (j > i) {\n j++;\n push();\n }\n return path;\n}\n\nfunction field (field, name, opt) {\n const path = splitAccessPath(field);\n field = path.length === 1 ? path[0] : field;\n return accessor((opt && opt.get || getter)(path), [field], name || field);\n}\n\nconst id = field('id');\nconst identity = accessor(_ => _, [], 'identity');\nconst zero = accessor(() => 0, [], 'zero');\nconst one = accessor(() => 1, [], 'one');\nconst truthy = accessor(() => true, [], 'true');\nconst falsy = accessor(() => false, [], 'false');\n\nfunction log$1(method, level, input) {\n const args = [level].concat([].slice.call(input));\n console[method].apply(console, args); // eslint-disable-line no-console\n}\n\nconst None = 0;\nconst Error$1 = 1;\nconst Warn = 2;\nconst Info = 3;\nconst Debug = 4;\nfunction logger (_, method) {\n let handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : log$1;\n let level = _ || None;\n return {\n level(_) {\n if (arguments.length) {\n level = +_;\n return this;\n } else {\n return level;\n }\n },\n error() {\n if (level >= Error$1) handler(method || 'error', 'ERROR', arguments);\n return this;\n },\n warn() {\n if (level >= Warn) handler(method || 'warn', 'WARN', arguments);\n return this;\n },\n info() {\n if (level >= Info) handler(method || 'log', 'INFO', arguments);\n return this;\n },\n debug() {\n if (level >= Debug) handler(method || 'log', 'DEBUG', arguments);\n return this;\n }\n };\n}\n\nvar isArray = Array.isArray;\n\nfunction isObject (_) {\n return _ === Object(_);\n}\n\nconst isLegalKey = key => key !== '__proto__';\nfunction mergeConfig() {\n for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) {\n configs[_key] = arguments[_key];\n }\n return configs.reduce((out, source) => {\n for (const key in source) {\n if (key === 'signals') {\n // for signals, we merge the signals arrays\n // source signals take precedence over\n // existing signals with the same name\n out.signals = mergeNamed(out.signals, source.signals);\n } else {\n // otherwise, merge objects subject to recursion constraints\n // for legend block, recurse for the layout entry only\n // for style block, recurse for all properties\n // otherwise, no recursion: objects overwrite, no merging\n const r = key === 'legend' ? {\n layout: 1\n } : key === 'style' ? true : null;\n writeConfig(out, key, source[key], r);\n }\n }\n return out;\n }, {});\n}\nfunction writeConfig(output, key, value, recurse) {\n if (!isLegalKey(key)) return;\n let k, o;\n if (isObject(value) && !isArray(value)) {\n o = isObject(output[key]) ? output[key] : output[key] = {};\n for (k in value) {\n if (recurse && (recurse === true || recurse[k])) {\n writeConfig(o, k, value[k]);\n } else if (isLegalKey(k)) {\n o[k] = value[k];\n }\n }\n } else {\n output[key] = value;\n }\n}\nfunction mergeNamed(a, b) {\n if (a == null) return b;\n const map = {},\n out = [];\n function add(_) {\n if (!map[_.name]) {\n map[_.name] = 1;\n out.push(_);\n }\n }\n b.forEach(add);\n a.forEach(add);\n return out;\n}\n\nfunction peek (array) {\n return array[array.length - 1];\n}\n\nfunction toNumber (_) {\n return _ == null || _ === '' ? null : +_;\n}\n\nconst exp = sign => x => sign * Math.exp(x);\nconst log = sign => x => Math.log(sign * x);\nconst symlog = c => x => Math.sign(x) * Math.log1p(Math.abs(x / c));\nconst symexp = c => x => Math.sign(x) * Math.expm1(Math.abs(x)) * c;\nconst pow = exponent => x => x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\nfunction pan(domain, delta, lift, ground) {\n const d0 = lift(domain[0]),\n d1 = lift(peek(domain)),\n dd = (d1 - d0) * delta;\n return [ground(d0 - dd), ground(d1 - dd)];\n}\nfunction panLinear(domain, delta) {\n return pan(domain, delta, toNumber, identity);\n}\nfunction panLog(domain, delta) {\n var sign = Math.sign(domain[0]);\n return pan(domain, delta, log(sign), exp(sign));\n}\nfunction panPow(domain, delta, exponent) {\n return pan(domain, delta, pow(exponent), pow(1 / exponent));\n}\nfunction panSymlog(domain, delta, constant) {\n return pan(domain, delta, symlog(constant), symexp(constant));\n}\nfunction zoom(domain, anchor, scale, lift, ground) {\n const d0 = lift(domain[0]),\n d1 = lift(peek(domain)),\n da = anchor != null ? lift(anchor) : (d0 + d1) / 2;\n return [ground(da + (d0 - da) * scale), ground(da + (d1 - da) * scale)];\n}\nfunction zoomLinear(domain, anchor, scale) {\n return zoom(domain, anchor, scale, toNumber, identity);\n}\nfunction zoomLog(domain, anchor, scale) {\n const sign = Math.sign(domain[0]);\n return zoom(domain, anchor, scale, log(sign), exp(sign));\n}\nfunction zoomPow(domain, anchor, scale, exponent) {\n return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent));\n}\nfunction zoomSymlog(domain, anchor, scale, constant) {\n return zoom(domain, anchor, scale, symlog(constant), symexp(constant));\n}\n\nfunction quarter(date) {\n return 1 + ~~(new Date(date).getMonth() / 3);\n}\nfunction utcquarter(date) {\n return 1 + ~~(new Date(date).getUTCMonth() / 3);\n}\n\nfunction array (_) {\n return _ != null ? isArray(_) ? _ : [_] : [];\n}\n\n/**\n * Span-preserving range clamp. If the span of the input range is less\n * than (max - min) and an endpoint exceeds either the min or max value,\n * the range is translated such that the span is preserved and one\n * endpoint touches the boundary of the min/max range.\n * If the span exceeds (max - min), the range [min, max] is returned.\n */\nfunction clampRange (range, min, max) {\n let lo = range[0],\n hi = range[1],\n span;\n if (hi < lo) {\n span = hi;\n hi = lo;\n lo = span;\n }\n span = hi - lo;\n return span >= max - min ? [min, max] : [lo = Math.min(Math.max(lo, min), max - span), lo + span];\n}\n\nfunction isFunction (_) {\n return typeof _ === 'function';\n}\n\nconst DESCENDING = 'descending';\nfunction compare (fields, orders, opt) {\n opt = opt || {};\n orders = array(orders) || [];\n const ord = [],\n get = [],\n fmap = {},\n gen = opt.comparator || comparator;\n array(fields).forEach((f, i) => {\n if (f == null) return;\n ord.push(orders[i] === DESCENDING ? -1 : 1);\n get.push(f = isFunction(f) ? f : field(f, null, opt));\n (accessorFields(f) || []).forEach(_ => fmap[_] = 1);\n });\n return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap));\n}\nconst ascending = (u, v) => (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0;\nconst comparator = (fields, orders) => fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length);\nconst compare1 = (field, order) => function (a, b) {\n return ascending(field(a), field(b)) * order;\n};\nconst compareN = (fields, orders, n) => {\n orders.push(0); // pad zero for convenient lookup\n return function (a, b) {\n let f,\n c = 0,\n i = -1;\n while (c === 0 && ++i < n) {\n f = fields[i];\n c = ascending(f(a), f(b));\n }\n return c * orders[i];\n };\n};\n\nfunction constant (_) {\n return isFunction(_) ? _ : () => _;\n}\n\nfunction debounce (delay, handler) {\n let tid;\n return e => {\n if (tid) clearTimeout(tid);\n tid = setTimeout(() => (handler(e), tid = null), delay);\n };\n}\n\nfunction extend (_) {\n for (let x, k, i = 1, len = arguments.length; i < len; ++i) {\n x = arguments[i];\n for (k in x) {\n _[k] = x[k];\n }\n }\n return _;\n}\n\n/**\n * Return an array with minimum and maximum values, in the\n * form [min, max]. Ignores null, undefined, and NaN values.\n */\nfunction extent (array, f) {\n let i = 0,\n n,\n v,\n min,\n max;\n if (array && (n = array.length)) {\n if (f == null) {\n // find first valid value\n for (v = array[i]; i < n && (v == null || v !== v); v = array[++i]);\n min = max = v;\n\n // visit all other values\n for (; i < n; ++i) {\n v = array[i];\n // skip null/undefined; NaN will fail all comparisons\n if (v != null) {\n if (v < min) min = v;\n if (v > max) max = v;\n }\n }\n } else {\n // find first valid value\n for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i]));\n min = max = v;\n\n // visit all other values\n for (; i < n; ++i) {\n v = f(array[i]);\n // skip null/undefined; NaN will fail all comparisons\n if (v != null) {\n if (v < min) min = v;\n if (v > max) max = v;\n }\n }\n }\n }\n return [min, max];\n}\n\nfunction extentIndex (array, f) {\n const n = array.length;\n let i = -1,\n a,\n b,\n c,\n u,\n v;\n if (f == null) {\n while (++i < n) {\n b = array[i];\n if (b != null && b >= b) {\n a = c = b;\n break;\n }\n }\n if (i === n) return [-1, -1];\n u = v = i;\n while (++i < n) {\n b = array[i];\n if (b != null) {\n if (a > b) {\n a = b;\n u = i;\n }\n if (c < b) {\n c = b;\n v = i;\n }\n }\n }\n } else {\n while (++i < n) {\n b = f(array[i], i, array);\n if (b != null && b >= b) {\n a = c = b;\n break;\n }\n }\n if (i === n) return [-1, -1];\n u = v = i;\n while (++i < n) {\n b = f(array[i], i, array);\n if (b != null) {\n if (a > b) {\n a = b;\n u = i;\n }\n if (c < b) {\n c = b;\n v = i;\n }\n }\n }\n }\n return [u, v];\n}\n\nconst hop = Object.prototype.hasOwnProperty;\nfunction has (object, property) {\n return hop.call(object, property);\n}\n\nconst NULL = {};\nfunction fastmap (input) {\n let obj = {},\n test;\n function has$1(key) {\n return has(obj, key) && obj[key] !== NULL;\n }\n const map = {\n size: 0,\n empty: 0,\n object: obj,\n has: has$1,\n get(key) {\n return has$1(key) ? obj[key] : undefined;\n },\n set(key, value) {\n if (!has$1(key)) {\n ++map.size;\n if (obj[key] === NULL) --map.empty;\n }\n obj[key] = value;\n return this;\n },\n delete(key) {\n if (has$1(key)) {\n --map.size;\n ++map.empty;\n obj[key] = NULL;\n }\n return this;\n },\n clear() {\n map.size = map.empty = 0;\n map.object = obj = {};\n },\n test(_) {\n if (arguments.length) {\n test = _;\n return map;\n } else {\n return test;\n }\n },\n clean() {\n const next = {};\n let size = 0;\n for (const key in obj) {\n const value = obj[key];\n if (value !== NULL && (!test || !test(value))) {\n next[key] = value;\n ++size;\n }\n }\n map.size = size;\n map.empty = 0;\n map.object = obj = next;\n }\n };\n if (input) Object.keys(input).forEach(key => {\n map.set(key, input[key]);\n });\n return map;\n}\n\nfunction flush (range, value, threshold, left, right, center) {\n if (!threshold && threshold !== 0) return center;\n const t = +threshold;\n let a = range[0],\n b = peek(range),\n l;\n\n // swap endpoints if range is reversed\n if (b < a) {\n l = a;\n a = b;\n b = l;\n }\n\n // compare value to endpoints\n l = Math.abs(value - a);\n const r = Math.abs(b - value);\n\n // adjust if value is within threshold distance of endpoint\n return l < r && l <= t ? left : r <= t ? right : center;\n}\n\nfunction inherits (child, parent, members) {\n const proto = child.prototype = Object.create(parent.prototype);\n Object.defineProperty(proto, 'constructor', {\n value: child,\n writable: true,\n enumerable: true,\n configurable: true\n });\n return extend(proto, members);\n}\n\n/**\n * Predicate that returns true if the value lies within the span\n * of the given range. The left and right flags control the use\n * of inclusive (true) or exclusive (false) comparisons.\n */\nfunction inrange (value, range, left, right) {\n let r0 = range[0],\n r1 = range[range.length - 1],\n t;\n if (r0 > r1) {\n t = r0;\n r0 = r1;\n r1 = t;\n }\n left = left === undefined || left;\n right = right === undefined || right;\n return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1);\n}\n\nfunction isBoolean (_) {\n return typeof _ === 'boolean';\n}\n\nfunction isDate (_) {\n return Object.prototype.toString.call(_) === '[object Date]';\n}\n\nfunction isIterable (_) {\n return _ && isFunction(_[Symbol.iterator]);\n}\n\nfunction isNumber (_) {\n return typeof _ === 'number';\n}\n\nfunction isRegExp (_) {\n return Object.prototype.toString.call(_) === '[object RegExp]';\n}\n\nfunction isString (_) {\n return typeof _ === 'string';\n}\n\nfunction key (fields, flat, opt) {\n if (fields) {\n fields = flat ? array(fields).map(f => f.replace(/\\\\(.)/g, '$1')) : array(fields);\n }\n const len = fields && fields.length,\n gen = opt && opt.get || getter,\n map = f => gen(flat ? [f] : splitAccessPath(f));\n let fn;\n if (!len) {\n fn = function () {\n return '';\n };\n } else if (len === 1) {\n const get = map(fields[0]);\n fn = function (_) {\n return '' + get(_);\n };\n } else {\n const get = fields.map(map);\n fn = function (_) {\n let s = '' + get[0](_),\n i = 0;\n while (++i < len) s += '|' + get[i](_);\n return s;\n };\n }\n return accessor(fn, fields, 'key');\n}\n\nfunction lerp (array, frac) {\n const lo = array[0],\n hi = peek(array),\n f = +frac;\n return !f ? lo : f === 1 ? hi : lo + f * (hi - lo);\n}\n\nconst DEFAULT_MAX_SIZE = 10000;\n\n// adapted from https://github.com/dominictarr/hashlru/ (MIT License)\nfunction lruCache (maxsize) {\n maxsize = +maxsize || DEFAULT_MAX_SIZE;\n let curr, prev, size;\n const clear = () => {\n curr = {};\n prev = {};\n size = 0;\n };\n const update = (key, value) => {\n if (++size > maxsize) {\n prev = curr;\n curr = {};\n size = 1;\n }\n return curr[key] = value;\n };\n clear();\n return {\n clear,\n has: key => has(curr, key) || has(prev, key),\n get: key => has(curr, key) ? curr[key] : has(prev, key) ? update(key, prev[key]) : undefined,\n set: (key, value) => has(curr, key) ? curr[key] = value : update(key, value)\n };\n}\n\nfunction merge (compare, array0, array1, output) {\n const n0 = array0.length,\n n1 = array1.length;\n if (!n1) return array0;\n if (!n0) return array1;\n const merged = output || new array0.constructor(n0 + n1);\n let i0 = 0,\n i1 = 0,\n i = 0;\n for (; i0 < n0 && i1 < n1; ++i) {\n merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++];\n }\n for (; i0 < n0; ++i0, ++i) {\n merged[i] = array0[i0];\n }\n for (; i1 < n1; ++i1, ++i) {\n merged[i] = array1[i1];\n }\n return merged;\n}\n\nfunction repeat (str, reps) {\n let s = '';\n while (--reps >= 0) s += str;\n return s;\n}\n\nfunction pad (str, length, padchar, align) {\n const c = padchar || ' ',\n s = str + '',\n n = length - s.length;\n return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n);\n}\n\n/**\n * Return the numerical span of an array: the difference between\n * the last and first values.\n */\nfunction span (array) {\n return array && peek(array) - array[0] || 0;\n}\n\nfunction $(x) {\n return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ?\n // Output valid JSON and JS source strings.\n // See http://timelessrepo.com/json-isnt-a-javascript-subset\n JSON.stringify(x).replace('\\u2028', '\\\\u2028').replace('\\u2029', '\\\\u2029') : x;\n}\n\nfunction toBoolean (_) {\n return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;\n}\n\nconst defaultParser = _ => isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_);\nfunction toDate (_, parser) {\n parser = parser || defaultParser;\n return _ == null || _ === '' ? null : parser(_);\n}\n\nfunction toString (_) {\n return _ == null || _ === '' ? null : _ + '';\n}\n\nfunction toSet (_) {\n const s = {},\n n = _.length;\n for (let i = 0; i < n; ++i) s[_[i]] = true;\n return s;\n}\n\nfunction truncate (str, length, align, ellipsis) {\n const e = ellipsis != null ? ellipsis : '\\u2026',\n s = str + '',\n n = s.length,\n l = Math.max(0, length - e.length);\n return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e;\n}\n\nfunction visitArray (array, filter, visitor) {\n if (array) {\n if (filter) {\n const n = array.length;\n for (let i = 0; i < n; ++i) {\n const t = filter(array[i]);\n if (t) visitor(t, i, array);\n }\n } else {\n array.forEach(visitor);\n }\n }\n}\n\nexport { Debug, Error$1 as Error, Info, None, Warn, accessor, accessorFields, accessorName, array, ascending, clampRange, compare, constant, debounce, error, extend, extent, extentIndex, falsy, fastmap, field, flush, has as hasOwnProperty, id, identity, inherits, inrange, isArray, isBoolean, isDate, isFunction, isIterable, isNumber, isObject, isRegExp, isString, key, lerp, logger, lruCache, merge, mergeConfig, one, pad, panLinear, panLog, panPow, panSymlog, peek, quarter, repeat, span, splitAccessPath, $ as stringValue, toBoolean, toDate, toNumber, toSet, toString, truncate, truthy, utcquarter, visitArray, writeConfig, zero, zoomLinear, zoomLog, zoomPow, zoomSymlog };\n","var EOL = {},\n EOF = {},\n QUOTE = 34,\n NEWLINE = 10,\n RETURN = 13;\n\nfunction objectConverter(columns) {\n return new Function(\"d\", \"return {\" + columns.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"] || \\\"\\\"\";\n }).join(\",\") + \"}\");\n}\n\nfunction customConverter(columns, f) {\n var object = objectConverter(columns);\n return function(row, i) {\n return f(object(row), i, columns);\n };\n}\n\n// Compute unique columns in order of discovery.\nfunction inferColumns(rows) {\n var columnSet = Object.create(null),\n columns = [];\n\n rows.forEach(function(row) {\n for (var column in row) {\n if (!(column in columnSet)) {\n columns.push(columnSet[column] = column);\n }\n }\n });\n\n return columns;\n}\n\nfunction pad(value, width) {\n var s = value + \"\", length = s.length;\n return length < width ? new Array(width - length + 1).join(0) + s : s;\n}\n\nfunction formatYear(year) {\n return year < 0 ? \"-\" + pad(-year, 6)\n : year > 9999 ? \"+\" + pad(year, 6)\n : pad(year, 4);\n}\n\nfunction formatDate(date) {\n var hours = date.getUTCHours(),\n minutes = date.getUTCMinutes(),\n seconds = date.getUTCSeconds(),\n milliseconds = date.getUTCMilliseconds();\n return isNaN(date) ? \"Invalid Date\"\n : formatYear(date.getUTCFullYear(), 4) + \"-\" + pad(date.getUTCMonth() + 1, 2) + \"-\" + pad(date.getUTCDate(), 2)\n + (milliseconds ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \":\" + pad(seconds, 2) + \".\" + pad(milliseconds, 3) + \"Z\"\n : seconds ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \":\" + pad(seconds, 2) + \"Z\"\n : minutes || hours ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \"Z\"\n : \"\");\n}\n\nexport default function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n\\r]\"),\n DELIMITER = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var convert, columns, rows = parseRows(text, function(row, i) {\n if (convert) return convert(row, i - 1);\n columns = row, convert = f ? customConverter(row, f) : objectConverter(row);\n });\n rows.columns = columns || [];\n return rows;\n }\n\n function parseRows(text, f) {\n var rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // current line number\n t, // current token\n eof = N <= 0, // current token followed by EOF?\n eol = false; // current token followed by EOL?\n\n // Strip the trailing newline.\n if (text.charCodeAt(N - 1) === NEWLINE) --N;\n if (text.charCodeAt(N - 1) === RETURN) --N;\n\n function token() {\n if (eof) return EOF;\n if (eol) return eol = false, EOL;\n\n // Unescape quotes.\n var i, j = I, c;\n if (text.charCodeAt(j) === QUOTE) {\n while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);\n if ((i = I) >= N) eof = true;\n else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n return text.slice(j + 1, i - 1).replace(/\"\"/g, \"\\\"\");\n }\n\n // Find next delimiter or newline.\n while (I < N) {\n if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n else if (c !== DELIMITER) continue;\n return text.slice(j, i);\n }\n\n // Return last token before EOF.\n return eof = true, text.slice(j, N);\n }\n\n while ((t = token()) !== EOF) {\n var row = [];\n while (t !== EOL && t !== EOF) row.push(t), t = token();\n if (f && (row = f(row, n++)) == null) continue;\n rows.push(row);\n }\n\n return rows;\n }\n\n function preformatBody(rows, columns) {\n return rows.map(function(row) {\n return columns.map(function(column) {\n return formatValue(row[column]);\n }).join(delimiter);\n });\n }\n\n function format(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join(\"\\n\");\n }\n\n function formatBody(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return preformatBody(rows, columns).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(value) {\n return value == null ? \"\"\n : value instanceof Date ? formatDate(value)\n : reFormat.test(value += \"\") ? \"\\\"\" + value.replace(/\"/g, \"\\\"\\\"\") + \"\\\"\"\n : value;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatBody: formatBody,\n formatRows: formatRows,\n formatRow: formatRow,\n formatValue: formatValue\n };\n}\n","export default function(x) {\n return x;\n}\n","import reverse from \"./reverse.js\";\nimport transform from \"./transform.js\";\n\nexport default function(topology, o) {\n if (typeof o === \"string\") o = topology.objects[o];\n return o.type === \"GeometryCollection\"\n ? {type: \"FeatureCollection\", features: o.geometries.map(function(o) { return feature(topology, o); })}\n : feature(topology, o);\n}\n\nfunction feature(topology, o) {\n var id = o.id,\n bbox = o.bbox,\n properties = o.properties == null ? {} : o.properties,\n geometry = object(topology, o);\n return id == null && bbox == null ? {type: \"Feature\", properties: properties, geometry: geometry}\n : bbox == null ? {type: \"Feature\", id: id, properties: properties, geometry: geometry}\n : {type: \"Feature\", id: id, bbox: bbox, properties: properties, geometry: geometry};\n}\n\nexport function object(topology, o) {\n var transformPoint = transform(topology.transform),\n arcs = topology.arcs;\n\n function arc(i, points) {\n if (points.length) points.pop();\n for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) {\n points.push(transformPoint(a[k], k));\n }\n if (i < 0) reverse(points, n);\n }\n\n function point(p) {\n return transformPoint(p);\n }\n\n function line(arcs) {\n var points = [];\n for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n if (points.length < 2) points.push(points[0]); // This should never happen per the specification.\n return points;\n }\n\n function ring(arcs) {\n var points = line(arcs);\n while (points.length < 4) points.push(points[0]); // This may happen if an arc has only two points.\n return points;\n }\n\n function polygon(arcs) {\n return arcs.map(ring);\n }\n\n function geometry(o) {\n var type = o.type, coordinates;\n switch (type) {\n case \"GeometryCollection\": return {type: type, geometries: o.geometries.map(geometry)};\n case \"Point\": coordinates = point(o.coordinates); break;\n case \"MultiPoint\": coordinates = o.coordinates.map(point); break;\n case \"LineString\": coordinates = line(o.arcs); break;\n case \"MultiLineString\": coordinates = o.arcs.map(line); break;\n case \"Polygon\": coordinates = polygon(o.arcs); break;\n case \"MultiPolygon\": coordinates = o.arcs.map(polygon); break;\n default: return null;\n }\n return {type: type, coordinates: coordinates};\n }\n\n return geometry(o);\n}\n","import identity from \"./identity.js\";\n\nexport default function(transform) {\n if (transform == null) return identity;\n var x0,\n y0,\n kx = transform.scale[0],\n ky = transform.scale[1],\n dx = transform.translate[0],\n dy = transform.translate[1];\n return function(input, i) {\n if (!i) x0 = y0 = 0;\n var j = 2, n = input.length, output = new Array(n);\n output[0] = (x0 += input[0]) * kx + dx;\n output[1] = (y0 += input[1]) * ky + dy;\n while (j < n) output[j] = input[j], ++j;\n return output;\n };\n}\n","export default function(array, n) {\n var t, j = array.length, i = j - n;\n while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n}\n","export default function(topology, arcs) {\n var stitchedArcs = {},\n fragmentByStart = {},\n fragmentByEnd = {},\n fragments = [],\n emptyIndex = -1;\n\n // Stitch empty arcs first, since they may be subsumed by other arcs.\n arcs.forEach(function(i, j) {\n var arc = topology.arcs[i < 0 ? ~i : i], t;\n if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n }\n });\n\n arcs.forEach(function(i) {\n var e = ends(i),\n start = e[0],\n end = e[1],\n f, g;\n\n if (f = fragmentByEnd[start]) {\n delete fragmentByEnd[f.end];\n f.push(i);\n f.end = end;\n if (g = fragmentByStart[end]) {\n delete fragmentByStart[g.start];\n var fg = g === f ? f : f.concat(g);\n fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else if (f = fragmentByStart[end]) {\n delete fragmentByStart[f.start];\n f.unshift(i);\n f.start = start;\n if (g = fragmentByEnd[start]) {\n delete fragmentByEnd[g.end];\n var gf = g === f ? f : g.concat(f);\n fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else {\n f = [i];\n fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n }\n });\n\n function ends(i) {\n var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });\n else p1 = arc[arc.length - 1];\n return i < 0 ? [p1, p0] : [p0, p1];\n }\n\n function flush(fragmentByEnd, fragmentByStart) {\n for (var k in fragmentByEnd) {\n var f = fragmentByEnd[k];\n delete fragmentByStart[f.start];\n delete f.start;\n delete f.end;\n f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });\n fragments.push(f);\n }\n }\n\n flush(fragmentByEnd, fragmentByStart);\n flush(fragmentByStart, fragmentByEnd);\n arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });\n\n return fragments;\n}\n","import {object} from \"./feature.js\";\nimport stitch from \"./stitch.js\";\n\nexport default function(topology) {\n return object(topology, meshArcs.apply(this, arguments));\n}\n\nexport function meshArcs(topology, object, filter) {\n var arcs, i, n;\n if (arguments.length > 1) arcs = extractArcs(topology, object, filter);\n else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i;\n return {type: \"MultiLineString\", arcs: stitch(topology, arcs)};\n}\n\nfunction extractArcs(topology, object, filter) {\n var arcs = [],\n geomsByArc = [],\n geom;\n\n function extract0(i) {\n var j = i < 0 ? ~i : i;\n (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});\n }\n\n function extract1(arcs) {\n arcs.forEach(extract0);\n }\n\n function extract2(arcs) {\n arcs.forEach(extract1);\n }\n\n function extract3(arcs) {\n arcs.forEach(extract2);\n }\n\n function geometry(o) {\n switch (geom = o, o.type) {\n case \"GeometryCollection\": o.geometries.forEach(geometry); break;\n case \"LineString\": extract1(o.arcs); break;\n case \"MultiLineString\": case \"Polygon\": extract2(o.arcs); break;\n case \"MultiPolygon\": extract3(o.arcs); break;\n }\n }\n\n geometry(object);\n\n geomsByArc.forEach(filter == null\n ? function(geoms) { arcs.push(geoms[0].i); }\n : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });\n\n return arcs;\n}\n","const e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction tickSpec(start, stop, count) {\n const step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log10(step)),\n error = step / Math.pow(10, power),\n factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n let i1, i2, inc;\n if (power < 0) {\n inc = Math.pow(10, -power) / factor;\n i1 = Math.round(start * inc);\n i2 = Math.round(stop * inc);\n if (i1 / inc < start) ++i1;\n if (i2 / inc > stop) --i2;\n inc = -inc;\n } else {\n inc = Math.pow(10, power) * factor;\n i1 = Math.round(start / inc);\n i2 = Math.round(stop / inc);\n if (i1 * inc < start) ++i1;\n if (i2 * inc > stop) --i2;\n }\n if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);\n return [i1, i2, inc];\n}\n\nexport default function ticks(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n if (!(count > 0)) return [];\n if (start === stop) return [start];\n const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);\n if (!(i2 >= i1)) return [];\n const n = i2 - i1 + 1, ticks = new Array(n);\n if (reverse) {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;\n } else {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;\n }\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n return tickSpec(start, stop, count)[2];\n}\n\nexport function tickStep(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);\n}\n","// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n","export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n","import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": (x, p) => (x * 100).toFixed(p),\n \"b\": (x) => Math.round(x).toString(2),\n \"c\": (x) => x + \"\",\n \"d\": formatDecimal,\n \"e\": (x, p) => x.toExponential(p),\n \"f\": (x, p) => x.toFixed(p),\n \"g\": (x, p) => x.toPrecision(p),\n \"o\": (x) => Math.round(x).toString(8),\n \"p\": (x, p) => formatRounded(x * 100, p),\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": (x) => Math.round(x).toString(16).toUpperCase(),\n \"x\": (x) => Math.round(x).toString(16)\n};\n","export default function(x) {\n return x;\n}\n","import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"−\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n","export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n","export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n","// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n","const t0 = new Date, t1 = new Date;\n\nexport function timeInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;\n }\n\n interval.floor = (date) => {\n return floori(date = new Date(+date)), date;\n };\n\n interval.ceil = (date) => {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = (date) => {\n const d0 = interval(date), d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = (date, step) => {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = (start, stop, step) => {\n const range = [];\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n let previous;\n do range.push(previous = new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n\n interval.filter = (test) => {\n return timeInterval((date) => {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, (date, step) => {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = (start, end) => {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n interval.every = (step) => {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? (d) => field(d) % step === 0\n : (d) => interval.count(0, d) % step === 0);\n };\n }\n\n return interval;\n}\n","export const durationSecond = 1000;\nexport const durationMinute = durationSecond * 60;\nexport const durationHour = durationMinute * 60;\nexport const durationDay = durationHour * 24;\nexport const durationWeek = durationDay * 7;\nexport const durationMonth = durationDay * 30;\nexport const durationYear = durationDay * 365;\n","import {timeInterval} from \"./interval.js\";\nimport {durationDay, durationMinute} from \"./duration.js\";\n\nexport const timeDay = timeInterval(\n date => date.setHours(0, 0, 0, 0),\n (date, step) => date.setDate(date.getDate() + step),\n (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,\n date => date.getDate() - 1\n);\n\nexport const timeDays = timeDay.range;\n\nexport const utcDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return date.getUTCDate() - 1;\n});\n\nexport const utcDays = utcDay.range;\n\nexport const unixDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return Math.floor(date / durationDay);\n});\n\nexport const unixDays = unixDay.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationWeek} from \"./duration.js\";\n\nfunction timeWeekday(i) {\n return timeInterval((date) => {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setDate(date.getDate() + step * 7);\n }, (start, end) => {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n}\n\nexport const timeSunday = timeWeekday(0);\nexport const timeMonday = timeWeekday(1);\nexport const timeTuesday = timeWeekday(2);\nexport const timeWednesday = timeWeekday(3);\nexport const timeThursday = timeWeekday(4);\nexport const timeFriday = timeWeekday(5);\nexport const timeSaturday = timeWeekday(6);\n\nexport const timeSundays = timeSunday.range;\nexport const timeMondays = timeMonday.range;\nexport const timeTuesdays = timeTuesday.range;\nexport const timeWednesdays = timeWednesday.range;\nexport const timeThursdays = timeThursday.range;\nexport const timeFridays = timeFriday.range;\nexport const timeSaturdays = timeSaturday.range;\n\nfunction utcWeekday(i) {\n return timeInterval((date) => {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, (start, end) => {\n return (end - start) / durationWeek;\n });\n}\n\nexport const utcSunday = utcWeekday(0);\nexport const utcMonday = utcWeekday(1);\nexport const utcTuesday = utcWeekday(2);\nexport const utcWednesday = utcWeekday(3);\nexport const utcThursday = utcWeekday(4);\nexport const utcFriday = utcWeekday(5);\nexport const utcSaturday = utcWeekday(6);\n\nexport const utcSundays = utcSunday.range;\nexport const utcMondays = utcMonday.range;\nexport const utcTuesdays = utcTuesday.range;\nexport const utcWednesdays = utcWednesday.range;\nexport const utcThursdays = utcThursday.range;\nexport const utcFridays = utcFriday.range;\nexport const utcSaturdays = utcSaturday.range;\n","import {timeInterval} from \"./interval.js\";\n\nexport const timeYear = timeInterval((date) => {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setFullYear(date.getFullYear() + step);\n}, (start, end) => {\n return end.getFullYear() - start.getFullYear();\n}, (date) => {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\ntimeYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nexport const timeYears = timeYear.range;\n\nexport const utcYear = timeInterval((date) => {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, (start, end) => {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, (date) => {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nexport const utcYears = utcYear.range;\n","import {timeInterval} from \"./interval.js\";\n\nexport const timeMonth = timeInterval((date) => {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setMonth(date.getMonth() + step);\n}, (start, end) => {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, (date) => {\n return date.getMonth();\n});\n\nexport const timeMonths = timeMonth.range;\n\nexport const utcMonth = timeInterval((date) => {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, (start, end) => {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, (date) => {\n return date.getUTCMonth();\n});\n\nexport const utcMonths = utcMonth.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationHour, durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeHour = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getHours();\n});\n\nexport const timeHours = timeHour.range;\n\nexport const utcHour = timeInterval((date) => {\n date.setUTCMinutes(0, 0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getUTCHours();\n});\n\nexport const utcHours = utcHour.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeMinute = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getMinutes();\n});\n\nexport const timeMinutes = timeMinute.range;\n\nexport const utcMinute = timeInterval((date) => {\n date.setUTCSeconds(0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getUTCMinutes();\n});\n\nexport const utcMinutes = utcMinute.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationSecond} from \"./duration.js\";\n\nexport const second = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds());\n}, (date, step) => {\n date.setTime(+date + step * durationSecond);\n}, (start, end) => {\n return (end - start) / durationSecond;\n}, (date) => {\n return date.getUTCSeconds();\n});\n\nexport const seconds = second.range;\n","import {timeInterval} from \"./interval.js\";\n\nexport const millisecond = timeInterval(() => {\n // noop\n}, (date, step) => {\n date.setTime(+date + step);\n}, (start, end) => {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = (k) => {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return timeInterval((date) => {\n date.setTime(Math.floor(date / k) * k);\n }, (date, step) => {\n date.setTime(+date + step * k);\n }, (start, end) => {\n return (end - start) / k;\n });\n};\n\nexport const milliseconds = millisecond.range;\n","export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n","import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can’t do this\n // for a comparator (except for specific, known comparators) because we can’t\n // tell if the comparator is symmetric, and an asymmetric comparator can’t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n","import { array, error, hasOwnProperty, extend, peek, toSet, constant, zero, one, span } from 'vega-util';\nimport { timeDay, timeWeek, utcDay, utcWeek, timeYear, timeMonth, timeHour, timeMinute, timeSecond, timeMillisecond, utcYear, utcMonth, utcHour, utcMinute, utcSecond, utcMillisecond } from 'd3-time';\nimport { bisector, tickStep } from 'd3-array';\n\nconst YEAR = 'year';\nconst QUARTER = 'quarter';\nconst MONTH = 'month';\nconst WEEK = 'week';\nconst DATE = 'date';\nconst DAY = 'day';\nconst DAYOFYEAR = 'dayofyear';\nconst HOURS = 'hours';\nconst MINUTES = 'minutes';\nconst SECONDS = 'seconds';\nconst MILLISECONDS = 'milliseconds';\nconst TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS];\nconst UNITS = TIME_UNITS.reduce((o, u, i) => (o[u] = 1 + i, o), {});\nfunction timeUnits(units) {\n const u = array(units).slice(),\n m = {};\n\n // check validity\n if (!u.length) error('Missing time unit.');\n u.forEach(unit => {\n if (hasOwnProperty(UNITS, unit)) {\n m[unit] = 1;\n } else {\n error(`Invalid time unit: ${unit}.`);\n }\n });\n const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0);\n if (numTypes > 1) {\n error(`Incompatible time units: ${units}`);\n }\n\n // ensure proper sort order\n u.sort((a, b) => UNITS[a] - UNITS[b]);\n return u;\n}\nconst defaultSpecifiers = {\n [YEAR]: '%Y ',\n [QUARTER]: 'Q%q ',\n [MONTH]: '%b ',\n [DATE]: '%d ',\n [WEEK]: 'W%U ',\n [DAY]: '%a ',\n [DAYOFYEAR]: '%j ',\n [HOURS]: '%H:00',\n [MINUTES]: '00:%M',\n [SECONDS]: ':%S',\n [MILLISECONDS]: '.%L',\n [`${YEAR}-${MONTH}`]: '%Y-%m ',\n [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ',\n [`${HOURS}-${MINUTES}`]: '%H:%M'\n};\nfunction timeUnitSpecifier(units, specifiers) {\n const s = extend({}, defaultSpecifiers, specifiers),\n u = timeUnits(units),\n n = u.length;\n let fmt = '',\n start = 0,\n end,\n key;\n for (start = 0; start < n;) {\n for (end = u.length; end > start; --end) {\n key = u.slice(start, end).join('-');\n if (s[key] != null) {\n fmt += s[key];\n start = end;\n break;\n }\n }\n }\n return fmt.trim();\n}\n\nconst t0 = new Date();\nfunction localYear(y) {\n t0.setFullYear(y);\n t0.setMonth(0);\n t0.setDate(1);\n t0.setHours(0, 0, 0, 0);\n return t0;\n}\nfunction dayofyear(d) {\n return localDayOfYear(new Date(d));\n}\nfunction week(d) {\n return localWeekNum(new Date(d));\n}\nfunction localDayOfYear(d) {\n return timeDay.count(localYear(d.getFullYear()) - 1, d);\n}\nfunction localWeekNum(d) {\n return timeWeek.count(localYear(d.getFullYear()) - 1, d);\n}\nfunction localFirst(y) {\n return localYear(y).getDay();\n}\nfunction localDate(y, m, d, H, M, S, L) {\n if (0 <= y && y < 100) {\n const date = new Date(-1, m, d, H, M, S, L);\n date.setFullYear(y);\n return date;\n }\n return new Date(y, m, d, H, M, S, L);\n}\nfunction utcdayofyear(d) {\n return utcDayOfYear(new Date(d));\n}\nfunction utcweek(d) {\n return utcWeekNum(new Date(d));\n}\nfunction utcDayOfYear(d) {\n const y = Date.UTC(d.getUTCFullYear(), 0, 1);\n return utcDay.count(y - 1, d);\n}\nfunction utcWeekNum(d) {\n const y = Date.UTC(d.getUTCFullYear(), 0, 1);\n return utcWeek.count(y - 1, d);\n}\nfunction utcFirst(y) {\n t0.setTime(Date.UTC(y, 0, 1));\n return t0.getUTCDay();\n}\nfunction utcDate(y, m, d, H, M, S, L) {\n if (0 <= y && y < 100) {\n const date = new Date(Date.UTC(-1, m, d, H, M, S, L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(y, m, d, H, M, S, L));\n}\n\nfunction floor(units, step, get, inv, newDate) {\n const s = step || 1,\n b = peek(units),\n _ = (unit, p, key) => {\n key = key || unit;\n return getUnit(get[key], inv[key], unit === b && s, p);\n };\n const t = new Date(),\n u = toSet(units),\n y = u[YEAR] ? _(YEAR) : constant(2012),\n m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : zero,\n d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one,\n H = u[HOURS] ? _(HOURS) : zero,\n M = u[MINUTES] ? _(MINUTES) : zero,\n S = u[SECONDS] ? _(SECONDS) : zero,\n L = u[MILLISECONDS] ? _(MILLISECONDS) : zero;\n return function (v) {\n t.setTime(+v);\n const year = y(t);\n return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t));\n };\n}\nfunction getUnit(f, inv, step, phase) {\n const u = step <= 1 ? f : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) : (d, y) => step * Math.floor(f(d, y) / step);\n return inv ? (d, y) => inv(u(d, y), y) : u;\n}\n\n// returns the day of the year based on week number, day of week,\n// and the day of the week for the first day of the year\nfunction weekday(week, day, firstDay) {\n return day + week * 7 - (firstDay + 6) % 7;\n}\n\n// -- LOCAL TIME --\n\nconst localGet = {\n [YEAR]: d => d.getFullYear(),\n [QUARTER]: d => Math.floor(d.getMonth() / 3),\n [MONTH]: d => d.getMonth(),\n [DATE]: d => d.getDate(),\n [HOURS]: d => d.getHours(),\n [MINUTES]: d => d.getMinutes(),\n [SECONDS]: d => d.getSeconds(),\n [MILLISECONDS]: d => d.getMilliseconds(),\n [DAYOFYEAR]: d => localDayOfYear(d),\n [WEEK]: d => localWeekNum(d),\n [WEEK + DAY]: (d, y) => weekday(localWeekNum(d), d.getDay(), localFirst(y)),\n [DAY]: (d, y) => weekday(1, d.getDay(), localFirst(y))\n};\nconst localInv = {\n [QUARTER]: q => 3 * q,\n [WEEK]: (w, y) => weekday(w, 0, localFirst(y))\n};\nfunction timeFloor(units, step) {\n return floor(units, step || 1, localGet, localInv, localDate);\n}\n\n// -- UTC TIME --\n\nconst utcGet = {\n [YEAR]: d => d.getUTCFullYear(),\n [QUARTER]: d => Math.floor(d.getUTCMonth() / 3),\n [MONTH]: d => d.getUTCMonth(),\n [DATE]: d => d.getUTCDate(),\n [HOURS]: d => d.getUTCHours(),\n [MINUTES]: d => d.getUTCMinutes(),\n [SECONDS]: d => d.getUTCSeconds(),\n [MILLISECONDS]: d => d.getUTCMilliseconds(),\n [DAYOFYEAR]: d => utcDayOfYear(d),\n [WEEK]: d => utcWeekNum(d),\n [DAY]: (d, y) => weekday(1, d.getUTCDay(), utcFirst(y)),\n [WEEK + DAY]: (d, y) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y))\n};\nconst utcInv = {\n [QUARTER]: q => 3 * q,\n [WEEK]: (w, y) => weekday(w, 0, utcFirst(y))\n};\nfunction utcFloor(units, step) {\n return floor(units, step || 1, utcGet, utcInv, utcDate);\n}\n\nconst timeIntervals = {\n [YEAR]: timeYear,\n [QUARTER]: timeMonth.every(3),\n [MONTH]: timeMonth,\n [WEEK]: timeWeek,\n [DATE]: timeDay,\n [DAY]: timeDay,\n [DAYOFYEAR]: timeDay,\n [HOURS]: timeHour,\n [MINUTES]: timeMinute,\n [SECONDS]: timeSecond,\n [MILLISECONDS]: timeMillisecond\n};\nconst utcIntervals = {\n [YEAR]: utcYear,\n [QUARTER]: utcMonth.every(3),\n [MONTH]: utcMonth,\n [WEEK]: utcWeek,\n [DATE]: utcDay,\n [DAY]: utcDay,\n [DAYOFYEAR]: utcDay,\n [HOURS]: utcHour,\n [MINUTES]: utcMinute,\n [SECONDS]: utcSecond,\n [MILLISECONDS]: utcMillisecond\n};\nfunction timeInterval(unit) {\n return timeIntervals[unit];\n}\nfunction utcInterval(unit) {\n return utcIntervals[unit];\n}\nfunction offset(ival, date, step) {\n return ival ? ival.offset(date, step) : undefined;\n}\nfunction timeOffset(unit, date, step) {\n return offset(timeInterval(unit), date, step);\n}\nfunction utcOffset(unit, date, step) {\n return offset(utcInterval(unit), date, step);\n}\nfunction sequence(ival, start, stop, step) {\n return ival ? ival.range(start, stop, step) : undefined;\n}\nfunction timeSequence(unit, start, stop, step) {\n return sequence(timeInterval(unit), start, stop, step);\n}\nfunction utcSequence(unit, start, stop, step) {\n return sequence(utcInterval(unit), start, stop, step);\n}\n\nconst durationSecond = 1000,\n durationMinute = durationSecond * 60,\n durationHour = durationMinute * 60,\n durationDay = durationHour * 24,\n durationWeek = durationDay * 7,\n durationMonth = durationDay * 30,\n durationYear = durationDay * 365;\nconst Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS],\n Seconds = Milli.slice(0, -1),\n Minutes = Seconds.slice(0, -1),\n Hours = Minutes.slice(0, -1),\n Day = Hours.slice(0, -1),\n Week = [YEAR, WEEK],\n Month = [YEAR, MONTH],\n Year = [YEAR];\nconst intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]];\nfunction bin (opt) {\n const ext = opt.extent,\n max = opt.maxbins || 40,\n target = Math.abs(span(ext)) / max;\n let i = bisector(i => i[2]).right(intervals, target),\n units,\n step;\n if (i === intervals.length) {\n units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max);\n } else if (i) {\n i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i];\n units = i[0];\n step = i[1];\n } else {\n units = Milli;\n step = Math.max(tickStep(ext[0], ext[1], max), 1);\n }\n return {\n units,\n step\n };\n}\n\nexport { DATE, DAY, DAYOFYEAR, HOURS, MILLISECONDS, MINUTES, MONTH, QUARTER, SECONDS, TIME_UNITS, WEEK, YEAR, dayofyear, bin as timeBin, timeFloor, timeInterval, timeOffset, timeSequence, timeUnitSpecifier, timeUnits, utcFloor, utcInterval, utcOffset, utcSequence, utcdayofyear, utcweek, week };\n","import {\n timeDay,\n timeSunday,\n timeMonday,\n timeThursday,\n timeYear,\n utcDay,\n utcSunday,\n utcMonday,\n utcThursday,\n utcYear\n} from \"d3-time\";\n\nfunction localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n}\n\nfunction utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n}\n\nfunction newDate(y, m, d) {\n return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};\n}\n\nexport default function formatLocale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodRe = formatRe(locale_periods),\n periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"f\": formatMicroseconds,\n \"g\": formatYearISO,\n \"G\": formatFullYearISO,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"q\": formatQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatSeconds,\n \"u\": formatWeekdayNumberMonday,\n \"U\": formatWeekNumberSunday,\n \"V\": formatWeekNumberISO,\n \"w\": formatWeekdayNumberSunday,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"f\": formatUTCMicroseconds,\n \"g\": formatUTCYearISO,\n \"G\": formatUTCFullYearISO,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"q\": formatUTCQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatUTCSeconds,\n \"u\": formatUTCWeekdayNumberMonday,\n \"U\": formatUTCWeekNumberSunday,\n \"V\": formatUTCWeekNumberISO,\n \"w\": formatUTCWeekdayNumberSunday,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"f\": parseMicroseconds,\n \"g\": parseYear,\n \"G\": parseFullYear,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"q\": parseQuarter,\n \"Q\": parseUnixTimestamp,\n \"s\": parseUnixTimestampSeconds,\n \"S\": parseSeconds,\n \"u\": parseWeekdayNumberMonday,\n \"U\": parseWeekNumberSunday,\n \"V\": parseWeekNumberISO,\n \"w\": parseWeekdayNumberSunday,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n if (!(date instanceof Date)) date = new Date(+date);\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad = c === \"e\" ? \" \" : \"0\";\n if (format = formats[c]) c = format(date, pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, Z) {\n return function(string) {\n var d = newDate(1900, undefined, 1),\n i = parseSpecifier(d, specifier, string += \"\", 0),\n week, day;\n if (i != string.length) return null;\n\n // If a UNIX timestamp is specified, return it.\n if (\"Q\" in d) return new Date(d.Q);\n if (\"s\" in d) return new Date(d.s * 1000 + (\"L\" in d ? d.L : 0));\n\n // If this is utcParse, never use the local timezone.\n if (Z && !(\"Z\" in d)) d.Z = 0;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If the month was not specified, inherit from the quarter.\n if (d.m === undefined) d.m = \"q\" in d ? d.q : 0;\n\n // Convert day-of-week and week-of-year to day-of-year.\n if (\"V\" in d) {\n if (d.V < 1 || d.V > 53) return null;\n if (!(\"w\" in d)) d.w = 1;\n if (\"Z\" in d) {\n week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();\n week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);\n week = utcDay.offset(week, (d.V - 1) * 7);\n d.y = week.getUTCFullYear();\n d.m = week.getUTCMonth();\n d.d = week.getUTCDate() + (d.w + 6) % 7;\n } else {\n week = localDate(newDate(d.y, 0, 1)), day = week.getDay();\n week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);\n week = timeDay.offset(week, (d.V - 1) * 7);\n d.y = week.getFullYear();\n d.m = week.getMonth();\n d.d = week.getDate() + (d.w + 6) % 7;\n }\n } else if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"u\" in d ? d.u % 7 : \"W\" in d ? 1 : 0;\n day = \"Z\" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;\n }\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n return localDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatQuarter(d) {\n return 1 + ~~(d.getMonth() / 3);\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n function formatUTCQuarter(d) {\n return 1 + ~~(d.getUTCMonth() / 3);\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() { return specifier; };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", false);\n p.toString = function() { return specifier; };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() { return specifier; };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier += \"\", true);\n p.toString = function() { return specifier; };\n return p;\n }\n };\n}\n\nvar pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"},\n numberRe = /^\\s*\\d+/, // note: ignores next directive\n percentRe = /^%/,\n requoteRe = /[\\\\^$*+?|[\\]().{}]/g;\n\nfunction pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n}\n\nfunction requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n}\n\nfunction formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n}\n\nfunction formatLookup(names) {\n return new Map(names.map((name, i) => [name.toLowerCase(), i]));\n}\n\nfunction parseWeekdayNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekdayNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.u = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberISO(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.V = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n}\n\nfunction parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n}\n\nfunction parseQuarter(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;\n}\n\nfunction parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n}\n\nfunction parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMicroseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 6));\n return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;\n}\n\nfunction parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n}\n\nfunction parseUnixTimestamp(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.Q = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseUnixTimestampSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.s = +n[0], i + n[0].length) : -1;\n}\n\nfunction formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n}\n\nfunction formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n}\n\nfunction formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n}\n\nfunction formatDayOfYear(d, p) {\n return pad(1 + timeDay.count(timeYear(d), d), p, 3);\n}\n\nfunction formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n}\n\nfunction formatMicroseconds(d, p) {\n return formatMilliseconds(d, p) + \"000\";\n}\n\nfunction formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n}\n\nfunction formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n}\n\nfunction formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n}\n\nfunction formatWeekdayNumberMonday(d) {\n var day = d.getDay();\n return day === 0 ? 7 : day;\n}\n\nfunction formatWeekNumberSunday(d, p) {\n return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction dISO(d) {\n var day = d.getDay();\n return (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n}\n\nfunction formatWeekNumberISO(d, p) {\n d = dISO(d);\n return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);\n}\n\nfunction formatWeekdayNumberSunday(d) {\n return d.getDay();\n}\n\nfunction formatWeekNumberMonday(d, p) {\n return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatYearISO(d, p) {\n d = dISO(d);\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatFullYearISO(d, p) {\n var day = d.getDay();\n d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n}\n\nfunction formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n}\n\nfunction formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n}\n\nfunction formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n}\n\nfunction formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n}\n\nfunction formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n}\n\nfunction formatUTCMicroseconds(d, p) {\n return formatUTCMilliseconds(d, p) + \"000\";\n}\n\nfunction formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n}\n\nfunction formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n}\n\nfunction formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n}\n\nfunction formatUTCWeekdayNumberMonday(d) {\n var dow = d.getUTCDay();\n return dow === 0 ? 7 : dow;\n}\n\nfunction formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction UTCdISO(d) {\n var day = d.getUTCDay();\n return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n}\n\nfunction formatUTCWeekNumberISO(d, p) {\n d = UTCdISO(d);\n return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);\n}\n\nfunction formatUTCWeekdayNumberSunday(d) {\n return d.getUTCDay();\n}\n\nfunction formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCYearISO(d, p) {\n d = UTCdISO(d);\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCFullYearISO(d, p) {\n var day = d.getUTCDay();\n d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCZone() {\n return \"+0000\";\n}\n\nfunction formatLiteralPercent() {\n return \"%\";\n}\n\nfunction formatUnixTimestamp(d) {\n return +d;\n}\n\nfunction formatUnixTimestampSeconds(d) {\n return Math.floor(+d / 1000);\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var timeFormat;\nexport var timeParse;\nexport var utcFormat;\nexport var utcParse;\n\ndefaultLocale({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n timeFormat = locale.format;\n timeParse = locale.parse;\n utcFormat = locale.utcFormat;\n utcParse = locale.utcParse;\n return locale;\n}\n","import { tickStep } from 'd3-array';\nimport { formatSpecifier, precisionFixed, precisionRound, precisionPrefix, format, formatPrefix, formatLocale } from 'd3-format';\nimport { SECONDS, MINUTES, HOURS, DATE, WEEK, MONTH, QUARTER, YEAR, MILLISECONDS, DAY, timeInterval, utcInterval } from 'vega-time';\nimport { isString, isObject, error, extend } from 'vega-util';\nimport { timeFormat, timeParse, utcFormat, utcParse, timeFormatLocale as timeFormatLocale$1 } from 'd3-time-format';\n\nfunction memoize (method) {\n const cache = {};\n return spec => cache[spec] || (cache[spec] = method(spec));\n}\n\nfunction trimZeroes(numberFormat, decimalChar) {\n return x => {\n const str = numberFormat(x),\n dec = str.indexOf(decimalChar);\n if (dec < 0) return str;\n let idx = rightmostDigit(str, dec);\n const end = idx < str.length ? str.slice(idx) : '';\n while (--idx > dec) if (str[idx] !== '0') {\n ++idx;\n break;\n }\n return str.slice(0, idx) + end;\n };\n}\nfunction rightmostDigit(str, dec) {\n let i = str.lastIndexOf('e'),\n c;\n if (i > 0) return i;\n for (i = str.length; --i > dec;) {\n c = str.charCodeAt(i);\n if (c >= 48 && c <= 57) return i + 1; // is digit\n }\n}\n\nfunction numberLocale(locale) {\n const format = memoize(locale.format),\n formatPrefix = locale.formatPrefix;\n return {\n format,\n formatPrefix,\n formatFloat(spec) {\n const s = formatSpecifier(spec || ',');\n if (s.precision == null) {\n s.precision = 12;\n switch (s.type) {\n case '%':\n s.precision -= 2;\n break;\n case 'e':\n s.precision -= 1;\n break;\n }\n return trimZeroes(format(s),\n // number format\n format('.1f')(1)[1] // decimal point character\n );\n } else {\n return format(s);\n }\n },\n formatSpan(start, stop, count, specifier) {\n specifier = formatSpecifier(specifier == null ? ',f' : specifier);\n const step = tickStep(start, stop, count),\n value = Math.max(Math.abs(start), Math.abs(stop));\n let precision;\n if (specifier.precision == null) {\n switch (specifier.type) {\n case 's':\n {\n if (!isNaN(precision = precisionPrefix(step, value))) {\n specifier.precision = precision;\n }\n return formatPrefix(specifier, value);\n }\n case '':\n case 'e':\n case 'g':\n case 'p':\n case 'r':\n {\n if (!isNaN(precision = precisionRound(step, value))) {\n specifier.precision = precision - (specifier.type === 'e');\n }\n break;\n }\n case 'f':\n case '%':\n {\n if (!isNaN(precision = precisionFixed(step))) {\n specifier.precision = precision - (specifier.type === '%') * 2;\n }\n break;\n }\n }\n }\n return format(specifier);\n }\n };\n}\nlet defaultNumberLocale;\nresetNumberFormatDefaultLocale();\nfunction resetNumberFormatDefaultLocale() {\n return defaultNumberLocale = numberLocale({\n format: format,\n formatPrefix: formatPrefix\n });\n}\nfunction numberFormatLocale(definition) {\n return numberLocale(formatLocale(definition));\n}\nfunction numberFormatDefaultLocale(definition) {\n return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale;\n}\n\nfunction timeMultiFormat(format, interval, spec) {\n spec = spec || {};\n if (!isObject(spec)) {\n error(`Invalid time multi-format specifier: ${spec}`);\n }\n const second = interval(SECONDS),\n minute = interval(MINUTES),\n hour = interval(HOURS),\n day = interval(DATE),\n week = interval(WEEK),\n month = interval(MONTH),\n quarter = interval(QUARTER),\n year = interval(YEAR),\n L = format(spec[MILLISECONDS] || '.%L'),\n S = format(spec[SECONDS] || ':%S'),\n M = format(spec[MINUTES] || '%I:%M'),\n H = format(spec[HOURS] || '%I %p'),\n d = format(spec[DATE] || spec[DAY] || '%a %d'),\n w = format(spec[WEEK] || '%b %d'),\n m = format(spec[MONTH] || '%B'),\n q = format(spec[QUARTER] || '%B'),\n y = format(spec[YEAR] || '%Y');\n return date => (second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date);\n}\nfunction timeLocale(locale) {\n const timeFormat = memoize(locale.format),\n utcFormat = memoize(locale.utcFormat);\n return {\n timeFormat: spec => isString(spec) ? timeFormat(spec) : timeMultiFormat(timeFormat, timeInterval, spec),\n utcFormat: spec => isString(spec) ? utcFormat(spec) : timeMultiFormat(utcFormat, utcInterval, spec),\n timeParse: memoize(locale.parse),\n utcParse: memoize(locale.utcParse)\n };\n}\nlet defaultTimeLocale;\nresetTimeFormatDefaultLocale();\nfunction resetTimeFormatDefaultLocale() {\n return defaultTimeLocale = timeLocale({\n format: timeFormat,\n parse: timeParse,\n utcFormat: utcFormat,\n utcParse: utcParse\n });\n}\nfunction timeFormatLocale(definition) {\n return timeLocale(timeFormatLocale$1(definition));\n}\nfunction timeFormatDefaultLocale(definition) {\n return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale;\n}\n\nconst createLocale = (number, time) => extend({}, number, time);\nfunction locale(numberSpec, timeSpec) {\n const number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale();\n const time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale();\n return createLocale(number, time);\n}\nfunction defaultLocale(numberSpec, timeSpec) {\n const args = arguments.length;\n if (args && args !== 2) {\n error('defaultLocale expects either zero or two arguments.');\n }\n return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale());\n}\nfunction resetDefaultLocale() {\n resetNumberFormatDefaultLocale();\n resetTimeFormatDefaultLocale();\n return defaultLocale();\n}\n\nexport { defaultLocale, locale, numberFormatDefaultLocale, numberFormatLocale, resetDefaultLocale, resetNumberFormatDefaultLocale, resetTimeFormatDefaultLocale, timeFormatDefaultLocale, timeFormatLocale };\n","import { extend, error, stringValue, isFunction, toBoolean, toNumber, toDate, toString, identity, field, isObject, isArray, isIterable, hasOwnProperty } from 'vega-util';\nimport { dsvFormat } from 'd3-dsv';\nimport { feature, mesh } from 'topojson-client';\nimport { timeFormatDefaultLocale } from 'vega-format';\n\n// Matches absolute URLs with optional protocol\n// https://... file://... //...\nconst protocol_re = /^(data:|([A-Za-z]+:)?\\/\\/)/;\n\n// Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file://\nconst allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i; // eslint-disable-line no-useless-escape\nconst whitespace_re = /[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205f\\u3000]/g; // eslint-disable-line no-control-regex\n\n// Special treatment in node.js for the file: protocol\nconst fileProtocol = 'file://';\n\n/**\n * Factory for a loader constructor that provides methods for requesting\n * files from either the network or disk, and for sanitizing request URIs.\n * @param {function} fetch - The Fetch API for HTTP network requests.\n * If null or undefined, HTTP loading will be disabled.\n * @param {object} fs - The file system interface for file loading.\n * If null or undefined, local file loading will be disabled.\n * @return {function} A loader constructor with the following signature:\n * param {object} [options] - Optional default loading options to use.\n * return {object} - A new loader instance.\n */\nfunction loaderFactory (fetch, fs) {\n return options => ({\n options: options || {},\n sanitize: sanitize,\n load: load,\n fileAccess: !!fs,\n file: fileLoader(fs),\n http: httpLoader(fetch)\n });\n}\n\n/**\n * Load an external resource, typically either from the web or from the local\n * filesystem. This function uses {@link sanitize} to first sanitize the uri,\n * then calls either {@link http} (for web requests) or {@link file} (for\n * filesystem loading).\n * @param {string} uri - The resource indicator (e.g., URL or filename).\n * @param {object} [options] - Optional loading options. These options will\n * override any existing default options.\n * @return {Promise} - A promise that resolves to the loaded content.\n */\nasync function load(uri, options) {\n const opt = await this.sanitize(uri, options),\n url = opt.href;\n return opt.localFile ? this.file(url) : this.http(url, options);\n}\n\n/**\n * URI sanitizer function.\n * @param {string} uri - The uri (url or filename) to check.\n * @param {object} options - An options hash.\n * @return {Promise} - A promise that resolves to an object containing\n * sanitized uri data, or rejects it the input uri is deemed invalid.\n * The properties of the resolved object are assumed to be\n * valid attributes for an HTML 'a' tag. The sanitized uri *must* be\n * provided by the 'href' property of the returned object.\n */\nasync function sanitize(uri, options) {\n options = extend({}, this.options, options);\n const fileAccess = this.fileAccess,\n result = {\n href: null\n };\n let isFile, loadFile, base;\n const isAllowed = allowed_re.test(uri.replace(whitespace_re, ''));\n if (uri == null || typeof uri !== 'string' || !isAllowed) {\n error('Sanitize failure, invalid URI: ' + stringValue(uri));\n }\n const hasProtocol = protocol_re.test(uri);\n\n // if relative url (no protocol/host), prepend baseURL\n if ((base = options.baseURL) && !hasProtocol) {\n // Ensure that there is a slash between the baseURL (e.g. hostname) and url\n if (!uri.startsWith('/') && !base.endsWith('/')) {\n uri = '/' + uri;\n }\n uri = base + uri;\n }\n\n // should we load from file system?\n loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess;\n if (isFile) {\n // strip file protocol\n uri = uri.slice(fileProtocol.length);\n } else if (uri.startsWith('//')) {\n if (options.defaultProtocol === 'file') {\n // if is file, strip protocol and set loadFile flag\n uri = uri.slice(2);\n loadFile = true;\n } else {\n // if relative protocol (starts with '//'), prepend default protocol\n uri = (options.defaultProtocol || 'http') + ':' + uri;\n }\n }\n\n // set non-enumerable mode flag to indicate local file load\n Object.defineProperty(result, 'localFile', {\n value: !!loadFile\n });\n\n // set uri\n result.href = uri;\n\n // set default result target, if specified\n if (options.target) {\n result.target = options.target + '';\n }\n\n // set default result rel, if specified (#1542)\n if (options.rel) {\n result.rel = options.rel + '';\n }\n\n // provide control over cross-origin image handling (#2238)\n // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image\n if (options.context === 'image' && options.crossOrigin) {\n result.crossOrigin = options.crossOrigin + '';\n }\n\n // return\n return result;\n}\n\n/**\n * File system loader factory.\n * @param {object} fs - The file system interface.\n * @return {function} - A file loader with the following signature:\n * param {string} filename - The file system path to load.\n * param {string} filename - The file system path to load.\n * return {Promise} A promise that resolves to the file contents.\n */\nfunction fileLoader(fs) {\n return fs ? filename => new Promise((accept, reject) => {\n fs.readFile(filename, (error, data) => {\n if (error) reject(error);else accept(data);\n });\n }) : fileReject;\n}\n\n/**\n * Default file system loader that simply rejects.\n */\nasync function fileReject() {\n error('No file system access.');\n}\n\n/**\n * HTTP request handler factory.\n * @param {function} fetch - The Fetch API method.\n * @return {function} - An http loader with the following signature:\n * param {string} url - The url to request.\n * param {object} options - An options hash.\n * return {Promise} - A promise that resolves to the file contents.\n */\nfunction httpLoader(fetch) {\n return fetch ? async function (url, options) {\n const opt = extend({}, this.options.http, options),\n type = options && options.response,\n response = await fetch(url, opt);\n return !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text();\n } : httpReject;\n}\n\n/**\n * Default http request handler that simply rejects.\n */\nasync function httpReject() {\n error('No HTTP fetch method available.');\n}\n\nconst isValid = _ => _ != null && _ === _;\nconst isBoolean = _ => _ === 'true' || _ === 'false' || _ === true || _ === false;\nconst isDate = _ => !Number.isNaN(Date.parse(_));\nconst isNumber = _ => !Number.isNaN(+_) && !(_ instanceof Date);\nconst isInteger = _ => isNumber(_) && Number.isInteger(+_);\nconst typeParsers = {\n boolean: toBoolean,\n integer: toNumber,\n number: toNumber,\n date: toDate,\n string: toString,\n unknown: identity\n};\nconst typeTests = [isBoolean, isInteger, isNumber, isDate];\nconst typeList = ['boolean', 'integer', 'number', 'date'];\nfunction inferType(values, field) {\n if (!values || !values.length) return 'unknown';\n const n = values.length,\n m = typeTests.length,\n a = typeTests.map((_, i) => i + 1);\n for (let i = 0, t = 0, j, value; i < n; ++i) {\n value = field ? values[i][field] : values[i];\n for (j = 0; j < m; ++j) {\n if (a[j] && isValid(value) && !typeTests[j](value)) {\n a[j] = 0;\n ++t;\n if (t === typeTests.length) return 'string';\n }\n }\n }\n return typeList[a.reduce((u, v) => u === 0 ? v : u, 0) - 1];\n}\nfunction inferTypes(data, fields) {\n return fields.reduce((types, field) => {\n types[field] = inferType(data, field);\n return types;\n }, {});\n}\n\nfunction delimitedFormat(delimiter) {\n const parse = function (data, format) {\n const delim = {\n delimiter: delimiter\n };\n return dsv(data, format ? extend(format, delim) : delim);\n };\n parse.responseType = 'text';\n return parse;\n}\nfunction dsv(data, format) {\n if (format.header) {\n data = format.header.map(stringValue).join(format.delimiter) + '\\n' + data;\n }\n return dsvFormat(format.delimiter).parse(data + '');\n}\ndsv.responseType = 'text';\n\nfunction isBuffer(_) {\n return typeof Buffer === 'function' && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false;\n}\nfunction json(data, format) {\n const prop = format && format.property ? field(format.property) : identity;\n return isObject(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data));\n}\njson.responseType = 'json';\nfunction parseJSON(data, format) {\n if (!isArray(data) && isIterable(data)) {\n data = [...data];\n }\n return format && format.copy ? JSON.parse(JSON.stringify(data)) : data;\n}\n\nconst filters = {\n interior: (a, b) => a !== b,\n exterior: (a, b) => a === b\n};\nfunction topojson(data, format) {\n let method, object, property, filter;\n data = json(data, format);\n if (format && format.feature) {\n method = feature;\n property = format.feature;\n } else if (format && format.mesh) {\n method = mesh;\n property = format.mesh;\n filter = filters[format.filter];\n } else {\n error('Missing TopoJSON feature or mesh parameter.');\n }\n object = (object = data.objects[property]) ? method(data, object, filter) : error('Invalid TopoJSON object: ' + property);\n return object && object.features || [object];\n}\ntopojson.responseType = 'json';\n\nconst format = {\n dsv: dsv,\n csv: delimitedFormat(','),\n tsv: delimitedFormat('\\t'),\n json: json,\n topojson: topojson\n};\nfunction formats(name, reader) {\n if (arguments.length > 1) {\n format[name] = reader;\n return this;\n } else {\n return hasOwnProperty(format, name) ? format[name] : null;\n }\n}\nfunction responseType(type) {\n const f = formats(type);\n return f && f.responseType || 'text';\n}\n\nfunction read (data, schema, timeParser, utcParser) {\n schema = schema || {};\n const reader = formats(schema.type || 'json');\n if (!reader) error('Unknown data format type: ' + schema.type);\n data = reader(data, schema);\n if (schema.parse) parse(data, schema.parse, timeParser, utcParser);\n if (hasOwnProperty(data, 'columns')) delete data.columns;\n return data;\n}\nfunction parse(data, types, timeParser, utcParser) {\n if (!data.length) return; // early exit for empty data\n\n const locale = timeFormatDefaultLocale();\n timeParser = timeParser || locale.timeParse;\n utcParser = utcParser || locale.utcParse;\n let fields = data.columns || Object.keys(data[0]),\n datum,\n field,\n i,\n j,\n n,\n m;\n if (types === 'auto') types = inferTypes(data, fields);\n fields = Object.keys(types);\n const parsers = fields.map(field => {\n const type = types[field];\n let parts, pattern;\n if (type && (type.startsWith('date:') || type.startsWith('utc:'))) {\n parts = type.split(/:(.+)?/, 2); // split on first :\n pattern = parts[1];\n if (pattern[0] === '\\'' && pattern[pattern.length - 1] === '\\'' || pattern[0] === '\"' && pattern[pattern.length - 1] === '\"') {\n pattern = pattern.slice(1, -1);\n }\n const parse = parts[0] === 'utc' ? utcParser : timeParser;\n return parse(pattern);\n }\n if (!typeParsers[type]) {\n throw Error('Illegal format pattern: ' + field + ':' + type);\n }\n return typeParsers[type];\n });\n for (i = 0, n = data.length, m = fields.length; i < n; ++i) {\n datum = data[i];\n for (j = 0; j < m; ++j) {\n field = fields[j];\n datum[field] = parsers[j](datum[field]);\n }\n }\n}\n\nconst loader = loaderFactory(typeof fetch !== 'undefined' && fetch,\n// use built-in fetch API\nnull // no file system access\n);\n\nexport { format, formats, inferType, inferTypes, loader, read, responseType, typeParsers };\n","import { identity, array, isFunction, constant, isArray, id, error, truthy, debounce, extend, visitArray, inherits, logger, Error, hasOwnProperty } from 'vega-util';\nimport { read, responseType, loader } from 'vega-loader';\nimport { defaultLocale } from 'vega-format';\n\nfunction UniqueList(idFunc) {\n const $ = idFunc || identity,\n list = [],\n ids = {};\n list.add = _ => {\n const id = $(_);\n if (!ids[id]) {\n ids[id] = 1;\n list.push(_);\n }\n return list;\n };\n list.remove = _ => {\n const id = $(_);\n if (ids[id]) {\n ids[id] = 0;\n const idx = list.indexOf(_);\n if (idx >= 0) list.splice(idx, 1);\n }\n return list;\n };\n return list;\n}\n\n/**\n * Invoke and await a potentially async callback function. If\n * an error occurs, trap it and route to Dataflow.error.\n * @param {Dataflow} df - The dataflow instance\n * @param {function} callback - A callback function to invoke\n * and then await. The dataflow will be passed as the single\n * argument to the function.\n */\nasync function asyncCallback (df, callback) {\n try {\n await callback(df);\n } catch (err) {\n df.error(err);\n }\n}\n\nconst TUPLE_ID_KEY = Symbol('vega_id');\nlet TUPLE_ID = 1;\n\n/**\n * Checks if an input value is a registered tuple.\n * @param {*} t - The value to check.\n * @return {boolean} True if the input is a tuple, false otherwise.\n */\nfunction isTuple(t) {\n return !!(t && tupleid(t));\n}\n\n/**\n * Returns the id of a tuple.\n * @param {object} t - The input tuple.\n * @return {*} the tuple id.\n */\nfunction tupleid(t) {\n return t[TUPLE_ID_KEY];\n}\n\n/**\n * Sets the id of a tuple.\n * @param {object} t - The input tuple.\n * @param {*} id - The id value to set.\n * @return {object} the input tuple.\n */\nfunction setid(t, id) {\n t[TUPLE_ID_KEY] = id;\n return t;\n}\n\n/**\n * Ingest an object or value as a data tuple.\n * If the input value is an object, an id field will be added to it. For\n * efficiency, the input object is modified directly. A copy is not made.\n * If the input value is a literal, it will be wrapped in a new object\n * instance, with the value accessible as the 'data' property.\n * @param datum - The value to ingest.\n * @return {object} The ingested data tuple.\n */\nfunction ingest$1(datum) {\n const t = datum === Object(datum) ? datum : {\n data: datum\n };\n return tupleid(t) ? t : setid(t, TUPLE_ID++);\n}\n\n/**\n * Given a source tuple, return a derived copy.\n * @param {object} t - The source tuple.\n * @return {object} The derived tuple.\n */\nfunction derive(t) {\n return rederive(t, ingest$1({}));\n}\n\n/**\n * Rederive a derived tuple by copying values from the source tuple.\n * @param {object} t - The source tuple.\n * @param {object} d - The derived tuple.\n * @return {object} The derived tuple.\n */\nfunction rederive(t, d) {\n for (const k in t) d[k] = t[k];\n return d;\n}\n\n/**\n * Replace an existing tuple with a new tuple.\n * @param {object} t - The existing data tuple.\n * @param {object} d - The new tuple that replaces the old.\n * @return {object} The new tuple.\n */\nfunction replace(t, d) {\n return setid(d, tupleid(t));\n}\n\n/**\n * Generate an augmented comparator function that provides stable\n * sorting by tuple id when the given comparator produces ties.\n * @param {function} cmp - The comparator to augment.\n * @param {function} [f] - Optional tuple accessor function.\n * @return {function} An augmented comparator function.\n */\nfunction stableCompare(cmp, f) {\n return !cmp ? null : f ? (a, b) => cmp(a, b) || tupleid(f(a)) - tupleid(f(b)) : (a, b) => cmp(a, b) || tupleid(a) - tupleid(b);\n}\n\nfunction isChangeSet(v) {\n return v && v.constructor === changeset;\n}\nfunction changeset() {\n const add = [],\n // insert tuples\n rem = [],\n // remove tuples\n mod = [],\n // modify tuples\n remp = [],\n // remove by predicate\n modp = []; // modify by predicate\n let clean = null,\n reflow = false;\n return {\n constructor: changeset,\n insert(t) {\n const d = array(t),\n n = d.length;\n for (let i = 0; i < n; ++i) add.push(d[i]);\n return this;\n },\n remove(t) {\n const a = isFunction(t) ? remp : rem,\n d = array(t),\n n = d.length;\n for (let i = 0; i < n; ++i) a.push(d[i]);\n return this;\n },\n modify(t, field, value) {\n const m = {\n field: field,\n value: constant(value)\n };\n if (isFunction(t)) {\n m.filter = t;\n modp.push(m);\n } else {\n m.tuple = t;\n mod.push(m);\n }\n return this;\n },\n encode(t, set) {\n if (isFunction(t)) modp.push({\n filter: t,\n field: set\n });else mod.push({\n tuple: t,\n field: set\n });\n return this;\n },\n clean(value) {\n clean = value;\n return this;\n },\n reflow() {\n reflow = true;\n return this;\n },\n pulse(pulse, tuples) {\n const cur = {},\n out = {};\n let i, n, m, f, t, id;\n\n // build lookup table of current tuples\n for (i = 0, n = tuples.length; i < n; ++i) {\n cur[tupleid(tuples[i])] = 1;\n }\n\n // process individual tuples to remove\n for (i = 0, n = rem.length; i < n; ++i) {\n t = rem[i];\n cur[tupleid(t)] = -1;\n }\n\n // process predicate-based removals\n for (i = 0, n = remp.length; i < n; ++i) {\n f = remp[i];\n tuples.forEach(t => {\n if (f(t)) cur[tupleid(t)] = -1;\n });\n }\n\n // process all add tuples\n for (i = 0, n = add.length; i < n; ++i) {\n t = add[i];\n id = tupleid(t);\n if (cur[id]) {\n // tuple already resides in dataset\n // if flagged for both add and remove, cancel\n cur[id] = 1;\n } else {\n // tuple does not reside in dataset, add\n pulse.add.push(ingest$1(add[i]));\n }\n }\n\n // populate pulse rem list\n for (i = 0, n = tuples.length; i < n; ++i) {\n t = tuples[i];\n if (cur[tupleid(t)] < 0) pulse.rem.push(t);\n }\n\n // modify helper method\n function modify(t, f, v) {\n if (v) {\n t[f] = v(t);\n } else {\n pulse.encode = f;\n }\n if (!reflow) out[tupleid(t)] = t;\n }\n\n // process individual tuples to modify\n for (i = 0, n = mod.length; i < n; ++i) {\n m = mod[i];\n t = m.tuple;\n f = m.field;\n id = cur[tupleid(t)];\n if (id > 0) {\n modify(t, f, m.value);\n pulse.modifies(f);\n }\n }\n\n // process predicate-based modifications\n for (i = 0, n = modp.length; i < n; ++i) {\n m = modp[i];\n f = m.filter;\n tuples.forEach(t => {\n if (f(t) && cur[tupleid(t)] > 0) {\n modify(t, m.field, m.value);\n }\n });\n pulse.modifies(m.field);\n }\n\n // upon reflow request, populate mod with all non-removed tuples\n // otherwise, populate mod with modified tuples only\n if (reflow) {\n pulse.mod = rem.length || remp.length ? tuples.filter(t => cur[tupleid(t)] > 0) : tuples.slice();\n } else {\n for (id in out) pulse.mod.push(out[id]);\n }\n\n // set pulse garbage collection request\n if (clean || clean == null && (rem.length || remp.length)) {\n pulse.clean(true);\n }\n return pulse;\n }\n };\n}\n\nconst CACHE = '_:mod:_';\n\n/**\n * Hash that tracks modifications to assigned values.\n * Callers *must* use the set method to update values.\n */\nfunction Parameters() {\n Object.defineProperty(this, CACHE, {\n writable: true,\n value: {}\n });\n}\nParameters.prototype = {\n /**\n * Set a parameter value. If the parameter value changes, the parameter\n * will be recorded as modified.\n * @param {string} name - The parameter name.\n * @param {number} index - The index into an array-value parameter. Ignored if\n * the argument is undefined, null or less than zero.\n * @param {*} value - The parameter value to set.\n * @param {boolean} [force=false] - If true, records the parameter as modified\n * even if the value is unchanged.\n * @return {Parameters} - This parameter object.\n */\n set(name, index, value, force) {\n const o = this,\n v = o[name],\n mod = o[CACHE];\n if (index != null && index >= 0) {\n if (v[index] !== value || force) {\n v[index] = value;\n mod[index + ':' + name] = -1;\n mod[name] = -1;\n }\n } else if (v !== value || force) {\n o[name] = value;\n mod[name] = isArray(value) ? 1 + value.length : -1;\n }\n return o;\n },\n /**\n * Tests if one or more parameters has been modified. If invoked with no\n * arguments, returns true if any parameter value has changed. If the first\n * argument is array, returns trues if any parameter name in the array has\n * changed. Otherwise, tests if the given name and optional array index has\n * changed.\n * @param {string} name - The parameter name to test.\n * @param {number} [index=undefined] - The parameter array index to test.\n * @return {boolean} - Returns true if a queried parameter was modified.\n */\n modified(name, index) {\n const mod = this[CACHE];\n if (!arguments.length) {\n for (const k in mod) {\n if (mod[k]) return true;\n }\n return false;\n } else if (isArray(name)) {\n for (let k = 0; k < name.length; ++k) {\n if (mod[name[k]]) return true;\n }\n return false;\n }\n return index != null && index >= 0 ? index + 1 < mod[name] || !!mod[index + ':' + name] : !!mod[name];\n },\n /**\n * Clears the modification records. After calling this method,\n * all parameters are considered unmodified.\n */\n clear() {\n this[CACHE] = {};\n return this;\n }\n};\n\nlet OP_ID = 0;\nconst PULSE = 'pulse',\n NO_PARAMS = new Parameters();\n\n// Boolean Flags\nconst SKIP$1 = 1,\n MODIFIED = 2;\n\n/**\n * An Operator is a processing node in a dataflow graph.\n * Each operator stores a value and an optional value update function.\n * Operators can accept a hash of named parameters. Parameter values can\n * either be direct (JavaScript literals, arrays, objects) or indirect\n * (other operators whose values will be pulled dynamically). Operators\n * included as parameters will have this operator added as a dependency.\n * @constructor\n * @param {*} [init] - The initial value for this operator.\n * @param {function(object, Pulse)} [update] - An update function. Upon\n * evaluation of this operator, the update function will be invoked and the\n * return value will be used as the new value of this operator.\n * @param {object} [params] - The parameters for this operator.\n * @param {boolean} [react=true] - Flag indicating if this operator should\n * listen for changes to upstream operators included as parameters.\n * @see parameters\n */\nfunction Operator(init, update, params, react) {\n this.id = ++OP_ID;\n this.value = init;\n this.stamp = -1;\n this.rank = -1;\n this.qrank = -1;\n this.flags = 0;\n if (update) {\n this._update = update;\n }\n if (params) this.parameters(params, react);\n}\nfunction flag(bit) {\n return function (state) {\n const f = this.flags;\n if (arguments.length === 0) return !!(f & bit);\n this.flags = state ? f | bit : f & ~bit;\n return this;\n };\n}\nOperator.prototype = {\n /**\n * Returns a list of target operators dependent on this operator.\n * If this list does not exist, it is created and then returned.\n * @return {UniqueList}\n */\n targets() {\n return this._targets || (this._targets = UniqueList(id));\n },\n /**\n * Sets the value of this operator.\n * @param {*} value - the value to set.\n * @return {Number} Returns 1 if the operator value has changed\n * according to strict equality, returns 0 otherwise.\n */\n set(value) {\n if (this.value !== value) {\n this.value = value;\n return 1;\n } else {\n return 0;\n }\n },\n /**\n * Indicates that operator evaluation should be skipped on the next pulse.\n * This operator will still propagate incoming pulses, but its update function\n * will not be invoked. The skip flag is reset after every pulse, so calling\n * this method will affect processing of the next pulse only.\n */\n skip: flag(SKIP$1),\n /**\n * Indicates that this operator's value has been modified on its most recent\n * pulse. Normally modification is checked via strict equality; however, in\n * some cases it is more efficient to update the internal state of an object.\n * In those cases, the modified flag can be used to trigger propagation. Once\n * set, the modification flag persists across pulses until unset. The flag can\n * be used with the last timestamp to test if a modification is recent.\n */\n modified: flag(MODIFIED),\n /**\n * Sets the parameters for this operator. The parameter values are analyzed for\n * operator instances. If found, this operator will be added as a dependency\n * of the parameterizing operator. Operator values are dynamically marshalled\n * from each operator parameter prior to evaluation. If a parameter value is\n * an array, the array will also be searched for Operator instances. However,\n * the search does not recurse into sub-arrays or object properties.\n * @param {object} params - A hash of operator parameters.\n * @param {boolean} [react=true] - A flag indicating if this operator should\n * automatically update (react) when parameter values change. In other words,\n * this flag determines if the operator registers itself as a listener on\n * any upstream operators included in the parameters.\n * @param {boolean} [initonly=false] - A flag indicating if this operator\n * should calculate an update only upon its initial evaluation, then\n * deregister dependencies and suppress all future update invocations.\n * @return {Operator[]} - An array of upstream dependencies.\n */\n parameters(params, react, initonly) {\n react = react !== false;\n const argval = this._argval = this._argval || new Parameters(),\n argops = this._argops = this._argops || [],\n deps = [];\n let name, value, n, i;\n const add = (name, index, value) => {\n if (value instanceof Operator) {\n if (value !== this) {\n if (react) value.targets().add(this);\n deps.push(value);\n }\n argops.push({\n op: value,\n name: name,\n index: index\n });\n } else {\n argval.set(name, index, value);\n }\n };\n for (name in params) {\n value = params[name];\n if (name === PULSE) {\n array(value).forEach(op => {\n if (!(op instanceof Operator)) {\n error('Pulse parameters must be operator instances.');\n } else if (op !== this) {\n op.targets().add(this);\n deps.push(op);\n }\n });\n this.source = value;\n } else if (isArray(value)) {\n argval.set(name, -1, Array(n = value.length));\n for (i = 0; i < n; ++i) add(name, i, value[i]);\n } else {\n add(name, -1, value);\n }\n }\n this.marshall().clear(); // initialize values\n if (initonly) argops.initonly = true;\n return deps;\n },\n /**\n * Internal method for marshalling parameter values.\n * Visits each operator dependency to pull the latest value.\n * @return {Parameters} A Parameters object to pass to the update function.\n */\n marshall(stamp) {\n const argval = this._argval || NO_PARAMS,\n argops = this._argops;\n let item, i, op, mod;\n if (argops) {\n const n = argops.length;\n for (i = 0; i < n; ++i) {\n item = argops[i];\n op = item.op;\n mod = op.modified() && op.stamp === stamp;\n argval.set(item.name, item.index, op.value, mod);\n }\n if (argops.initonly) {\n for (i = 0; i < n; ++i) {\n item = argops[i];\n item.op.targets().remove(this);\n }\n this._argops = null;\n this._update = null;\n }\n }\n return argval;\n },\n /**\n * Detach this operator from the dataflow.\n * Unregisters listeners on upstream dependencies.\n */\n detach() {\n const argops = this._argops;\n let i, n, item, op;\n if (argops) {\n for (i = 0, n = argops.length; i < n; ++i) {\n item = argops[i];\n op = item.op;\n if (op._targets) {\n op._targets.remove(this);\n }\n }\n }\n\n // remove references to the source and pulse object,\n // if present, to prevent memory leaks of old data.\n this.pulse = null;\n this.source = null;\n },\n /**\n * Delegate method to perform operator processing.\n * Subclasses can override this method to perform custom processing.\n * By default, it marshalls parameters and calls the update function\n * if that function is defined. If the update function does not\n * change the operator value then StopPropagation is returned.\n * If no update function is defined, this method does nothing.\n * @param {Pulse} pulse - the current dataflow pulse.\n * @return The output pulse or StopPropagation. A falsy return value\n * (including undefined) will let the input pulse pass through.\n */\n evaluate(pulse) {\n const update = this._update;\n if (update) {\n const params = this.marshall(pulse.stamp),\n v = update.call(this, params, pulse);\n params.clear();\n if (v !== this.value) {\n this.value = v;\n } else if (!this.modified()) {\n return pulse.StopPropagation;\n }\n }\n },\n /**\n * Run this operator for the current pulse. If this operator has already\n * been run at (or after) the pulse timestamp, returns StopPropagation.\n * Internally, this method calls {@link evaluate} to perform processing.\n * If {@link evaluate} returns a falsy value, the input pulse is returned.\n * This method should NOT be overridden, instead overrride {@link evaluate}.\n * @param {Pulse} pulse - the current dataflow pulse.\n * @return the output pulse for this operator (or StopPropagation)\n */\n run(pulse) {\n if (pulse.stamp < this.stamp) return pulse.StopPropagation;\n let rv;\n if (this.skip()) {\n this.skip(false);\n rv = 0;\n } else {\n rv = this.evaluate(pulse);\n }\n return this.pulse = rv || pulse;\n }\n};\n\n/**\n * Add an operator to the dataflow graph. This function accepts a\n * variety of input argument types. The basic signature supports an\n * initial value, update function and parameters. If the first parameter\n * is an Operator instance, it will be added directly. If it is a\n * constructor for an Operator subclass, a new instance will be instantiated.\n * Otherwise, if the first parameter is a function instance, it will be used\n * as the update function and a null initial value is assumed.\n * @param {*} init - One of: the operator to add, the initial value of\n * the operator, an operator class to instantiate, or an update function.\n * @param {function} [update] - The operator update function.\n * @param {object} [params] - The operator parameters.\n * @param {boolean} [react=true] - Flag indicating if this operator should\n * listen for changes to upstream operators included as parameters.\n * @return {Operator} - The added operator.\n */\nfunction add (init, update, params, react) {\n let shift = 1,\n op;\n if (init instanceof Operator) {\n op = init;\n } else if (init && init.prototype instanceof Operator) {\n op = new init();\n } else if (isFunction(init)) {\n op = new Operator(null, init);\n } else {\n shift = 0;\n op = new Operator(init, update);\n }\n this.rank(op);\n if (shift) {\n react = params;\n params = update;\n }\n if (params) this.connect(op, op.parameters(params, react));\n this.touch(op);\n return op;\n}\n\n/**\n * Connect a target operator as a dependent of source operators.\n * If necessary, this method will rerank the target operator and its\n * dependents to ensure propagation proceeds in a topologically sorted order.\n * @param {Operator} target - The target operator.\n * @param {Array} - The source operators that should propagate\n * to the target operator.\n */\nfunction connect (target, sources) {\n const targetRank = target.rank,\n n = sources.length;\n for (let i = 0; i < n; ++i) {\n if (targetRank < sources[i].rank) {\n this.rerank(target);\n return;\n }\n }\n}\n\nlet STREAM_ID = 0;\n\n/**\n * Models an event stream.\n * @constructor\n * @param {function(Object, number): boolean} [filter] - Filter predicate.\n * Events pass through when truthy, events are suppressed when falsy.\n * @param {function(Object): *} [apply] - Applied to input events to produce\n * new event values.\n * @param {function(Object)} [receive] - Event callback function to invoke\n * upon receipt of a new event. Use to override standard event processing.\n */\nfunction EventStream(filter, apply, receive) {\n this.id = ++STREAM_ID;\n this.value = null;\n if (receive) this.receive = receive;\n if (filter) this._filter = filter;\n if (apply) this._apply = apply;\n}\n\n/**\n * Creates a new event stream instance with the provided\n * (optional) filter, apply and receive functions.\n * @param {function(Object, number): boolean} [filter] - Filter predicate.\n * Events pass through when truthy, events are suppressed when falsy.\n * @param {function(Object): *} [apply] - Applied to input events to produce\n * new event values.\n * @see EventStream\n */\nfunction stream(filter, apply, receive) {\n return new EventStream(filter, apply, receive);\n}\nEventStream.prototype = {\n _filter: truthy,\n _apply: identity,\n targets() {\n return this._targets || (this._targets = UniqueList(id));\n },\n consume(_) {\n if (!arguments.length) return !!this._consume;\n this._consume = !!_;\n return this;\n },\n receive(evt) {\n if (this._filter(evt)) {\n const val = this.value = this._apply(evt),\n trg = this._targets,\n n = trg ? trg.length : 0;\n for (let i = 0; i < n; ++i) trg[i].receive(val);\n if (this._consume) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n }\n },\n filter(filter) {\n const s = stream(filter);\n this.targets().add(s);\n return s;\n },\n apply(apply) {\n const s = stream(null, apply);\n this.targets().add(s);\n return s;\n },\n merge() {\n const s = stream();\n this.targets().add(s);\n for (let i = 0, n = arguments.length; i < n; ++i) {\n arguments[i].targets().add(s);\n }\n return s;\n },\n throttle(pause) {\n let t = -1;\n return this.filter(() => {\n const now = Date.now();\n if (now - t > pause) {\n t = now;\n return 1;\n } else {\n return 0;\n }\n });\n },\n debounce(delay) {\n const s = stream();\n this.targets().add(stream(null, null, debounce(delay, e => {\n const df = e.dataflow;\n s.receive(e);\n if (df && df.run) df.run();\n })));\n return s;\n },\n between(a, b) {\n let active = false;\n a.targets().add(stream(null, null, () => active = true));\n b.targets().add(stream(null, null, () => active = false));\n return this.filter(() => active);\n },\n detach() {\n // ensures compatibility with operators (#2753)\n // remove references to other streams and filter functions that may\n // be bound to subcontexts that need to be garbage collected.\n this._filter = truthy;\n this._targets = null;\n }\n};\n\n/**\n * Create a new event stream from an event source.\n * @param {object} source - The event source to monitor. The input must\n * support the addEventListener method.\n * @param {string} type - The event type.\n * @param {function(object): boolean} [filter] - Event filter function.\n * @param {function(object): *} [apply] - Event application function.\n * If provided, this function will be invoked and the result will be\n * used as the downstream event value.\n * @return {EventStream}\n */\nfunction events (source, type, filter, apply) {\n const df = this,\n s = stream(filter, apply),\n send = function (e) {\n e.dataflow = df;\n try {\n s.receive(e);\n } catch (error) {\n df.error(error);\n } finally {\n df.run();\n }\n };\n let sources;\n if (typeof source === 'string' && typeof document !== 'undefined') {\n sources = document.querySelectorAll(source);\n } else {\n sources = array(source);\n }\n const n = sources.length;\n for (let i = 0; i < n; ++i) {\n sources[i].addEventListener(type, send);\n }\n return s;\n}\n\nfunction parse(data, format) {\n const locale = this.locale();\n return read(data, format, locale.timeParse, locale.utcParse);\n}\n\n/**\n * Ingests new data into the dataflow. First parses the data using the\n * vega-loader read method, then pulses a changeset to the target operator.\n * @param {Operator} target - The Operator to target with ingested data,\n * typically a Collect transform instance.\n * @param {*} data - The input data, prior to parsing. For JSON this may\n * be a string or an object. For CSV, TSV, etc should be a string.\n * @param {object} format - The data format description for parsing\n * loaded data. This object is passed to the vega-loader read method.\n * @returns {Dataflow}\n */\nfunction ingest(target, data, format) {\n data = this.parse(data, format);\n return this.pulse(target, this.changeset().insert(data));\n}\n\n/**\n * Request data from an external source, parse it, and return a Promise.\n * @param {string} url - The URL from which to load the data. This string\n * is passed to the vega-loader load method.\n * @param {object} [format] - The data format description for parsing\n * loaded data. This object is passed to the vega-loader read method.\n * @return {Promise} A Promise that resolves upon completion of the request.\n * The resolved object contains the following properties:\n * - data: an array of parsed data (or null upon error)\n * - status: a code for success (0), load fail (-1), or parse fail (-2)\n */\nasync function request(url, format) {\n const df = this;\n let status = 0,\n data;\n try {\n data = await df.loader().load(url, {\n context: 'dataflow',\n response: responseType(format && format.type)\n });\n try {\n data = df.parse(data, format);\n } catch (err) {\n status = -2;\n df.warn('Data ingestion failed', url, err);\n }\n } catch (err) {\n status = -1;\n df.warn('Loading failed', url, err);\n }\n return {\n data,\n status\n };\n}\nasync function preload(target, url, format) {\n const df = this,\n pending = df._pending || loadPending(df);\n pending.requests += 1;\n const res = await df.request(url, format);\n df.pulse(target, df.changeset().remove(truthy).insert(res.data || []));\n pending.done();\n return res;\n}\nfunction loadPending(df) {\n let accept;\n const pending = new Promise(a => accept = a);\n pending.requests = 0;\n pending.done = () => {\n if (--pending.requests === 0) {\n df._pending = null;\n accept(df);\n }\n };\n return df._pending = pending;\n}\n\nconst SKIP = {\n skip: true\n};\n\n/**\n * Perform operator updates in response to events. Applies an\n * update function to compute a new operator value. If the update function\n * returns a {@link ChangeSet}, the operator will be pulsed with those tuple\n * changes. Otherwise, the operator value will be updated to the return value.\n * @param {EventStream|Operator} source - The event source to react to.\n * This argument can be either an EventStream or an Operator.\n * @param {Operator|function(object):Operator} target - The operator to update.\n * This argument can either be an Operator instance or (if the source\n * argument is an EventStream), a function that accepts an event object as\n * input and returns an Operator to target.\n * @param {function(Parameters,Event): *} [update] - Optional update function\n * to compute the new operator value, or a literal value to set. Update\n * functions expect to receive a parameter object and event as arguments.\n * This function can either return a new operator value or (if the source\n * argument is an EventStream) a {@link ChangeSet} instance to pulse\n * the target operator with tuple changes.\n * @param {object} [params] - The update function parameters.\n * @param {object} [options] - Additional options hash. If not overridden,\n * updated operators will be skipped by default.\n * @param {boolean} [options.skip] - If true, the operator will\n * be skipped: it will not be evaluated, but its dependents will be.\n * @param {boolean} [options.force] - If true, the operator will\n * be re-evaluated even if its value has not changed.\n * @return {Dataflow}\n */\nfunction on (source, target, update, params, options) {\n const fn = source instanceof Operator ? onOperator : onStream;\n fn(this, source, target, update, params, options);\n return this;\n}\nfunction onStream(df, stream, target, update, params, options) {\n const opt = extend({}, options, SKIP);\n let func, op;\n if (!isFunction(target)) target = constant(target);\n if (update === undefined) {\n func = e => df.touch(target(e));\n } else if (isFunction(update)) {\n op = new Operator(null, update, params, false);\n func = e => {\n op.evaluate(e);\n const t = target(e),\n v = op.value;\n isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt);\n };\n } else {\n func = e => df.update(target(e), update, opt);\n }\n stream.apply(func);\n}\nfunction onOperator(df, source, target, update, params, options) {\n if (update === undefined) {\n source.targets().add(target);\n } else {\n const opt = options || {},\n op = new Operator(null, updater(target, update), params, false);\n op.modified(opt.force);\n op.rank = source.rank; // immediately follow source\n source.targets().add(op); // add dependency\n\n if (target) {\n op.skip(true); // skip first invocation\n op.value = target.value; // initialize value\n op.targets().add(target); // chain dependencies\n df.connect(target, [op]); // rerank as needed, #1672\n }\n }\n}\n\nfunction updater(target, update) {\n update = isFunction(update) ? update : constant(update);\n return target ? function (_, pulse) {\n const value = update(_, pulse);\n if (!target.skip()) {\n target.skip(value !== this.value).value = value;\n }\n return value;\n } : update;\n}\n\n/**\n * Assigns a rank to an operator. Ranks are assigned in increasing order\n * by incrementing an internal rank counter.\n * @param {Operator} op - The operator to assign a rank.\n */\nfunction rank(op) {\n op.rank = ++this._rank;\n}\n\n/**\n * Re-ranks an operator and all downstream target dependencies. This\n * is necessary when upstream dependencies of higher rank are added to\n * a target operator.\n * @param {Operator} op - The operator to re-rank.\n */\nfunction rerank(op) {\n const queue = [op];\n let cur, list, i;\n while (queue.length) {\n this.rank(cur = queue.pop());\n if (list = cur._targets) {\n for (i = list.length; --i >= 0;) {\n queue.push(cur = list[i]);\n if (cur === op) error('Cycle detected in dataflow graph.');\n }\n }\n }\n}\n\n/**\n * Sentinel value indicating pulse propagation should stop.\n */\nconst StopPropagation = {};\n\n// Pulse visit type flags\nconst ADD = 1 << 0,\n REM = 1 << 1,\n MOD = 1 << 2,\n ADD_REM = ADD | REM,\n ADD_MOD = ADD | MOD,\n ALL = ADD | REM | MOD,\n REFLOW = 1 << 3,\n SOURCE = 1 << 4,\n NO_SOURCE = 1 << 5,\n NO_FIELDS = 1 << 6;\n\n/**\n * A Pulse enables inter-operator communication during a run of the\n * dataflow graph. In addition to the current timestamp, a pulse may also\n * contain a change-set of added, removed or modified data tuples, as well as\n * a pointer to a full backing data source. Tuple change sets may not\n * be fully materialized; for example, to prevent needless array creation\n * a change set may include larger arrays and corresponding filter functions.\n * The pulse provides a {@link visit} method to enable proper and efficient\n * iteration over requested data tuples.\n *\n * In addition, each pulse can track modification flags for data tuple fields.\n * Responsible transform operators should call the {@link modifies} method to\n * indicate changes to data fields. The {@link modified} method enables\n * querying of this modification state.\n *\n * @constructor\n * @param {Dataflow} dataflow - The backing dataflow instance.\n * @param {number} stamp - The current propagation timestamp.\n * @param {string} [encode] - An optional encoding set name, which is then\n * accessible as Pulse.encode. Operators can respond to (or ignore) this\n * setting as appropriate. This parameter can be used in conjunction with\n * the Encode transform in the vega-encode module.\n */\nfunction Pulse(dataflow, stamp, encode) {\n this.dataflow = dataflow;\n this.stamp = stamp == null ? -1 : stamp;\n this.add = [];\n this.rem = [];\n this.mod = [];\n this.fields = null;\n this.encode = encode || null;\n}\nfunction materialize(data, filter) {\n const out = [];\n visitArray(data, filter, _ => out.push(_));\n return out;\n}\nfunction filter(pulse, flags) {\n const map = {};\n pulse.visit(flags, t => {\n map[tupleid(t)] = 1;\n });\n return t => map[tupleid(t)] ? null : t;\n}\nfunction addFilter(a, b) {\n return a ? (t, i) => a(t, i) && b(t, i) : b;\n}\nPulse.prototype = {\n /**\n * Sentinel value indicating pulse propagation should stop.\n */\n StopPropagation,\n /**\n * Boolean flag indicating ADD (added) tuples.\n */\n ADD,\n /**\n * Boolean flag indicating REM (removed) tuples.\n */\n REM,\n /**\n * Boolean flag indicating MOD (modified) tuples.\n */\n MOD,\n /**\n * Boolean flag indicating ADD (added) and REM (removed) tuples.\n */\n ADD_REM,\n /**\n * Boolean flag indicating ADD (added) and MOD (modified) tuples.\n */\n ADD_MOD,\n /**\n * Boolean flag indicating ADD, REM and MOD tuples.\n */\n ALL,\n /**\n * Boolean flag indicating all tuples in a data source\n * except for the ADD, REM and MOD tuples.\n */\n REFLOW,\n /**\n * Boolean flag indicating a 'pass-through' to a\n * backing data source, ignoring ADD, REM and MOD tuples.\n */\n SOURCE,\n /**\n * Boolean flag indicating that source data should be\n * suppressed when creating a forked pulse.\n */\n NO_SOURCE,\n /**\n * Boolean flag indicating that field modifications should be\n * suppressed when creating a forked pulse.\n */\n NO_FIELDS,\n /**\n * Creates a new pulse based on the values of this pulse.\n * The dataflow, time stamp and field modification values are copied over.\n * By default, new empty ADD, REM and MOD arrays are created.\n * @param {number} flags - Integer of boolean flags indicating which (if any)\n * tuple arrays should be copied to the new pulse. The supported flag values\n * are ADD, REM and MOD. Array references are copied directly: new array\n * instances are not created.\n * @return {Pulse} - The forked pulse instance.\n * @see init\n */\n fork(flags) {\n return new Pulse(this.dataflow).init(this, flags);\n },\n /**\n * Creates a copy of this pulse with new materialized array\n * instances for the ADD, REM, MOD, and SOURCE arrays.\n * The dataflow, time stamp and field modification values are copied over.\n * @return {Pulse} - The cloned pulse instance.\n * @see init\n */\n clone() {\n const p = this.fork(ALL);\n p.add = p.add.slice();\n p.rem = p.rem.slice();\n p.mod = p.mod.slice();\n if (p.source) p.source = p.source.slice();\n return p.materialize(ALL | SOURCE);\n },\n /**\n * Returns a pulse that adds all tuples from a backing source. This is\n * useful for cases where operators are added to a dataflow after an\n * upstream data pipeline has already been processed, ensuring that\n * new operators can observe all tuples within a stream.\n * @return {Pulse} - A pulse instance with all source tuples included\n * in the add array. If the current pulse already has all source\n * tuples in its add array, it is returned directly. If the current\n * pulse does not have a backing source, it is returned directly.\n */\n addAll() {\n let p = this;\n const reuse = !p.source || p.add === p.rem // special case for indexed set (e.g., crossfilter)\n || !p.rem.length && p.source.length === p.add.length;\n if (reuse) {\n return p;\n } else {\n p = new Pulse(this.dataflow).init(this);\n p.add = p.source;\n p.rem = []; // new operators can ignore rem #2769\n return p;\n }\n },\n /**\n * Initialize this pulse based on the values of another pulse. This method\n * is used internally by {@link fork} to initialize a new forked tuple.\n * The dataflow, time stamp and field modification values are copied over.\n * By default, new empty ADD, REM and MOD arrays are created.\n * @param {Pulse} src - The source pulse to copy from.\n * @param {number} flags - Integer of boolean flags indicating which (if any)\n * tuple arrays should be copied to the new pulse. The supported flag values\n * are ADD, REM and MOD. Array references are copied directly: new array\n * instances are not created. By default, source data arrays are copied\n * to the new pulse. Use the NO_SOURCE flag to enforce a null source.\n * @return {Pulse} - Returns this Pulse instance.\n */\n init(src, flags) {\n const p = this;\n p.stamp = src.stamp;\n p.encode = src.encode;\n if (src.fields && !(flags & NO_FIELDS)) {\n p.fields = src.fields;\n }\n if (flags & ADD) {\n p.addF = src.addF;\n p.add = src.add;\n } else {\n p.addF = null;\n p.add = [];\n }\n if (flags & REM) {\n p.remF = src.remF;\n p.rem = src.rem;\n } else {\n p.remF = null;\n p.rem = [];\n }\n if (flags & MOD) {\n p.modF = src.modF;\n p.mod = src.mod;\n } else {\n p.modF = null;\n p.mod = [];\n }\n if (flags & NO_SOURCE) {\n p.srcF = null;\n p.source = null;\n } else {\n p.srcF = src.srcF;\n p.source = src.source;\n if (src.cleans) p.cleans = src.cleans;\n }\n return p;\n },\n /**\n * Schedules a function to run after pulse propagation completes.\n * @param {function} func - The function to run.\n */\n runAfter(func) {\n this.dataflow.runAfter(func);\n },\n /**\n * Indicates if tuples have been added, removed or modified.\n * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query.\n * Defaults to ALL, returning true if any tuple type has changed.\n * @return {boolean} - Returns true if one or more queried tuple types have\n * changed, false otherwise.\n */\n changed(flags) {\n const f = flags || ALL;\n return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length;\n },\n /**\n * Forces a \"reflow\" of tuple values, such that all tuples in the backing\n * source are added to the MOD set, unless already present in the ADD set.\n * @param {boolean} [fork=false] - If true, returns a forked copy of this\n * pulse, and invokes reflow on that derived pulse.\n * @return {Pulse} - The reflowed pulse instance.\n */\n reflow(fork) {\n if (fork) return this.fork(ALL).reflow();\n const len = this.add.length,\n src = this.source && this.source.length;\n if (src && src !== len) {\n this.mod = this.source;\n if (len) this.filter(MOD, filter(this, ADD));\n }\n return this;\n },\n /**\n * Get/set metadata to pulse requesting garbage collection\n * to reclaim currently unused resources.\n */\n clean(value) {\n if (arguments.length) {\n this.cleans = !!value;\n return this;\n } else {\n return this.cleans;\n }\n },\n /**\n * Marks one or more data field names as modified to assist dependency\n * tracking and incremental processing by transform operators.\n * @param {string|Array} _ - The field(s) to mark as modified.\n * @return {Pulse} - This pulse instance.\n */\n modifies(_) {\n const hash = this.fields || (this.fields = {});\n if (isArray(_)) {\n _.forEach(f => hash[f] = true);\n } else {\n hash[_] = true;\n }\n return this;\n },\n /**\n * Checks if one or more data fields have been modified during this pulse\n * propagation timestamp.\n * @param {string|Array} _ - The field(s) to check for modified.\n * @param {boolean} nomod - If true, will check the modified flag even if\n * no mod tuples exist. If false (default), mod tuples must be present.\n * @return {boolean} - Returns true if any of the provided fields has been\n * marked as modified, false otherwise.\n */\n modified(_, nomod) {\n const fields = this.fields;\n return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : isArray(_) ? _.some(f => fields[f]) : fields[_];\n },\n /**\n * Adds a filter function to one more tuple sets. Filters are applied to\n * backing tuple arrays, to determine the actual set of tuples considered\n * added, removed or modified. They can be used to delay materialization of\n * a tuple set in order to avoid expensive array copies. In addition, the\n * filter functions can serve as value transformers: unlike standard predicate\n * function (which return boolean values), Pulse filters should return the\n * actual tuple value to process. If a tuple set is already filtered, the\n * new filter function will be appended into a conjuntive ('and') query.\n * @param {number} flags - Flags indicating the tuple set(s) to filter.\n * @param {function(*):object} filter - Filter function that will be applied\n * to the tuple set array, and should return a data tuple if the value\n * should be included in the tuple set, and falsy (or null) otherwise.\n * @return {Pulse} - Returns this pulse instance.\n */\n filter(flags, filter) {\n const p = this;\n if (flags & ADD) p.addF = addFilter(p.addF, filter);\n if (flags & REM) p.remF = addFilter(p.remF, filter);\n if (flags & MOD) p.modF = addFilter(p.modF, filter);\n if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter);\n return p;\n },\n /**\n * Materialize one or more tuple sets in this pulse. If the tuple set(s) have\n * a registered filter function, it will be applied and the tuple set(s) will\n * be replaced with materialized tuple arrays.\n * @param {number} flags - Flags indicating the tuple set(s) to materialize.\n * @return {Pulse} - Returns this pulse instance.\n */\n materialize(flags) {\n flags = flags || ALL;\n const p = this;\n if (flags & ADD && p.addF) {\n p.add = materialize(p.add, p.addF);\n p.addF = null;\n }\n if (flags & REM && p.remF) {\n p.rem = materialize(p.rem, p.remF);\n p.remF = null;\n }\n if (flags & MOD && p.modF) {\n p.mod = materialize(p.mod, p.modF);\n p.modF = null;\n }\n if (flags & SOURCE && p.srcF) {\n p.source = p.source.filter(p.srcF);\n p.srcF = null;\n }\n return p;\n },\n /**\n * Visit one or more tuple sets in this pulse.\n * @param {number} flags - Flags indicating the tuple set(s) to visit.\n * Legal values are ADD, REM, MOD and SOURCE (if a backing data source\n * has been set).\n * @param {function(object):*} - Visitor function invoked per-tuple.\n * @return {Pulse} - Returns this pulse instance.\n */\n visit(flags, visitor) {\n const p = this,\n v = visitor;\n if (flags & SOURCE) {\n visitArray(p.source, p.srcF, v);\n return p;\n }\n if (flags & ADD) visitArray(p.add, p.addF, v);\n if (flags & REM) visitArray(p.rem, p.remF, v);\n if (flags & MOD) visitArray(p.mod, p.modF, v);\n const src = p.source;\n if (flags & REFLOW && src) {\n const sum = p.add.length + p.mod.length;\n if (sum === src.length) ; else if (sum) {\n visitArray(src, filter(p, ADD_MOD), v);\n } else {\n // if no add/rem/mod tuples, visit source\n visitArray(src, p.srcF, v);\n }\n }\n return p;\n }\n};\n\n/**\n * Represents a set of multiple pulses. Used as input for operators\n * that accept multiple pulses at a time. Contained pulses are\n * accessible via the public \"pulses\" array property. This pulse doe\n * not carry added, removed or modified tuples directly. However,\n * the visit method can be used to traverse all such tuples contained\n * in sub-pulses with a timestamp matching this parent multi-pulse.\n * @constructor\n * @param {Dataflow} dataflow - The backing dataflow instance.\n * @param {number} stamp - The timestamp.\n * @param {Array} pulses - The sub-pulses for this multi-pulse.\n */\nfunction MultiPulse(dataflow, stamp, pulses, encode) {\n const p = this;\n let c = 0;\n this.dataflow = dataflow;\n this.stamp = stamp;\n this.fields = null;\n this.encode = encode || null;\n this.pulses = pulses;\n for (const pulse of pulses) {\n if (pulse.stamp !== stamp) continue;\n if (pulse.fields) {\n const hash = p.fields || (p.fields = {});\n for (const f in pulse.fields) {\n hash[f] = 1;\n }\n }\n if (pulse.changed(p.ADD)) c |= p.ADD;\n if (pulse.changed(p.REM)) c |= p.REM;\n if (pulse.changed(p.MOD)) c |= p.MOD;\n }\n this.changes = c;\n}\ninherits(MultiPulse, Pulse, {\n /**\n * Creates a new pulse based on the values of this pulse.\n * The dataflow, time stamp and field modification values are copied over.\n * @return {Pulse}\n */\n fork(flags) {\n const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS);\n if (flags !== undefined) {\n if (flags & p.ADD) this.visit(p.ADD, t => p.add.push(t));\n if (flags & p.REM) this.visit(p.REM, t => p.rem.push(t));\n if (flags & p.MOD) this.visit(p.MOD, t => p.mod.push(t));\n }\n return p;\n },\n changed(flags) {\n return this.changes & flags;\n },\n modified(_) {\n const p = this,\n fields = p.fields;\n return !(fields && p.changes & p.MOD) ? 0 : isArray(_) ? _.some(f => fields[f]) : fields[_];\n },\n filter() {\n error('MultiPulse does not support filtering.');\n },\n materialize() {\n error('MultiPulse does not support materialization.');\n },\n visit(flags, visitor) {\n const p = this,\n pulses = p.pulses,\n n = pulses.length;\n let i = 0;\n if (flags & p.SOURCE) {\n for (; i < n; ++i) {\n pulses[i].visit(flags, visitor);\n }\n } else {\n for (; i < n; ++i) {\n if (pulses[i].stamp === p.stamp) {\n pulses[i].visit(flags, visitor);\n }\n }\n }\n return p;\n }\n});\n\n/* eslint-disable require-atomic-updates */\n\n/**\n * Evaluates the dataflow and returns a Promise that resolves when pulse\n * propagation completes. This method will increment the current timestamp\n * and process all updated, pulsed and touched operators. When invoked for\n * the first time, all registered operators will be processed. This method\n * should not be invoked by third-party clients, use {@link runAsync} or\n * {@link run} instead.\n * @param {string} [encode] - The name of an encoding set to invoke during\n * propagation. This value is added to generated Pulse instances;\n * operators can then respond to (or ignore) this setting as appropriate.\n * This parameter can be used in conjunction with the Encode transform in\n * the vega-encode package.\n * @param {function} [prerun] - An optional callback function to invoke\n * immediately before dataflow evaluation commences.\n * @param {function} [postrun] - An optional callback function to invoke\n * after dataflow evaluation completes. The callback will be invoked\n * after those registered via {@link runAfter}.\n * @return {Promise} - A promise that resolves to this dataflow after\n * evaluation completes.\n */\nasync function evaluate(encode, prerun, postrun) {\n const df = this,\n async = [];\n\n // if the pulse value is set, this is a re-entrant call\n if (df._pulse) return reentrant(df);\n\n // wait for pending datasets to load\n if (df._pending) await df._pending;\n\n // invoke prerun function, if provided\n if (prerun) await asyncCallback(df, prerun);\n\n // exit early if there are no updates\n if (!df._touched.length) {\n df.debug('Dataflow invoked, but nothing to do.');\n return df;\n }\n\n // increment timestamp clock\n const stamp = ++df._clock;\n\n // set the current pulse\n df._pulse = new Pulse(df, stamp, encode);\n\n // initialize priority queue, reset touched operators\n df._touched.forEach(op => df._enqueue(op, true));\n df._touched = UniqueList(id);\n let count = 0,\n op,\n next,\n error;\n try {\n while (df._heap.size() > 0) {\n // dequeue operator with highest priority\n op = df._heap.pop();\n\n // re-queue if rank changed\n if (op.rank !== op.qrank) {\n df._enqueue(op, true);\n continue;\n }\n\n // otherwise, evaluate the operator\n next = op.run(df._getPulse(op, encode));\n if (next.then) {\n // await if operator returns a promise directly\n next = await next;\n } else if (next.async) {\n // queue parallel asynchronous execution\n async.push(next.async);\n next = StopPropagation;\n }\n\n // propagate evaluation, enqueue dependent operators\n if (next !== StopPropagation) {\n if (op._targets) op._targets.forEach(op => df._enqueue(op));\n }\n\n // increment visit counter\n ++count;\n }\n } catch (err) {\n df._heap.clear();\n error = err;\n }\n\n // reset pulse map\n df._input = {};\n df._pulse = null;\n df.debug(`Pulse ${stamp}: ${count} operators`);\n if (error) {\n df._postrun = [];\n df.error(error);\n }\n\n // invoke callbacks queued via runAfter\n if (df._postrun.length) {\n const pr = df._postrun.sort((a, b) => b.priority - a.priority);\n df._postrun = [];\n for (let i = 0; i < pr.length; ++i) {\n await asyncCallback(df, pr[i].callback);\n }\n }\n\n // invoke postrun function, if provided\n if (postrun) await asyncCallback(df, postrun);\n\n // handle non-blocking asynchronous callbacks\n if (async.length) {\n Promise.all(async).then(cb => df.runAsync(null, () => {\n cb.forEach(f => {\n try {\n f(df);\n } catch (err) {\n df.error(err);\n }\n });\n }));\n }\n return df;\n}\n\n/**\n * Queues dataflow evaluation to run once any other queued evaluations have\n * completed and returns a Promise that resolves when the queued pulse\n * propagation completes. If provided, a callback function will be invoked\n * immediately before evaluation commences. This method will ensure a\n * separate evaluation is invoked for each time it is called.\n * @param {string} [encode] - The name of an encoding set to invoke during\n * propagation. This value is added to generated Pulse instances;\n * operators can then respond to (or ignore) this setting as appropriate.\n * This parameter can be used in conjunction with the Encode transform in\n * the vega-encode package.\n * @param {function} [prerun] - An optional callback function to invoke\n * immediately before dataflow evaluation commences.\n * @param {function} [postrun] - An optional callback function to invoke\n * after dataflow evaluation completes. The callback will be invoked\n * after those registered via {@link runAfter}.\n * @return {Promise} - A promise that resolves to this dataflow after\n * evaluation completes.\n */\nasync function runAsync(encode, prerun, postrun) {\n // await previously queued functions\n while (this._running) await this._running;\n\n // run dataflow, manage running promise\n const clear = () => this._running = null;\n (this._running = this.evaluate(encode, prerun, postrun)).then(clear, clear);\n return this._running;\n}\n\n/**\n * Requests dataflow evaluation and the immediately returns this dataflow\n * instance. If there are pending data loading or other asynchronous\n * operations, the dataflow will evaluate asynchronously after this method\n * has been invoked. To track when dataflow evaluation completes, use the\n * {@link runAsync} method instead. This method will raise an error if\n * invoked while the dataflow is already in the midst of evaluation.\n * @param {string} [encode] - The name of an encoding set to invoke during\n * propagation. This value is added to generated Pulse instances;\n * operators can then respond to (or ignore) this setting as appropriate.\n * This parameter can be used in conjunction with the Encode transform in\n * the vega-encode module.\n * @param {function} [prerun] - An optional callback function to invoke\n * immediately before dataflow evaluation commences.\n * @param {function} [postrun] - An optional callback function to invoke\n * after dataflow evaluation completes. The callback will be invoked\n * after those registered via {@link runAfter}.\n * @return {Dataflow} - This dataflow instance.\n */\nfunction run(encode, prerun, postrun) {\n return this._pulse ? reentrant(this) : (this.evaluate(encode, prerun, postrun), this);\n}\n\n/**\n * Schedules a callback function to be invoked after the current pulse\n * propagation completes. If no propagation is currently occurring,\n * the function is invoked immediately. Callbacks scheduled via runAfter\n * are invoked immediately upon completion of the current cycle, before\n * any request queued via runAsync. This method is primarily intended for\n * internal use. Third-party callers using runAfter to schedule a callback\n * that invokes {@link run} or {@link runAsync} should not use this method,\n * but instead use {@link runAsync} with prerun or postrun arguments.\n * @param {function(Dataflow)} callback - The callback function to run.\n * The callback will be invoked with this Dataflow instance as its\n * sole argument.\n * @param {boolean} enqueue - A boolean flag indicating that the\n * callback should be queued up to run after the next propagation\n * cycle, suppressing immediate invocation when propagation is not\n * currently occurring.\n * @param {number} [priority] - A priority value used to sort registered\n * callbacks to determine execution order. This argument is intended\n * for internal Vega use only.\n */\nfunction runAfter(callback, enqueue, priority) {\n if (this._pulse || enqueue) {\n // pulse propagation is currently running, queue to run after\n this._postrun.push({\n priority: priority || 0,\n callback: callback\n });\n } else {\n // pulse propagation already complete, invoke immediately\n try {\n callback(this);\n } catch (err) {\n this.error(err);\n }\n }\n}\n\n/**\n * Raise an error for re-entrant dataflow evaluation.\n */\nfunction reentrant(df) {\n df.error('Dataflow already running. Use runAsync() to chain invocations.');\n return df;\n}\n\n/**\n * Enqueue an operator into the priority queue for evaluation. The operator\n * will be enqueued if it has no registered pulse for the current cycle, or if\n * the force argument is true. Upon enqueue, this method also sets the\n * operator's qrank to the current rank value.\n * @param {Operator} op - The operator to enqueue.\n * @param {boolean} [force] - A flag indicating if the operator should be\n * forceably added to the queue, even if it has already been previously\n * enqueued during the current pulse propagation. This is useful when the\n * dataflow graph is dynamically modified and the operator rank changes.\n */\nfunction enqueue(op, force) {\n const q = op.stamp < this._clock;\n if (q) op.stamp = this._clock;\n if (q || force) {\n op.qrank = op.rank;\n this._heap.push(op);\n }\n}\n\n/**\n * Provide a correct pulse for evaluating an operator. If the operator has an\n * explicit source operator, we will try to pull the pulse(s) from it.\n * If there is an array of source operators, we build a multi-pulse.\n * Otherwise, we return a current pulse with correct source data.\n * If the pulse is the pulse map has an explicit target set, we use that.\n * Else if the pulse on the upstream source operator is current, we use that.\n * Else we use the pulse from the pulse map, but copy the source tuple array.\n * @param {Operator} op - The operator for which to get an input pulse.\n * @param {string} [encode] - An (optional) encoding set name with which to\n * annotate the returned pulse. See {@link run} for more information.\n */\nfunction getPulse(op, encode) {\n const s = op.source,\n stamp = this._clock;\n return s && isArray(s) ? new MultiPulse(this, stamp, s.map(_ => _.pulse), encode) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse);\n}\nfunction singlePulse(p, s) {\n if (s && s.stamp === p.stamp) {\n return s;\n }\n p = p.fork();\n if (s && s !== StopPropagation) {\n p.source = s.source;\n }\n return p;\n}\n\nconst NO_OPT = {\n skip: false,\n force: false\n};\n\n/**\n * Touches an operator, scheduling it to be evaluated. If invoked outside of\n * a pulse propagation, the operator will be evaluated the next time this\n * dataflow is run. If invoked in the midst of pulse propagation, the operator\n * will be queued for evaluation if and only if the operator has not yet been\n * evaluated on the current propagation timestamp.\n * @param {Operator} op - The operator to touch.\n * @param {object} [options] - Additional options hash.\n * @param {boolean} [options.skip] - If true, the operator will\n * be skipped: it will not be evaluated, but its dependents will be.\n * @return {Dataflow}\n */\nfunction touch(op, options) {\n const opt = options || NO_OPT;\n if (this._pulse) {\n // if in midst of propagation, add to priority queue\n this._enqueue(op);\n } else {\n // otherwise, queue for next propagation\n this._touched.add(op);\n }\n if (opt.skip) op.skip(true);\n return this;\n}\n\n/**\n * Updates the value of the given operator.\n * @param {Operator} op - The operator to update.\n * @param {*} value - The value to set.\n * @param {object} [options] - Additional options hash.\n * @param {boolean} [options.force] - If true, the operator will\n * be re-evaluated even if its value has not changed.\n * @param {boolean} [options.skip] - If true, the operator will\n * be skipped: it will not be evaluated, but its dependents will be.\n * @return {Dataflow}\n */\nfunction update(op, value, options) {\n const opt = options || NO_OPT;\n if (op.set(value) || opt.force) {\n this.touch(op, opt);\n }\n return this;\n}\n\n/**\n * Pulses an operator with a changeset of tuples. If invoked outside of\n * a pulse propagation, the pulse will be applied the next time this\n * dataflow is run. If invoked in the midst of pulse propagation, the pulse\n * will be added to the set of active pulses and will be applied if and\n * only if the target operator has not yet been evaluated on the current\n * propagation timestamp.\n * @param {Operator} op - The operator to pulse.\n * @param {ChangeSet} value - The tuple changeset to apply.\n * @param {object} [options] - Additional options hash.\n * @param {boolean} [options.skip] - If true, the operator will\n * be skipped: it will not be evaluated, but its dependents will be.\n * @return {Dataflow}\n */\nfunction pulse(op, changeset, options) {\n this.touch(op, options || NO_OPT);\n const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)),\n t = op.pulse && op.pulse.source || [];\n p.target = op;\n this._input[op.id] = changeset.pulse(p, t);\n return this;\n}\n\nfunction Heap(cmp) {\n let nodes = [];\n return {\n clear: () => nodes = [],\n size: () => nodes.length,\n peek: () => nodes[0],\n push: x => {\n nodes.push(x);\n return siftdown(nodes, 0, nodes.length - 1, cmp);\n },\n pop: () => {\n const last = nodes.pop();\n let item;\n if (nodes.length) {\n item = nodes[0];\n nodes[0] = last;\n siftup(nodes, 0, cmp);\n } else {\n item = last;\n }\n return item;\n }\n };\n}\nfunction siftdown(array, start, idx, cmp) {\n let parent, pidx;\n const item = array[idx];\n while (idx > start) {\n pidx = idx - 1 >> 1;\n parent = array[pidx];\n if (cmp(item, parent) < 0) {\n array[idx] = parent;\n idx = pidx;\n continue;\n }\n break;\n }\n return array[idx] = item;\n}\nfunction siftup(array, idx, cmp) {\n const start = idx,\n end = array.length,\n item = array[idx];\n let cidx = (idx << 1) + 1,\n ridx;\n while (cidx < end) {\n ridx = cidx + 1;\n if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) {\n cidx = ridx;\n }\n array[idx] = array[cidx];\n idx = cidx;\n cidx = (idx << 1) + 1;\n }\n array[idx] = item;\n return siftdown(array, start, idx, cmp);\n}\n\n/**\n * A dataflow graph for reactive processing of data streams.\n * @constructor\n */\nfunction Dataflow() {\n this.logger(logger());\n this.logLevel(Error);\n this._clock = 0;\n this._rank = 0;\n this._locale = defaultLocale();\n try {\n this._loader = loader();\n } catch (e) {\n // do nothing if loader module is unavailable\n }\n this._touched = UniqueList(id);\n this._input = {};\n this._pulse = null;\n this._heap = Heap((a, b) => a.qrank - b.qrank);\n this._postrun = [];\n}\nfunction logMethod(method) {\n return function () {\n return this._log[method].apply(this, arguments);\n };\n}\nDataflow.prototype = {\n /**\n * The current timestamp of this dataflow. This value reflects the\n * timestamp of the previous dataflow run. The dataflow is initialized\n * with a stamp value of 0. The initial run of the dataflow will have\n * a timestap of 1, and so on. This value will match the\n * {@link Pulse.stamp} property.\n * @return {number} - The current timestamp value.\n */\n stamp() {\n return this._clock;\n },\n /**\n * Gets or sets the loader instance to use for data file loading. A\n * loader object must provide a \"load\" method for loading files and a\n * \"sanitize\" method for checking URL/filename validity. Both methods\n * should accept a URI and options hash as arguments, and return a Promise\n * that resolves to the loaded file contents (load) or a hash containing\n * sanitized URI data with the sanitized url assigned to the \"href\" property\n * (sanitize).\n * @param {object} _ - The loader instance to use.\n * @return {object|Dataflow} - If no arguments are provided, returns\n * the current loader instance. Otherwise returns this Dataflow instance.\n */\n loader(_) {\n if (arguments.length) {\n this._loader = _;\n return this;\n } else {\n return this._loader;\n }\n },\n /**\n * Gets or sets the locale instance to use for formatting and parsing\n * string values. The locale object should be provided by the\n * vega-format library, and include methods such as format, timeFormat,\n * utcFormat, timeParse, and utcParse.\n * @param {object} _ - The locale instance to use.\n * @return {object|Dataflow} - If no arguments are provided, returns\n * the current locale instance. Otherwise returns this Dataflow instance.\n */\n locale(_) {\n if (arguments.length) {\n this._locale = _;\n return this;\n } else {\n return this._locale;\n }\n },\n /**\n * Get or set the logger instance used to log messages. If no arguments are\n * provided, returns the current logger instance. Otherwise, sets the logger\n * and return this Dataflow instance. Provided loggers must support the full\n * API of logger objects generated by the vega-util logger method. Note that\n * by default the log level of the new logger will be used; use the logLevel\n * method to adjust the log level as needed.\n */\n logger(logger) {\n if (arguments.length) {\n this._log = logger;\n return this;\n } else {\n return this._log;\n }\n },\n /**\n * Logs an error message. By default, logged messages are written to console\n * output. The message will only be logged if the current log level is high\n * enough to permit error messages.\n */\n error: logMethod('error'),\n /**\n * Logs a warning message. By default, logged messages are written to console\n * output. The message will only be logged if the current log level is high\n * enough to permit warning messages.\n */\n warn: logMethod('warn'),\n /**\n * Logs a information message. By default, logged messages are written to\n * console output. The message will only be logged if the current log level is\n * high enough to permit information messages.\n */\n info: logMethod('info'),\n /**\n * Logs a debug message. By default, logged messages are written to console\n * output. The message will only be logged if the current log level is high\n * enough to permit debug messages.\n */\n debug: logMethod('debug'),\n /**\n * Get or set the current log level. If an argument is provided, it\n * will be used as the new log level.\n * @param {number} [level] - Should be one of None, Warn, Info\n * @return {number} - The current log level.\n */\n logLevel: logMethod('level'),\n /**\n * Empty entry threshold for garbage cleaning. Map data structures will\n * perform cleaning once the number of empty entries exceeds this value.\n */\n cleanThreshold: 1e4,\n // OPERATOR REGISTRATION\n add,\n connect,\n rank,\n rerank,\n // OPERATOR UPDATES\n pulse,\n touch,\n update,\n changeset,\n // DATA LOADING\n ingest,\n parse,\n preload,\n request,\n // EVENT HANDLING\n events,\n on,\n // PULSE PROPAGATION\n evaluate,\n run,\n runAsync,\n runAfter,\n _enqueue: enqueue,\n _getPulse: getPulse\n};\n\n/**\n * Abstract class for operators that process data tuples.\n * Subclasses must provide a {@link transform} method for operator processing.\n * @constructor\n * @param {*} [init] - The initial value for this operator.\n * @param {object} [params] - The parameters for this operator.\n * @param {Operator} [source] - The operator from which to receive pulses.\n */\nfunction Transform(init, params) {\n Operator.call(this, init, null, params);\n}\ninherits(Transform, Operator, {\n /**\n * Overrides {@link Operator.evaluate} for transform operators.\n * Internally, this method calls {@link evaluate} to perform processing.\n * If {@link evaluate} returns a falsy value, the input pulse is returned.\n * This method should NOT be overridden, instead overrride {@link evaluate}.\n * @param {Pulse} pulse - the current dataflow pulse.\n * @return the output pulse for this operator (or StopPropagation)\n */\n run(pulse) {\n if (pulse.stamp < this.stamp) return pulse.StopPropagation;\n let rv;\n if (this.skip()) {\n this.skip(false);\n } else {\n rv = this.evaluate(pulse);\n }\n rv = rv || pulse;\n if (rv.then) {\n rv = rv.then(_ => this.pulse = _);\n } else if (rv !== pulse.StopPropagation) {\n this.pulse = rv;\n }\n return rv;\n },\n /**\n * Overrides {@link Operator.evaluate} for transform operators.\n * Marshalls parameter values and then invokes {@link transform}.\n * @param {Pulse} pulse - the current dataflow pulse.\n * @return {Pulse} The output pulse (or StopPropagation). A falsy return\n value (including undefined) will let the input pulse pass through.\n */\n evaluate(pulse) {\n const params = this.marshall(pulse.stamp),\n out = this.transform(params, pulse);\n params.clear();\n return out;\n },\n /**\n * Process incoming pulses.\n * Subclasses should override this method to implement transforms.\n * @param {Parameters} _ - The operator parameter values.\n * @param {Pulse} pulse - The current dataflow pulse.\n * @return {Pulse} The output pulse (or StopPropagation). A falsy return\n * value (including undefined) will let the input pulse pass through.\n */\n transform() {}\n});\n\nconst transforms = {};\nfunction definition(type) {\n const t = transform(type);\n return t && t.Definition || null;\n}\nfunction transform(type) {\n type = type && type.toLowerCase();\n return hasOwnProperty(transforms, type) ? transforms[type] : null;\n}\n\nexport { Dataflow, EventStream, MultiPulse, Operator, Parameters, Pulse, Transform, UniqueList, asyncCallback, changeset, definition, derive, ingest$1 as ingest, isChangeSet, isTuple, rederive, replace, stableCompare, transform, transforms, tupleid };\n","export default function max(values, valueof) {\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n }\n return max;\n}\n","export default function min(values, valueof) {\n let min;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n }\n return min;\n}\n","import ascending from \"./ascending.js\";\nimport permute from \"./permute.js\";\n\nexport default function sort(values, ...F) {\n if (typeof values[Symbol.iterator] !== \"function\") throw new TypeError(\"values is not iterable\");\n values = Array.from(values);\n let [f] = F;\n if ((f && f.length !== 2) || F.length > 1) {\n const index = Uint32Array.from(values, (d, i) => i);\n if (F.length > 1) {\n F = F.map(f => values.map(f));\n index.sort((i, j) => {\n for (const f of F) {\n const c = ascendingDefined(f[i], f[j]);\n if (c) return c;\n }\n });\n } else {\n f = values.map(f);\n index.sort((i, j) => ascendingDefined(f[i], f[j]));\n }\n return permute(values, index);\n }\n return values.sort(compareDefined(f));\n}\n\nexport function compareDefined(compare = ascending) {\n if (compare === ascending) return ascendingDefined;\n if (typeof compare !== \"function\") throw new TypeError(\"compare is not a function\");\n return (a, b) => {\n const x = compare(a, b);\n if (x || x === 0) return x;\n return (compare(b, b) === 0) - (compare(a, a) === 0);\n };\n}\n\nexport function ascendingDefined(a, b) {\n return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);\n}\n","import {ascendingDefined, compareDefined} from \"./sort.js\";\n\n// Based on https://github.com/mourner/quickselect\n// ISC license, Copyright 2018 Vladimir Agafonkin.\nexport default function quickselect(array, k, left = 0, right = Infinity, compare) {\n k = Math.floor(k);\n left = Math.floor(Math.max(0, left));\n right = Math.floor(Math.min(array.length - 1, right));\n\n if (!(left <= k && k <= right)) return array;\n\n compare = compare === undefined ? ascendingDefined : compareDefined(compare);\n\n while (right > left) {\n if (right - left > 600) {\n const n = right - left + 1;\n const m = k - left + 1;\n const z = Math.log(n);\n const s = 0.5 * Math.exp(2 * z / 3);\n const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselect(array, k, newLeft, newRight, compare);\n }\n\n const t = array[k];\n let i = left;\n let j = right;\n\n swap(array, left, k);\n if (compare(array[right], t) > 0) swap(array, left, right);\n\n while (i < j) {\n swap(array, i, j), ++i, --j;\n while (compare(array[i], t) < 0) ++i;\n while (compare(array[j], t) > 0) --j;\n }\n\n if (compare(array[left], t) === 0) swap(array, left, j);\n else ++j, swap(array, j, right);\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n\n return array;\n}\n\nfunction swap(array, i, j) {\n const t = array[i];\n array[i] = array[j];\n array[j] = t;\n}\n","export default function number(x) {\n return x === null ? NaN : +x;\n}\n\nexport function* numbers(values, valueof) {\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n","import max from \"./max.js\";\nimport maxIndex from \"./maxIndex.js\";\nimport min from \"./min.js\";\nimport minIndex from \"./minIndex.js\";\nimport quickselect from \"./quickselect.js\";\nimport number, {numbers} from \"./number.js\";\nimport {ascendingDefined} from \"./sort.js\";\nimport greatest from \"./greatest.js\";\n\nexport default function quantile(values, p, valueof) {\n values = Float64Array.from(numbers(values, valueof));\n if (!(n = values.length) || isNaN(p = +p)) return;\n if (p <= 0 || n < 2) return min(values);\n if (p >= 1) return max(values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = max(quickselect(values, i0).subarray(0, i0 + 1)),\n value1 = min(values.subarray(i0 + 1));\n return value0 + (value1 - value0) * (i - i0);\n}\n\nexport function quantileSorted(values, p, valueof = number) {\n if (!(n = values.length) || isNaN(p = +p)) return;\n if (p <= 0 || n < 2) return +valueof(values[0], 0, values);\n if (p >= 1) return +valueof(values[n - 1], n - 1, values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = +valueof(values[i0], i0, values),\n value1 = +valueof(values[i0 + 1], i0 + 1, values);\n return value0 + (value1 - value0) * (i - i0);\n}\n\nexport function quantileIndex(values, p, valueof = number) {\n if (isNaN(p = +p)) return;\n numbers = Float64Array.from(values, (_, i) => number(valueof(values[i], i, values)));\n if (p <= 0) return minIndex(numbers);\n if (p >= 1) return maxIndex(numbers);\n var numbers,\n index = Uint32Array.from(values, (_, i) => i),\n j = numbers.length - 1,\n i = Math.floor(j * p);\n quickselect(index, i, 0, j, (i, j) => ascendingDefined(numbers[i], numbers[j]));\n i = greatest(index.subarray(0, i + 1), (i) => numbers[i]);\n return i >= 0 ? i : -1;\n}\n","import quantile, {quantileIndex} from \"./quantile.js\";\n\nexport default function median(values, valueof) {\n return quantile(values, 0.5, valueof);\n}\n\nexport function medianIndex(values, valueof) {\n return quantileIndex(values, 0.5, valueof);\n}\n","import { ascending, quantileSorted, deviation, quantile, median } from 'd3-array';\n\nfunction* numbers (values, valueof) {\n if (valueof == null) {\n for (let value of values) {\n if (value != null && value !== '' && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n value = valueof(value, ++index, values);\n if (value != null && value !== '' && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n\nfunction quantiles (array, p, f) {\n const values = Float64Array.from(numbers(array, f));\n\n // don't depend on return value from typed array sort call\n // protects against undefined sort results in Safari (vega/vega-lite#4964)\n values.sort(ascending);\n return p.map(_ => quantileSorted(values, _));\n}\n\nfunction quartiles (array, f) {\n return quantiles(array, [0.25, 0.50, 0.75], f);\n}\n\n// Scott, D. W. (1992) Multivariate Density Estimation:\n// Theory, Practice, and Visualization. Wiley.\nfunction estimateBandwidth (array, f) {\n const n = array.length,\n d = deviation(array, f),\n q = quartiles(array, f),\n h = (q[2] - q[0]) / 1.34,\n v = Math.min(d, h) || d || Math.abs(q[0]) || 1;\n return 1.06 * v * Math.pow(n, -0.2);\n}\n\nfunction bin (_) {\n // determine range\n const maxb = _.maxbins || 20,\n base = _.base || 10,\n logb = Math.log(base),\n div = _.divide || [5, 2];\n let min = _.extent[0],\n max = _.extent[1],\n step,\n level,\n minstep,\n v,\n i,\n n;\n const span = _.span || max - min || Math.abs(min) || 1;\n if (_.step) {\n // if step size is explicitly given, use that\n step = _.step;\n } else if (_.steps) {\n // if provided, limit choice to acceptable step sizes\n v = span / maxb;\n for (i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i);\n step = _.steps[Math.max(0, i - 1)];\n } else {\n // else use span to determine step size\n level = Math.ceil(Math.log(maxb) / logb);\n minstep = _.minstep || 0;\n step = Math.max(minstep, Math.pow(base, Math.round(Math.log(span) / logb) - level));\n\n // increase step size if too many bins\n while (Math.ceil(span / step) > maxb) {\n step *= base;\n }\n\n // decrease step size if allowed\n for (i = 0, n = div.length; i < n; ++i) {\n v = step / div[i];\n if (v >= minstep && span / v <= maxb) step = v;\n }\n }\n\n // update precision, min and max\n v = Math.log(step);\n const precision = v >= 0 ? 0 : ~~(-v / logb) + 1,\n eps = Math.pow(base, -precision - 1);\n if (_.nice || _.nice === undefined) {\n v = Math.floor(min / step + eps) * step;\n min = min < v ? v - step : v;\n max = Math.ceil(max / step) * step;\n }\n return {\n start: min,\n stop: max === min ? min + step : max,\n step: step\n };\n}\n\nvar random = Math.random;\nfunction setRandom(r) {\n random = r;\n}\n\nfunction bootstrapCI (array, samples, alpha, f) {\n if (!array.length) return [undefined, undefined];\n const values = Float64Array.from(numbers(array, f)),\n n = values.length,\n m = samples;\n let a, i, j, mu;\n for (j = 0, mu = Array(m); j < m; ++j) {\n for (a = 0, i = 0; i < n; ++i) {\n a += values[~~(random() * n)];\n }\n mu[j] = a / n;\n }\n mu.sort(ascending);\n return [quantile(mu, alpha / 2), quantile(mu, 1 - alpha / 2)];\n}\n\n// Dot density binning for dot plot construction.\n// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999.\n// https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf\nfunction dotbin (array, step, smooth, f) {\n f = f || (_ => _);\n const n = array.length,\n v = new Float64Array(n);\n let i = 0,\n j = 1,\n a = f(array[0]),\n b = a,\n w = a + step,\n x;\n for (; j < n; ++j) {\n x = f(array[j]);\n if (x >= w) {\n b = (a + b) / 2;\n for (; i < j; ++i) v[i] = b;\n w = x + step;\n a = x;\n }\n b = x;\n }\n b = (a + b) / 2;\n for (; i < j; ++i) v[i] = b;\n return smooth ? smoothing(v, step + step / 4) : v;\n}\n\n// perform smoothing to reduce variance\n// swap points between \"adjacent\" stacks\n// Wilkinson defines adjacent as within step/4 units\nfunction smoothing(v, thresh) {\n const n = v.length;\n let a = 0,\n b = 1,\n c,\n d;\n\n // get left stack\n while (v[a] === v[b]) ++b;\n while (b < n) {\n // get right stack\n c = b + 1;\n while (v[b] === v[c]) ++c;\n\n // are stacks adjacent?\n // if so, compare sizes and swap as needed\n if (v[b] - v[b - 1] < thresh) {\n d = b + (a + c - b - b >> 1);\n while (d < b) v[d++] = v[b];\n while (d > b) v[d--] = v[a];\n }\n\n // update left stack indices\n a = b;\n b = c;\n }\n return v;\n}\n\nfunction lcg (seed) {\n // Random numbers using a Linear Congruential Generator with seed value\n // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator\n return function () {\n seed = (1103515245 * seed + 12345) % 2147483647;\n return seed / 2147483647;\n };\n}\n\nfunction integer (min, max) {\n if (max == null) {\n max = min;\n min = 0;\n }\n let a, b, d;\n const dist = {\n min(_) {\n if (arguments.length) {\n a = _ || 0;\n d = b - a;\n return dist;\n } else {\n return a;\n }\n },\n max(_) {\n if (arguments.length) {\n b = _ || 0;\n d = b - a;\n return dist;\n } else {\n return b;\n }\n },\n sample() {\n return a + Math.floor(d * random());\n },\n pdf(x) {\n return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0;\n },\n cdf(x) {\n const v = Math.floor(x);\n return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d;\n },\n icdf(p) {\n return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN;\n }\n };\n return dist.min(min).max(max);\n}\n\nconst SQRT2PI = Math.sqrt(2 * Math.PI);\nconst SQRT2 = Math.SQRT2;\n\nlet nextSample = NaN;\nfunction sampleNormal(mean, stdev) {\n mean = mean || 0;\n stdev = stdev == null ? 1 : stdev;\n let x = 0,\n y = 0,\n rds,\n c;\n if (nextSample === nextSample) {\n x = nextSample;\n nextSample = NaN;\n } else {\n do {\n x = random() * 2 - 1;\n y = random() * 2 - 1;\n rds = x * x + y * y;\n } while (rds === 0 || rds > 1);\n c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform\n x *= c;\n nextSample = y * c;\n }\n return mean + x * stdev;\n}\nfunction densityNormal(value, mean, stdev) {\n stdev = stdev == null ? 1 : stdev;\n const z = (value - (mean || 0)) / stdev;\n return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI);\n}\n\n// Approximation from West (2009)\n// Better Approximations to Cumulative Normal Functions\nfunction cumulativeNormal(value, mean, stdev) {\n mean = mean || 0;\n stdev = stdev == null ? 1 : stdev;\n const z = (value - mean) / stdev,\n Z = Math.abs(z);\n let cd;\n if (Z > 37) {\n cd = 0;\n } else {\n const exp = Math.exp(-Z * Z / 2);\n let sum;\n if (Z < 7.07106781186547) {\n sum = 3.52624965998911e-02 * Z + 0.700383064443688;\n sum = sum * Z + 6.37396220353165;\n sum = sum * Z + 33.912866078383;\n sum = sum * Z + 112.079291497871;\n sum = sum * Z + 221.213596169931;\n sum = sum * Z + 220.206867912376;\n cd = exp * sum;\n sum = 8.83883476483184e-02 * Z + 1.75566716318264;\n sum = sum * Z + 16.064177579207;\n sum = sum * Z + 86.7807322029461;\n sum = sum * Z + 296.564248779674;\n sum = sum * Z + 637.333633378831;\n sum = sum * Z + 793.826512519948;\n sum = sum * Z + 440.413735824752;\n cd = cd / sum;\n } else {\n sum = Z + 0.65;\n sum = Z + 4 / sum;\n sum = Z + 3 / sum;\n sum = Z + 2 / sum;\n sum = Z + 1 / sum;\n cd = exp / sum / 2.506628274631;\n }\n }\n return z > 0 ? 1 - cd : cd;\n}\n\n// Approximation of Probit function using inverse error function.\nfunction quantileNormal(p, mean, stdev) {\n if (p < 0 || p > 1) return NaN;\n return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1);\n}\n\n// Approximate inverse error function. Implementation from \"Approximating\n// the erfinv function\" by Mike Giles, GPU Computing Gems, volume 2, 2010.\n// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0\nfunction erfinv(x) {\n // beware that the logarithm argument must be\n // commputed as (1.0 - x) * (1.0 + x),\n // it must NOT be simplified as 1.0 - x * x as this\n // would induce rounding errors near the boundaries +/-1\n let w = -Math.log((1 - x) * (1 + x)),\n p;\n if (w < 6.25) {\n w -= 3.125;\n p = -3.6444120640178196996e-21;\n p = -1.685059138182016589e-19 + p * w;\n p = 1.2858480715256400167e-18 + p * w;\n p = 1.115787767802518096e-17 + p * w;\n p = -1.333171662854620906e-16 + p * w;\n p = 2.0972767875968561637e-17 + p * w;\n p = 6.6376381343583238325e-15 + p * w;\n p = -4.0545662729752068639e-14 + p * w;\n p = -8.1519341976054721522e-14 + p * w;\n p = 2.6335093153082322977e-12 + p * w;\n p = -1.2975133253453532498e-11 + p * w;\n p = -5.4154120542946279317e-11 + p * w;\n p = 1.051212273321532285e-09 + p * w;\n p = -4.1126339803469836976e-09 + p * w;\n p = -2.9070369957882005086e-08 + p * w;\n p = 4.2347877827932403518e-07 + p * w;\n p = -1.3654692000834678645e-06 + p * w;\n p = -1.3882523362786468719e-05 + p * w;\n p = 0.0001867342080340571352 + p * w;\n p = -0.00074070253416626697512 + p * w;\n p = -0.0060336708714301490533 + p * w;\n p = 0.24015818242558961693 + p * w;\n p = 1.6536545626831027356 + p * w;\n } else if (w < 16.0) {\n w = Math.sqrt(w) - 3.25;\n p = 2.2137376921775787049e-09;\n p = 9.0756561938885390979e-08 + p * w;\n p = -2.7517406297064545428e-07 + p * w;\n p = 1.8239629214389227755e-08 + p * w;\n p = 1.5027403968909827627e-06 + p * w;\n p = -4.013867526981545969e-06 + p * w;\n p = 2.9234449089955446044e-06 + p * w;\n p = 1.2475304481671778723e-05 + p * w;\n p = -4.7318229009055733981e-05 + p * w;\n p = 6.8284851459573175448e-05 + p * w;\n p = 2.4031110387097893999e-05 + p * w;\n p = -0.0003550375203628474796 + p * w;\n p = 0.00095328937973738049703 + p * w;\n p = -0.0016882755560235047313 + p * w;\n p = 0.0024914420961078508066 + p * w;\n p = -0.0037512085075692412107 + p * w;\n p = 0.005370914553590063617 + p * w;\n p = 1.0052589676941592334 + p * w;\n p = 3.0838856104922207635 + p * w;\n } else if (Number.isFinite(w)) {\n w = Math.sqrt(w) - 5.0;\n p = -2.7109920616438573243e-11;\n p = -2.5556418169965252055e-10 + p * w;\n p = 1.5076572693500548083e-09 + p * w;\n p = -3.7894654401267369937e-09 + p * w;\n p = 7.6157012080783393804e-09 + p * w;\n p = -1.4960026627149240478e-08 + p * w;\n p = 2.9147953450901080826e-08 + p * w;\n p = -6.7711997758452339498e-08 + p * w;\n p = 2.2900482228026654717e-07 + p * w;\n p = -9.9298272942317002539e-07 + p * w;\n p = 4.5260625972231537039e-06 + p * w;\n p = -1.9681778105531670567e-05 + p * w;\n p = 7.5995277030017761139e-05 + p * w;\n p = -0.00021503011930044477347 + p * w;\n p = -0.00013871931833623122026 + p * w;\n p = 1.0103004648645343977 + p * w;\n p = 4.8499064014085844221 + p * w;\n } else {\n p = Infinity;\n }\n return p * x;\n}\nfunction gaussian (mean, stdev) {\n let mu, sigma;\n const dist = {\n mean(_) {\n if (arguments.length) {\n mu = _ || 0;\n return dist;\n } else {\n return mu;\n }\n },\n stdev(_) {\n if (arguments.length) {\n sigma = _ == null ? 1 : _;\n return dist;\n } else {\n return sigma;\n }\n },\n sample: () => sampleNormal(mu, sigma),\n pdf: value => densityNormal(value, mu, sigma),\n cdf: value => cumulativeNormal(value, mu, sigma),\n icdf: p => quantileNormal(p, mu, sigma)\n };\n return dist.mean(mean).stdev(stdev);\n}\n\nfunction kde (support, bandwidth) {\n const kernel = gaussian();\n let n = 0;\n const dist = {\n data(_) {\n if (arguments.length) {\n support = _;\n n = _ ? _.length : 0;\n return dist.bandwidth(bandwidth);\n } else {\n return support;\n }\n },\n bandwidth(_) {\n if (!arguments.length) return bandwidth;\n bandwidth = _;\n if (!bandwidth && support) bandwidth = estimateBandwidth(support);\n return dist;\n },\n sample() {\n return support[~~(random() * n)] + bandwidth * kernel.sample();\n },\n pdf(x) {\n let y = 0,\n i = 0;\n for (; i < n; ++i) {\n y += kernel.pdf((x - support[i]) / bandwidth);\n }\n return y / bandwidth / n;\n },\n cdf(x) {\n let y = 0,\n i = 0;\n for (; i < n; ++i) {\n y += kernel.cdf((x - support[i]) / bandwidth);\n }\n return y / n;\n },\n icdf() {\n throw Error('KDE icdf not supported.');\n }\n };\n return dist.data(support);\n}\n\nfunction sampleLogNormal(mean, stdev) {\n mean = mean || 0;\n stdev = stdev == null ? 1 : stdev;\n return Math.exp(mean + sampleNormal() * stdev);\n}\nfunction densityLogNormal(value, mean, stdev) {\n if (value <= 0) return 0;\n mean = mean || 0;\n stdev = stdev == null ? 1 : stdev;\n const z = (Math.log(value) - mean) / stdev;\n return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value);\n}\nfunction cumulativeLogNormal(value, mean, stdev) {\n return cumulativeNormal(Math.log(value), mean, stdev);\n}\nfunction quantileLogNormal(p, mean, stdev) {\n return Math.exp(quantileNormal(p, mean, stdev));\n}\nfunction lognormal (mean, stdev) {\n let mu, sigma;\n const dist = {\n mean(_) {\n if (arguments.length) {\n mu = _ || 0;\n return dist;\n } else {\n return mu;\n }\n },\n stdev(_) {\n if (arguments.length) {\n sigma = _ == null ? 1 : _;\n return dist;\n } else {\n return sigma;\n }\n },\n sample: () => sampleLogNormal(mu, sigma),\n pdf: value => densityLogNormal(value, mu, sigma),\n cdf: value => cumulativeLogNormal(value, mu, sigma),\n icdf: p => quantileLogNormal(p, mu, sigma)\n };\n return dist.mean(mean).stdev(stdev);\n}\n\nfunction mixture (dists, weights) {\n let m = 0,\n w;\n function normalize(x) {\n const w = [];\n let sum = 0,\n i;\n for (i = 0; i < m; ++i) {\n sum += w[i] = x[i] == null ? 1 : +x[i];\n }\n for (i = 0; i < m; ++i) {\n w[i] /= sum;\n }\n return w;\n }\n const dist = {\n weights(_) {\n if (arguments.length) {\n w = normalize(weights = _ || []);\n return dist;\n }\n return weights;\n },\n distributions(_) {\n if (arguments.length) {\n if (_) {\n m = _.length;\n dists = _;\n } else {\n m = 0;\n dists = [];\n }\n return dist.weights(weights);\n }\n return dists;\n },\n sample() {\n const r = random();\n let d = dists[m - 1],\n v = w[0],\n i = 0;\n\n // first select distribution\n for (; i < m - 1; v += w[++i]) {\n if (r < v) {\n d = dists[i];\n break;\n }\n }\n // then sample from it\n return d.sample();\n },\n pdf(x) {\n let p = 0,\n i = 0;\n for (; i < m; ++i) {\n p += w[i] * dists[i].pdf(x);\n }\n return p;\n },\n cdf(x) {\n let p = 0,\n i = 0;\n for (; i < m; ++i) {\n p += w[i] * dists[i].cdf(x);\n }\n return p;\n },\n icdf() {\n throw Error('Mixture icdf not supported.');\n }\n };\n return dist.distributions(dists).weights(weights);\n}\n\nfunction sampleUniform(min, max) {\n if (max == null) {\n max = min == null ? 1 : min;\n min = 0;\n }\n return min + (max - min) * random();\n}\nfunction densityUniform(value, min, max) {\n if (max == null) {\n max = min == null ? 1 : min;\n min = 0;\n }\n return value >= min && value <= max ? 1 / (max - min) : 0;\n}\nfunction cumulativeUniform(value, min, max) {\n if (max == null) {\n max = min == null ? 1 : min;\n min = 0;\n }\n return value < min ? 0 : value > max ? 1 : (value - min) / (max - min);\n}\nfunction quantileUniform(p, min, max) {\n if (max == null) {\n max = min == null ? 1 : min;\n min = 0;\n }\n return p >= 0 && p <= 1 ? min + p * (max - min) : NaN;\n}\nfunction uniform (min, max) {\n let a, b;\n const dist = {\n min(_) {\n if (arguments.length) {\n a = _ || 0;\n return dist;\n } else {\n return a;\n }\n },\n max(_) {\n if (arguments.length) {\n b = _ == null ? 1 : _;\n return dist;\n } else {\n return b;\n }\n },\n sample: () => sampleUniform(a, b),\n pdf: value => densityUniform(value, a, b),\n cdf: value => cumulativeUniform(value, a, b),\n icdf: p => quantileUniform(p, a, b)\n };\n if (max == null) {\n max = min == null ? 1 : min;\n min = 0;\n }\n return dist.min(min).max(max);\n}\n\nfunction constant (data, x, y) {\n let mean = 0,\n n = 0;\n for (const d of data) {\n const val = y(d);\n if (x(d) == null || val == null || isNaN(val)) continue;\n mean += (val - mean) / ++n;\n }\n return {\n coef: [mean],\n predict: () => mean,\n rSquared: 0\n };\n}\n\n// Ordinary Least Squares\nfunction ols (uX, uY, uXY, uX2) {\n const delta = uX2 - uX * uX,\n slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta,\n intercept = uY - slope * uX;\n return [intercept, slope];\n}\n\nfunction points(data, x, y, sort) {\n data = data.filter(d => {\n let u = x(d),\n v = y(d);\n return u != null && (u = +u) >= u && v != null && (v = +v) >= v;\n });\n if (sort) {\n data.sort((a, b) => x(a) - x(b));\n }\n const n = data.length,\n X = new Float64Array(n),\n Y = new Float64Array(n);\n\n // extract values, calculate means\n let i = 0,\n ux = 0,\n uy = 0,\n xv,\n yv,\n d;\n for (d of data) {\n X[i] = xv = +x(d);\n Y[i] = yv = +y(d);\n ++i;\n ux += (xv - ux) / i;\n uy += (yv - uy) / i;\n }\n\n // mean center the data\n for (i = 0; i < n; ++i) {\n X[i] -= ux;\n Y[i] -= uy;\n }\n return [X, Y, ux, uy];\n}\nfunction visitPoints(data, x, y, callback) {\n let i = -1,\n u,\n v;\n for (const d of data) {\n u = x(d);\n v = y(d);\n if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) {\n callback(u, v, ++i);\n }\n }\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nfunction rSquared (data, x, y, uY, predict) {\n let SSE = 0,\n SST = 0;\n visitPoints(data, x, y, (dx, dy) => {\n const sse = dy - predict(dx),\n sst = dy - uY;\n SSE += sse * sse;\n SST += sst * sst;\n });\n return 1 - SSE / SST;\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nfunction linear (data, x, y) {\n let X = 0,\n Y = 0,\n XY = 0,\n X2 = 0,\n n = 0;\n visitPoints(data, x, y, (dx, dy) => {\n ++n;\n X += (dx - X) / n;\n Y += (dy - Y) / n;\n XY += (dx * dy - XY) / n;\n X2 += (dx * dx - X2) / n;\n });\n const coef = ols(X, Y, XY, X2),\n predict = x => coef[0] + coef[1] * x;\n return {\n coef: coef,\n predict: predict,\n rSquared: rSquared(data, x, y, Y, predict)\n };\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nfunction log (data, x, y) {\n let X = 0,\n Y = 0,\n XY = 0,\n X2 = 0,\n n = 0;\n visitPoints(data, x, y, (dx, dy) => {\n ++n;\n dx = Math.log(dx);\n X += (dx - X) / n;\n Y += (dy - Y) / n;\n XY += (dx * dy - XY) / n;\n X2 += (dx * dx - X2) / n;\n });\n const coef = ols(X, Y, XY, X2),\n predict = x => coef[0] + coef[1] * Math.log(x);\n return {\n coef: coef,\n predict: predict,\n rSquared: rSquared(data, x, y, Y, predict)\n };\n}\n\nfunction exp (data, x, y) {\n // eslint-disable-next-line no-unused-vars\n const [xv, yv, ux, uy] = points(data, x, y);\n let YL = 0,\n XY = 0,\n XYL = 0,\n X2Y = 0,\n n = 0,\n dx,\n ly,\n xy;\n visitPoints(data, x, y, (_, dy) => {\n dx = xv[n++];\n ly = Math.log(dy);\n xy = dx * dy;\n YL += (dy * ly - YL) / n;\n XY += (xy - XY) / n;\n XYL += (xy * ly - XYL) / n;\n X2Y += (dx * xy - X2Y) / n;\n });\n const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy),\n predict = x => Math.exp(c0 + c1 * (x - ux));\n return {\n coef: [Math.exp(c0 - c1 * ux), c1],\n predict: predict,\n rSquared: rSquared(data, x, y, uy, predict)\n };\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nfunction pow (data, x, y) {\n let X = 0,\n Y = 0,\n XY = 0,\n X2 = 0,\n YS = 0,\n n = 0;\n visitPoints(data, x, y, (dx, dy) => {\n const lx = Math.log(dx),\n ly = Math.log(dy);\n ++n;\n X += (lx - X) / n;\n Y += (ly - Y) / n;\n XY += (lx * ly - XY) / n;\n X2 += (lx * lx - X2) / n;\n YS += (dy - YS) / n;\n });\n const coef = ols(X, Y, XY, X2),\n predict = x => coef[0] * Math.pow(x, coef[1]);\n coef[0] = Math.exp(coef[0]);\n return {\n coef: coef,\n predict: predict,\n rSquared: rSquared(data, x, y, YS, predict)\n };\n}\n\nfunction quad (data, x, y) {\n const [xv, yv, ux, uy] = points(data, x, y),\n n = xv.length;\n let X2 = 0,\n X3 = 0,\n X4 = 0,\n XY = 0,\n X2Y = 0,\n i,\n dx,\n dy,\n x2;\n for (i = 0; i < n;) {\n dx = xv[i];\n dy = yv[i++];\n x2 = dx * dx;\n X2 += (x2 - X2) / i;\n X3 += (x2 * dx - X3) / i;\n X4 += (x2 * x2 - X4) / i;\n XY += (dx * dy - XY) / i;\n X2Y += (x2 * dy - X2Y) / i;\n }\n const X2X2 = X4 - X2 * X2,\n d = X2 * X2X2 - X3 * X3,\n a = (X2Y * X2 - XY * X3) / d,\n b = (XY * X2X2 - X2Y * X3) / d,\n c = -a * X2,\n predict = x => {\n x = x - ux;\n return a * x * x + b * x + c + uy;\n };\n\n // transform coefficients back from mean-centered space\n return {\n coef: [c - b * ux + a * ux * ux + uy, b - 2 * a * ux, a],\n predict: predict,\n rSquared: rSquared(data, x, y, uy, predict)\n };\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\n// ... which was adapted from regression-js by Tom Alexander\n// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246\n// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE\nfunction poly (data, x, y, order) {\n // use more efficient methods for lower orders\n if (order === 0) return constant(data, x, y);\n if (order === 1) return linear(data, x, y);\n if (order === 2) return quad(data, x, y);\n const [xv, yv, ux, uy] = points(data, x, y),\n n = xv.length,\n lhs = [],\n rhs = [],\n k = order + 1;\n let i, j, l, v, c;\n for (i = 0; i < k; ++i) {\n for (l = 0, v = 0; l < n; ++l) {\n v += Math.pow(xv[l], i) * yv[l];\n }\n lhs.push(v);\n c = new Float64Array(k);\n for (j = 0; j < k; ++j) {\n for (l = 0, v = 0; l < n; ++l) {\n v += Math.pow(xv[l], i + j);\n }\n c[j] = v;\n }\n rhs.push(c);\n }\n rhs.push(lhs);\n const coef = gaussianElimination(rhs),\n predict = x => {\n x -= ux;\n let y = uy + coef[0] + coef[1] * x + coef[2] * x * x;\n for (i = 3; i < k; ++i) y += coef[i] * Math.pow(x, i);\n return y;\n };\n return {\n coef: uncenter(k, coef, -ux, uy),\n predict: predict,\n rSquared: rSquared(data, x, y, uy, predict)\n };\n}\nfunction uncenter(k, a, x, y) {\n const z = Array(k);\n let i, j, v, c;\n\n // initialize to zero\n for (i = 0; i < k; ++i) z[i] = 0;\n\n // polynomial expansion\n for (i = k - 1; i >= 0; --i) {\n v = a[i];\n c = 1;\n z[i] += v;\n for (j = 1; j <= i; ++j) {\n c *= (i + 1 - j) / j; // binomial coefficent\n z[i - j] += v * Math.pow(x, j) * c;\n }\n }\n\n // bias term\n z[0] += y;\n return z;\n}\n\n// Given an array for a two-dimensional matrix and the polynomial order,\n// solve A * x = b using Gaussian elimination.\nfunction gaussianElimination(matrix) {\n const n = matrix.length - 1,\n coef = [];\n let i, j, k, r, t;\n for (i = 0; i < n; ++i) {\n r = i; // max row\n for (j = i + 1; j < n; ++j) {\n if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) {\n r = j;\n }\n }\n for (k = i; k < n + 1; ++k) {\n t = matrix[k][i];\n matrix[k][i] = matrix[k][r];\n matrix[k][r] = t;\n }\n for (j = i + 1; j < n; ++j) {\n for (k = n; k >= i; k--) {\n matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i];\n }\n }\n }\n for (j = n - 1; j >= 0; --j) {\n t = 0;\n for (k = j + 1; k < n; ++k) {\n t += matrix[k][j] * coef[k];\n }\n coef[j] = (matrix[n][j] - t) / matrix[j][j];\n }\n return coef;\n}\n\nconst maxiters = 2,\n epsilon = 1e-12;\n\n// Adapted from science.js by Jason Davies\n// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js\n// License: https://github.com/jasondavies/science.js/blob/master/LICENSE\nfunction loess (data, x, y, bandwidth) {\n const [xv, yv, ux, uy] = points(data, x, y, true),\n n = xv.length,\n bw = Math.max(2, ~~(bandwidth * n)),\n // # nearest neighbors\n yhat = new Float64Array(n),\n residuals = new Float64Array(n),\n robustWeights = new Float64Array(n).fill(1);\n for (let iter = -1; ++iter <= maxiters;) {\n const interval = [0, bw - 1];\n for (let i = 0; i < n; ++i) {\n const dx = xv[i],\n i0 = interval[0],\n i1 = interval[1],\n edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1;\n let W = 0,\n X = 0,\n Y = 0,\n XY = 0,\n X2 = 0;\n const denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity!\n\n for (let k = i0; k <= i1; ++k) {\n const xk = xv[k],\n yk = yv[k],\n w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k],\n xkw = xk * w;\n W += w;\n X += xkw;\n Y += yk * w;\n XY += yk * xkw;\n X2 += xk * xkw;\n }\n\n // linear regression fit\n const [a, b] = ols(X / W, Y / W, XY / W, X2 / W);\n yhat[i] = a + b * dx;\n residuals[i] = Math.abs(yv[i] - yhat[i]);\n updateInterval(xv, i + 1, interval);\n }\n if (iter === maxiters) {\n break;\n }\n const medianResidual = median(residuals);\n if (Math.abs(medianResidual) < epsilon) break;\n for (let i = 0, arg, w; i < n; ++i) {\n arg = residuals[i] / (6 * medianResidual);\n // default to epsilon (rather than zero) for large deviations\n // keeping weights tiny but non-zero prevents singularites\n robustWeights[i] = arg >= 1 ? epsilon : (w = 1 - arg * arg) * w;\n }\n }\n return output(xv, yhat, ux, uy);\n}\n\n// weighting kernel for local regression\nfunction tricube(x) {\n return (x = 1 - x * x * x) * x * x;\n}\n\n// advance sliding window interval of nearest neighbors\nfunction updateInterval(xv, i, interval) {\n const val = xv[i];\n let left = interval[0],\n right = interval[1] + 1;\n if (right >= xv.length) return;\n\n // step right if distance to new right edge is <= distance to old left edge\n // step when distance is equal to ensure movement over duplicate x values\n while (i > left && xv[right] - val <= val - xv[left]) {\n interval[0] = ++left;\n interval[1] = right;\n ++right;\n }\n}\n\n// generate smoothed output points\n// average points with repeated x values\nfunction output(xv, yhat, ux, uy) {\n const n = xv.length,\n out = [];\n let i = 0,\n cnt = 0,\n prev = [],\n v;\n for (; i < n; ++i) {\n v = xv[i] + ux;\n if (prev[0] === v) {\n // average output values via online update\n prev[1] += (yhat[i] - prev[1]) / ++cnt;\n } else {\n // add new output point\n cnt = 0;\n prev[1] += uy;\n prev = [v, yhat[i]];\n out.push(prev);\n }\n }\n prev[1] += uy;\n return out;\n}\n\n// subdivide up to accuracy of 0.5 degrees\nconst MIN_RADIANS = 0.5 * Math.PI / 180;\n\n// Adaptively sample an interpolated function over a domain extent\nfunction sampleCurve (f, extent, minSteps, maxSteps) {\n minSteps = minSteps || 25;\n maxSteps = Math.max(minSteps, maxSteps || 200);\n const point = x => [x, f(x)],\n minX = extent[0],\n maxX = extent[1],\n span = maxX - minX,\n stop = span / maxSteps,\n prev = [point(minX)],\n next = [];\n if (minSteps === maxSteps) {\n // no adaptation, sample uniform grid directly and return\n for (let i = 1; i < maxSteps; ++i) {\n prev.push(point(minX + i / minSteps * span));\n }\n prev.push(point(maxX));\n return prev;\n } else {\n // sample minimum points on uniform grid\n // then move on to perform adaptive refinement\n next.push(point(maxX));\n for (let i = minSteps; --i > 0;) {\n next.push(point(minX + i / minSteps * span));\n }\n }\n let p0 = prev[0];\n let p1 = next[next.length - 1];\n const sx = 1 / span;\n const sy = scaleY(p0[1], next);\n while (p1) {\n // midpoint for potential curve subdivision\n const pm = point((p0[0] + p1[0]) / 2);\n const dx = pm[0] - p0[0] >= stop;\n if (dx && angleDelta(p0, pm, p1, sx, sy) > MIN_RADIANS) {\n // maximum resolution has not yet been met, and\n // subdivision midpoint is sufficiently different from endpoint\n // save subdivision, push midpoint onto the visitation stack\n next.push(pm);\n } else {\n // subdivision midpoint sufficiently similar to endpoint\n // skip subdivision, store endpoint, move to next point on the stack\n p0 = p1;\n prev.push(p1);\n next.pop();\n }\n p1 = next[next.length - 1];\n }\n return prev;\n}\nfunction scaleY(init, points) {\n let ymin = init;\n let ymax = init;\n const n = points.length;\n for (let i = 0; i < n; ++i) {\n const y = points[i][1];\n if (y < ymin) ymin = y;\n if (y > ymax) ymax = y;\n }\n return 1 / (ymax - ymin);\n}\nfunction angleDelta(p, q, r, sx, sy) {\n const a0 = Math.atan2(sy * (r[1] - p[1]), sx * (r[0] - p[0])),\n a1 = Math.atan2(sy * (q[1] - p[1]), sx * (q[0] - p[0]));\n return Math.abs(a0 - a1);\n}\n\nexport { estimateBandwidth as bandwidthNRD, bin, bootstrapCI, cumulativeLogNormal, cumulativeNormal, cumulativeUniform, densityLogNormal, densityNormal, densityUniform, dotbin, quantileLogNormal, quantileNormal, quantileUniform, quantiles, quartiles, random, integer as randomInteger, kde as randomKDE, lcg as randomLCG, lognormal as randomLogNormal, mixture as randomMixture, gaussian as randomNormal, uniform as randomUniform, constant as regressionConstant, exp as regressionExp, linear as regressionLinear, loess as regressionLoess, log as regressionLog, poly as regressionPoly, pow as regressionPow, quad as regressionQuad, sampleCurve, sampleLogNormal, sampleNormal, sampleUniform, setRandom };\n","import variance from \"./variance.js\";\n\nexport default function deviation(values, valueof) {\n const v = variance(values, valueof);\n return v ? Math.sqrt(v) : v;\n}\n","export default function variance(values, valueof) {\n let count = 0;\n let delta;\n let mean = 0;\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n delta = value - mean;\n mean += delta / ++count;\n sum += delta * (value - mean);\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n delta = value - mean;\n mean += delta / ++count;\n sum += delta * (value - mean);\n }\n }\n }\n if (count > 1) return sum / (count - 1);\n}\n","export default function range(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n}\n","import { extend, identity, field, hasOwnProperty, extentIndex, inherits, array, accessorName, error, accessorFields, accessor, toNumber, merge, compare, truthy, extent, span, fastmap, isArray, key, ascending, peek, zero, constant } from 'vega-util';\nimport { tupleid, Transform, replace, ingest, stableCompare, Operator, derive, rederive } from 'vega-dataflow';\nimport { quartiles, bootstrapCI, bin, randomKDE, randomMixture, randomNormal, randomLogNormal, randomUniform, sampleCurve, dotbin, quantiles, random } from 'vega-statistics';\nimport { median, mean, min, max, range, bisector } from 'd3-array';\nimport { TIME_UNITS, utcInterval, timeInterval, timeBin, timeUnits, utcFloor, timeFloor } from 'vega-time';\n\nfunction multikey(f) {\n return x => {\n const n = f.length;\n let i = 1,\n k = String(f[0](x));\n for (; i < n; ++i) {\n k += '|' + f[i](x);\n }\n return k;\n };\n}\nfunction groupkey(fields) {\n return !fields || !fields.length ? function () {\n return '';\n } : fields.length === 1 ? fields[0] : multikey(fields);\n}\n\nfunction measureName(op, field, as) {\n return as || op + (!field ? '' : '_' + field);\n}\nconst noop = () => {};\nconst base_op = {\n init: noop,\n add: noop,\n rem: noop,\n idx: 0\n};\nconst AggregateOps = {\n values: {\n init: m => m.cell.store = true,\n value: m => m.cell.data.values(),\n idx: -1\n },\n count: {\n value: m => m.cell.num\n },\n __count__: {\n value: m => m.missing + m.valid\n },\n missing: {\n value: m => m.missing\n },\n valid: {\n value: m => m.valid\n },\n sum: {\n init: m => m.sum = 0,\n value: m => m.sum,\n add: (m, v) => m.sum += +v,\n rem: (m, v) => m.sum -= v\n },\n product: {\n init: m => m.product = 1,\n value: m => m.valid ? m.product : undefined,\n add: (m, v) => m.product *= v,\n rem: (m, v) => m.product /= v\n },\n mean: {\n init: m => m.mean = 0,\n value: m => m.valid ? m.mean : undefined,\n add: (m, v) => (m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid),\n rem: (m, v) => (m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean)\n },\n average: {\n value: m => m.valid ? m.mean : undefined,\n req: ['mean'],\n idx: 1\n },\n variance: {\n init: m => m.dev = 0,\n value: m => m.valid > 1 ? m.dev / (m.valid - 1) : undefined,\n add: (m, v) => m.dev += m.mean_d * (v - m.mean),\n rem: (m, v) => m.dev -= m.mean_d * (v - m.mean),\n req: ['mean'],\n idx: 1\n },\n variancep: {\n value: m => m.valid > 1 ? m.dev / m.valid : undefined,\n req: ['variance'],\n idx: 2\n },\n stdev: {\n value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined,\n req: ['variance'],\n idx: 2\n },\n stdevp: {\n value: m => m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined,\n req: ['variance'],\n idx: 2\n },\n stderr: {\n value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined,\n req: ['variance'],\n idx: 2\n },\n distinct: {\n value: m => m.cell.data.distinct(m.get),\n req: ['values'],\n idx: 3\n },\n ci0: {\n value: m => m.cell.data.ci0(m.get),\n req: ['values'],\n idx: 3\n },\n ci1: {\n value: m => m.cell.data.ci1(m.get),\n req: ['values'],\n idx: 3\n },\n median: {\n value: m => m.cell.data.q2(m.get),\n req: ['values'],\n idx: 3\n },\n q1: {\n value: m => m.cell.data.q1(m.get),\n req: ['values'],\n idx: 3\n },\n q3: {\n value: m => m.cell.data.q3(m.get),\n req: ['values'],\n idx: 3\n },\n min: {\n init: m => m.min = undefined,\n value: m => m.min = Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min,\n add: (m, v) => {\n if (v < m.min || m.min === undefined) m.min = v;\n },\n rem: (m, v) => {\n if (v <= m.min) m.min = NaN;\n },\n req: ['values'],\n idx: 4\n },\n max: {\n init: m => m.max = undefined,\n value: m => m.max = Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max,\n add: (m, v) => {\n if (v > m.max || m.max === undefined) m.max = v;\n },\n rem: (m, v) => {\n if (v >= m.max) m.max = NaN;\n },\n req: ['values'],\n idx: 4\n },\n argmin: {\n init: m => m.argmin = undefined,\n value: m => m.argmin || m.cell.data.argmin(m.get),\n add: (m, v, t) => {\n if (v < m.min) m.argmin = t;\n },\n rem: (m, v) => {\n if (v <= m.min) m.argmin = undefined;\n },\n req: ['min', 'values'],\n idx: 3\n },\n argmax: {\n init: m => m.argmax = undefined,\n value: m => m.argmax || m.cell.data.argmax(m.get),\n add: (m, v, t) => {\n if (v > m.max) m.argmax = t;\n },\n rem: (m, v) => {\n if (v >= m.max) m.argmax = undefined;\n },\n req: ['max', 'values'],\n idx: 3\n },\n exponential: {\n init: (m, r) => {\n m.exp = 0;\n m.exp_r = r;\n },\n value: m => m.valid ? m.exp * (1 - m.exp_r) / (1 - m.exp_r ** m.valid) : undefined,\n add: (m, v) => m.exp = m.exp_r * m.exp + v,\n rem: (m, v) => m.exp = (m.exp - v / m.exp_r ** (m.valid - 1)) / m.exp_r\n },\n exponentialb: {\n value: m => m.valid ? m.exp * (1 - m.exp_r) : undefined,\n req: ['exponential'],\n idx: 1\n }\n};\nconst ValidAggregateOps = Object.keys(AggregateOps).filter(d => d !== '__count__');\nfunction measure(key, value) {\n return (out, aggregate_param) => extend({\n name: key,\n aggregate_param: aggregate_param,\n out: out || key\n }, base_op, value);\n}\n[...ValidAggregateOps, '__count__'].forEach(key => {\n AggregateOps[key] = measure(key, AggregateOps[key]);\n});\nfunction createMeasure(op, param, name) {\n return AggregateOps[op](name, param);\n}\nfunction compareIndex(a, b) {\n return a.idx - b.idx;\n}\nfunction resolve(agg) {\n const map = {};\n agg.forEach(a => map[a.name] = a);\n const getreqs = a => {\n if (!a.req) return;\n a.req.forEach(key => {\n if (!map[key]) getreqs(map[key] = AggregateOps[key]());\n });\n };\n agg.forEach(getreqs);\n return Object.values(map).sort(compareIndex);\n}\nfunction init() {\n this.valid = 0;\n this.missing = 0;\n this._ops.forEach(op => op.aggregate_param == null ? op.init(this) : op.init(this, op.aggregate_param));\n}\nfunction add(v, t) {\n if (v == null || v === '') {\n ++this.missing;\n return;\n }\n if (v !== v) return;\n ++this.valid;\n this._ops.forEach(op => op.add(this, v, t));\n}\nfunction rem(v, t) {\n if (v == null || v === '') {\n --this.missing;\n return;\n }\n if (v !== v) return;\n --this.valid;\n this._ops.forEach(op => op.rem(this, v, t));\n}\nfunction set(t) {\n this._out.forEach(op => t[op.out] = op.value(this));\n return t;\n}\nfunction compileMeasures(agg, field) {\n const get = field || identity,\n ops = resolve(agg),\n out = agg.slice().sort(compareIndex);\n function ctr(cell) {\n this._ops = ops;\n this._out = out;\n this.cell = cell;\n this.init();\n }\n ctr.prototype.init = init;\n ctr.prototype.add = add;\n ctr.prototype.rem = rem;\n ctr.prototype.set = set;\n ctr.prototype.get = get;\n ctr.fields = agg.map(op => op.out);\n return ctr;\n}\n\nfunction TupleStore(key) {\n this._key = key ? field(key) : tupleid;\n this.reset();\n}\nconst prototype$1 = TupleStore.prototype;\nprototype$1.reset = function () {\n this._add = [];\n this._rem = [];\n this._ext = null;\n this._get = null;\n this._q = null;\n};\nprototype$1.add = function (v) {\n this._add.push(v);\n};\nprototype$1.rem = function (v) {\n this._rem.push(v);\n};\nprototype$1.values = function () {\n this._get = null;\n if (this._rem.length === 0) return this._add;\n const a = this._add,\n r = this._rem,\n k = this._key,\n n = a.length,\n m = r.length,\n x = Array(n - m),\n map = {};\n let i, j, v;\n\n // use unique key field to clear removed values\n for (i = 0; i < m; ++i) {\n map[k(r[i])] = 1;\n }\n for (i = 0, j = 0; i < n; ++i) {\n if (map[k(v = a[i])]) {\n map[k(v)] = 0;\n } else {\n x[j++] = v;\n }\n }\n this._rem = [];\n return this._add = x;\n};\n\n// memoizing statistics methods\n\nprototype$1.distinct = function (get) {\n const v = this.values(),\n map = {};\n let n = v.length,\n count = 0,\n s;\n while (--n >= 0) {\n s = get(v[n]) + '';\n if (!hasOwnProperty(map, s)) {\n map[s] = 1;\n ++count;\n }\n }\n return count;\n};\nprototype$1.extent = function (get) {\n if (this._get !== get || !this._ext) {\n const v = this.values(),\n i = extentIndex(v, get);\n this._ext = [v[i[0]], v[i[1]]];\n this._get = get;\n }\n return this._ext;\n};\nprototype$1.argmin = function (get) {\n return this.extent(get)[0] || {};\n};\nprototype$1.argmax = function (get) {\n return this.extent(get)[1] || {};\n};\nprototype$1.min = function (get) {\n const m = this.extent(get)[0];\n return m != null ? get(m) : undefined;\n};\nprototype$1.max = function (get) {\n const m = this.extent(get)[1];\n return m != null ? get(m) : undefined;\n};\nprototype$1.quartile = function (get) {\n if (this._get !== get || !this._q) {\n this._q = quartiles(this.values(), get);\n this._get = get;\n }\n return this._q;\n};\nprototype$1.q1 = function (get) {\n return this.quartile(get)[0];\n};\nprototype$1.q2 = function (get) {\n return this.quartile(get)[1];\n};\nprototype$1.q3 = function (get) {\n return this.quartile(get)[2];\n};\nprototype$1.ci = function (get) {\n if (this._get !== get || !this._ci) {\n this._ci = bootstrapCI(this.values(), 1000, 0.05, get);\n this._get = get;\n }\n return this._ci;\n};\nprototype$1.ci0 = function (get) {\n return this.ci(get)[0];\n};\nprototype$1.ci1 = function (get) {\n return this.ci(get)[1];\n};\n\n/**\n * Group-by aggregation operator.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} [params.groupby] - An array of accessors to groupby.\n * @param {Array} [params.fields] - An array of accessors to aggregate.\n * @param {Array} [params.ops] - An array of strings indicating aggregation operations.\n * @param {Array} [params.aggregate_params=[null]] - An optional array of parameters for aggregation operations.\n * @param {Array} [params.as] - An array of output field names for aggregated values.\n * @param {boolean} [params.cross=false] - A flag indicating that the full\n * cross-product of groupby values should be generated, including empty cells.\n * If true, the drop parameter is ignored and empty cells are retained.\n * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed.\n */\nfunction Aggregate(params) {\n Transform.call(this, null, params);\n this._adds = []; // array of added output tuples\n this._mods = []; // array of modified output tuples\n this._alen = 0; // number of active added tuples\n this._mlen = 0; // number of active modified tuples\n this._drop = true; // should empty aggregation cells be removed\n this._cross = false; // produce full cross-product of group-by values\n\n this._dims = []; // group-by dimension accessors\n this._dnames = []; // group-by dimension names\n\n this._measures = []; // collection of aggregation monoids\n this._countOnly = false; // flag indicating only count aggregation\n this._counts = null; // collection of count fields\n this._prev = null; // previous aggregation cells\n\n this._inputs = null; // array of dependent input tuple field names\n this._outputs = null; // array of output tuple field names\n}\n\nAggregate.Definition = {\n 'type': 'Aggregate',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'ops',\n 'type': 'enum',\n 'array': true,\n 'values': ValidAggregateOps\n }, {\n 'name': 'aggregate_params',\n 'type': 'field',\n 'null': true,\n 'array': true,\n 'default': [null]\n }, {\n 'name': 'fields',\n 'type': 'field',\n 'null': true,\n 'array': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'null': true,\n 'array': true\n }, {\n 'name': 'drop',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'cross',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'key',\n 'type': 'field'\n }]\n};\ninherits(Aggregate, Transform, {\n transform(_, pulse) {\n const aggr = this,\n out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n mod = _.modified();\n aggr.stamp = out.stamp;\n if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) {\n aggr._prev = aggr.value;\n aggr.value = mod ? aggr.init(_) : Object.create(null);\n pulse.visit(pulse.SOURCE, t => aggr.add(t));\n } else {\n aggr.value = aggr.value || aggr.init(_);\n pulse.visit(pulse.REM, t => aggr.rem(t));\n pulse.visit(pulse.ADD, t => aggr.add(t));\n }\n\n // Indicate output fields and return aggregate tuples.\n out.modifies(aggr._outputs);\n\n // Should empty cells be dropped?\n aggr._drop = _.drop !== false;\n\n // If domain cross-product requested, generate empty cells as needed\n // and ensure that empty cells are not dropped\n if (_.cross && aggr._dims.length > 1) {\n aggr._drop = false;\n aggr.cross();\n }\n if (pulse.clean() && aggr._drop) {\n out.clean(true).runAfter(() => this.clean());\n }\n return aggr.changes(out);\n },\n cross() {\n const aggr = this,\n curr = aggr.value,\n dims = aggr._dnames,\n vals = dims.map(() => ({})),\n n = dims.length;\n\n // collect all group-by domain values\n function collect(cells) {\n let key, i, t, v;\n for (key in cells) {\n t = cells[key].tuple;\n for (i = 0; i < n; ++i) {\n vals[i][v = t[dims[i]]] = v;\n }\n }\n }\n collect(aggr._prev);\n collect(curr);\n\n // iterate over key cross-product, create cells as needed\n function generate(base, tuple, index) {\n const name = dims[index],\n v = vals[index++];\n for (const k in v) {\n const key = base ? base + '|' + k : k;\n tuple[name] = v[k];\n if (index < n) generate(key, tuple, index);else if (!curr[key]) aggr.cell(key, tuple);\n }\n }\n generate('', {}, 0);\n },\n init(_) {\n // initialize input and output fields\n const inputs = this._inputs = [],\n outputs = this._outputs = [],\n inputMap = {};\n function inputVisit(get) {\n const fields = array(accessorFields(get)),\n n = fields.length;\n let i = 0,\n f;\n for (; i < n; ++i) {\n if (!inputMap[f = fields[i]]) {\n inputMap[f] = 1;\n inputs.push(f);\n }\n }\n }\n\n // initialize group-by dimensions\n this._dims = array(_.groupby);\n this._dnames = this._dims.map(d => {\n const dname = accessorName(d);\n inputVisit(d);\n outputs.push(dname);\n return dname;\n });\n this.cellkey = _.key ? _.key : groupkey(this._dims);\n\n // initialize aggregate measures\n this._countOnly = true;\n this._counts = [];\n this._measures = [];\n const fields = _.fields || [null],\n ops = _.ops || ['count'],\n aggregate_params = _.aggregate_params || [null],\n as = _.as || [],\n n = fields.length,\n map = {};\n let field, op, aggregate_param, m, mname, outname, i;\n if (n !== ops.length) {\n error('Unmatched number of fields and aggregate ops.');\n }\n for (i = 0; i < n; ++i) {\n field = fields[i];\n op = ops[i];\n aggregate_param = aggregate_params[i] || null;\n if (field == null && op !== 'count') {\n error('Null aggregate field specified.');\n }\n mname = accessorName(field);\n outname = measureName(op, mname, as[i]);\n outputs.push(outname);\n if (op === 'count') {\n this._counts.push(outname);\n continue;\n }\n m = map[mname];\n if (!m) {\n inputVisit(field);\n m = map[mname] = [];\n m.field = field;\n this._measures.push(m);\n }\n if (op !== 'count') this._countOnly = false;\n m.push(createMeasure(op, aggregate_param, outname));\n }\n this._measures = this._measures.map(m => compileMeasures(m, m.field));\n return Object.create(null); // aggregation cells (this.value)\n },\n\n // -- Cell Management -----\n\n cellkey: groupkey(),\n cell(key, t) {\n let cell = this.value[key];\n if (!cell) {\n cell = this.value[key] = this.newcell(key, t);\n this._adds[this._alen++] = cell;\n } else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) {\n cell.stamp = this.stamp;\n this._adds[this._alen++] = cell;\n } else if (cell.stamp < this.stamp) {\n cell.stamp = this.stamp;\n this._mods[this._mlen++] = cell;\n }\n return cell;\n },\n newcell(key, t) {\n const cell = {\n key: key,\n num: 0,\n agg: null,\n tuple: this.newtuple(t, this._prev && this._prev[key]),\n stamp: this.stamp,\n store: false\n };\n if (!this._countOnly) {\n const measures = this._measures,\n n = measures.length;\n cell.agg = Array(n);\n for (let i = 0; i < n; ++i) {\n cell.agg[i] = new measures[i](cell);\n }\n }\n if (cell.store) {\n cell.data = new TupleStore();\n }\n return cell;\n },\n newtuple(t, p) {\n const names = this._dnames,\n dims = this._dims,\n n = dims.length,\n x = {};\n for (let i = 0; i < n; ++i) {\n x[names[i]] = dims[i](t);\n }\n return p ? replace(p.tuple, x) : ingest(x);\n },\n clean() {\n const cells = this.value;\n for (const key in cells) {\n if (cells[key].num === 0) {\n delete cells[key];\n }\n }\n },\n // -- Process Tuples -----\n\n add(t) {\n const key = this.cellkey(t),\n cell = this.cell(key, t);\n cell.num += 1;\n if (this._countOnly) return;\n if (cell.store) cell.data.add(t);\n const agg = cell.agg;\n for (let i = 0, n = agg.length; i < n; ++i) {\n agg[i].add(agg[i].get(t), t);\n }\n },\n rem(t) {\n const key = this.cellkey(t),\n cell = this.cell(key, t);\n cell.num -= 1;\n if (this._countOnly) return;\n if (cell.store) cell.data.rem(t);\n const agg = cell.agg;\n for (let i = 0, n = agg.length; i < n; ++i) {\n agg[i].rem(agg[i].get(t), t);\n }\n },\n celltuple(cell) {\n const tuple = cell.tuple,\n counts = this._counts;\n\n // consolidate stored values\n if (cell.store) {\n cell.data.values();\n }\n\n // update tuple properties\n for (let i = 0, n = counts.length; i < n; ++i) {\n tuple[counts[i]] = cell.num;\n }\n if (!this._countOnly) {\n const agg = cell.agg;\n for (let i = 0, n = agg.length; i < n; ++i) {\n agg[i].set(tuple);\n }\n }\n return tuple;\n },\n changes(out) {\n const adds = this._adds,\n mods = this._mods,\n prev = this._prev,\n drop = this._drop,\n add = out.add,\n rem = out.rem,\n mod = out.mod;\n let cell, key, i, n;\n if (prev) for (key in prev) {\n cell = prev[key];\n if (!drop || cell.num) rem.push(cell.tuple);\n }\n for (i = 0, n = this._alen; i < n; ++i) {\n add.push(this.celltuple(adds[i]));\n adds[i] = null; // for garbage collection\n }\n\n for (i = 0, n = this._mlen; i < n; ++i) {\n cell = mods[i];\n (cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell));\n mods[i] = null; // for garbage collection\n }\n\n this._alen = this._mlen = 0; // reset list of active cells\n this._prev = null;\n return out;\n }\n});\n\n// epsilon bias to offset floating point error (#1737)\nconst EPSILON$1 = 1e-14;\n\n/**\n * Generates a binning function for discretizing data.\n * @constructor\n * @param {object} params - The parameters for this operator. The\n * provided values should be valid options for the {@link bin} function.\n * @param {function(object): *} params.field - The data field to bin.\n */\nfunction Bin(params) {\n Transform.call(this, null, params);\n}\nBin.Definition = {\n 'type': 'Bin',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'interval',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'anchor',\n 'type': 'number'\n }, {\n 'name': 'maxbins',\n 'type': 'number',\n 'default': 20\n }, {\n 'name': 'base',\n 'type': 'number',\n 'default': 10\n }, {\n 'name': 'divide',\n 'type': 'number',\n 'array': true,\n 'default': [5, 2]\n }, {\n 'name': 'extent',\n 'type': 'number',\n 'array': true,\n 'length': 2,\n 'required': true\n }, {\n 'name': 'span',\n 'type': 'number'\n }, {\n 'name': 'step',\n 'type': 'number'\n }, {\n 'name': 'steps',\n 'type': 'number',\n 'array': true\n }, {\n 'name': 'minstep',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'nice',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'name',\n 'type': 'string'\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['bin0', 'bin1']\n }]\n};\ninherits(Bin, Transform, {\n transform(_, pulse) {\n const band = _.interval !== false,\n bins = this._bins(_),\n start = bins.start,\n step = bins.step,\n as = _.as || ['bin0', 'bin1'],\n b0 = as[0],\n b1 = as[1];\n let flag;\n if (_.modified()) {\n pulse = pulse.reflow(true);\n flag = pulse.SOURCE;\n } else {\n flag = pulse.modified(accessorFields(_.field)) ? pulse.ADD_MOD : pulse.ADD;\n }\n pulse.visit(flag, band ? t => {\n const v = bins(t);\n // minimum bin value (inclusive)\n t[b0] = v;\n // maximum bin value (exclusive)\n // use convoluted math for better floating point agreement\n // see https://github.com/vega/vega/issues/830\n // infinite values propagate through this formula! #2227\n t[b1] = v == null ? null : start + step * (1 + (v - start) / step);\n } : t => t[b0] = bins(t));\n return pulse.modifies(band ? as : b0);\n },\n _bins(_) {\n if (this.value && !_.modified()) {\n return this.value;\n }\n const field = _.field,\n bins = bin(_),\n step = bins.step;\n let start = bins.start,\n stop = start + Math.ceil((bins.stop - start) / step) * step,\n a,\n d;\n if ((a = _.anchor) != null) {\n d = a - (start + step * Math.floor((a - start) / step));\n start += d;\n stop += d;\n }\n const f = function (t) {\n let v = toNumber(field(t));\n return v == null ? null : v < start ? -Infinity : v > stop ? +Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON$1 + (v - start) / step));\n };\n f.start = start;\n f.stop = bins.stop;\n f.step = step;\n return this.value = accessor(f, accessorFields(field), _.name || 'bin_' + accessorName(field));\n }\n});\n\nfunction SortedList (idFunc, source, input) {\n const $ = idFunc;\n let data = source || [],\n add = input || [],\n rem = {},\n cnt = 0;\n return {\n add: t => add.push(t),\n remove: t => rem[$(t)] = ++cnt,\n size: () => data.length,\n data: (compare, resort) => {\n if (cnt) {\n data = data.filter(t => !rem[$(t)]);\n rem = {};\n cnt = 0;\n }\n if (resort && compare) {\n data.sort(compare);\n }\n if (add.length) {\n data = compare ? merge(compare, data, add.sort(compare)) : data.concat(add);\n add = [];\n }\n return data;\n }\n };\n}\n\n/**\n * Collects all data tuples that pass through this operator.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(*,*): number} [params.sort] - An optional\n * comparator function for additionally sorting the collected tuples.\n */\nfunction Collect(params) {\n Transform.call(this, [], params);\n}\nCollect.Definition = {\n 'type': 'Collect',\n 'metadata': {\n 'source': true\n },\n 'params': [{\n 'name': 'sort',\n 'type': 'compare'\n }]\n};\ninherits(Collect, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.ALL),\n list = SortedList(tupleid, this.value, out.materialize(out.ADD).add),\n sort = _.sort,\n mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields));\n out.visit(out.REM, list.remove);\n this.modified(mod);\n this.value = out.source = list.data(stableCompare(sort), mod);\n\n // propagate tree root if defined\n if (pulse.source && pulse.source.root) {\n this.value.root = pulse.source.root;\n }\n return out;\n }\n});\n\n/**\n * Generates a comparator function.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.fields - The fields to compare.\n * @param {Array} [params.orders] - The sort orders.\n * Each entry should be one of \"ascending\" (default) or \"descending\".\n */\nfunction Compare(params) {\n Operator.call(this, null, update$5, params);\n}\ninherits(Compare, Operator);\nfunction update$5(_) {\n return this.value && !_.modified() ? this.value : compare(_.fields, _.orders);\n}\n\n/**\n * Count regexp-defined pattern occurrences in a text field.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - An accessor for the text field.\n * @param {string} [params.pattern] - RegExp string defining the text pattern.\n * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case.\n * @param {string} [params.stopwords] - RegExp string of words to ignore.\n */\nfunction CountPattern(params) {\n Transform.call(this, null, params);\n}\nCountPattern.Definition = {\n 'type': 'CountPattern',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'case',\n 'type': 'enum',\n 'values': ['upper', 'lower', 'mixed'],\n 'default': 'mixed'\n }, {\n 'name': 'pattern',\n 'type': 'string',\n 'default': '[\\\\w\"]+'\n }, {\n 'name': 'stopwords',\n 'type': 'string',\n 'default': ''\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['text', 'count']\n }]\n};\nfunction tokenize(text, tcase, match) {\n switch (tcase) {\n case 'upper':\n text = text.toUpperCase();\n break;\n case 'lower':\n text = text.toLowerCase();\n break;\n }\n return text.match(match);\n}\ninherits(CountPattern, Transform, {\n transform(_, pulse) {\n const process = update => tuple => {\n var tokens = tokenize(get(tuple), _.case, match) || [],\n t;\n for (var i = 0, n = tokens.length; i < n; ++i) {\n if (!stop.test(t = tokens[i])) update(t);\n }\n };\n const init = this._parameterCheck(_, pulse),\n counts = this._counts,\n match = this._match,\n stop = this._stop,\n get = _.field,\n as = _.as || ['text', 'count'],\n add = process(t => counts[t] = 1 + (counts[t] || 0)),\n rem = process(t => counts[t] -= 1);\n if (init) {\n pulse.visit(pulse.SOURCE, add);\n } else {\n pulse.visit(pulse.ADD, add);\n pulse.visit(pulse.REM, rem);\n }\n return this._finish(pulse, as); // generate output tuples\n },\n\n _parameterCheck(_, pulse) {\n let init = false;\n if (_.modified('stopwords') || !this._stop) {\n this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i');\n init = true;\n }\n if (_.modified('pattern') || !this._match) {\n this._match = new RegExp(_.pattern || '[\\\\w\\']+', 'g');\n init = true;\n }\n if (_.modified('field') || pulse.modified(_.field.fields)) {\n init = true;\n }\n if (init) this._counts = {};\n return init;\n },\n _finish(pulse, as) {\n const counts = this._counts,\n tuples = this._tuples || (this._tuples = {}),\n text = as[0],\n count = as[1],\n out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n let w, t, c;\n for (w in counts) {\n t = tuples[w];\n c = counts[w] || 0;\n if (!t && c) {\n tuples[w] = t = ingest({});\n t[text] = w;\n t[count] = c;\n out.add.push(t);\n } else if (c === 0) {\n if (t) out.rem.push(t);\n counts[w] = null;\n tuples[w] = null;\n } else if (t[count] !== c) {\n t[count] = c;\n out.mod.push(t);\n }\n }\n return out.modifies(as);\n }\n});\n\n/**\n * Perform a cross-product of a tuple stream with itself.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object):boolean} [params.filter] - An optional filter\n * function for selectively including tuples in the cross product.\n * @param {Array} [params.as] - The names of the output fields.\n */\nfunction Cross(params) {\n Transform.call(this, null, params);\n}\nCross.Definition = {\n 'type': 'Cross',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'filter',\n 'type': 'expr'\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['a', 'b']\n }]\n};\ninherits(Cross, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE),\n as = _.as || ['a', 'b'],\n a = as[0],\n b = as[1],\n reset = !this.value || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter');\n let data = this.value;\n if (reset) {\n if (data) out.rem = data;\n data = pulse.materialize(pulse.SOURCE).source;\n out.add = this.value = cross(data, a, b, _.filter || truthy);\n } else {\n out.mod = data;\n }\n out.source = this.value;\n return out.modifies(as);\n }\n});\nfunction cross(input, a, b, filter) {\n var data = [],\n t = {},\n n = input.length,\n i = 0,\n j,\n left;\n for (; i < n; ++i) {\n t[a] = left = input[i];\n for (j = 0; j < n; ++j) {\n t[b] = input[j];\n if (filter(t)) {\n data.push(ingest(t));\n t = {};\n t[a] = left;\n }\n }\n }\n return data;\n}\n\nconst Distributions = {\n kde: randomKDE,\n mixture: randomMixture,\n normal: randomNormal,\n lognormal: randomLogNormal,\n uniform: randomUniform\n};\nconst DISTRIBUTIONS = 'distributions',\n FUNCTION = 'function',\n FIELD = 'field';\n\n/**\n * Parse a parameter object for a probability distribution.\n * @param {object} def - The distribution parameter object.\n * @param {function():Array} - A method for requesting\n * source data. Used for distributions (such as KDE) that\n * require sample data points. This method will only be\n * invoked if the 'from' parameter for a target data source\n * is not provided. Typically this method returns backing\n * source data for a Pulse object.\n * @return {object} - The output distribution object.\n */\nfunction parse(def, data) {\n const func = def[FUNCTION];\n if (!hasOwnProperty(Distributions, func)) {\n error('Unknown distribution function: ' + func);\n }\n const d = Distributions[func]();\n for (const name in def) {\n // if data field, extract values\n if (name === FIELD) {\n d.data((def.from || data()).map(def[name]));\n }\n\n // if distribution mixture, recurse to parse each definition\n else if (name === DISTRIBUTIONS) {\n d[name](def[name].map(_ => parse(_, data)));\n }\n\n // otherwise, simply set the parameter\n else if (typeof d[name] === FUNCTION) {\n d[name](def[name]);\n }\n }\n return d;\n}\n\n/**\n * Grid sample points for a probability density. Given a distribution and\n * a sampling extent, will generate points suitable for plotting either\n * PDF (probability density function) or CDF (cumulative distribution\n * function) curves.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {object} params.distribution - The probability distribution. This\n * is an object parameter dependent on the distribution type.\n * @param {string} [params.method='pdf'] - The distribution method to sample.\n * One of 'pdf' or 'cdf'.\n * @param {Array} [params.extent] - The [min, max] extent over which\n * to sample the distribution. This argument is required in most cases, but\n * can be omitted if the distribution (e.g., 'kde') supports a 'data' method\n * that returns numerical sample points from which the extent can be deduced.\n * @param {number} [params.minsteps=25] - The minimum number of curve samples\n * for plotting the density.\n * @param {number} [params.maxsteps=200] - The maximum number of curve samples\n * for plotting the density.\n * @param {number} [params.steps] - The exact number of curve samples for\n * plotting the density. If specified, overrides both minsteps and maxsteps\n * to set an exact number of uniform samples. Useful in conjunction with\n * a fixed extent to ensure consistent sample points for stacked densities.\n */\nfunction Density(params) {\n Transform.call(this, null, params);\n}\nconst distributions = [{\n 'key': {\n 'function': 'normal'\n },\n 'params': [{\n 'name': 'mean',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'stdev',\n 'type': 'number',\n 'default': 1\n }]\n}, {\n 'key': {\n 'function': 'lognormal'\n },\n 'params': [{\n 'name': 'mean',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'stdev',\n 'type': 'number',\n 'default': 1\n }]\n}, {\n 'key': {\n 'function': 'uniform'\n },\n 'params': [{\n 'name': 'min',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'max',\n 'type': 'number',\n 'default': 1\n }]\n}, {\n 'key': {\n 'function': 'kde'\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'from',\n 'type': 'data'\n }, {\n 'name': 'bandwidth',\n 'type': 'number',\n 'default': 0\n }]\n}];\nconst mixture = {\n 'key': {\n 'function': 'mixture'\n },\n 'params': [{\n 'name': 'distributions',\n 'type': 'param',\n 'array': true,\n 'params': distributions\n }, {\n 'name': 'weights',\n 'type': 'number',\n 'array': true\n }]\n};\nDensity.Definition = {\n 'type': 'Density',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'extent',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'steps',\n 'type': 'number'\n }, {\n 'name': 'minsteps',\n 'type': 'number',\n 'default': 25\n }, {\n 'name': 'maxsteps',\n 'type': 'number',\n 'default': 200\n }, {\n 'name': 'method',\n 'type': 'string',\n 'default': 'pdf',\n 'values': ['pdf', 'cdf']\n }, {\n 'name': 'distribution',\n 'type': 'param',\n 'params': distributions.concat(mixture)\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'default': ['value', 'density']\n }]\n};\ninherits(Density, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n if (!this.value || pulse.changed() || _.modified()) {\n const dist = parse(_.distribution, source(pulse)),\n minsteps = _.steps || _.minsteps || 25,\n maxsteps = _.steps || _.maxsteps || 200;\n let method = _.method || 'pdf';\n if (method !== 'pdf' && method !== 'cdf') {\n error('Invalid density method: ' + method);\n }\n if (!_.extent && !dist.data) {\n error('Missing density extent parameter.');\n }\n method = dist[method];\n const as = _.as || ['value', 'density'],\n domain = _.extent || extent(dist.data()),\n values = sampleCurve(method, domain, minsteps, maxsteps).map(v => {\n const tuple = {};\n tuple[as[0]] = v[0];\n tuple[as[1]] = v[1];\n return ingest(tuple);\n });\n if (this.value) out.rem = this.value;\n this.value = out.add = out.source = values;\n }\n return out;\n }\n});\nfunction source(pulse) {\n return () => pulse.materialize(pulse.SOURCE).source;\n}\n\n// use either provided alias or accessor field name\nfunction fieldNames(fields, as) {\n if (!fields) return null;\n return fields.map((f, i) => as[i] || accessorName(f));\n}\nfunction partition$1(data, groupby, field) {\n const groups = [],\n get = f => f(t);\n let map, i, n, t, k, g;\n\n // partition data points into groups\n if (groupby == null) {\n groups.push(data.map(field));\n } else {\n for (map = {}, i = 0, n = data.length; i < n; ++i) {\n t = data[i];\n k = groupby.map(get);\n g = map[k];\n if (!g) {\n map[k] = g = [];\n g.dims = k;\n groups.push(g);\n }\n g.push(field(t));\n }\n }\n return groups;\n}\n\nconst Output = 'bin';\n\n/**\n * Dot density binning for dot plot construction.\n * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999.\n * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to bin.\n * @param {Array} [params.groupby] - An array of accessors to groupby.\n * @param {number} [params.step] - The step size (bin width) within which dots should be\n * stacked. Defaults to 1/30 of the extent of the data *field*.\n * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density\n * stacks should be smoothed to reduce variance.\n */\nfunction DotBin(params) {\n Transform.call(this, null, params);\n}\nDotBin.Definition = {\n 'type': 'DotBin',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'step',\n 'type': 'number'\n }, {\n 'name': 'smooth',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': Output\n }]\n};\nconst autostep = (data, field) => span(extent(data, field)) / 30;\ninherits(DotBin, Transform, {\n transform(_, pulse) {\n if (this.value && !(_.modified() || pulse.changed())) {\n return pulse; // early exit\n }\n\n const source = pulse.materialize(pulse.SOURCE).source,\n groups = partition$1(pulse.source, _.groupby, identity),\n smooth = _.smooth || false,\n field = _.field,\n step = _.step || autostep(source, field),\n sort = stableCompare((a, b) => field(a) - field(b)),\n as = _.as || Output,\n n = groups.length;\n\n // compute dotplot bins per group\n let min = Infinity,\n max = -Infinity,\n i = 0,\n j;\n for (; i < n; ++i) {\n const g = groups[i].sort(sort);\n j = -1;\n for (const v of dotbin(g, step, smooth, field)) {\n if (v < min) min = v;\n if (v > max) max = v;\n g[++j][as] = v;\n }\n }\n this.value = {\n start: min,\n stop: max,\n step: step\n };\n return pulse.reflow(true).modifies(as);\n }\n});\n\n/**\n * Wraps an expression function with access to external parameters.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function} params.expr - The expression function. The\n * function should accept both a datum and a parameter object.\n * This operator's value will be a new function that wraps the\n * expression function with access to this operator's parameters.\n */\nfunction Expression(params) {\n Operator.call(this, null, update$4, params);\n this.modified(true);\n}\ninherits(Expression, Operator);\nfunction update$4(_) {\n const expr = _.expr;\n return this.value && !_.modified('expr') ? this.value : accessor(datum => expr(datum, _), accessorFields(expr), accessorName(expr));\n}\n\n/**\n * Computes extents (min/max) for a data field.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The field over which to compute extends.\n */\nfunction Extent(params) {\n Transform.call(this, [undefined, undefined], params);\n}\nExtent.Definition = {\n 'type': 'Extent',\n 'metadata': {},\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }]\n};\ninherits(Extent, Transform, {\n transform(_, pulse) {\n const extent = this.value,\n field = _.field,\n mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field');\n let min = extent[0],\n max = extent[1];\n if (mod || min == null) {\n min = +Infinity;\n max = -Infinity;\n }\n pulse.visit(mod ? pulse.SOURCE : pulse.ADD, t => {\n const v = toNumber(field(t));\n if (v != null) {\n // NaNs will fail all comparisons!\n if (v < min) min = v;\n if (v > max) max = v;\n }\n });\n if (!Number.isFinite(min) || !Number.isFinite(max)) {\n let name = accessorName(field);\n if (name) name = ` for field \"${name}\"`;\n pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`);\n min = max = undefined;\n }\n this.value = [min, max];\n }\n});\n\n/**\n * Provides a bridge between a parent transform and a target subflow that\n * consumes only a subset of the tuples that pass through the parent.\n * @constructor\n * @param {Pulse} pulse - A pulse to use as the value of this operator.\n * @param {Transform} parent - The parent transform (typically a Facet instance).\n */\nfunction Subflow(pulse, parent) {\n Operator.call(this, pulse);\n this.parent = parent;\n this.count = 0;\n}\ninherits(Subflow, Operator, {\n /**\n * Routes pulses from this subflow to a target transform.\n * @param {Transform} target - A transform that receives the subflow of tuples.\n */\n connect(target) {\n this.detachSubflow = target.detachSubflow;\n this.targets().add(target);\n return target.source = this;\n },\n /**\n * Add an 'add' tuple to the subflow pulse.\n * @param {Tuple} t - The tuple being added.\n */\n add(t) {\n this.count += 1;\n this.value.add.push(t);\n },\n /**\n * Add a 'rem' tuple to the subflow pulse.\n * @param {Tuple} t - The tuple being removed.\n */\n rem(t) {\n this.count -= 1;\n this.value.rem.push(t);\n },\n /**\n * Add a 'mod' tuple to the subflow pulse.\n * @param {Tuple} t - The tuple being modified.\n */\n mod(t) {\n this.value.mod.push(t);\n },\n /**\n * Re-initialize this operator's pulse value.\n * @param {Pulse} pulse - The pulse to copy from.\n * @see Pulse.init\n */\n init(pulse) {\n this.value.init(pulse, pulse.NO_SOURCE);\n },\n /**\n * Evaluate this operator. This method overrides the\n * default behavior to simply return the contained pulse value.\n * @return {Pulse}\n */\n evaluate() {\n // assert: this.value.stamp === pulse.stamp\n return this.value;\n }\n});\n\n/**\n * Facets a dataflow into a set of subflows based on a key.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(Dataflow, string): Operator} params.subflow - A function\n * that generates a subflow of operators and returns its root operator.\n * @param {function(object): *} params.key - The key field to facet by.\n */\nfunction Facet(params) {\n Transform.call(this, {}, params);\n this._keys = fastmap(); // cache previously calculated key values\n\n // keep track of active subflows, use as targets array for listeners\n // this allows us to limit propagation to only updated subflows\n const a = this._targets = [];\n a.active = 0;\n a.forEach = f => {\n for (let i = 0, n = a.active; i < n; ++i) {\n f(a[i], i, a);\n }\n };\n}\ninherits(Facet, Transform, {\n activate(flow) {\n this._targets[this._targets.active++] = flow;\n },\n // parent argument provided by PreFacet subclass\n subflow(key, flow, pulse, parent) {\n const flows = this.value;\n let sf = hasOwnProperty(flows, key) && flows[key],\n df,\n p;\n if (!sf) {\n p = parent || (p = this._group[key]) && p.tuple;\n df = pulse.dataflow;\n sf = new Subflow(pulse.fork(pulse.NO_SOURCE), this);\n df.add(sf).connect(flow(df, key, p));\n flows[key] = sf;\n this.activate(sf);\n } else if (sf.value.stamp < pulse.stamp) {\n sf.init(pulse);\n this.activate(sf);\n }\n return sf;\n },\n clean() {\n const flows = this.value;\n let detached = 0;\n for (const key in flows) {\n if (flows[key].count === 0) {\n const detach = flows[key].detachSubflow;\n if (detach) detach();\n delete flows[key];\n ++detached;\n }\n }\n\n // remove inactive targets from the active targets array\n if (detached) {\n const active = this._targets.filter(sf => sf && sf.count > 0);\n this.initTargets(active);\n }\n },\n initTargets(act) {\n const a = this._targets,\n n = a.length,\n m = act ? act.length : 0;\n let i = 0;\n for (; i < m; ++i) {\n a[i] = act[i];\n }\n for (; i < n && a[i] != null; ++i) {\n a[i] = null; // ensure old flows can be garbage collected\n }\n\n a.active = m;\n },\n transform(_, pulse) {\n const df = pulse.dataflow,\n key = _.key,\n flow = _.subflow,\n cache = this._keys,\n rekey = _.modified('key'),\n subflow = key => this.subflow(key, flow, pulse);\n this._group = _.group || {};\n this.initTargets(); // reset list of active subflows\n\n pulse.visit(pulse.REM, t => {\n const id = tupleid(t),\n k = cache.get(id);\n if (k !== undefined) {\n cache.delete(id);\n subflow(k).rem(t);\n }\n });\n pulse.visit(pulse.ADD, t => {\n const k = key(t);\n cache.set(tupleid(t), k);\n subflow(k).add(t);\n });\n if (rekey || pulse.modified(key.fields)) {\n pulse.visit(pulse.MOD, t => {\n const id = tupleid(t),\n k0 = cache.get(id),\n k1 = key(t);\n if (k0 === k1) {\n subflow(k1).mod(t);\n } else {\n cache.set(id, k1);\n subflow(k0).rem(t);\n subflow(k1).add(t);\n }\n });\n } else if (pulse.changed(pulse.MOD)) {\n pulse.visit(pulse.MOD, t => {\n subflow(cache.get(tupleid(t))).mod(t);\n });\n }\n if (rekey) {\n pulse.visit(pulse.REFLOW, t => {\n const id = tupleid(t),\n k0 = cache.get(id),\n k1 = key(t);\n if (k0 !== k1) {\n cache.set(id, k1);\n subflow(k0).rem(t);\n subflow(k1).add(t);\n }\n });\n }\n if (pulse.clean()) {\n df.runAfter(() => {\n this.clean();\n cache.clean();\n });\n } else if (cache.empty > df.cleanThreshold) {\n df.runAfter(cache.clean);\n }\n return pulse;\n }\n});\n\n/**\n * Generates one or more field accessor functions.\n * If the 'name' parameter is an array, an array of field accessors\n * will be created and the 'as' parameter will be ignored.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {string} params.name - The field name(s) to access.\n * @param {string} params.as - The accessor function name.\n */\nfunction Field(params) {\n Operator.call(this, null, update$3, params);\n}\ninherits(Field, Operator);\nfunction update$3(_) {\n return this.value && !_.modified() ? this.value : isArray(_.name) ? array(_.name).map(f => field(f)) : field(_.name, _.as);\n}\n\n/**\n * Filters data tuples according to a predicate function.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.expr - The predicate expression function\n * that determines a tuple's filter status. Truthy values pass the filter.\n */\nfunction Filter(params) {\n Transform.call(this, fastmap(), params);\n}\nFilter.Definition = {\n 'type': 'Filter',\n 'metadata': {\n 'changes': true\n },\n 'params': [{\n 'name': 'expr',\n 'type': 'expr',\n 'required': true\n }]\n};\ninherits(Filter, Transform, {\n transform(_, pulse) {\n const df = pulse.dataflow,\n cache = this.value,\n // cache ids of filtered tuples\n output = pulse.fork(),\n add = output.add,\n rem = output.rem,\n mod = output.mod,\n test = _.expr;\n let isMod = true;\n pulse.visit(pulse.REM, t => {\n const id = tupleid(t);\n if (!cache.has(id)) rem.push(t);else cache.delete(id);\n });\n pulse.visit(pulse.ADD, t => {\n if (test(t, _)) add.push(t);else cache.set(tupleid(t), 1);\n });\n function revisit(t) {\n const id = tupleid(t),\n b = test(t, _),\n s = cache.get(id);\n if (b && s) {\n cache.delete(id);\n add.push(t);\n } else if (!b && !s) {\n cache.set(id, 1);\n rem.push(t);\n } else if (isMod && b && !s) {\n mod.push(t);\n }\n }\n pulse.visit(pulse.MOD, revisit);\n if (_.modified()) {\n isMod = false;\n pulse.visit(pulse.REFLOW, revisit);\n }\n if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean);\n return output;\n }\n});\n\n/**\n * Flattens array-typed field values into new data objects.\n * If multiple fields are specified, they are treated as parallel arrays,\n * with output values included for each matching index (or null if missing).\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.fields - An array of field\n * accessors for the tuple fields that should be flattened.\n * @param {string} [params.index] - Optional output field name for index\n * value. If unspecified, no index field is included in the output.\n * @param {Array} [params.as] - Output field names for flattened\n * array fields. Any unspecified fields will use the field name provided\n * by the fields accessors.\n */\nfunction Flatten(params) {\n Transform.call(this, [], params);\n}\nFlatten.Definition = {\n 'type': 'Flatten',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'required': true\n }, {\n 'name': 'index',\n 'type': 'string'\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true\n }]\n};\ninherits(Flatten, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE),\n fields = _.fields,\n as = fieldNames(fields, _.as || []),\n index = _.index || null,\n m = as.length;\n\n // remove any previous results\n out.rem = this.value;\n\n // generate flattened tuples\n pulse.visit(pulse.SOURCE, t => {\n const arrays = fields.map(f => f(t)),\n maxlen = arrays.reduce((l, a) => Math.max(l, a.length), 0);\n let i = 0,\n j,\n d,\n v;\n for (; i < maxlen; ++i) {\n d = derive(t);\n for (j = 0; j < m; ++j) {\n d[as[j]] = (v = arrays[j][i]) == null ? null : v;\n }\n if (index) {\n d[index] = i;\n }\n out.add.push(d);\n }\n });\n this.value = out.source = out.add;\n if (index) out.modifies(index);\n return out.modifies(as);\n }\n});\n\n/**\n * Folds one more tuple fields into multiple tuples in which the field\n * name and values are available under new 'key' and 'value' fields.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.fields - An array of field accessors\n * for the tuple fields that should be folded.\n * @param {Array} [params.as] - Output field names for folded key\n * and value fields, defaults to ['key', 'value'].\n */\nfunction Fold(params) {\n Transform.call(this, [], params);\n}\nFold.Definition = {\n 'type': 'Fold',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'required': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['key', 'value']\n }]\n};\ninherits(Fold, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE),\n fields = _.fields,\n fnames = fields.map(accessorName),\n as = _.as || ['key', 'value'],\n k = as[0],\n v = as[1],\n n = fields.length;\n out.rem = this.value;\n pulse.visit(pulse.SOURCE, t => {\n for (let i = 0, d; i < n; ++i) {\n d = derive(t);\n d[k] = fnames[i];\n d[v] = fields[i](t);\n out.add.push(d);\n }\n });\n this.value = out.source = out.add;\n return out.modifies(as);\n }\n});\n\n/**\n * Invokes a function for each data tuple and saves the results as a new field.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.expr - The formula function to invoke for each tuple.\n * @param {string} params.as - The field name under which to save the result.\n * @param {boolean} [params.initonly=false] - If true, the formula is applied to\n * added tuples only, and does not update in response to modifications.\n */\nfunction Formula(params) {\n Transform.call(this, null, params);\n}\nFormula.Definition = {\n 'type': 'Formula',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'expr',\n 'type': 'expr',\n 'required': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'required': true\n }, {\n 'name': 'initonly',\n 'type': 'boolean'\n }]\n};\ninherits(Formula, Transform, {\n transform(_, pulse) {\n const func = _.expr,\n as = _.as,\n mod = _.modified(),\n flag = _.initonly ? pulse.ADD : mod ? pulse.SOURCE : pulse.modified(func.fields) || pulse.modified(as) ? pulse.ADD_MOD : pulse.ADD;\n if (mod) {\n // parameters updated, need to reflow\n pulse = pulse.materialize().reflow(true);\n }\n if (!_.initonly) {\n pulse.modifies(as);\n }\n return pulse.visit(flag, t => t[as] = func(t, _));\n }\n});\n\n/**\n * Generates data tuples using a provided generator function.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(Parameters): object} params.generator - A tuple generator\n * function. This function is given the operator parameters as input.\n * Changes to any additional parameters will not trigger re-calculation\n * of previously generated tuples. Only future tuples are affected.\n * @param {number} params.size - The number of tuples to produce.\n */\nfunction Generate(params) {\n Transform.call(this, [], params);\n}\ninherits(Generate, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.ALL),\n gen = _.generator;\n let data = this.value,\n num = _.size - data.length,\n add,\n rem,\n t;\n if (num > 0) {\n // need more tuples, generate and add\n for (add = []; --num >= 0;) {\n add.push(t = ingest(gen(_)));\n data.push(t);\n }\n out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add;\n } else {\n // need fewer tuples, remove\n rem = data.slice(0, -num);\n out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem) : rem;\n data = data.slice(-num);\n }\n out.source = this.value = data;\n return out;\n }\n});\n\nconst Methods = {\n value: 'value',\n median: median,\n mean: mean,\n min: min,\n max: max\n};\nconst Empty = [];\n\n/**\n * Impute missing values.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to impute.\n * @param {Array} [params.groupby] - An array of\n * accessors to determine series within which to perform imputation.\n * @param {function(object): *} params.key - An accessor for a key value.\n * Each key value should be unique within a group. New tuples will be\n * imputed for any key values that are not found within a group.\n * @param {Array<*>} [params.keyvals] - Optional array of required key\n * values. New tuples will be imputed for any key values that are not\n * found within a group. In addition, these values will be automatically\n * augmented with the key values observed in the input data.\n * @param {string} [method='value'] - The imputation method to use. One of\n * 'value', 'mean', 'median', 'max', 'min'.\n * @param {*} [value=0] - The constant value to use for imputation\n * when using method 'value'.\n */\nfunction Impute(params) {\n Transform.call(this, [], params);\n}\nImpute.Definition = {\n 'type': 'Impute',\n 'metadata': {\n 'changes': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'key',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'keyvals',\n 'array': true\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'method',\n 'type': 'enum',\n 'default': 'value',\n 'values': ['value', 'mean', 'median', 'max', 'min']\n }, {\n 'name': 'value',\n 'default': 0\n }]\n};\nfunction getValue(_) {\n var m = _.method || Methods.value,\n v;\n if (Methods[m] == null) {\n error('Unrecognized imputation method: ' + m);\n } else if (m === Methods.value) {\n v = _.value !== undefined ? _.value : 0;\n return () => v;\n } else {\n return Methods[m];\n }\n}\nfunction getField(_) {\n const f = _.field;\n return t => t ? f(t) : NaN;\n}\ninherits(Impute, Transform, {\n transform(_, pulse) {\n var out = pulse.fork(pulse.ALL),\n impute = getValue(_),\n field = getField(_),\n fName = accessorName(_.field),\n kName = accessorName(_.key),\n gNames = (_.groupby || []).map(accessorName),\n groups = partition(pulse.source, _.groupby, _.key, _.keyvals),\n curr = [],\n prev = this.value,\n m = groups.domain.length,\n group,\n value,\n gVals,\n kVal,\n g,\n i,\n j,\n l,\n n,\n t;\n for (g = 0, l = groups.length; g < l; ++g) {\n group = groups[g];\n gVals = group.values;\n value = NaN;\n\n // add tuples for missing values\n for (j = 0; j < m; ++j) {\n if (group[j] != null) continue;\n kVal = groups.domain[j];\n t = {\n _impute: true\n };\n for (i = 0, n = gVals.length; i < n; ++i) t[gNames[i]] = gVals[i];\n t[kName] = kVal;\n t[fName] = Number.isNaN(value) ? value = impute(group, field) : value;\n curr.push(ingest(t));\n }\n }\n\n // update pulse with imputed tuples\n if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr);\n if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev);\n this.value = curr;\n return out;\n }\n});\nfunction partition(data, groupby, key, keyvals) {\n var get = f => f(t),\n groups = [],\n domain = keyvals ? keyvals.slice() : [],\n kMap = {},\n gMap = {},\n gVals,\n gKey,\n group,\n i,\n j,\n k,\n n,\n t;\n domain.forEach((k, i) => kMap[k] = i + 1);\n for (i = 0, n = data.length; i < n; ++i) {\n t = data[i];\n k = key(t);\n j = kMap[k] || (kMap[k] = domain.push(k));\n gKey = (gVals = groupby ? groupby.map(get) : Empty) + '';\n if (!(group = gMap[gKey])) {\n group = gMap[gKey] = [];\n groups.push(group);\n group.values = gVals;\n }\n group[j - 1] = t;\n }\n groups.domain = domain;\n return groups;\n}\n\n/**\n * Extend input tuples with aggregate values.\n * Calcuates aggregate values and joins them with the input stream.\n * @constructor\n */\nfunction JoinAggregate(params) {\n Aggregate.call(this, params);\n}\nJoinAggregate.Definition = {\n 'type': 'JoinAggregate',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'fields',\n 'type': 'field',\n 'null': true,\n 'array': true\n }, {\n 'name': 'ops',\n 'type': 'enum',\n 'array': true,\n 'values': ValidAggregateOps\n }, {\n 'name': 'as',\n 'type': 'string',\n 'null': true,\n 'array': true\n }, {\n 'name': 'key',\n 'type': 'field'\n }]\n};\ninherits(JoinAggregate, Aggregate, {\n transform(_, pulse) {\n const aggr = this,\n mod = _.modified();\n let cells;\n\n // process all input tuples to calculate aggregates\n if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) {\n cells = aggr.value = mod ? aggr.init(_) : {};\n pulse.visit(pulse.SOURCE, t => aggr.add(t));\n } else {\n cells = aggr.value = aggr.value || this.init(_);\n pulse.visit(pulse.REM, t => aggr.rem(t));\n pulse.visit(pulse.ADD, t => aggr.add(t));\n }\n\n // update aggregation cells\n aggr.changes();\n\n // write aggregate values to input tuples\n pulse.visit(pulse.SOURCE, t => {\n extend(t, cells[aggr.cellkey(t)].tuple);\n });\n return pulse.reflow(mod).modifies(this._outputs);\n },\n changes() {\n const adds = this._adds,\n mods = this._mods;\n let i, n;\n for (i = 0, n = this._alen; i < n; ++i) {\n this.celltuple(adds[i]);\n adds[i] = null; // for garbage collection\n }\n\n for (i = 0, n = this._mlen; i < n; ++i) {\n this.celltuple(mods[i]);\n mods[i] = null; // for garbage collection\n }\n\n this._alen = this._mlen = 0; // reset list of active cells\n }\n});\n\n/**\n * Compute kernel density estimates (KDE) for one or more data groups.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} [params.groupby] - An array of accessors\n * to groupby.\n * @param {function(object): *} params.field - An accessor for the data field\n * to estimate.\n * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth.\n * If zero or unspecified, the bandwidth is automatically determined.\n * @param {boolean} [params.counts=false] - A boolean flag indicating if the\n * output values should be probability estimates (false, default) or\n * smoothed counts (true).\n * @param {string} [params.cumulative=false] - A boolean flag indicating if a\n * density (false) or cumulative distribution (true) should be generated.\n * @param {Array} [params.extent] - The domain extent over which to\n * plot the density. If unspecified, the [min, max] data extent is used.\n * @param {string} [params.resolve='independent'] - Indicates how parameters for\n * multiple densities should be resolved. If \"independent\" (the default), each\n * density may have its own domain extent and dynamic number of curve sample\n * steps. If \"shared\", the KDE transform will ensure that all densities are\n * defined over a shared domain and curve steps, enabling stacking.\n * @param {number} [params.minsteps=25] - The minimum number of curve samples\n * for plotting the density.\n * @param {number} [params.maxsteps=200] - The maximum number of curve samples\n * for plotting the density.\n * @param {number} [params.steps] - The exact number of curve samples for\n * plotting the density. If specified, overrides both minsteps and maxsteps\n * to set an exact number of uniform samples. Useful in conjunction with\n * a fixed extent to ensure consistent sample points for stacked densities.\n */\nfunction KDE(params) {\n Transform.call(this, null, params);\n}\nKDE.Definition = {\n 'type': 'KDE',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'cumulative',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'counts',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'bandwidth',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'extent',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'resolve',\n 'type': 'enum',\n 'values': ['shared', 'independent'],\n 'default': 'independent'\n }, {\n 'name': 'steps',\n 'type': 'number'\n }, {\n 'name': 'minsteps',\n 'type': 'number',\n 'default': 25\n }, {\n 'name': 'maxsteps',\n 'type': 'number',\n 'default': 200\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'default': ['value', 'density']\n }]\n};\ninherits(KDE, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n if (!this.value || pulse.changed() || _.modified()) {\n const source = pulse.materialize(pulse.SOURCE).source,\n groups = partition$1(source, _.groupby, _.field),\n names = (_.groupby || []).map(accessorName),\n bandwidth = _.bandwidth,\n method = _.cumulative ? 'cdf' : 'pdf',\n as = _.as || ['value', 'density'],\n values = [];\n let domain = _.extent,\n minsteps = _.steps || _.minsteps || 25,\n maxsteps = _.steps || _.maxsteps || 200;\n if (method !== 'pdf' && method !== 'cdf') {\n error('Invalid density method: ' + method);\n }\n if (_.resolve === 'shared') {\n if (!domain) domain = extent(source, _.field);\n minsteps = maxsteps = _.steps || maxsteps;\n }\n groups.forEach(g => {\n const density = randomKDE(g, bandwidth)[method],\n scale = _.counts ? g.length : 1,\n local = domain || extent(g);\n sampleCurve(density, local, minsteps, maxsteps).forEach(v => {\n const t = {};\n for (let i = 0; i < names.length; ++i) {\n t[names[i]] = g.dims[i];\n }\n t[as[0]] = v[0];\n t[as[1]] = v[1] * scale;\n values.push(ingest(t));\n });\n });\n if (this.value) out.rem = this.value;\n this.value = out.add = out.source = values;\n }\n return out;\n }\n});\n\n/**\n * Generates a key function.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.fields - The field name(s) for the key function.\n * @param {boolean} params.flat - A boolean flag indicating if the field names\n * should be treated as flat property names, side-stepping nested field\n * lookups normally indicated by dot or bracket notation.\n */\nfunction Key(params) {\n Operator.call(this, null, update$2, params);\n}\ninherits(Key, Operator);\nfunction update$2(_) {\n return this.value && !_.modified() ? this.value : key(_.fields, _.flat);\n}\n\n/**\n * Load and parse data from an external source. Marshalls parameter\n * values and then invokes the Dataflow request method.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {string} params.url - The URL to load from.\n * @param {object} params.format - The data format options.\n */\nfunction Load(params) {\n Transform.call(this, [], params);\n this._pending = null;\n}\ninherits(Load, Transform, {\n transform(_, pulse) {\n const df = pulse.dataflow;\n if (this._pending) {\n // update state and return pulse\n return output(this, pulse, this._pending);\n }\n if (stop(_)) return pulse.StopPropagation;\n if (_.values) {\n // parse and ingest values, return output pulse\n return output(this, pulse, df.parse(_.values, _.format));\n } else if (_.async) {\n // return promise for non-blocking async loading\n const p = df.request(_.url, _.format).then(res => {\n this._pending = array(res.data);\n return df => df.touch(this);\n });\n return {\n async: p\n };\n } else {\n // return promise for synchronous loading\n return df.request(_.url, _.format).then(res => output(this, pulse, array(res.data)));\n }\n }\n});\nfunction stop(_) {\n return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format'));\n}\nfunction output(op, pulse, data) {\n data.forEach(ingest);\n const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE);\n out.rem = op.value;\n op.value = out.source = out.add = data;\n op._pending = null;\n if (out.rem.length) out.clean(true);\n return out;\n}\n\n/**\n * Extend tuples by joining them with values from a lookup table.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Map} params.index - The lookup table map.\n * @param {Array} params.as - Output field names for each lookup value.\n * @param {*} [params.default] - A default value to use if lookup fails.\n */\nfunction Lookup(params) {\n Transform.call(this, {}, params);\n}\nLookup.Definition = {\n 'type': 'Lookup',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'index',\n 'type': 'index',\n 'params': [{\n 'name': 'from',\n 'type': 'data',\n 'required': true\n }, {\n 'name': 'key',\n 'type': 'field',\n 'required': true\n }]\n }, {\n 'name': 'values',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'required': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true\n }, {\n 'name': 'default',\n 'default': null\n }]\n};\ninherits(Lookup, Transform, {\n transform(_, pulse) {\n const keys = _.fields,\n index = _.index,\n values = _.values,\n defaultValue = _.default == null ? null : _.default,\n reset = _.modified(),\n n = keys.length;\n let flag = reset ? pulse.SOURCE : pulse.ADD,\n out = pulse,\n as = _.as,\n set,\n m,\n mods;\n if (values) {\n m = values.length;\n if (n > 1 && !as) {\n error('Multi-field lookup requires explicit \"as\" parameter.');\n }\n if (as && as.length !== n * m) {\n error('The \"as\" parameter has too few output field names.');\n }\n as = as || values.map(accessorName);\n set = function (t) {\n for (var i = 0, k = 0, j, v; i < n; ++i) {\n v = index.get(keys[i](t));\n if (v == null) for (j = 0; j < m; ++j, ++k) t[as[k]] = defaultValue;else for (j = 0; j < m; ++j, ++k) t[as[k]] = values[j](v);\n }\n };\n } else {\n if (!as) {\n error('Missing output field names.');\n }\n set = function (t) {\n for (var i = 0, v; i < n; ++i) {\n v = index.get(keys[i](t));\n t[as[i]] = v == null ? defaultValue : v;\n }\n };\n }\n if (reset) {\n out = pulse.reflow(true);\n } else {\n mods = keys.some(k => pulse.modified(k.fields));\n flag |= mods ? pulse.MOD : 0;\n }\n pulse.visit(flag, set);\n return out.modifies(as);\n }\n});\n\n/**\n * Computes global min/max extents over a collection of extents.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array>} params.extents - The input extents.\n */\nfunction MultiExtent(params) {\n Operator.call(this, null, update$1, params);\n}\ninherits(MultiExtent, Operator);\nfunction update$1(_) {\n if (this.value && !_.modified()) {\n return this.value;\n }\n const ext = _.extents,\n n = ext.length;\n let min = +Infinity,\n max = -Infinity,\n i,\n e;\n for (i = 0; i < n; ++i) {\n e = ext[i];\n if (e[0] < min) min = e[0];\n if (e[1] > max) max = e[1];\n }\n return [min, max];\n}\n\n/**\n * Merge a collection of value arrays.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array>} params.values - The input value arrrays.\n */\nfunction MultiValues(params) {\n Operator.call(this, null, update, params);\n}\ninherits(MultiValues, Operator);\nfunction update(_) {\n return this.value && !_.modified() ? this.value : _.values.reduce((data, _) => data.concat(_), []);\n}\n\n/**\n * Operator whose value is simply its parameter hash. This operator is\n * useful for enabling reactive updates to values of nested objects.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction Params(params) {\n Transform.call(this, null, params);\n}\ninherits(Params, Transform, {\n transform(_, pulse) {\n this.modified(_.modified());\n this.value = _;\n return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples\n }\n});\n\n/**\n * Aggregate and pivot selected field values to become new fields.\n * This operator is useful to construction cross-tabulations.\n * @constructor\n * @param {Array} [params.groupby] - An array of accessors\n * to groupby. These fields act just like groupby fields of an Aggregate transform.\n * @param {function(object): *} params.field - The field to pivot on. The unique\n * values of this field become new field names in the output stream.\n * @param {function(object): *} params.value - The field to populate pivoted fields.\n * The aggregate values of this field become the values of the new pivoted fields.\n * @param {string} [params.op] - The aggregation operation for the value field,\n * applied per cell in the output stream. The default is \"sum\".\n * @param {number} [params.limit] - An optional parameter indicating the maximum\n * number of pivoted fields to generate. The pivoted field names are sorted in\n * ascending order prior to enforcing the limit.\n */\nfunction Pivot(params) {\n Aggregate.call(this, params);\n}\nPivot.Definition = {\n 'type': 'Pivot',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'value',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'op',\n 'type': 'enum',\n 'values': ValidAggregateOps,\n 'default': 'sum'\n }, {\n 'name': 'limit',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'key',\n 'type': 'field'\n }]\n};\ninherits(Pivot, Aggregate, {\n _transform: Aggregate.prototype.transform,\n transform(_, pulse) {\n return this._transform(aggregateParams(_, pulse), pulse);\n }\n});\n\n// Shoehorn a pivot transform into an aggregate transform!\n// First collect all unique pivot field values.\n// Then generate aggregate fields for each output pivot field.\nfunction aggregateParams(_, pulse) {\n const key = _.field,\n value = _.value,\n op = (_.op === 'count' ? '__count__' : _.op) || 'sum',\n fields = accessorFields(key).concat(accessorFields(value)),\n keys = pivotKeys(key, _.limit || 0, pulse);\n\n // if data stream content changes, pivot fields may change\n // flag parameter modification to ensure re-initialization\n if (pulse.changed()) _.set('__pivot__', null, null, true);\n return {\n key: _.key,\n groupby: _.groupby,\n ops: keys.map(() => op),\n fields: keys.map(k => get(k, key, value, fields)),\n as: keys.map(k => k + ''),\n modified: _.modified.bind(_)\n };\n}\n\n// Generate aggregate field accessor.\n// Output NaN for non-existent values; aggregator will ignore!\nfunction get(k, key, value, fields) {\n return accessor(d => key(d) === k ? value(d) : NaN, fields, k + '');\n}\n\n// Collect (and optionally limit) all unique pivot values.\nfunction pivotKeys(key, limit, pulse) {\n const map = {},\n list = [];\n pulse.visit(pulse.SOURCE, t => {\n const k = key(t);\n if (!map[k]) {\n map[k] = 1;\n list.push(k);\n }\n });\n list.sort(ascending);\n return limit ? list.slice(0, limit) : list;\n}\n\n/**\n * Partitions pre-faceted data into tuple subflows.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(Dataflow, string): Operator} params.subflow - A function\n * that generates a subflow of operators and returns its root operator.\n * @param {function(object): Array} params.field - The field\n * accessor for an array of subflow tuple objects.\n */\nfunction PreFacet(params) {\n Facet.call(this, params);\n}\ninherits(PreFacet, Facet, {\n transform(_, pulse) {\n const flow = _.subflow,\n field = _.field,\n subflow = t => this.subflow(tupleid(t), flow, pulse, t);\n if (_.modified('field') || field && pulse.modified(accessorFields(field))) {\n error('PreFacet does not support field modification.');\n }\n this.initTargets(); // reset list of active subflows\n\n if (field) {\n pulse.visit(pulse.MOD, t => {\n const sf = subflow(t);\n field(t).forEach(_ => sf.mod(_));\n });\n pulse.visit(pulse.ADD, t => {\n const sf = subflow(t);\n field(t).forEach(_ => sf.add(ingest(_)));\n });\n pulse.visit(pulse.REM, t => {\n const sf = subflow(t);\n field(t).forEach(_ => sf.rem(_));\n });\n } else {\n pulse.visit(pulse.MOD, t => subflow(t).mod(t));\n pulse.visit(pulse.ADD, t => subflow(t).add(t));\n pulse.visit(pulse.REM, t => subflow(t).rem(t));\n }\n if (pulse.clean()) {\n pulse.runAfter(() => this.clean());\n }\n return pulse;\n }\n});\n\n/**\n * Performs a relational projection, copying selected fields from source\n * tuples to a new set of derived tuples.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} [params.as] - Output field names for each projected\n * field. Any unspecified fields will use the field name provided by\n * the field accessor.\n */\nfunction Project(params) {\n Transform.call(this, null, params);\n}\nProject.Definition = {\n 'type': 'Project',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'fields',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'null': true,\n 'array': true\n }]\n};\ninherits(Project, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE),\n fields = _.fields,\n as = fieldNames(_.fields, _.as || []),\n derive = fields ? (s, t) => project(s, t, fields, as) : rederive;\n let lut;\n if (this.value) {\n lut = this.value;\n } else {\n pulse = pulse.addAll();\n lut = this.value = {};\n }\n pulse.visit(pulse.REM, t => {\n const id = tupleid(t);\n out.rem.push(lut[id]);\n lut[id] = null;\n });\n pulse.visit(pulse.ADD, t => {\n const dt = derive(t, ingest({}));\n lut[tupleid(t)] = dt;\n out.add.push(dt);\n });\n pulse.visit(pulse.MOD, t => {\n out.mod.push(derive(t, lut[tupleid(t)]));\n });\n return out;\n }\n});\nfunction project(s, t, fields, as) {\n for (let i = 0, n = fields.length; i < n; ++i) {\n t[as[i]] = fields[i](s);\n }\n return t;\n}\n\n/**\n * Proxy the value of another operator as a pure signal value.\n * Ensures no tuples are propagated.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {*} params.value - The value to proxy, becomes the value of this operator.\n */\nfunction Proxy(params) {\n Transform.call(this, null, params);\n}\ninherits(Proxy, Transform, {\n transform(_, pulse) {\n this.value = _.value;\n return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation;\n }\n});\n\n/**\n * Generates sample quantile values from an input data stream.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - An accessor for the data field\n * over which to calculate quantile values.\n * @param {Array} [params.groupby] - An array of accessors\n * to groupby.\n * @param {Array} [params.probs] - An array of probabilities in\n * the range (0, 1) for which to compute quantile values. If not specified,\n * the *step* parameter will be used.\n * @param {Array} [params.step=0.01] - A probability step size for\n * sampling quantile values. All values from one-half the step size up to\n * 1 (exclusive) will be sampled. This parameter is only used if the\n * *quantiles* parameter is not provided.\n */\nfunction Quantile(params) {\n Transform.call(this, null, params);\n}\nQuantile.Definition = {\n 'type': 'Quantile',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'probs',\n 'type': 'number',\n 'array': true\n }, {\n 'name': 'step',\n 'type': 'number',\n 'default': 0.01\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'default': ['prob', 'value']\n }]\n};\nconst EPSILON = 1e-14;\ninherits(Quantile, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n as = _.as || ['prob', 'value'];\n if (this.value && !_.modified() && !pulse.changed()) {\n out.source = this.value;\n return out;\n }\n const source = pulse.materialize(pulse.SOURCE).source,\n groups = partition$1(source, _.groupby, _.field),\n names = (_.groupby || []).map(accessorName),\n values = [],\n step = _.step || 0.01,\n p = _.probs || range(step / 2, 1 - EPSILON, step),\n n = p.length;\n groups.forEach(g => {\n const q = quantiles(g, p);\n for (let i = 0; i < n; ++i) {\n const t = {};\n for (let i = 0; i < names.length; ++i) {\n t[names[i]] = g.dims[i];\n }\n t[as[0]] = p[i];\n t[as[1]] = q[i];\n values.push(ingest(t));\n }\n });\n if (this.value) out.rem = this.value;\n this.value = out.add = out.source = values;\n return out;\n }\n});\n\n/**\n * Relays a data stream between data processing pipelines.\n * If the derive parameter is set, this transform will create derived\n * copies of observed tuples. This provides derived data streams in which\n * modifications to the tuples do not pollute an upstream data source.\n * @param {object} params - The parameters for this operator.\n * @param {number} [params.derive=false] - Boolean flag indicating if\n * the transform should make derived copies of incoming tuples.\n * @constructor\n */\nfunction Relay(params) {\n Transform.call(this, null, params);\n}\ninherits(Relay, Transform, {\n transform(_, pulse) {\n let out, lut;\n if (this.value) {\n lut = this.value;\n } else {\n out = pulse = pulse.addAll();\n lut = this.value = {};\n }\n if (_.derive) {\n out = pulse.fork(pulse.NO_SOURCE);\n pulse.visit(pulse.REM, t => {\n const id = tupleid(t);\n out.rem.push(lut[id]);\n lut[id] = null;\n });\n pulse.visit(pulse.ADD, t => {\n const dt = derive(t);\n lut[tupleid(t)] = dt;\n out.add.push(dt);\n });\n pulse.visit(pulse.MOD, t => {\n const dt = lut[tupleid(t)];\n for (const k in t) {\n dt[k] = t[k];\n // down stream writes may overwrite re-derived tuples\n // conservatively mark all source fields as modified\n out.modifies(k);\n }\n out.mod.push(dt);\n });\n }\n return out;\n }\n});\n\n/**\n * Samples tuples passing through this operator.\n * Uses reservoir sampling to maintain a representative sample.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {number} [params.size=1000] - The maximum number of samples.\n */\nfunction Sample(params) {\n Transform.call(this, [], params);\n this.count = 0;\n}\nSample.Definition = {\n 'type': 'Sample',\n 'metadata': {},\n 'params': [{\n 'name': 'size',\n 'type': 'number',\n 'default': 1000\n }]\n};\ninherits(Sample, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE),\n mod = _.modified('size'),\n num = _.size,\n map = this.value.reduce((m, t) => (m[tupleid(t)] = 1, m), {});\n let res = this.value,\n cnt = this.count,\n cap = 0;\n\n // sample reservoir update function\n function update(t) {\n let p, idx;\n if (res.length < num) {\n res.push(t);\n } else {\n idx = ~~((cnt + 1) * random());\n if (idx < res.length && idx >= cap) {\n p = res[idx];\n if (map[tupleid(p)]) out.rem.push(p); // eviction\n res[idx] = t;\n }\n }\n ++cnt;\n }\n if (pulse.rem.length) {\n // find all tuples that should be removed, add to output\n pulse.visit(pulse.REM, t => {\n const id = tupleid(t);\n if (map[id]) {\n map[id] = -1;\n out.rem.push(t);\n }\n --cnt;\n });\n\n // filter removed tuples out of the sample reservoir\n res = res.filter(t => map[tupleid(t)] !== -1);\n }\n if ((pulse.rem.length || mod) && res.length < num && pulse.source) {\n // replenish sample if backing data source is available\n cap = cnt = res.length;\n pulse.visit(pulse.SOURCE, t => {\n // update, but skip previously sampled tuples\n if (!map[tupleid(t)]) update(t);\n });\n cap = -1;\n }\n if (mod && res.length > num) {\n const n = res.length - num;\n for (let i = 0; i < n; ++i) {\n map[tupleid(res[i])] = -1;\n out.rem.push(res[i]);\n }\n res = res.slice(n);\n }\n if (pulse.mod.length) {\n // propagate modified tuples in the sample reservoir\n pulse.visit(pulse.MOD, t => {\n if (map[tupleid(t)]) out.mod.push(t);\n });\n }\n if (pulse.add.length) {\n // update sample reservoir\n pulse.visit(pulse.ADD, update);\n }\n if (pulse.add.length || cap < 0) {\n // output newly added tuples\n out.add = res.filter(t => !map[tupleid(t)]);\n }\n this.count = cnt;\n this.value = out.source = res;\n return out;\n }\n});\n\n/**\n * Generates data tuples for a specified sequence range of numbers.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {number} params.start - The first number in the sequence.\n * @param {number} params.stop - The last number (exclusive) in the sequence.\n * @param {number} [params.step=1] - The step size between numbers in the sequence.\n */\nfunction Sequence(params) {\n Transform.call(this, null, params);\n}\nSequence.Definition = {\n 'type': 'Sequence',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'start',\n 'type': 'number',\n 'required': true\n }, {\n 'name': 'stop',\n 'type': 'number',\n 'required': true\n }, {\n 'name': 'step',\n 'type': 'number',\n 'default': 1\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'data'\n }]\n};\ninherits(Sequence, Transform, {\n transform(_, pulse) {\n if (this.value && !_.modified()) return;\n const out = pulse.materialize().fork(pulse.MOD),\n as = _.as || 'data';\n out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem;\n this.value = range(_.start, _.stop, _.step || 1).map(v => {\n const t = {};\n t[as] = v;\n return ingest(t);\n });\n out.add = pulse.add.concat(this.value);\n return out;\n }\n});\n\n/**\n * Propagates a new pulse without any tuples so long as the input\n * pulse contains some added, removed or modified tuples.\n * @param {object} params - The parameters for this operator.\n * @constructor\n */\nfunction Sieve(params) {\n Transform.call(this, null, params);\n this.modified(true); // always treat as modified\n}\n\ninherits(Sieve, Transform, {\n transform(_, pulse) {\n this.value = pulse.source;\n return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation;\n }\n});\n\n/**\n * Discretize dates to specific time units.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The data field containing date/time values.\n */\nfunction TimeUnit(params) {\n Transform.call(this, null, params);\n}\nconst OUTPUT = ['unit0', 'unit1'];\nTimeUnit.Definition = {\n 'type': 'TimeUnit',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'interval',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'units',\n 'type': 'enum',\n 'values': TIME_UNITS,\n 'array': true\n }, {\n 'name': 'step',\n 'type': 'number',\n 'default': 1\n }, {\n 'name': 'maxbins',\n 'type': 'number',\n 'default': 40\n }, {\n 'name': 'extent',\n 'type': 'date',\n 'array': true\n }, {\n 'name': 'timezone',\n 'type': 'enum',\n 'default': 'local',\n 'values': ['local', 'utc']\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': OUTPUT\n }]\n};\ninherits(TimeUnit, Transform, {\n transform(_, pulse) {\n const field = _.field,\n band = _.interval !== false,\n utc = _.timezone === 'utc',\n floor = this._floor(_, pulse),\n offset = (utc ? utcInterval : timeInterval)(floor.unit).offset,\n as = _.as || OUTPUT,\n u0 = as[0],\n u1 = as[1],\n step = floor.step;\n let min = floor.start || Infinity,\n max = floor.stop || -Infinity,\n flag = pulse.ADD;\n if (_.modified() || pulse.changed(pulse.REM) || pulse.modified(accessorFields(field))) {\n pulse = pulse.reflow(true);\n flag = pulse.SOURCE;\n min = Infinity;\n max = -Infinity;\n }\n pulse.visit(flag, t => {\n const v = field(t);\n let a, b;\n if (v == null) {\n t[u0] = null;\n if (band) t[u1] = null;\n } else {\n t[u0] = a = b = floor(v);\n if (band) t[u1] = b = offset(a, step);\n if (a < min) min = a;\n if (b > max) max = b;\n }\n });\n floor.start = min;\n floor.stop = max;\n return pulse.modifies(band ? as : u0);\n },\n _floor(_, pulse) {\n const utc = _.timezone === 'utc';\n\n // get parameters\n const {\n units,\n step\n } = _.units ? {\n units: _.units,\n step: _.step || 1\n } : timeBin({\n extent: _.extent || extent(pulse.materialize(pulse.SOURCE).source, _.field),\n maxbins: _.maxbins\n });\n\n // check / standardize time units\n const tunits = timeUnits(units),\n prev = this.value || {},\n floor = (utc ? utcFloor : timeFloor)(tunits, step);\n floor.unit = peek(tunits);\n floor.units = tunits;\n floor.step = step;\n floor.start = prev.start;\n floor.stop = prev.stop;\n return this.value = floor;\n }\n});\n\n/**\n * An index that maps from unique, string-coerced, field values to tuples.\n * Assumes that the field serves as a unique key with no duplicate values.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The field accessor to index.\n */\nfunction TupleIndex(params) {\n Transform.call(this, fastmap(), params);\n}\ninherits(TupleIndex, Transform, {\n transform(_, pulse) {\n const df = pulse.dataflow,\n field = _.field,\n index = this.value,\n set = t => index.set(field(t), t);\n let mod = true;\n if (_.modified('field') || pulse.modified(field.fields)) {\n index.clear();\n pulse.visit(pulse.SOURCE, set);\n } else if (pulse.changed()) {\n pulse.visit(pulse.REM, t => index.delete(field(t)));\n pulse.visit(pulse.ADD, set);\n } else {\n mod = false;\n }\n this.modified(mod);\n if (index.empty > df.cleanThreshold) df.runAfter(index.clean);\n return pulse.fork();\n }\n});\n\n/**\n * Extracts an array of values. Assumes the source data has already been\n * reduced as needed (e.g., by an upstream Aggregate transform).\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The domain field to extract.\n * @param {function(*,*): number} [params.sort] - An optional\n * comparator function for sorting the values. The comparator will be\n * applied to backing tuples prior to value extraction.\n */\nfunction Values(params) {\n Transform.call(this, null, params);\n}\ninherits(Values, Transform, {\n transform(_, pulse) {\n const run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields);\n if (run) {\n this.value = (_.sort ? pulse.source.slice().sort(stableCompare(_.sort)) : pulse.source).map(_.field);\n }\n }\n});\n\nfunction WindowOp(op, field, param, as) {\n const fn = WindowOps[op](field, param);\n return {\n init: fn.init || zero,\n update: function (w, t) {\n t[as] = fn.next(w);\n }\n };\n}\nconst WindowOps = {\n row_number: function () {\n return {\n next: w => w.index + 1\n };\n },\n rank: function () {\n let rank;\n return {\n init: () => rank = 1,\n next: w => {\n const i = w.index,\n data = w.data;\n return i && w.compare(data[i - 1], data[i]) ? rank = i + 1 : rank;\n }\n };\n },\n dense_rank: function () {\n let drank;\n return {\n init: () => drank = 1,\n next: w => {\n const i = w.index,\n d = w.data;\n return i && w.compare(d[i - 1], d[i]) ? ++drank : drank;\n }\n };\n },\n percent_rank: function () {\n const rank = WindowOps.rank(),\n next = rank.next;\n return {\n init: rank.init,\n next: w => (next(w) - 1) / (w.data.length - 1)\n };\n },\n cume_dist: function () {\n let cume;\n return {\n init: () => cume = 0,\n next: w => {\n const d = w.data,\n c = w.compare;\n let i = w.index;\n if (cume < i) {\n while (i + 1 < d.length && !c(d[i], d[i + 1])) ++i;\n cume = i;\n }\n return (1 + cume) / d.length;\n }\n };\n },\n ntile: function (field, num) {\n num = +num;\n if (!(num > 0)) error('ntile num must be greater than zero.');\n const cume = WindowOps.cume_dist(),\n next = cume.next;\n return {\n init: cume.init,\n next: w => Math.ceil(num * next(w))\n };\n },\n lag: function (field, offset) {\n offset = +offset || 1;\n return {\n next: w => {\n const i = w.index - offset;\n return i >= 0 ? field(w.data[i]) : null;\n }\n };\n },\n lead: function (field, offset) {\n offset = +offset || 1;\n return {\n next: w => {\n const i = w.index + offset,\n d = w.data;\n return i < d.length ? field(d[i]) : null;\n }\n };\n },\n first_value: function (field) {\n return {\n next: w => field(w.data[w.i0])\n };\n },\n last_value: function (field) {\n return {\n next: w => field(w.data[w.i1 - 1])\n };\n },\n nth_value: function (field, nth) {\n nth = +nth;\n if (!(nth > 0)) error('nth_value nth must be greater than zero.');\n return {\n next: w => {\n const i = w.i0 + (nth - 1);\n return i < w.i1 ? field(w.data[i]) : null;\n }\n };\n },\n prev_value: function (field) {\n let prev;\n return {\n init: () => prev = null,\n next: w => {\n const v = field(w.data[w.index]);\n return v != null ? prev = v : prev;\n }\n };\n },\n next_value: function (field) {\n let v, i;\n return {\n init: () => (v = null, i = -1),\n next: w => {\n const d = w.data;\n return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]);\n }\n };\n }\n};\nfunction find(field, data, index) {\n for (let n = data.length; index < n; ++index) {\n const v = field(data[index]);\n if (v != null) return index;\n }\n return -1;\n}\nconst ValidWindowOps = Object.keys(WindowOps);\n\nfunction WindowState(_) {\n const ops = array(_.ops),\n fields = array(_.fields),\n params = array(_.params),\n aggregate_params = array(_.aggregate_params),\n as = array(_.as),\n outputs = this.outputs = [],\n windows = this.windows = [],\n inputs = {},\n map = {},\n counts = [],\n measures = [];\n let countOnly = true;\n function visitInputs(f) {\n array(accessorFields(f)).forEach(_ => inputs[_] = 1);\n }\n visitInputs(_.sort);\n ops.forEach((op, i) => {\n const field = fields[i],\n param = params[i],\n aggregate_param = aggregate_params[i] || null,\n mname = accessorName(field),\n name = measureName(op, mname, as[i]);\n visitInputs(field);\n outputs.push(name);\n\n // Window operation\n if (hasOwnProperty(WindowOps, op)) {\n windows.push(WindowOp(op, field, param, name));\n }\n\n // Aggregate operation\n else {\n if (field == null && op !== 'count') {\n error('Null aggregate field specified.');\n }\n if (op === 'count') {\n counts.push(name);\n return;\n }\n countOnly = false;\n let m = map[mname];\n if (!m) {\n m = map[mname] = [];\n m.field = field;\n measures.push(m);\n }\n m.push(createMeasure(op, aggregate_param, name));\n }\n });\n if (counts.length || measures.length) {\n this.cell = cell(measures, counts, countOnly);\n }\n this.inputs = Object.keys(inputs);\n}\nconst prototype = WindowState.prototype;\nprototype.init = function () {\n this.windows.forEach(_ => _.init());\n if (this.cell) this.cell.init();\n};\nprototype.update = function (w, t) {\n const cell = this.cell,\n wind = this.windows,\n data = w.data,\n m = wind && wind.length;\n let j;\n if (cell) {\n for (j = w.p0; j < w.i0; ++j) cell.rem(data[j]);\n for (j = w.p1; j < w.i1; ++j) cell.add(data[j]);\n cell.set(t);\n }\n for (j = 0; j < m; ++j) wind[j].update(w, t);\n};\nfunction cell(measures, counts, countOnly) {\n measures = measures.map(m => compileMeasures(m, m.field));\n const cell = {\n num: 0,\n agg: null,\n store: false,\n count: counts\n };\n if (!countOnly) {\n var n = measures.length,\n a = cell.agg = Array(n),\n i = 0;\n for (; i < n; ++i) a[i] = new measures[i](cell);\n }\n if (cell.store) {\n var store = cell.data = new TupleStore();\n }\n cell.add = function (t) {\n cell.num += 1;\n if (countOnly) return;\n if (store) store.add(t);\n for (let i = 0; i < n; ++i) {\n a[i].add(a[i].get(t), t);\n }\n };\n cell.rem = function (t) {\n cell.num -= 1;\n if (countOnly) return;\n if (store) store.rem(t);\n for (let i = 0; i < n; ++i) {\n a[i].rem(a[i].get(t), t);\n }\n };\n cell.set = function (t) {\n let i, n;\n\n // consolidate stored values\n if (store) store.values();\n\n // update tuple properties\n for (i = 0, n = counts.length; i < n; ++i) t[counts[i]] = cell.num;\n if (!countOnly) for (i = 0, n = a.length; i < n; ++i) a[i].set(t);\n };\n cell.init = function () {\n cell.num = 0;\n if (store) store.reset();\n for (let i = 0; i < n; ++i) a[i].init();\n };\n return cell;\n}\n\n/**\n * Perform window calculations and write results to the input stream.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window.\n * @param {Array} [params.groupby] - An array of accessors by which to partition tuples into separate windows.\n * @param {Array} params.ops - An array of strings indicating window operations to perform.\n * @param {Array} [params.fields] - An array of accessors\n * for data fields to use as inputs to window operations.\n * @param {Array<*>} [params.params] - An array of parameter values for window operations.\n * @param {Array} [params.aggregate_params] - An optional array of parameter values for aggregation operations.\n * @param {Array} [params.as] - An array of output field names for window operations.\n * @param {Array} [params.frame] - Window frame definition as two-element array.\n * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row\n * number alone, ignoring peers with identical sort values. If false (default),\n * the window boundaries will be adjusted to include peer values.\n */\nfunction Window(params) {\n Transform.call(this, {}, params);\n this._mlen = 0;\n this._mods = [];\n}\nWindow.Definition = {\n 'type': 'Window',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'ops',\n 'type': 'enum',\n 'array': true,\n 'values': ValidWindowOps.concat(ValidAggregateOps)\n }, {\n 'name': 'params',\n 'type': 'number',\n 'null': true,\n 'array': true\n }, {\n 'name': 'aggregate_params',\n 'type': 'field',\n 'null': true,\n 'array': true,\n 'default': [null]\n }, {\n 'name': 'fields',\n 'type': 'field',\n 'null': true,\n 'array': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'null': true,\n 'array': true\n }, {\n 'name': 'frame',\n 'type': 'number',\n 'null': true,\n 'array': true,\n 'length': 2,\n 'default': [null, 0]\n }, {\n 'name': 'ignorePeers',\n 'type': 'boolean',\n 'default': false\n }]\n};\ninherits(Window, Transform, {\n transform(_, pulse) {\n this.stamp = pulse.stamp;\n const mod = _.modified(),\n cmp = stableCompare(_.sort),\n key = groupkey(_.groupby),\n group = t => this.group(key(t));\n\n // initialize window state\n let state = this.state;\n if (!state || mod) {\n state = this.state = new WindowState(_);\n }\n\n // partition input tuples\n if (mod || pulse.modified(state.inputs)) {\n this.value = {};\n pulse.visit(pulse.SOURCE, t => group(t).add(t));\n } else {\n pulse.visit(pulse.REM, t => group(t).remove(t));\n pulse.visit(pulse.ADD, t => group(t).add(t));\n }\n\n // perform window calculations for each modified partition\n for (let i = 0, n = this._mlen; i < n; ++i) {\n processPartition(this._mods[i], state, cmp, _);\n }\n this._mlen = 0;\n this._mods = [];\n\n // TODO don't reflow everything?\n return pulse.reflow(mod).modifies(state.outputs);\n },\n group(key) {\n let group = this.value[key];\n if (!group) {\n group = this.value[key] = SortedList(tupleid);\n group.stamp = -1;\n }\n if (group.stamp < this.stamp) {\n group.stamp = this.stamp;\n this._mods[this._mlen++] = group;\n }\n return group;\n }\n});\nfunction processPartition(list, state, cmp, _) {\n const sort = _.sort,\n range = sort && !_.ignorePeers,\n frame = _.frame || [null, 0],\n data = list.data(cmp),\n // use cmp for stable sort\n n = data.length,\n b = range ? bisector(sort) : null,\n w = {\n i0: 0,\n i1: 0,\n p0: 0,\n p1: 0,\n index: 0,\n data: data,\n compare: sort || constant(-1)\n };\n state.init();\n for (let i = 0; i < n; ++i) {\n setWindow(w, frame, i, n);\n if (range) adjustRange(w, b);\n state.update(w, data[i]);\n }\n}\nfunction setWindow(w, f, i, n) {\n w.p0 = w.i0;\n w.p1 = w.i1;\n w.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0]));\n w.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1);\n w.index = i;\n}\n\n// if frame type is 'range', adjust window for peer values\nfunction adjustRange(w, bisect) {\n const r0 = w.i0,\n r1 = w.i1 - 1,\n c = w.compare,\n d = w.data,\n n = d.length - 1;\n if (r0 > 0 && !c(d[r0], d[r0 - 1])) w.i0 = bisect.left(d, d[r0]);\n if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]);\n}\n\nexport { Aggregate as aggregate, Bin as bin, Collect as collect, Compare as compare, CountPattern as countpattern, Cross as cross, Density as density, DotBin as dotbin, Expression as expression, Extent as extent, Facet as facet, Field as field, Filter as filter, Flatten as flatten, Fold as fold, Formula as formula, Generate as generate, Impute as impute, JoinAggregate as joinaggregate, KDE as kde, Key as key, Load as load, Lookup as lookup, MultiExtent as multiextent, MultiValues as multivalues, Params as params, Pivot as pivot, PreFacet as prefacet, Project as project, Proxy as proxy, Quantile as quantile, Relay as relay, Sample as sample, Sequence as sequence, Sieve as sieve, Subflow as subflow, TimeUnit as timeunit, TupleIndex as tupleindex, Values as values, Window as window };\n","export default function mean(values, valueof) {\n let count = 0;\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n ++count, sum += value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n ++count, sum += value;\n }\n }\n }\n if (count) return sum / count;\n}\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x) / 6,\n (that._y0 + 4 * that._y1 + y) / 6\n );\n}\n\nexport function Basis(context) {\n this._context = context;\n}\n\nBasis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3: point(this, this._x1, this._y1); // falls through\n case 2: this._context.lineTo(this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new Basis(context);\n}\n","export default function() {}\n","import noop from \"../noop.js\";\nimport {point} from \"./basis.js\";\n\nfunction BasisClosed(context) {\n this._context = context;\n}\n\nBasisClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisClosed(context);\n}\n","import {point} from \"./basis.js\";\n\nfunction BasisOpen(context) {\n this._context = context;\n}\n\nBasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisOpen(context);\n}\n","import {Basis} from \"./basis.js\";\n\nfunction Bundle(context, beta) {\n this._basis = new Basis(context);\n this._beta = beta;\n}\n\nBundle.prototype = {\n lineStart: function() {\n this._x = [];\n this._y = [];\n this._basis.lineStart();\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n j = x.length - 1;\n\n if (j > 0) {\n var x0 = x[0],\n y0 = y[0],\n dx = x[j] - x0,\n dy = y[j] - y0,\n i = -1,\n t;\n\n while (++i <= j) {\n t = i / j;\n this._basis.point(\n this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n );\n }\n }\n\n this._x = this._y = null;\n this._basis.lineEnd();\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\nexport default (function custom(beta) {\n\n function bundle(context) {\n return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n }\n\n bundle.beta = function(beta) {\n return custom(+beta);\n };\n\n return bundle;\n})(0.85);\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import {point} from \"./cardinal.js\";\n\nexport function CardinalOpen(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalOpen(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","import {epsilon} from \"../math.js\";\nimport {Cardinal} from \"./cardinal.js\";\n\nexport function point(that, x, y) {\n var x1 = that._x1,\n y1 = that._y1,\n x2 = that._x2,\n y2 = that._y2;\n\n if (that._l01_a > epsilon) {\n var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n }\n\n if (that._l23_a > epsilon) {\n var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n }\n\n that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: this.point(this._x2, this._y2); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","import {CardinalClosed} from \"./cardinalClosed.js\";\nimport noop from \"../noop.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomClosed(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","import {CardinalOpen} from \"./cardinalOpen.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomOpen(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","function Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nexport default function(context) {\n return new Linear(context);\n}\n","import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n","function sign(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n}\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n return new MonotoneY(context);\n}\n","function Natural(context) {\n this._context = context;\n}\n\nNatural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n n = x.length;\n\n if (n) {\n this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n if (n === 2) {\n this._context.lineTo(x[1], y[1]);\n } else {\n var px = controlPoints(x),\n py = controlPoints(y);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n }\n }\n }\n\n if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n var i,\n n = x.length - 1,\n m,\n a = new Array(n),\n b = new Array(n),\n r = new Array(n);\n a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n b[n - 1] = (x[n] + a[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n return [a, b];\n}\n\nexport default function(context) {\n return new Natural(context);\n}\n","function Step(context, t) {\n this._context = context;\n this._t = t;\n}\n\nStep.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y);\n this._context.lineTo(x, y);\n } else {\n var x1 = this._x * (1 - this._t) + x * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y);\n }\n break;\n }\n }\n this._x = x, this._y = y;\n }\n};\n\nexport default function(context) {\n return new Step(context, 0.5);\n}\n\nexport function stepBefore(context) {\n return new Step(context, 0);\n}\n\nexport function stepAfter(context) {\n return new Step(context, 1);\n}\n","export default function(x) {\n return function constant() {\n return x;\n };\n}\n","const pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction append(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n let d = Math.floor(digits);\n if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);\n if (d > 15) return append;\n const k = 10 ** d;\n return function(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n}\n\nexport class Path {\n constructor(digits) {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n this._append = digits == null ? append : appendRound(digits);\n }\n moveTo(x, y) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._append`Z`;\n }\n }\n lineTo(x, y) {\n this._append`L${this._x1 = +x},${this._y1 = +y}`;\n }\n quadraticCurveTo(x1, y1, x, y) {\n this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;\n }\n bezierCurveTo(x1, y1, x2, y2, x, y) {\n this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;\n }\n arcTo(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._append`M${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._append`L${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Otherwise, draw an arc!\n else {\n let x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;\n }\n\n this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;\n }\n }\n arc(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._append`M${x0},${y0}`;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._append`L${x0},${y0}`;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;\n }\n }\n rect(x, y, w, h) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;\n }\n toString() {\n return this._;\n }\n}\n\nexport function path() {\n return new Path;\n}\n\n// Allow instanceof d3.path\npath.prototype = Path.prototype;\n\nexport function pathRound(digits = 3) {\n return new Path(+digits);\n}\n","import {Path} from \"d3-path\";\n\nexport function withPath(shape) {\n let digits = 3;\n\n shape.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) {\n digits = null;\n } else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n return shape;\n };\n\n return () => new Path(digits);\n}\n","import constant from \"./constant.js\";\nimport {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from \"./math.js\";\nimport {withPath} from \"./path.js\";\n\nfunction arcInnerRadius(d) {\n return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0,\n x32 = x3 - x2, y32 = y3 - y2,\n t = y32 * x10 - x32 * y10;\n if (t * t < epsilon) return;\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1,\n y01 = y0 - y1,\n lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),\n ox = lo * y01,\n oy = -lo * x01,\n x11 = x0 + ox,\n y11 = y0 + oy,\n x10 = x1 + ox,\n y10 = y1 + oy,\n x00 = (x11 + x10) / 2,\n y00 = (y11 + y10) / 2,\n dx = x10 - x11,\n dy = y10 - y11,\n d2 = dx * dx + dy * dy,\n r = r1 - rc,\n D = x11 * y10 - x10 * y11,\n d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),\n cx0 = (D * dy - dx * d) / d2,\n cy0 = (-D * dx - dy * d) / d2,\n cx1 = (D * dy + dx * d) / d2,\n cy1 = (-D * dx + dy * d) / d2,\n dx0 = cx0 - x00,\n dy0 = cy0 - y00,\n dx1 = cx1 - x00,\n dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points.\n // TODO Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n}\n\nexport default function() {\n var innerRadius = arcInnerRadius,\n outerRadius = arcOuterRadius,\n cornerRadius = constant(0),\n padRadius = null,\n startAngle = arcStartAngle,\n endAngle = arcEndAngle,\n padAngle = arcPadAngle,\n context = null,\n path = withPath(arc);\n\n function arc() {\n var buffer,\n r,\n r0 = +innerRadius.apply(this, arguments),\n r1 = +outerRadius.apply(this, arguments),\n a0 = startAngle.apply(this, arguments) - halfPi,\n a1 = endAngle.apply(this, arguments) - halfPi,\n da = abs(a1 - a0),\n cw = a1 > a0;\n\n if (!context) context = buffer = path();\n\n // Ensure that the outer radius is always larger than the inner radius.\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n // Is it a point?\n if (!(r1 > epsilon)) context.moveTo(0, 0);\n\n // Or is it a circle or annulus?\n else if (da > tau - epsilon) {\n context.moveTo(r1 * cos(a0), r1 * sin(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon) {\n context.moveTo(r0 * cos(a1), r0 * sin(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n }\n\n // Or is it a circular or annular sector?\n else {\n var a01 = a0,\n a11 = a1,\n a00 = a0,\n a10 = a1,\n da0 = da,\n da1 = da,\n ap = padAngle.apply(this, arguments) / 2,\n rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),\n rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n rc0 = rc,\n rc1 = rc,\n t0,\n t1;\n\n // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n if (rp > epsilon) {\n var p0 = asin(rp / r0 * sin(ap)),\n p1 = asin(rp / r1 * sin(ap));\n if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n\n var x01 = r1 * cos(a01),\n y01 = r1 * sin(a01),\n x10 = r0 * cos(a10),\n y10 = r0 * sin(a10);\n\n // Apply rounded corners?\n if (rc > epsilon) {\n var x11 = r1 * cos(a11),\n y11 = r1 * sin(a11),\n x00 = r0 * cos(a00),\n y00 = r0 * sin(a00),\n oc;\n\n // Restrict the corner radius according to the sector angle. If this\n // intersection fails, it’s probably because the arc is too small, so\n // disable the corner radius entirely.\n if (da < pi) {\n if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {\n var ax = x01 - oc[0],\n ay = y01 - oc[1],\n bx = x11 - oc[0],\n by = y11 - oc[1],\n kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),\n lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min(rc, (r0 - lc) / (kc - 1));\n rc1 = min(rc, (r1 - lc) / (kc + 1));\n } else {\n rc0 = rc1 = 0;\n }\n }\n }\n\n // Is the sector collapsed to a line?\n if (!(da1 > epsilon)) context.moveTo(x01, y01);\n\n // Does the sector’s outer ring have rounded corners?\n else if (rc1 > epsilon) {\n t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the outer ring just a circular arc?\n else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n // Is there no inner ring, and it’s a circular sector?\n // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n\n // Does the sector’s inner ring (or point) have rounded corners?\n else if (rc0 > epsilon) {\n t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the inner ring just a circular arc?\n else context.arc(0, 0, r0, a10, a00, cw);\n }\n\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n return [cos(a) * r, sin(a) * r];\n };\n\n arc.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : innerRadius;\n };\n\n arc.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : outerRadius;\n };\n\n arc.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : cornerRadius;\n };\n\n arc.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc) : padRadius;\n };\n\n arc.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : startAngle;\n };\n\n arc.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : endAngle;\n };\n\n arc.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : padAngle;\n };\n\n arc.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n };\n\n return arc;\n}\n","export var slice = Array.prototype.slice;\n\nexport default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n","export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x, y) {\n var defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(line);\n\n x = typeof x === \"function\" ? x : (x === undefined) ? pointX : constant(x);\n y = typeof y === \"function\" ? y : (y === undefined) ? pointY : constant(y);\n\n function line(data) {\n var i,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x(d, i, data), +y(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), line) : x;\n };\n\n line.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), line) : y;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport line from \"./line.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x0, y0, y1) {\n var x1 = null,\n defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(area);\n\n x0 = typeof x0 === \"function\" ? x0 : (x0 === undefined) ? pointX : constant(+x0);\n y0 = typeof y0 === \"function\" ? y0 : (y0 === undefined) ? constant(0) : constant(+y0);\n y1 = typeof y1 === \"function\" ? y1 : (y1 === undefined) ? pointY : constant(+y1);\n\n function area(data) {\n var i,\n j,\n k,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer,\n x0z = new Array(n),\n y0z = new Array(n);\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k = i - 1; k >= j; --k) {\n output.point(x0z[k], y0z[k]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n\n area.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), x1 = null, area) : x0;\n };\n\n area.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), area) : x0;\n };\n\n area.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : x1;\n };\n\n area.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), y1 = null, area) : y0;\n };\n\n area.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), area) : y0;\n };\n\n area.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : y1;\n };\n\n area.lineX0 =\n area.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n\n area.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n\n area.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n\n area.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), area) : defined;\n };\n\n area.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;\n };\n\n area.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;\n };\n\n return area;\n}\n","import {min, sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const r = sqrt(size + min(size / 28, 0.75)) * 0.59436;\n const t = r / 2;\n const u = t * sqrt3;\n context.moveTo(0, r);\n context.lineTo(0, -r);\n context.moveTo(-u, -t);\n context.lineTo(u, t);\n context.moveTo(-u, t);\n context.lineTo(u, -t);\n }\n};\n","import {pi, sqrt, tau} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / pi);\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, tau);\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst tan30 = sqrt(1 / 3);\nconst tan30_2 = tan30 * 2;\n\nexport default {\n draw(context, size) {\n const y = sqrt(size / tan30_2);\n const x = y * tan30;\n context.moveTo(0, -y);\n context.lineTo(x, 0);\n context.lineTo(0, y);\n context.lineTo(-x, 0);\n context.closePath();\n }\n};\n","import {sin, cos, sqrt, pi, tau} from \"../math.js\";\n\nconst ka = 0.89081309152928522810;\nconst kr = sin(pi / 10) / sin(7 * pi / 10);\nconst kx = sin(tau / 10) * kr;\nconst ky = -cos(tau / 10) * kr;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size * ka);\n const x = kx * r;\n const y = ky * r;\n context.moveTo(0, -r);\n context.lineTo(x, y);\n for (let i = 1; i < 5; ++i) {\n const a = tau * i / 5;\n const c = cos(a);\n const s = sin(a);\n context.lineTo(s * r, -c * r);\n context.lineTo(c * x - s * y, s * x + c * y);\n }\n context.closePath();\n }\n};\n","function domCanvas(w, h) {\n if (typeof document !== 'undefined' && document.createElement) {\n const c = document.createElement('canvas');\n if (c && c.getContext) {\n c.width = w;\n c.height = h;\n return c;\n }\n }\n return null;\n}\nconst domImage = () => typeof Image !== 'undefined' ? Image : null;\n\nexport { domCanvas as canvas, domCanvas, domImage as image };\n","import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const y = -sqrt(size / (sqrt3 * 3));\n context.moveTo(0, y * 2);\n context.lineTo(-sqrt3 * y, -y);\n context.lineTo(sqrt3 * y, -y);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const s = sqrt(size) * 0.6824;\n const t = s / 2;\n const u = (s * sqrt3) / 2; // cos(Math.PI / 6)\n context.moveTo(0, -s);\n context.lineTo(u, t);\n context.lineTo(-u, t);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst c = -0.5;\nconst s = sqrt(3) / 2;\nconst k = 1 / sqrt(12);\nconst a = (k / 2 + 1) * 3;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / a);\n const x0 = r / 2, y0 = r * k;\n const x1 = x0, y1 = r * k + r;\n const x2 = -x1, y2 = y1;\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n context.closePath();\n }\n};\n","import ascending from \"./ascending.js\";\nimport bisector from \"./bisector.js\";\nimport number from \"./number.js\";\n\nconst ascendingBisect = bisector(ascending);\nexport const bisectRight = ascendingBisect.right;\nexport const bisectLeft = ascendingBisect.left;\nexport const bisectCenter = bisector(number).center;\nexport default bisectRight;\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","export default x => () => x;\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n","import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n","export default function number(x) {\n return +x;\n}\n","import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateNumber, interpolateRound} from \"d3-interpolate\";\nimport constant from \"./constant.js\";\nimport number from \"./number.js\";\n\nvar unit = [0, 1];\n\nexport function identity(x) {\n return x;\n}\n\nfunction normalize(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(isNaN(b) ? NaN : 0.5);\n}\n\nfunction clamper(a, b) {\n var t;\n if (a > b) t = a, a = b, b = t;\n return function(x) { return Math.max(a, Math.min(b, x)); };\n}\n\n// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].\nfunction bimap(domain, range, interpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);\n else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, interpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = normalize(domain[i], domain[i + 1]);\n r[i] = interpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport function transformer() {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n transform,\n untransform,\n unknown,\n clamp = identity,\n piecewise,\n output,\n input;\n\n function rescale() {\n var n = Math.min(domain.length, range.length);\n if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);\n piecewise = n > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));\n }\n\n scale.invert = function(y) {\n return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = Array.from(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t, u) {\n transform = t, untransform = u;\n return rescale();\n };\n}\n\nexport default function continuous() {\n return transformer()(identity, identity);\n}\n","export default function constants(x) {\n return function() {\n return x;\n };\n}\n","export function initRange(domain, range) {\n switch (arguments.length) {\n case 0: break;\n case 1: this.range(domain); break;\n default: this.range(range).domain(domain); break;\n }\n return this;\n}\n\nexport function initInterpolator(domain, interpolator) {\n switch (arguments.length) {\n case 0: break;\n case 1: {\n if (typeof domain === \"function\") this.interpolator(domain);\n else this.range(domain);\n break;\n }\n default: {\n this.domain(domain);\n if (typeof interpolator === \"function\") this.interpolator(interpolator);\n else this.range(interpolator);\n break;\n }\n }\n return this;\n}\n","import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function tickFormat(start, stop, count, specifier) {\n var step = tickStep(start, stop, count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n","import {ticks, tickIncrement} from \"d3-array\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport tickFormat from \"./tickFormat.js\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n var d = domain();\n return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain();\n var i0 = 0;\n var i1 = d.length - 1;\n var start = d[i0];\n var stop = d[i1];\n var prestep;\n var step;\n var maxIter = 10;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n \n while (maxIter-- > 0) {\n step = tickIncrement(start, stop, count);\n if (step === prestep) {\n d[i0] = start\n d[i1] = stop\n return domain(d);\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n } else {\n break;\n }\n prestep = step;\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous();\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n","export default function nice(domain, interval) {\n domain = domain.slice();\n\n var i0 = 0,\n i1 = domain.length - 1,\n x0 = domain[i0],\n x1 = domain[i1],\n t;\n\n if (x1 < x0) {\n t = i0, i0 = i1, i1 = t;\n t = x0, x0 = x1, x1 = t;\n }\n\n domain[i0] = interval.floor(x0);\n domain[i1] = interval.ceil(x1);\n return domain;\n}\n","import {ticks} from \"d3-array\";\nimport {format, formatSpecifier} from \"d3-format\";\nimport nice from \"./nice.js\";\nimport {copy, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformLog(x) {\n return Math.log(x);\n}\n\nfunction transformExp(x) {\n return Math.exp(x);\n}\n\nfunction transformLogn(x) {\n return -Math.log(-x);\n}\n\nfunction transformExpn(x) {\n return -Math.exp(-x);\n}\n\nfunction pow10(x) {\n return isFinite(x) ? +(\"1e\" + x) : x < 0 ? 0 : x;\n}\n\nfunction powp(base) {\n return base === 10 ? pow10\n : base === Math.E ? Math.exp\n : x => Math.pow(base, x);\n}\n\nfunction logp(base) {\n return base === Math.E ? Math.log\n : base === 10 && Math.log10\n || base === 2 && Math.log2\n || (base = Math.log(base), x => Math.log(x) / base);\n}\n\nfunction reflect(f) {\n return (x, k) => -f(-x, k);\n}\n\nexport function loggish(transform) {\n const scale = transform(transformLog, transformExp);\n const domain = scale.domain;\n let base = 10;\n let logs;\n let pows;\n\n function rescale() {\n logs = logp(base), pows = powp(base);\n if (domain()[0] < 0) {\n logs = reflect(logs), pows = reflect(pows);\n transform(transformLogn, transformExpn);\n } else {\n transform(transformLog, transformExp);\n }\n return scale;\n }\n\n scale.base = function(_) {\n return arguments.length ? (base = +_, rescale()) : base;\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.ticks = count => {\n const d = domain();\n let u = d[0];\n let v = d[d.length - 1];\n const r = v < u;\n\n if (r) ([u, v] = [v, u]);\n\n let i = logs(u);\n let j = logs(v);\n let k;\n let t;\n const n = count == null ? 10 : +count;\n let z = [];\n\n if (!(base % 1) && j - i < n) {\n i = Math.floor(i), j = Math.ceil(j);\n if (u > 0) for (; i <= j; ++i) {\n for (k = 1; k < base; ++k) {\n t = i < 0 ? k / pows(-i) : k * pows(i);\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n } else for (; i <= j; ++i) {\n for (k = base - 1; k >= 1; --k) {\n t = i > 0 ? k / pows(-i) : k * pows(i);\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n }\n if (z.length * 2 < n) z = ticks(u, v, n);\n } else {\n z = ticks(i, j, Math.min(j - i, n)).map(pows);\n }\n return r ? z.reverse() : z;\n };\n\n scale.tickFormat = (count, specifier) => {\n if (count == null) count = 10;\n if (specifier == null) specifier = base === 10 ? \"s\" : \",\";\n if (typeof specifier !== \"function\") {\n if (!(base % 1) && (specifier = formatSpecifier(specifier)).precision == null) specifier.trim = true;\n specifier = format(specifier);\n }\n if (count === Infinity) return specifier;\n const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?\n return d => {\n let i = d / pows(Math.round(logs(d)));\n if (i * base < base - 0.5) i *= base;\n return i <= k ? specifier(d) : \"\";\n };\n };\n\n scale.nice = () => {\n return domain(nice(domain(), {\n floor: x => pows(Math.floor(logs(x))),\n ceil: x => pows(Math.ceil(logs(x)))\n }));\n };\n\n return scale;\n}\n\nexport default function log() {\n const scale = loggish(transformer()).domain([1, 10]);\n scale.copy = () => copy(scale, log()).base(scale.base());\n initRange.apply(scale, arguments);\n return scale;\n}\n","import {linearish} from \"./linear.js\";\nimport {copy, identity, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformPow(exponent) {\n return function(x) {\n return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\n };\n}\n\nfunction transformSqrt(x) {\n return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);\n}\n\nfunction transformSquare(x) {\n return x < 0 ? -x * x : x * x;\n}\n\nexport function powish(transform) {\n var scale = transform(identity, identity),\n exponent = 1;\n\n function rescale() {\n return exponent === 1 ? transform(identity, identity)\n : exponent === 0.5 ? transform(transformSqrt, transformSquare)\n : transform(transformPow(exponent), transformPow(1 / exponent));\n }\n\n scale.exponent = function(_) {\n return arguments.length ? (exponent = +_, rescale()) : exponent;\n };\n\n return linearish(scale);\n}\n\nexport default function pow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, pow()).exponent(scale.exponent());\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n\nexport function sqrt() {\n return pow.apply(null, arguments).exponent(0.5);\n}\n","import {linearish} from \"./linear.js\";\nimport {copy, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformSymlog(c) {\n return function(x) {\n return Math.sign(x) * Math.log1p(Math.abs(x / c));\n };\n}\n\nfunction transformSymexp(c) {\n return function(x) {\n return Math.sign(x) * Math.expm1(Math.abs(x)) * c;\n };\n}\n\nexport function symlogish(transform) {\n var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));\n\n scale.constant = function(_) {\n return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;\n };\n\n return linearish(scale);\n}\n\nexport default function symlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, symlog()).constant(scale.constant());\n };\n\n return initRange.apply(scale, arguments);\n}\n","import {bisector, tickStep} from \"d3-array\";\nimport {durationDay, durationHour, durationMinute, durationMonth, durationSecond, durationWeek, durationYear} from \"./duration.js\";\nimport {millisecond} from \"./millisecond.js\";\nimport {second} from \"./second.js\";\nimport {timeMinute, utcMinute} from \"./minute.js\";\nimport {timeHour, utcHour} from \"./hour.js\";\nimport {timeDay, unixDay} from \"./day.js\";\nimport {timeSunday, utcSunday} from \"./week.js\";\nimport {timeMonth, utcMonth} from \"./month.js\";\nimport {timeYear, utcYear} from \"./year.js\";\n\nfunction ticker(year, month, week, day, hour, minute) {\n\n const tickIntervals = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [ hour, 1, durationHour ],\n [ hour, 3, 3 * durationHour ],\n [ hour, 6, 6 * durationHour ],\n [ hour, 12, 12 * durationHour ],\n [ day, 1, durationDay ],\n [ day, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month, 1, durationMonth ],\n [ month, 3, 3 * durationMonth ],\n [ year, 1, durationYear ]\n ];\n\n function ticks(start, stop, count) {\n const reverse = stop < start;\n if (reverse) [start, stop] = [stop, start];\n const interval = count && typeof count.range === \"function\" ? count : tickInterval(start, stop, count);\n const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop\n return reverse ? ticks.reverse() : ticks;\n }\n\n function tickInterval(start, stop, count) {\n const target = Math.abs(stop - start) / count;\n const i = bisector(([,, step]) => step).right(tickIntervals, target);\n if (i === tickIntervals.length) return year.every(tickStep(start / durationYear, stop / durationYear, count));\n if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));\n const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n return t.every(step);\n }\n\n return [ticks, tickInterval];\n}\n\nconst [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);\nconst [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);\n\nexport {utcTicks, utcTickInterval, timeTicks, timeTickInterval};\n","import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeTicks, timeTickInterval} from \"d3-time\";\nimport {timeFormat} from \"d3-time-format\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport nice from \"./nice.js\";\n\nfunction date(t) {\n return new Date(t);\n}\n\nfunction number(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nexport function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {\n var scale = continuous(),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n function tickFormat(date) {\n return (second(date) < date ? formatMillisecond\n : minute(date) < date ? formatSecond\n : hour(date) < date ? formatMinute\n : day(date) < date ? formatHour\n : month(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(Array.from(_, number)) : domain().map(date);\n };\n\n scale.ticks = function(interval) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval) {\n var d = domain();\n if (!interval || typeof interval.range !== \"function\") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);\n return interval ? domain(nice(d, interval)) : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));\n };\n\n return scale;\n}\n\nexport default function time() {\n return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);\n}\n","import {interpolate, interpolateRound} from \"d3-interpolate\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport {loggish} from \"./log.js\";\nimport {symlogish} from \"./symlog.js\";\nimport {powish} from \"./pow.js\";\n\nfunction transformer() {\n var x0 = 0,\n x1 = 1,\n t0,\n t1,\n k10,\n transform,\n interpolator = identity,\n clamp = false,\n unknown;\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n function range(interpolate) {\n return function(_) {\n var r0, r1;\n return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)];\n };\n }\n\n scale.range = range(interpolate);\n\n scale.rangeRound = range(interpolateRound);\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t) {\n transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);\n return scale;\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .interpolator(source.interpolator())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport default function sequential() {\n var scale = linearish(transformer()(identity));\n\n scale.copy = function() {\n return copy(scale, sequential());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialLog() {\n var scale = loggish(transformer()).domain([1, 10]);\n\n scale.copy = function() {\n return copy(scale, sequentialLog()).base(scale.base());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialSymlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, sequentialSymlog()).constant(scale.constant());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialPow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, sequentialPow()).exponent(scale.exponent());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialSqrt() {\n return sequentialPow.apply(null, arguments).exponent(0.5);\n}\n","import {default as value} from \"./value.js\";\n\nexport default function piecewise(interpolate, values) {\n if (values === undefined) values = interpolate, interpolate = value;\n var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);\n while (i < n) I[i] = interpolate(v, v = values[++i]);\n return function(t) {\n var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));\n return I[i](t - i);\n };\n}\n","import {interpolate, interpolateRound, piecewise} from \"d3-interpolate\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport {loggish} from \"./log.js\";\nimport {copy} from \"./sequential.js\";\nimport {symlogish} from \"./symlog.js\";\nimport {powish} from \"./pow.js\";\n\nfunction transformer() {\n var x0 = 0,\n x1 = 0.5,\n x2 = 1,\n s = 1,\n t0,\n t1,\n t2,\n k10,\n k21,\n interpolator = identity,\n transform,\n clamp = false,\n unknown;\n\n function scale(x) {\n return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n function range(interpolate) {\n return function(_) {\n var r0, r1, r2;\n return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)];\n };\n }\n\n scale.range = range(interpolate);\n\n scale.rangeRound = range(interpolateRound);\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t) {\n transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1;\n return scale;\n };\n}\n\nexport default function diverging() {\n var scale = linearish(transformer()(identity));\n\n scale.copy = function() {\n return copy(scale, diverging());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingLog() {\n var scale = loggish(transformer()).domain([0.1, 1, 10]);\n\n scale.copy = function() {\n return copy(scale, divergingLog()).base(scale.base());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingSymlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, divergingSymlog()).constant(scale.constant());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingPow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, divergingPow()).exponent(scale.exponent());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingSqrt() {\n return divergingPow.apply(null, arguments).exponent(0.5);\n}\n","export class InternMap extends Map {\n constructor(entries, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (entries != null) for (const [key, value] of entries) this.set(key, value);\n }\n get(key) {\n return super.get(intern_get(this, key));\n }\n has(key) {\n return super.has(intern_get(this, key));\n }\n set(key, value) {\n return super.set(intern_set(this, key), value);\n }\n delete(key) {\n return super.delete(intern_delete(this, key));\n }\n}\n\nexport class InternSet extends Set {\n constructor(values, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (values != null) for (const value of values) this.add(value);\n }\n has(value) {\n return super.has(intern_get(this, value));\n }\n add(value) {\n return super.add(intern_set(this, value));\n }\n delete(value) {\n return super.delete(intern_delete(this, value));\n }\n}\n\nfunction intern_get({_intern, _key}, value) {\n const key = _key(value);\n return _intern.has(key) ? _intern.get(key) : value;\n}\n\nfunction intern_set({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) return _intern.get(key);\n _intern.set(key, value);\n return value;\n}\n\nfunction intern_delete({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) {\n value = _intern.get(key);\n _intern.delete(key);\n }\n return value;\n}\n\nfunction keyof(value) {\n return value !== null && typeof value === \"object\" ? value.valueOf() : value;\n}\n","import {InternMap} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport const implicit = Symbol(\"implicit\");\n\nexport default function ordinal() {\n var index = new InternMap(),\n domain = [],\n range = [],\n unknown = implicit;\n\n function scale(d) {\n let i = index.get(d);\n if (i === undefined) {\n if (unknown !== implicit) return unknown;\n index.set(d, i = domain.push(d) - 1);\n }\n return range[i % range.length];\n }\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [], index = new InternMap();\n for (const value of _) {\n if (index.has(value)) continue;\n index.set(value, domain.push(value) - 1);\n }\n return scale;\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), scale) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return ordinal(domain, range).unknown(unknown);\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n","export default function(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n","import {hue} from \"./color.js\";\n\nexport default function(a, b) {\n var i = hue(+a, +b);\n return function(t) {\n var x = i(t);\n return x - 360 * Math.floor(x / 360);\n };\n}\n","var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n","import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n","import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n","var epsilon2 = 1e-12;\n\nfunction cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n}\n\nfunction sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n}\n\nfunction tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n}\n\nexport default (function zoomRho(rho, rho2, rho4) {\n\n // p0 = [ux0, uy0, w0]\n // p1 = [ux1, uy1, w1]\n function zoom(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],\n ux1 = p1[0], uy1 = p1[1], w1 = p1[2],\n dx = ux1 - ux0,\n dy = uy1 - uy0,\n d2 = dx * dx + dy * dy,\n i,\n S;\n\n // Special case for u0 ≅ u1.\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n }\n }\n\n // General case.\n else {\n var d1 = Math.sqrt(d2),\n b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),\n b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),\n r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),\n r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S,\n coshr0 = cosh(r0),\n u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n }\n }\n\n i.duration = S * 1000 * rho / Math.SQRT2;\n\n return i;\n }\n\n zoom.rho = function(_) {\n var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;\n return zoomRho(_1, _2, _4);\n };\n\n return zoom;\n})(Math.SQRT2, 2, 4);\n","import {hsl as colorHsl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hsl(hue) {\n return function(start, end) {\n var h = hue((start = colorHsl(start)).h, (end = colorHsl(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hsl(hue);\nexport var hslLong = hsl(color);\n","export const radians = Math.PI / 180;\nexport const degrees = 180 / Math.PI;\n","import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\n// https://observablehq.com/@mbostock/lab-and-rgb\nconst K = 18,\n Xn = 0.96422,\n Yn = 1,\n Zn = 0.82521,\n t0 = 4 / 29,\n t1 = 6 / 29,\n t2 = 3 * t1 * t1,\n t3 = t1 * t1 * t1;\n\nfunction labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) return hcl2lab(o);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = rgb2lrgb(o.r),\n g = rgb2lrgb(o.g),\n b = rgb2lrgb(o.b),\n y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;\n if (r === g && g === b) x = z = y; else {\n x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n }\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n}\n\nexport function gray(l, opacity) {\n return new Lab(l, 0, 0, opacity == null ? 1 : opacity);\n}\n\nexport default function lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n}\n\nexport function Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Lab, lab, extend(Color, {\n brighter(k) {\n return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker(k) {\n return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n x = Xn * lab2xyz(x);\n y = Yn * lab2xyz(y);\n z = Zn * lab2xyz(z);\n return new Rgb(\n lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),\n lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),\n lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n this.opacity\n );\n }\n}));\n\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction lrgb2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2lrgb(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\nfunction hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);\n var h = Math.atan2(o.b, o.a) * degrees;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n}\n\nexport function lch(l, c, h, opacity) {\n return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n}\n\nfunction hcl2lab(o) {\n if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);\n var h = o.h * radians;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n}\n\ndefine(Hcl, hcl, extend(Color, {\n brighter(k) {\n return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);\n },\n darker(k) {\n return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);\n },\n rgb() {\n return hcl2lab(this).rgb();\n }\n}));\n","import {lab as colorLab} from \"d3-color\";\nimport color from \"./color.js\";\n\nexport default function lab(start, end) {\n var l = color((start = colorLab(start)).l, (end = colorLab(end)).l),\n a = color(start.a, end.a),\n b = color(start.b, end.b),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.l = l(t);\n start.a = a(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n}\n","import {hcl as colorHcl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hcl(hue) {\n return function(start, end) {\n var h = hue((start = colorHcl(start)).h, (end = colorHcl(end)).h),\n c = color(start.c, end.c),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hcl(hue);\nexport var hclLong = hcl(color);\n","import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb, darker, brighter} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\nvar A = -0.14861,\n B = +1.78277,\n C = -0.29227,\n D = -0.90649,\n E = +1.97294,\n ED = E * D,\n EB = E * B,\n BC_DA = B * C - D * A;\n\nfunction cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),\n bl = b - l,\n k = (E * (g - l) - C * bl) / D,\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n}\n\nexport default function cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n}\n\nexport function Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Cubehelix, cubehelix, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh)),\n this.opacity\n );\n }\n}));\n","import {cubehelix as colorCubehelix} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction cubehelix(hue) {\n return (function cubehelixGamma(y) {\n y = +y;\n\n function cubehelix(start, end) {\n var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n cubehelix.gamma = cubehelixGamma;\n\n return cubehelix;\n })(1);\n}\n\nexport default cubehelix(hue);\nexport var cubehelixLong = cubehelix(color);\n","export default function(interpolator, n) {\n var samples = new Array(n);\n for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));\n return samples;\n}\n","import { toNumber, peek, toSet, array, constant, isNumber, span, isObject, isString, error, isArray } from 'vega-util';\nimport { bisectRight, range, bisect } from 'd3-array';\nimport * as $ from 'd3-scale';\nimport { scaleOrdinal, tickFormat as tickFormat$1 } from 'd3-scale';\nexport { scaleImplicit } from 'd3-scale';\nimport * as $$1 from 'd3-interpolate';\nimport { timeInterval, utcInterval } from 'vega-time';\n\nfunction bandSpace (count, paddingInner, paddingOuter) {\n const space = count - paddingInner + paddingOuter * 2;\n return count ? space > 0 ? space : 1 : 0;\n}\n\nconst Identity = 'identity';\nconst Linear = 'linear';\nconst Log = 'log';\nconst Pow = 'pow';\nconst Sqrt = 'sqrt';\nconst Symlog = 'symlog';\nconst Time = 'time';\nconst UTC = 'utc';\nconst Sequential = 'sequential';\nconst Diverging = 'diverging';\nconst Quantile = 'quantile';\nconst Quantize = 'quantize';\nconst Threshold = 'threshold';\nconst Ordinal = 'ordinal';\nconst Point = 'point';\nconst Band = 'band';\nconst BinOrdinal = 'bin-ordinal';\n\n// categories\nconst Continuous = 'continuous';\nconst Discrete = 'discrete';\nconst Discretizing = 'discretizing';\nconst Interpolating = 'interpolating';\nconst Temporal = 'temporal';\n\nfunction invertRange (scale) {\n return function (_) {\n let lo = _[0],\n hi = _[1],\n t;\n if (hi < lo) {\n t = lo;\n lo = hi;\n hi = t;\n }\n return [scale.invert(lo), scale.invert(hi)];\n };\n}\n\nfunction invertRangeExtent (scale) {\n return function (_) {\n const range = scale.range();\n let lo = _[0],\n hi = _[1],\n min = -1,\n max,\n t,\n i,\n n;\n if (hi < lo) {\n t = lo;\n lo = hi;\n hi = t;\n }\n for (i = 0, n = range.length; i < n; ++i) {\n if (range[i] >= lo && range[i] <= hi) {\n if (min < 0) min = i;\n max = i;\n }\n }\n if (min < 0) return undefined;\n lo = scale.invertExtent(range[min]);\n hi = scale.invertExtent(range[max]);\n return [lo[0] === undefined ? lo[1] : lo[0], hi[1] === undefined ? hi[0] : hi[1]];\n };\n}\n\nfunction band() {\n const scale = scaleOrdinal().unknown(undefined),\n domain = scale.domain,\n ordinalRange = scale.range;\n let range$1 = [0, 1],\n step,\n bandwidth,\n round = false,\n paddingInner = 0,\n paddingOuter = 0,\n align = 0.5;\n delete scale.unknown;\n function rescale() {\n const n = domain().length,\n reverse = range$1[1] < range$1[0],\n stop = range$1[1 - reverse],\n space = bandSpace(n, paddingInner, paddingOuter);\n let start = range$1[reverse - 0];\n step = (stop - start) / (space || 1);\n if (round) {\n step = Math.floor(step);\n }\n start += (stop - start - step * (n - paddingInner)) * align;\n bandwidth = step * (1 - paddingInner);\n if (round) {\n start = Math.round(start);\n bandwidth = Math.round(bandwidth);\n }\n const values = range(n).map(i => start + step * i);\n return ordinalRange(reverse ? values.reverse() : values);\n }\n scale.domain = function (_) {\n if (arguments.length) {\n domain(_);\n return rescale();\n } else {\n return domain();\n }\n };\n scale.range = function (_) {\n if (arguments.length) {\n range$1 = [+_[0], +_[1]];\n return rescale();\n } else {\n return range$1.slice();\n }\n };\n scale.rangeRound = function (_) {\n range$1 = [+_[0], +_[1]];\n round = true;\n return rescale();\n };\n scale.bandwidth = function () {\n return bandwidth;\n };\n scale.step = function () {\n return step;\n };\n scale.round = function (_) {\n if (arguments.length) {\n round = !!_;\n return rescale();\n } else {\n return round;\n }\n };\n scale.padding = function (_) {\n if (arguments.length) {\n paddingOuter = Math.max(0, Math.min(1, _));\n paddingInner = paddingOuter;\n return rescale();\n } else {\n return paddingInner;\n }\n };\n scale.paddingInner = function (_) {\n if (arguments.length) {\n paddingInner = Math.max(0, Math.min(1, _));\n return rescale();\n } else {\n return paddingInner;\n }\n };\n scale.paddingOuter = function (_) {\n if (arguments.length) {\n paddingOuter = Math.max(0, Math.min(1, _));\n return rescale();\n } else {\n return paddingOuter;\n }\n };\n scale.align = function (_) {\n if (arguments.length) {\n align = Math.max(0, Math.min(1, _));\n return rescale();\n } else {\n return align;\n }\n };\n scale.invertRange = function (_) {\n // bail if range has null or undefined values\n if (_[0] == null || _[1] == null) return;\n const reverse = range$1[1] < range$1[0],\n values = reverse ? ordinalRange().reverse() : ordinalRange(),\n n = values.length - 1;\n let lo = +_[0],\n hi = +_[1],\n a,\n b,\n t;\n\n // bail if either range endpoint is invalid\n if (lo !== lo || hi !== hi) return;\n\n // order range inputs, bail if outside of scale range\n if (hi < lo) {\n t = lo;\n lo = hi;\n hi = t;\n }\n if (hi < values[0] || lo > range$1[1 - reverse]) return;\n\n // binary search to index into scale range\n a = Math.max(0, bisectRight(values, lo) - 1);\n b = lo === hi ? a : bisectRight(values, hi) - 1;\n\n // increment index a if lo is within padding gap\n if (lo - values[a] > bandwidth + 1e-10) ++a;\n if (reverse) {\n // map + swap\n t = a;\n a = n - b;\n b = n - t;\n }\n return a > b ? undefined : domain().slice(a, b + 1);\n };\n scale.invert = function (_) {\n const value = scale.invertRange([_, _]);\n return value ? value[0] : value;\n };\n scale.copy = function () {\n return band().domain(domain()).range(range$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);\n };\n return rescale();\n}\nfunction pointish(scale) {\n const copy = scale.copy;\n scale.padding = scale.paddingOuter;\n delete scale.paddingInner;\n scale.copy = function () {\n return pointish(copy());\n };\n return scale;\n}\nfunction point() {\n return pointish(band().paddingInner(1));\n}\n\nvar map = Array.prototype.map;\nfunction numbers(_) {\n return map.call(_, toNumber);\n}\n\nconst slice = Array.prototype.slice;\n\nfunction scaleBinOrdinal() {\n let domain = [],\n range = [];\n function scale(x) {\n return x == null || x !== x ? undefined : range[(bisect(domain, x) - 1) % range.length];\n }\n scale.domain = function (_) {\n if (arguments.length) {\n domain = numbers(_);\n return scale;\n } else {\n return domain.slice();\n }\n };\n scale.range = function (_) {\n if (arguments.length) {\n range = slice.call(_);\n return scale;\n } else {\n return range.slice();\n }\n };\n scale.tickFormat = function (count, specifier) {\n return tickFormat$1(domain[0], peek(domain), count == null ? 10 : count, specifier);\n };\n scale.copy = function () {\n return scaleBinOrdinal().domain(scale.domain()).range(scale.range());\n };\n return scale;\n}\n\n/** Private scale registry: should not be exported */\nconst scales = new Map();\nconst VEGA_SCALE = Symbol('vega_scale');\nfunction registerScale(scale) {\n scale[VEGA_SCALE] = true;\n return scale;\n}\n\n/**\n * Return true if object was created by a constructor from the vega-scale `scale` function.\n */\nfunction isRegisteredScale(scale) {\n return scale && scale[VEGA_SCALE] === true;\n}\n\n/**\n * Augment scales with their type and needed inverse methods.\n */\nfunction create(type, constructor, metadata) {\n const ctr = function scale() {\n const s = constructor();\n if (!s.invertRange) {\n s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined;\n }\n s.type = type;\n return registerScale(s);\n };\n ctr.metadata = toSet(array(metadata));\n return ctr;\n}\n\n/**\n * Registry function for adding and accessing scale constructor functions.\n * The *type* argument is a String indicating the name of the scale type.\n *\n * If the *scale* argument is not specified, this method returns the matching scale constructor in the registry, or `null` if not found.\n * If the *scale* argument is provided, it must be a scale constructor function to add to the registry under the given *type* name.\n * The *metadata* argument provides additional information to guide appropriate use of scales within Vega.\n *\n * *metadata* can be either a string or string array. The valid string values are:\n * - `\"continuous\"` - the scale is defined over a continuous-valued domain.\n * - `\"discrete\"` - the scale is defined over a discrete domain and range.\n * - `\"discretizing\"` - the scale discretizes a continuous domain to a discrete range.\n * - `\"interpolating\"` - the scale range is defined using a color interpolator.\n * - `\"log\"` - the scale performs a logarithmic transform of the continuous domain.\n * - `\"temporal\"` - the scale domain is defined over date-time values.\n */\nfunction scale(type, scale, metadata) {\n if (arguments.length > 1) {\n scales.set(type, create(type, scale, metadata));\n return this;\n } else {\n return isValidScaleType(type) ? scales.get(type) : undefined;\n }\n}\n\n// identity scale\nscale(Identity, $.scaleIdentity);\n\n// continuous scales\nscale(Linear, $.scaleLinear, Continuous);\nscale(Log, $.scaleLog, [Continuous, Log]);\nscale(Pow, $.scalePow, Continuous);\nscale(Sqrt, $.scaleSqrt, Continuous);\nscale(Symlog, $.scaleSymlog, Continuous);\nscale(Time, $.scaleTime, [Continuous, Temporal]);\nscale(UTC, $.scaleUtc, [Continuous, Temporal]);\n\n// sequential scales\nscale(Sequential, $.scaleSequential, [Continuous, Interpolating]); // backwards compat\nscale(`${Sequential}-${Linear}`, $.scaleSequential, [Continuous, Interpolating]);\nscale(`${Sequential}-${Log}`, $.scaleSequentialLog, [Continuous, Interpolating, Log]);\nscale(`${Sequential}-${Pow}`, $.scaleSequentialPow, [Continuous, Interpolating]);\nscale(`${Sequential}-${Sqrt}`, $.scaleSequentialSqrt, [Continuous, Interpolating]);\nscale(`${Sequential}-${Symlog}`, $.scaleSequentialSymlog, [Continuous, Interpolating]);\n\n// diverging scales\nscale(`${Diverging}-${Linear}`, $.scaleDiverging, [Continuous, Interpolating]);\nscale(`${Diverging}-${Log}`, $.scaleDivergingLog, [Continuous, Interpolating, Log]);\nscale(`${Diverging}-${Pow}`, $.scaleDivergingPow, [Continuous, Interpolating]);\nscale(`${Diverging}-${Sqrt}`, $.scaleDivergingSqrt, [Continuous, Interpolating]);\nscale(`${Diverging}-${Symlog}`, $.scaleDivergingSymlog, [Continuous, Interpolating]);\n\n// discretizing scales\nscale(Quantile, $.scaleQuantile, [Discretizing, Quantile]);\nscale(Quantize, $.scaleQuantize, Discretizing);\nscale(Threshold, $.scaleThreshold, Discretizing);\n\n// discrete scales\nscale(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]);\nscale(Ordinal, $.scaleOrdinal, Discrete);\nscale(Band, band, Discrete);\nscale(Point, point, Discrete);\nfunction isValidScaleType(type) {\n return scales.has(type);\n}\nfunction hasType(key, type) {\n const s = scales.get(key);\n return s && s.metadata[type];\n}\nfunction isContinuous(key) {\n return hasType(key, Continuous);\n}\nfunction isDiscrete(key) {\n return hasType(key, Discrete);\n}\nfunction isDiscretizing(key) {\n return hasType(key, Discretizing);\n}\nfunction isLogarithmic(key) {\n return hasType(key, Log);\n}\nfunction isTemporal(key) {\n return hasType(key, Temporal);\n}\nfunction isInterpolating(key) {\n return hasType(key, Interpolating);\n}\nfunction isQuantile(key) {\n return hasType(key, Quantile);\n}\n\nconst scaleProps = ['clamp', 'base', 'constant', 'exponent'];\nfunction interpolateRange(interpolator, range) {\n const start = range[0],\n span = peek(range) - start;\n return function (i) {\n return interpolator(start + i * span);\n };\n}\nfunction interpolateColors(colors, type, gamma) {\n return $$1.piecewise(interpolate(type || 'rgb', gamma), colors);\n}\nfunction quantizeInterpolator(interpolator, count) {\n const samples = new Array(count),\n n = count + 1;\n for (let i = 0; i < count;) samples[i] = interpolator(++i / n);\n return samples;\n}\nfunction scaleCopy(scale) {\n const t = scale.type,\n s = scale.copy();\n s.type = t;\n return s;\n}\nfunction scaleFraction(scale$1, min, max) {\n const delta = max - min;\n let i, t, s;\n if (!delta || !Number.isFinite(delta)) {\n return constant(0.5);\n } else {\n i = (t = scale$1.type).indexOf('-');\n t = i < 0 ? t : t.slice(i + 1);\n s = scale(t)().domain([min, max]).range([0, 1]);\n scaleProps.forEach(m => scale$1[m] ? s[m](scale$1[m]()) : 0);\n return s;\n }\n}\nfunction interpolate(type, gamma) {\n const interp = $$1[method(type)];\n return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp;\n}\nfunction method(type) {\n return 'interpolate' + type.toLowerCase().split('-').map(s => s[0].toUpperCase() + s.slice(1)).join('');\n}\n\nconst continuous = {\n blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90',\n greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429',\n greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e',\n oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303',\n purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c',\n reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13',\n blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429',\n bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71',\n greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1',\n orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403',\n purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281',\n purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353',\n purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a',\n redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174',\n yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034',\n yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204',\n yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225',\n blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07',\n brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147',\n purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29',\n purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07',\n redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85',\n redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434',\n yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185',\n redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695',\n redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837',\n pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419',\n spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2',\n viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725',\n magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf',\n inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4',\n plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921',\n cividis: '00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647',\n rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa',\n sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040',\n turbo: '23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00',\n browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632',\n tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985',\n teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667',\n warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e',\n goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36',\n goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26',\n goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e',\n lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b',\n lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc',\n lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c',\n lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b',\n lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988',\n darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff',\n darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff',\n darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa',\n darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff',\n darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c'\n};\nconst discrete = {\n category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf',\n category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5',\n category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6',\n category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9',\n tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac',\n tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5',\n accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666',\n dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666',\n paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928',\n pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2',\n pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc',\n set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999',\n set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3',\n set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f'\n};\n\nfunction colors(palette) {\n const n = palette.length / 6 | 0,\n c = new Array(n);\n for (let i = 0; i < n;) {\n c[i] = '#' + palette.slice(i * 6, ++i * 6);\n }\n return c;\n}\nfunction apply(_, f) {\n for (const k in _) scheme(k, f(_[k]));\n}\nconst schemes = {};\napply(discrete, colors);\napply(continuous, _ => interpolateColors(colors(_)));\nfunction scheme(name, scheme) {\n name = name && name.toLowerCase();\n if (arguments.length > 1) {\n schemes[name] = scheme;\n return this;\n } else {\n return schemes[name];\n }\n}\n\nconst SymbolLegend = 'symbol';\nconst DiscreteLegend = 'discrete';\nconst GradientLegend = 'gradient';\n\nconst defaultFormatter = value => isArray(value) ? value.map(v => String(v)) : String(value);\nconst ascending = (a, b) => a[1] - b[1];\nconst descending = (a, b) => b[1] - a[1];\n\n/**\n * Determine the tick count or interval function.\n * @param {Scale} scale - The scale for which to generate tick values.\n * @param {*} count - The desired tick count or interval specifier.\n * @param {number} minStep - The desired minimum step between tick values.\n * @return {*} - The tick count or interval function.\n */\nfunction tickCount(scale, count, minStep) {\n let step;\n if (isNumber(count)) {\n if (scale.bins) {\n count = Math.max(count, scale.bins.length);\n }\n if (minStep != null) {\n count = Math.min(count, Math.floor(span(scale.domain()) / minStep || 1) + 1);\n }\n }\n if (isObject(count)) {\n step = count.step;\n count = count.interval;\n }\n if (isString(count)) {\n count = scale.type === Time ? timeInterval(count) : scale.type == UTC ? utcInterval(count) : error('Only time and utc scales accept interval strings.');\n if (step) count = count.every(step);\n }\n return count;\n}\n\n/**\n * Filter a set of candidate tick values, ensuring that only tick values\n * that lie within the scale range are included.\n * @param {Scale} scale - The scale for which to generate tick values.\n * @param {Array<*>} ticks - The candidate tick values.\n * @param {*} count - The tick count or interval function.\n * @return {Array<*>} - The filtered tick values.\n */\nfunction validTicks(scale, ticks, count) {\n let range = scale.range(),\n lo = range[0],\n hi = peek(range),\n cmp = ascending;\n if (lo > hi) {\n range = hi;\n hi = lo;\n lo = range;\n cmp = descending;\n }\n lo = Math.floor(lo);\n hi = Math.ceil(hi);\n\n // filter ticks to valid values within the range\n // additionally sort ticks in range order (#2579)\n ticks = ticks.map(v => [v, scale(v)]).filter(_ => lo <= _[1] && _[1] <= hi).sort(cmp).map(_ => _[0]);\n if (count > 0 && ticks.length > 1) {\n const endpoints = [ticks[0], peek(ticks)];\n while (ticks.length > count && ticks.length >= 3) {\n ticks = ticks.filter((_, i) => !(i % 2));\n }\n if (ticks.length < 3) {\n ticks = endpoints;\n }\n }\n return ticks;\n}\n\n/**\n * Generate tick values for the given scale and approximate tick count or\n * interval value. If the scale has a 'ticks' method, it will be used to\n * generate the ticks, with the count argument passed as a parameter. If the\n * scale lacks a 'ticks' method, the full scale domain will be returned.\n * @param {Scale} scale - The scale for which to generate tick values.\n * @param {*} [count] - The approximate number of desired ticks.\n * @return {Array<*>} - The generated tick values.\n */\nfunction tickValues(scale, count) {\n return scale.bins ? validTicks(scale, scale.bins) : scale.ticks ? scale.ticks(count) : scale.domain();\n}\n\n/**\n * Generate a label format function for a scale. If the scale has a\n * 'tickFormat' method, it will be used to generate the formatter, with the\n * count and specifier arguments passed as parameters. If the scale lacks a\n * 'tickFormat' method, the returned formatter performs simple string coercion.\n * If the input scale is a logarithmic scale and the format specifier does not\n * indicate a desired decimal precision, a special variable precision formatter\n * that automatically trims trailing zeroes will be generated.\n * @param {Scale} scale - The scale for which to generate the label formatter.\n * @param {*} [count] - The approximate number of desired ticks.\n * @param {string} [specifier] - The format specifier. Must be a legal d3\n * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or\n * time multi-format specifier object.\n * @return {function(*):string} - The generated label formatter.\n */\nfunction tickFormat(locale, scale, count, specifier, formatType, noSkip) {\n const type = scale.type;\n let format = defaultFormatter;\n if (type === Time || formatType === Time) {\n format = locale.timeFormat(specifier);\n } else if (type === UTC || formatType === UTC) {\n format = locale.utcFormat(specifier);\n } else if (isLogarithmic(type)) {\n const varfmt = locale.formatFloat(specifier);\n if (noSkip || scale.bins) {\n format = varfmt;\n } else {\n const test = tickLog(scale, count, false);\n format = _ => test(_) ? varfmt(_) : '';\n }\n } else if (scale.tickFormat) {\n // if d3 scale has tickFormat, it must be continuous\n const d = scale.domain();\n format = locale.formatSpan(d[0], d[d.length - 1], count, specifier);\n } else if (specifier) {\n format = locale.format(specifier);\n }\n return format;\n}\nfunction tickLog(scale, count, values) {\n const ticks = tickValues(scale, count),\n base = scale.base(),\n logb = Math.log(base),\n k = Math.max(1, base * count / ticks.length);\n\n // apply d3-scale's log format filter criteria\n const test = d => {\n let i = d / Math.pow(base, Math.round(Math.log(d) / logb));\n if (i * base < base - 0.5) i *= base;\n return i <= k;\n };\n return values ? ticks.filter(test) : test;\n}\n\nconst symbols = {\n [Quantile]: 'quantiles',\n [Quantize]: 'thresholds',\n [Threshold]: 'domain'\n};\nconst formats = {\n [Quantile]: 'quantiles',\n [Quantize]: 'domain'\n};\nfunction labelValues(scale, count) {\n return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols[scale.type] ? thresholdValues(scale[symbols[scale.type]]()) : tickValues(scale, count);\n}\nfunction thresholdFormat(locale, scale, specifier) {\n const _ = scale[formats[scale.type]](),\n n = _.length;\n let d = n > 1 ? _[1] - _[0] : _[0],\n i;\n for (i = 1; i < n; ++i) {\n d = Math.min(d, _[i] - _[i - 1]);\n }\n\n // tickCount = 3 ticks times 10 for increased resolution\n return locale.formatSpan(0, d, 3 * 10, specifier);\n}\nfunction thresholdValues(thresholds) {\n const values = [-Infinity].concat(thresholds);\n values.max = +Infinity;\n return values;\n}\nfunction binValues(bins) {\n const values = bins.slice(0, -1);\n values.max = peek(bins);\n return values;\n}\nconst isDiscreteRange = scale => symbols[scale.type] || scale.bins;\nfunction labelFormat(locale, scale, count, type, specifier, formatType, noSkip) {\n const format = formats[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat(locale, scale, count, specifier, formatType, noSkip);\n return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format);\n}\nconst formatRange = format => (value, index, array) => {\n const limit = get(array[index + 1], get(array.max, +Infinity)),\n lo = formatValue(value, format),\n hi = formatValue(limit, format);\n return lo && hi ? lo + ' \\u2013 ' + hi : hi ? '< ' + hi : '\\u2265 ' + lo;\n};\nconst get = (value, dflt) => value != null ? value : dflt;\nconst formatDiscrete = format => (value, index) => index ? format(value) : null;\nconst formatPoint = format => value => format(value);\nconst formatValue = (value, format) => Number.isFinite(value) ? format(value) : null;\nfunction labelFraction(scale) {\n const domain = scale.domain(),\n count = domain.length - 1;\n let lo = +domain[0],\n hi = +peek(domain),\n span = hi - lo;\n if (scale.type === Threshold) {\n const adjust = count ? span / count : 0.1;\n lo -= adjust;\n hi += adjust;\n span = hi - lo;\n }\n return value => (value - lo) / span;\n}\n\nfunction format(locale, scale, specifier, formatType) {\n const type = formatType || scale.type;\n\n // replace abbreviated time specifiers to improve screen reader experience\n if (isString(specifier) && isTemporal(type)) {\n specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B');\n }\n return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') : labelFormat(locale, scale, 5, null, specifier, formatType, true);\n}\nfunction domainCaption(locale, scale, opt) {\n opt = opt || {};\n const max = Math.max(3, opt.maxlen || 7),\n fmt = format(locale, scale, opt.format, opt.formatType);\n\n // if scale breaks domain into bins, describe boundaries\n if (isDiscretizing(scale.type)) {\n const v = labelValues(scale).slice(1).map(fmt),\n n = v.length;\n return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`;\n }\n\n // if scale domain is discrete, list values\n else if (isDiscrete(scale.type)) {\n const d = scale.domain(),\n n = d.length,\n v = n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', ');\n return `${n} value${n === 1 ? '' : 's'}: ${v}`;\n }\n\n // if scale domain is continuous, describe value range\n else {\n const d = scale.domain();\n return `values from ${fmt(d[0])} to ${fmt(peek(d))}`;\n }\n}\n\nexport { Band, BinOrdinal, DiscreteLegend, Diverging, GradientLegend, Identity, Linear, Log, Ordinal, Point, Pow, Quantile, Quantize, Sequential, Sqrt, SymbolLegend, Symlog, Threshold, Time, UTC, bandSpace, domainCaption, interpolate, interpolateColors, interpolateRange, isContinuous, isDiscrete, isDiscretizing, isInterpolating, isLogarithmic, isQuantile, isRegisteredScale, isTemporal, isValidScaleType, labelFormat, labelFraction, labelValues, quantizeInterpolator, registerScale, scale, scaleCopy, scaleFraction, scheme, tickCount, tickFormat, tickValues, validTicks };\n","import {linearish} from \"./linear.js\";\nimport number from \"./number.js\";\n\nexport default function identity(domain) {\n var unknown;\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : x;\n }\n\n scale.invert = scale;\n\n scale.domain = scale.range = function(_) {\n return arguments.length ? (domain = Array.from(_, number), scale) : domain.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return identity(domain).unknown(unknown);\n };\n\n domain = arguments.length ? Array.from(domain, number) : [0, 1];\n\n return linearish(scale);\n}\n","import {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcTicks, utcTickInterval} from \"d3-time\";\nimport {utcFormat} from \"d3-time-format\";\nimport {calendar} from \"./time.js\";\nimport {initRange} from \"./init.js\";\n\nexport default function utcTime() {\n return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);\n}\n","import {ascending, bisect, quantileSorted as threshold} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport default function quantile() {\n var domain = [],\n range = [],\n thresholds = [],\n unknown;\n\n function rescale() {\n var i = 0, n = Math.max(1, range.length);\n thresholds = new Array(n - 1);\n while (++i < n) thresholds[i - 1] = threshold(domain, i / n);\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : range[bisect(thresholds, x)];\n }\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN] : [\n i > 0 ? thresholds[i - 1] : domain[0],\n i < thresholds.length ? thresholds[i] : domain[domain.length - 1]\n ];\n };\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [];\n for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d);\n domain.sort(ascending);\n return rescale();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.quantiles = function() {\n return thresholds.slice();\n };\n\n scale.copy = function() {\n return quantile()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(scale, arguments);\n}\n","import {bisect} from \"d3-array\";\nimport {linearish} from \"./linear.js\";\nimport {initRange} from \"./init.js\";\n\nexport default function quantize() {\n var x0 = 0,\n x1 = 1,\n n = 1,\n domain = [0.5],\n range = [0, 1],\n unknown;\n\n function scale(x) {\n return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;\n }\n\n function rescale() {\n var i = -1;\n domain = new Array(n);\n while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);\n return scale;\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1];\n };\n\n scale.range = function(_) {\n return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN]\n : i < 1 ? [x0, domain[0]]\n : i >= n ? [domain[n - 1], x1]\n : [domain[i - 1], domain[i]];\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : scale;\n };\n\n scale.thresholds = function() {\n return domain.slice();\n };\n\n scale.copy = function() {\n return quantize()\n .domain([x0, x1])\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(linearish(scale), arguments);\n}\n","import {bisect} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport default function threshold() {\n var domain = [0.5],\n range = [0, 1],\n unknown,\n n = 1;\n\n function scale(x) {\n return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return [domain[i - 1], domain[i]];\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return threshold()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(scale, arguments);\n}\n","import { hasOwnProperty, isFunction, inherits, truthy, lruCache, isArray, error, toSet, array, peek, extend, isNumber, isObject } from 'vega-util';\nimport { curveBasis, curveBasisClosed, curveBasisOpen, curveBundle, curveCardinal, curveCardinalOpen, curveCardinalClosed, curveCatmullRom, curveCatmullRomClosed, curveCatmullRomOpen, curveLinear, curveLinearClosed, curveMonotoneY, curveMonotoneX, curveNatural, curveStep, curveStepAfter, curveStepBefore, arc as arc$2, area as area$2, line as line$2, symbol as symbol$2 } from 'd3-shape';\nimport { path as path$3 } from 'd3-path';\nexport { path } from 'd3-path';\nimport { image as image$1, canvas } from 'vega-canvas';\nimport { loader } from 'vega-loader';\nimport { isDiscrete, domainCaption } from 'vega-scale';\n\nlet gradient_id = 0;\nfunction resetSVGGradientId() {\n gradient_id = 0;\n}\nconst patternPrefix = 'p_';\nfunction isGradient(value) {\n return value && value.gradient;\n}\nfunction gradientRef(g, defs, base) {\n const type = g.gradient;\n let id = g.id,\n prefix = type === 'radial' ? patternPrefix : '';\n\n // check id, assign default values as needed\n if (!id) {\n id = g.id = 'gradient_' + gradient_id++;\n if (type === 'radial') {\n g.x1 = get(g.x1, 0.5);\n g.y1 = get(g.y1, 0.5);\n g.r1 = get(g.r1, 0);\n g.x2 = get(g.x2, 0.5);\n g.y2 = get(g.y2, 0.5);\n g.r2 = get(g.r2, 0.5);\n prefix = patternPrefix;\n } else {\n g.x1 = get(g.x1, 0);\n g.y1 = get(g.y1, 0);\n g.x2 = get(g.x2, 1);\n g.y2 = get(g.y2, 0);\n }\n }\n\n // register definition\n defs[id] = g;\n\n // return url reference\n return 'url(' + (base || '') + '#' + prefix + id + ')';\n}\nfunction get(val, def) {\n return val != null ? val : def;\n}\nfunction Gradient (p0, p1) {\n var stops = [],\n gradient;\n return gradient = {\n gradient: 'linear',\n x1: p0 ? p0[0] : 0,\n y1: p0 ? p0[1] : 0,\n x2: p1 ? p1[0] : 1,\n y2: p1 ? p1[1] : 0,\n stops: stops,\n stop: function (offset, color) {\n stops.push({\n offset: offset,\n color: color\n });\n return gradient;\n }\n };\n}\n\nconst lookup = {\n 'basis': {\n curve: curveBasis\n },\n 'basis-closed': {\n curve: curveBasisClosed\n },\n 'basis-open': {\n curve: curveBasisOpen\n },\n 'bundle': {\n curve: curveBundle,\n tension: 'beta',\n value: 0.85\n },\n 'cardinal': {\n curve: curveCardinal,\n tension: 'tension',\n value: 0\n },\n 'cardinal-open': {\n curve: curveCardinalOpen,\n tension: 'tension',\n value: 0\n },\n 'cardinal-closed': {\n curve: curveCardinalClosed,\n tension: 'tension',\n value: 0\n },\n 'catmull-rom': {\n curve: curveCatmullRom,\n tension: 'alpha',\n value: 0.5\n },\n 'catmull-rom-closed': {\n curve: curveCatmullRomClosed,\n tension: 'alpha',\n value: 0.5\n },\n 'catmull-rom-open': {\n curve: curveCatmullRomOpen,\n tension: 'alpha',\n value: 0.5\n },\n 'linear': {\n curve: curveLinear\n },\n 'linear-closed': {\n curve: curveLinearClosed\n },\n 'monotone': {\n horizontal: curveMonotoneY,\n vertical: curveMonotoneX\n },\n 'natural': {\n curve: curveNatural\n },\n 'step': {\n curve: curveStep\n },\n 'step-after': {\n curve: curveStepAfter\n },\n 'step-before': {\n curve: curveStepBefore\n }\n};\nfunction curves(type, orientation, tension) {\n var entry = hasOwnProperty(lookup, type) && lookup[type],\n curve = null;\n if (entry) {\n curve = entry.curve || entry[orientation || 'vertical'];\n if (entry.tension && tension != null) {\n curve = curve[entry.tension](tension);\n }\n }\n return curve;\n}\n\nconst paramCounts = {\n m: 2,\n l: 2,\n h: 1,\n v: 1,\n z: 0,\n c: 6,\n s: 4,\n q: 4,\n t: 2,\n a: 7\n};\nconst commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi;\nconst numberPattern = /^[+-]?(([0-9]*\\.[0-9]+)|([0-9]+\\.)|([0-9]+))([eE][+-]?[0-9]+)?/;\nconst spacePattern = /^((\\s+,?\\s*)|(,\\s*))/;\nconst flagPattern = /^[01]/;\nfunction parse(path) {\n const commands = [];\n const matches = path.match(commandPattern) || [];\n matches.forEach(str => {\n let cmd = str[0];\n const type = cmd.toLowerCase();\n\n // parse parameters\n const paramCount = paramCounts[type];\n const params = parseParams(type, paramCount, str.slice(1).trim());\n const count = params.length;\n\n // error checking based on parameter count\n if (count < paramCount || count && count % paramCount !== 0) {\n throw Error('Invalid SVG path, incorrect parameter count');\n }\n\n // register the command\n commands.push([cmd, ...params.slice(0, paramCount)]);\n\n // exit now if we're done, also handles zero-param 'z'\n if (count === paramCount) {\n return;\n }\n\n // handle implicit line-to\n if (type === 'm') {\n cmd = cmd === 'M' ? 'L' : 'l';\n }\n\n // repeat command when given extended param list\n for (let i = paramCount; i < count; i += paramCount) {\n commands.push([cmd, ...params.slice(i, i + paramCount)]);\n }\n });\n return commands;\n}\nfunction parseParams(type, paramCount, segment) {\n const params = [];\n for (let index = 0; paramCount && index < segment.length;) {\n for (let i = 0; i < paramCount; ++i) {\n const pattern = type === 'a' && (i === 3 || i === 4) ? flagPattern : numberPattern;\n const match = segment.slice(index).match(pattern);\n if (match === null) {\n throw Error('Invalid SVG path, incorrect parameter type');\n }\n index += match[0].length;\n params.push(+match[0]);\n const ws = segment.slice(index).match(spacePattern);\n if (ws !== null) {\n index += ws[0].length;\n }\n }\n }\n return params;\n}\n\nconst DegToRad = Math.PI / 180;\nconst Epsilon = 1e-14;\nconst HalfPi = Math.PI / 2;\nconst Tau = Math.PI * 2;\nconst HalfSqrt3 = Math.sqrt(3) / 2;\n\nvar segmentCache = {};\nvar bezierCache = {};\nvar join = [].join;\n\n// Copied from Inkscape svgtopdf, thanks!\nfunction segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {\n const key = join.call(arguments);\n if (segmentCache[key]) {\n return segmentCache[key];\n }\n const th = rotateX * DegToRad;\n const sin_th = Math.sin(th);\n const cos_th = Math.cos(th);\n rx = Math.abs(rx);\n ry = Math.abs(ry);\n const px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;\n const py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;\n let pl = px * px / (rx * rx) + py * py / (ry * ry);\n if (pl > 1) {\n pl = Math.sqrt(pl);\n rx *= pl;\n ry *= pl;\n }\n const a00 = cos_th / rx;\n const a01 = sin_th / rx;\n const a10 = -sin_th / ry;\n const a11 = cos_th / ry;\n const x0 = a00 * ox + a01 * oy;\n const y0 = a10 * ox + a11 * oy;\n const x1 = a00 * x + a01 * y;\n const y1 = a10 * x + a11 * y;\n const d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);\n let sfactor_sq = 1 / d - 0.25;\n if (sfactor_sq < 0) sfactor_sq = 0;\n let sfactor = Math.sqrt(sfactor_sq);\n if (sweep == large) sfactor = -sfactor;\n const xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0);\n const yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);\n const th0 = Math.atan2(y0 - yc, x0 - xc);\n const th1 = Math.atan2(y1 - yc, x1 - xc);\n let th_arc = th1 - th0;\n if (th_arc < 0 && sweep === 1) {\n th_arc += Tau;\n } else if (th_arc > 0 && sweep === 0) {\n th_arc -= Tau;\n }\n const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001)));\n const result = [];\n for (let i = 0; i < segs; ++i) {\n const th2 = th0 + i * th_arc / segs;\n const th3 = th0 + (i + 1) * th_arc / segs;\n result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th];\n }\n return segmentCache[key] = result;\n}\nfunction bezier(params) {\n const key = join.call(params);\n if (bezierCache[key]) {\n return bezierCache[key];\n }\n var cx = params[0],\n cy = params[1],\n th0 = params[2],\n th1 = params[3],\n rx = params[4],\n ry = params[5],\n sin_th = params[6],\n cos_th = params[7];\n const a00 = cos_th * rx;\n const a01 = -sin_th * ry;\n const a10 = sin_th * rx;\n const a11 = cos_th * ry;\n const cos_th0 = Math.cos(th0);\n const sin_th0 = Math.sin(th0);\n const cos_th1 = Math.cos(th1);\n const sin_th1 = Math.sin(th1);\n const th_half = 0.5 * (th1 - th0);\n const sin_th_h2 = Math.sin(th_half * 0.5);\n const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half);\n const x1 = cx + cos_th0 - t * sin_th0;\n const y1 = cy + sin_th0 + t * cos_th0;\n const x3 = cx + cos_th1;\n const y3 = cy + sin_th1;\n const x2 = x3 + t * sin_th1;\n const y2 = y3 - t * cos_th1;\n return bezierCache[key] = [a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3];\n}\n\nconst temp = ['l', 0, 0, 0, 0, 0, 0, 0];\nfunction scale$1(current, sX, sY) {\n const c = temp[0] = current[0];\n if (c === 'a' || c === 'A') {\n temp[1] = sX * current[1];\n temp[2] = sY * current[2];\n temp[3] = current[3];\n temp[4] = current[4];\n temp[5] = current[5];\n temp[6] = sX * current[6];\n temp[7] = sY * current[7];\n } else if (c === 'h' || c === 'H') {\n temp[1] = sX * current[1];\n } else if (c === 'v' || c === 'V') {\n temp[1] = sY * current[1];\n } else {\n for (var i = 1, n = current.length; i < n; ++i) {\n temp[i] = (i % 2 == 1 ? sX : sY) * current[i];\n }\n }\n return temp;\n}\nfunction pathRender (context, path, l, t, sX, sY) {\n var current,\n // current instruction\n previous = null,\n x = 0,\n // current x\n y = 0,\n // current y\n controlX = 0,\n // current control point x\n controlY = 0,\n // current control point y\n tempX,\n tempY,\n tempControlX,\n tempControlY,\n anchorX = 0,\n anchorY = 0;\n if (l == null) l = 0;\n if (t == null) t = 0;\n if (sX == null) sX = 1;\n if (sY == null) sY = sX;\n if (context.beginPath) context.beginPath();\n for (var i = 0, len = path.length; i < len; ++i) {\n current = path[i];\n if (sX !== 1 || sY !== 1) {\n current = scale$1(current, sX, sY);\n }\n switch (current[0]) {\n // first letter\n\n case 'l':\n // lineto, relative\n x += current[1];\n y += current[2];\n context.lineTo(x + l, y + t);\n break;\n case 'L':\n // lineto, absolute\n x = current[1];\n y = current[2];\n context.lineTo(x + l, y + t);\n break;\n case 'h':\n // horizontal lineto, relative\n x += current[1];\n context.lineTo(x + l, y + t);\n break;\n case 'H':\n // horizontal lineto, absolute\n x = current[1];\n context.lineTo(x + l, y + t);\n break;\n case 'v':\n // vertical lineto, relative\n y += current[1];\n context.lineTo(x + l, y + t);\n break;\n case 'V':\n // verical lineto, absolute\n y = current[1];\n context.lineTo(x + l, y + t);\n break;\n case 'm':\n // moveTo, relative\n x += current[1];\n y += current[2];\n anchorX = x;\n anchorY = y;\n context.moveTo(x + l, y + t);\n break;\n case 'M':\n // moveTo, absolute\n x = current[1];\n y = current[2];\n anchorX = x;\n anchorY = y;\n context.moveTo(x + l, y + t);\n break;\n case 'c':\n // bezierCurveTo, relative\n tempX = x + current[5];\n tempY = y + current[6];\n controlX = x + current[3];\n controlY = y + current[4];\n context.bezierCurveTo(x + current[1] + l,\n // x1\n y + current[2] + t,\n // y1\n controlX + l,\n // x2\n controlY + t,\n // y2\n tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n break;\n case 'C':\n // bezierCurveTo, absolute\n x = current[5];\n y = current[6];\n controlX = current[3];\n controlY = current[4];\n context.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t);\n break;\n case 's':\n // shorthand cubic bezierCurveTo, relative\n // transform to absolute x,y\n tempX = x + current[3];\n tempY = y + current[4];\n // calculate reflection of previous control points\n controlX = 2 * x - controlX;\n controlY = 2 * y - controlY;\n context.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t);\n\n // set control point to 2nd one of this command\n // the first control point is assumed to be the reflection of\n // the second control point on the previous command relative\n // to the current point.\n controlX = x + current[1];\n controlY = y + current[2];\n x = tempX;\n y = tempY;\n break;\n case 'S':\n // shorthand cubic bezierCurveTo, absolute\n tempX = current[3];\n tempY = current[4];\n // calculate reflection of previous control points\n controlX = 2 * x - controlX;\n controlY = 2 * y - controlY;\n context.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n // set control point to 2nd one of this command\n // the first control point is assumed to be the reflection of\n // the second control point on the previous command relative\n // to the current point.\n controlX = current[1];\n controlY = current[2];\n break;\n case 'q':\n // quadraticCurveTo, relative\n // transform to absolute x,y\n tempX = x + current[3];\n tempY = y + current[4];\n controlX = x + current[1];\n controlY = y + current[2];\n context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n break;\n case 'Q':\n // quadraticCurveTo, absolute\n tempX = current[3];\n tempY = current[4];\n context.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n controlX = current[1];\n controlY = current[2];\n break;\n case 't':\n // shorthand quadraticCurveTo, relative\n\n // transform to absolute x,y\n tempX = x + current[1];\n tempY = y + current[2];\n if (previous[0].match(/[QqTt]/) === null) {\n // If there is no previous command or if the previous command was not a Q, q, T or t,\n // assume the control point is coincident with the current point\n controlX = x;\n controlY = y;\n } else if (previous[0] === 't') {\n // calculate reflection of previous control points for t\n controlX = 2 * x - tempControlX;\n controlY = 2 * y - tempControlY;\n } else if (previous[0] === 'q') {\n // calculate reflection of previous control points for q\n controlX = 2 * x - controlX;\n controlY = 2 * y - controlY;\n }\n tempControlX = controlX;\n tempControlY = controlY;\n context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n controlX = x + current[1];\n controlY = y + current[2];\n break;\n case 'T':\n tempX = current[1];\n tempY = current[2];\n\n // calculate reflection of previous control points\n controlX = 2 * x - controlX;\n controlY = 2 * y - controlY;\n context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n break;\n case 'a':\n drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + x + l, current[7] + y + t]);\n x += current[6];\n y += current[7];\n break;\n case 'A':\n drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + l, current[7] + t]);\n x = current[6];\n y = current[7];\n break;\n case 'z':\n case 'Z':\n x = anchorX;\n y = anchorY;\n context.closePath();\n break;\n }\n previous = current;\n }\n}\nfunction drawArc(context, x, y, coords) {\n const seg = segments(coords[5],\n // end x\n coords[6],\n // end y\n coords[0],\n // radius x\n coords[1],\n // radius y\n coords[3],\n // large flag\n coords[4],\n // sweep flag\n coords[2],\n // rotation\n x, y);\n for (let i = 0; i < seg.length; ++i) {\n const bez = bezier(seg[i]);\n context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]);\n }\n}\n\nconst Tan30 = 0.5773502691896257;\nconst builtins = {\n 'circle': {\n draw: function (context, size) {\n const r = Math.sqrt(size) / 2;\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, Tau);\n }\n },\n 'cross': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n s = r / 2.5;\n context.moveTo(-r, -s);\n context.lineTo(-r, s);\n context.lineTo(-s, s);\n context.lineTo(-s, r);\n context.lineTo(s, r);\n context.lineTo(s, s);\n context.lineTo(r, s);\n context.lineTo(r, -s);\n context.lineTo(s, -s);\n context.lineTo(s, -r);\n context.lineTo(-s, -r);\n context.lineTo(-s, -s);\n context.closePath();\n }\n },\n 'diamond': {\n draw: function (context, size) {\n const r = Math.sqrt(size) / 2;\n context.moveTo(-r, 0);\n context.lineTo(0, -r);\n context.lineTo(r, 0);\n context.lineTo(0, r);\n context.closePath();\n }\n },\n 'square': {\n draw: function (context, size) {\n var w = Math.sqrt(size),\n x = -w / 2;\n context.rect(x, x, w, w);\n }\n },\n 'arrow': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n s = r / 7,\n t = r / 2.5,\n v = r / 8;\n context.moveTo(-s, r);\n context.lineTo(s, r);\n context.lineTo(s, -v);\n context.lineTo(t, -v);\n context.lineTo(0, -r);\n context.lineTo(-t, -v);\n context.lineTo(-s, -v);\n context.closePath();\n }\n },\n 'wedge': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r,\n o = h - r * Tan30,\n b = r / 4;\n context.moveTo(0, -h - o);\n context.lineTo(-b, h - o);\n context.lineTo(b, h - o);\n context.closePath();\n }\n },\n 'triangle': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r,\n o = h - r * Tan30;\n context.moveTo(0, -h - o);\n context.lineTo(-r, h - o);\n context.lineTo(r, h - o);\n context.closePath();\n }\n },\n 'triangle-up': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r;\n context.moveTo(0, -h);\n context.lineTo(-r, h);\n context.lineTo(r, h);\n context.closePath();\n }\n },\n 'triangle-down': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r;\n context.moveTo(0, h);\n context.lineTo(-r, -h);\n context.lineTo(r, -h);\n context.closePath();\n }\n },\n 'triangle-right': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r;\n context.moveTo(h, 0);\n context.lineTo(-h, -r);\n context.lineTo(-h, r);\n context.closePath();\n }\n },\n 'triangle-left': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r;\n context.moveTo(-h, 0);\n context.lineTo(h, -r);\n context.lineTo(h, r);\n context.closePath();\n }\n },\n 'stroke': {\n draw: function (context, size) {\n const r = Math.sqrt(size) / 2;\n context.moveTo(-r, 0);\n context.lineTo(r, 0);\n }\n }\n};\nfunction symbols(_) {\n return hasOwnProperty(builtins, _) ? builtins[_] : customSymbol(_);\n}\nvar custom = {};\nfunction customSymbol(path) {\n if (!hasOwnProperty(custom, path)) {\n const parsed = parse(path);\n custom[path] = {\n draw: function (context, size) {\n pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2);\n }\n };\n }\n return custom[path];\n}\n\n// See http://spencermortensen.com/articles/bezier-circle/\nconst C = 0.448084975506; // C = 1 - c\n\nfunction rectangleX(d) {\n return d.x;\n}\nfunction rectangleY(d) {\n return d.y;\n}\nfunction rectangleWidth(d) {\n return d.width;\n}\nfunction rectangleHeight(d) {\n return d.height;\n}\nfunction number(_) {\n return typeof _ === 'function' ? _ : () => +_;\n}\nfunction clamp(value, min, max) {\n return Math.max(min, Math.min(value, max));\n}\nfunction vg_rect () {\n var x = rectangleX,\n y = rectangleY,\n width = rectangleWidth,\n height = rectangleHeight,\n crTL = number(0),\n crTR = crTL,\n crBL = crTL,\n crBR = crTL,\n context = null;\n function rectangle(_, x0, y0) {\n var buffer,\n x1 = x0 != null ? x0 : +x.call(this, _),\n y1 = y0 != null ? y0 : +y.call(this, _),\n w = +width.call(this, _),\n h = +height.call(this, _),\n s = Math.min(w, h) / 2,\n tl = clamp(+crTL.call(this, _), 0, s),\n tr = clamp(+crTR.call(this, _), 0, s),\n bl = clamp(+crBL.call(this, _), 0, s),\n br = clamp(+crBR.call(this, _), 0, s);\n if (!context) context = buffer = path$3();\n if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) {\n context.rect(x1, y1, w, h);\n } else {\n var x2 = x1 + w,\n y2 = y1 + h;\n context.moveTo(x1 + tl, y1);\n context.lineTo(x2 - tr, y1);\n context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr);\n context.lineTo(x2, y2 - br);\n context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2);\n context.lineTo(x1 + bl, y2);\n context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl);\n context.lineTo(x1, y1 + tl);\n context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1);\n context.closePath();\n }\n if (buffer) {\n context = null;\n return buffer + '' || null;\n }\n }\n rectangle.x = function (_) {\n if (arguments.length) {\n x = number(_);\n return rectangle;\n } else {\n return x;\n }\n };\n rectangle.y = function (_) {\n if (arguments.length) {\n y = number(_);\n return rectangle;\n } else {\n return y;\n }\n };\n rectangle.width = function (_) {\n if (arguments.length) {\n width = number(_);\n return rectangle;\n } else {\n return width;\n }\n };\n rectangle.height = function (_) {\n if (arguments.length) {\n height = number(_);\n return rectangle;\n } else {\n return height;\n }\n };\n rectangle.cornerRadius = function (tl, tr, br, bl) {\n if (arguments.length) {\n crTL = number(tl);\n crTR = tr != null ? number(tr) : crTL;\n crBR = br != null ? number(br) : crTL;\n crBL = bl != null ? number(bl) : crTR;\n return rectangle;\n } else {\n return crTL;\n }\n };\n rectangle.context = function (_) {\n if (arguments.length) {\n context = _ == null ? null : _;\n return rectangle;\n } else {\n return context;\n }\n };\n return rectangle;\n}\n\nfunction vg_trail () {\n var x,\n y,\n size,\n defined,\n context = null,\n ready,\n x1,\n y1,\n r1;\n function point(x2, y2, w2) {\n const r2 = w2 / 2;\n if (ready) {\n var ux = y1 - y2,\n uy = x2 - x1;\n if (ux || uy) {\n // get normal vector\n var ud = Math.hypot(ux, uy),\n rx = (ux /= ud) * r1,\n ry = (uy /= ud) * r1,\n t = Math.atan2(uy, ux);\n\n // draw segment\n context.moveTo(x1 - rx, y1 - ry);\n context.lineTo(x2 - ux * r2, y2 - uy * r2);\n context.arc(x2, y2, r2, t - Math.PI, t);\n context.lineTo(x1 + rx, y1 + ry);\n context.arc(x1, y1, r1, t, t + Math.PI);\n } else {\n context.arc(x2, y2, r2, 0, Tau);\n }\n context.closePath();\n } else {\n ready = 1;\n }\n x1 = x2;\n y1 = y2;\n r1 = r2;\n }\n function trail(data) {\n var i,\n n = data.length,\n d,\n defined0 = false,\n buffer;\n if (context == null) context = buffer = path$3();\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) ready = 0;\n }\n if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data));\n }\n if (buffer) {\n context = null;\n return buffer + '' || null;\n }\n }\n trail.x = function (_) {\n if (arguments.length) {\n x = _;\n return trail;\n } else {\n return x;\n }\n };\n trail.y = function (_) {\n if (arguments.length) {\n y = _;\n return trail;\n } else {\n return y;\n }\n };\n trail.size = function (_) {\n if (arguments.length) {\n size = _;\n return trail;\n } else {\n return size;\n }\n };\n trail.defined = function (_) {\n if (arguments.length) {\n defined = _;\n return trail;\n } else {\n return defined;\n }\n };\n trail.context = function (_) {\n if (arguments.length) {\n if (_ == null) {\n context = null;\n } else {\n context = _;\n }\n return trail;\n } else {\n return context;\n }\n };\n return trail;\n}\n\nfunction value$1(a, b) {\n return a != null ? a : b;\n}\nconst x = item => item.x || 0,\n y = item => item.y || 0,\n w = item => item.width || 0,\n h = item => item.height || 0,\n xw = item => (item.x || 0) + (item.width || 0),\n yh = item => (item.y || 0) + (item.height || 0),\n sa = item => item.startAngle || 0,\n ea = item => item.endAngle || 0,\n pa = item => item.padAngle || 0,\n ir = item => item.innerRadius || 0,\n or = item => item.outerRadius || 0,\n cr = item => item.cornerRadius || 0,\n tl = item => value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0,\n tr = item => value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0,\n br = item => value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0,\n bl = item => value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0,\n sz = item => value$1(item.size, 64),\n ts = item => item.size || 1,\n def = item => !(item.defined === false),\n type = item => symbols(item.shape || 'circle');\nconst arcShape = arc$2().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr),\n areavShape = area$2().x(x).y1(y).y0(yh).defined(def),\n areahShape = area$2().y(y).x1(x).x0(xw).defined(def),\n lineShape = line$2().x(x).y(y).defined(def),\n rectShape = vg_rect().x(x).y(y).width(w).height(h).cornerRadius(tl, tr, br, bl),\n symbolShape = symbol$2().type(type).size(sz),\n trailShape = vg_trail().x(x).y(y).defined(def).size(ts);\nfunction hasCornerRadius(item) {\n return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft;\n}\nfunction arc$1(context, item) {\n return arcShape.context(context)(item);\n}\nfunction area$1(context, items) {\n const item = items[0],\n interp = item.interpolate || 'linear';\n return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items);\n}\nfunction line$1(context, items) {\n const item = items[0],\n interp = item.interpolate || 'linear';\n return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items);\n}\nfunction rectangle(context, item, x, y) {\n return rectShape.context(context)(item, x, y);\n}\nfunction shape$1(context, item) {\n return (item.mark.shape || item.shape).context(context)(item);\n}\nfunction symbol$1(context, item) {\n return symbolShape.context(context)(item);\n}\nfunction trail$1(context, items) {\n return trailShape.context(context)(items);\n}\n\nvar clip_id = 1;\nfunction resetSVGClipId() {\n clip_id = 1;\n}\nfunction clip$1 (renderer, item, size) {\n var clip = item.clip,\n defs = renderer._defs,\n id = item.clip_id || (item.clip_id = 'clip' + clip_id++),\n c = defs.clipping[id] || (defs.clipping[id] = {\n id: id\n });\n if (isFunction(clip)) {\n c.path = clip(null);\n } else if (hasCornerRadius(size)) {\n c.path = rectangle(null, size, 0, 0);\n } else {\n c.width = size.width || 0;\n c.height = size.height || 0;\n }\n return 'url(#' + id + ')';\n}\n\nfunction Bounds(b) {\n this.clear();\n if (b) this.union(b);\n}\nBounds.prototype = {\n clone() {\n return new Bounds(this);\n },\n clear() {\n this.x1 = +Number.MAX_VALUE;\n this.y1 = +Number.MAX_VALUE;\n this.x2 = -Number.MAX_VALUE;\n this.y2 = -Number.MAX_VALUE;\n return this;\n },\n empty() {\n return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;\n },\n equals(b) {\n return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;\n },\n set(x1, y1, x2, y2) {\n if (x2 < x1) {\n this.x2 = x1;\n this.x1 = x2;\n } else {\n this.x1 = x1;\n this.x2 = x2;\n }\n if (y2 < y1) {\n this.y2 = y1;\n this.y1 = y2;\n } else {\n this.y1 = y1;\n this.y2 = y2;\n }\n return this;\n },\n add(x, y) {\n if (x < this.x1) this.x1 = x;\n if (y < this.y1) this.y1 = y;\n if (x > this.x2) this.x2 = x;\n if (y > this.y2) this.y2 = y;\n return this;\n },\n expand(d) {\n this.x1 -= d;\n this.y1 -= d;\n this.x2 += d;\n this.y2 += d;\n return this;\n },\n round() {\n this.x1 = Math.floor(this.x1);\n this.y1 = Math.floor(this.y1);\n this.x2 = Math.ceil(this.x2);\n this.y2 = Math.ceil(this.y2);\n return this;\n },\n scale(s) {\n this.x1 *= s;\n this.y1 *= s;\n this.x2 *= s;\n this.y2 *= s;\n return this;\n },\n translate(dx, dy) {\n this.x1 += dx;\n this.x2 += dx;\n this.y1 += dy;\n this.y2 += dy;\n return this;\n },\n rotate(angle, x, y) {\n const p = this.rotatedPoints(angle, x, y);\n return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);\n },\n rotatedPoints(angle, x, y) {\n var {\n x1,\n y1,\n x2,\n y2\n } = this,\n cos = Math.cos(angle),\n sin = Math.sin(angle),\n cx = x - x * cos + y * sin,\n cy = y - x * sin - y * cos;\n return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy];\n },\n union(b) {\n if (b.x1 < this.x1) this.x1 = b.x1;\n if (b.y1 < this.y1) this.y1 = b.y1;\n if (b.x2 > this.x2) this.x2 = b.x2;\n if (b.y2 > this.y2) this.y2 = b.y2;\n return this;\n },\n intersect(b) {\n if (b.x1 > this.x1) this.x1 = b.x1;\n if (b.y1 > this.y1) this.y1 = b.y1;\n if (b.x2 < this.x2) this.x2 = b.x2;\n if (b.y2 < this.y2) this.y2 = b.y2;\n return this;\n },\n encloses(b) {\n return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;\n },\n alignsWith(b) {\n return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2);\n },\n intersects(b) {\n return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);\n },\n contains(x, y) {\n return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);\n },\n width() {\n return this.x2 - this.x1;\n },\n height() {\n return this.y2 - this.y1;\n }\n};\n\nfunction Item(mark) {\n this.mark = mark;\n this.bounds = this.bounds || new Bounds();\n}\n\nfunction GroupItem(mark) {\n Item.call(this, mark);\n this.items = this.items || [];\n}\ninherits(GroupItem, Item);\n\nfunction ResourceLoader(customLoader) {\n this._pending = 0;\n this._loader = customLoader || loader();\n}\nfunction increment(loader) {\n loader._pending += 1;\n}\nfunction decrement(loader) {\n loader._pending -= 1;\n}\nResourceLoader.prototype = {\n pending() {\n return this._pending;\n },\n sanitizeURL(uri) {\n const loader = this;\n increment(loader);\n return loader._loader.sanitize(uri, {\n context: 'href'\n }).then(opt => {\n decrement(loader);\n return opt;\n }).catch(() => {\n decrement(loader);\n return null;\n });\n },\n loadImage(uri) {\n const loader = this,\n Image = image$1();\n increment(loader);\n return loader._loader.sanitize(uri, {\n context: 'image'\n }).then(opt => {\n const url = opt.href;\n if (!url || !Image) throw {\n url: url\n };\n const img = new Image();\n\n // set crossOrigin only if cors is defined; empty string sets anonymous mode\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin\n const cors = hasOwnProperty(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous';\n if (cors != null) img.crossOrigin = cors;\n\n // attempt to load image resource\n img.onload = () => decrement(loader);\n img.onerror = () => decrement(loader);\n img.src = url;\n return img;\n }).catch(e => {\n decrement(loader);\n return {\n complete: false,\n width: 0,\n height: 0,\n src: e && e.url || ''\n };\n });\n },\n ready() {\n const loader = this;\n return new Promise(accept => {\n function poll(value) {\n if (!loader.pending()) accept(value);else setTimeout(() => {\n poll(true);\n }, 10);\n }\n poll(false);\n });\n }\n};\n\nfunction boundStroke (bounds, item, miter) {\n if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) {\n const sw = item.strokeWidth != null ? +item.strokeWidth : 1;\n bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0));\n }\n return bounds;\n}\nfunction miterAdjustment(item, strokeWidth) {\n // TODO: more sophisticated adjustment? Or miter support in boundContext?\n return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth;\n}\n\nconst circleThreshold = Tau - 1e-8;\nlet bounds, lx, ly, rot, ma, mb, mc, md;\nconst add = (x, y) => bounds.add(x, y);\nconst addL = (x, y) => add(lx = x, ly = y);\nconst addX = x => add(x, bounds.y1);\nconst addY = y => add(bounds.x1, y);\nconst px = (x, y) => ma * x + mc * y;\nconst py = (x, y) => mb * x + md * y;\nconst addp = (x, y) => add(px(x, y), py(x, y));\nconst addpL = (x, y) => addL(px(x, y), py(x, y));\nfunction boundContext (_, deg) {\n bounds = _;\n if (deg) {\n rot = deg * DegToRad;\n ma = md = Math.cos(rot);\n mb = Math.sin(rot);\n mc = -mb;\n } else {\n ma = md = 1;\n rot = mb = mc = 0;\n }\n return context$1;\n}\nconst context$1 = {\n beginPath() {},\n closePath() {},\n moveTo: addpL,\n lineTo: addpL,\n rect(x, y, w, h) {\n if (rot) {\n addp(x + w, y);\n addp(x + w, y + h);\n addp(x, y + h);\n addpL(x, y);\n } else {\n add(x + w, y + h);\n addL(x, y);\n }\n },\n quadraticCurveTo(x1, y1, x2, y2) {\n const px1 = px(x1, y1),\n py1 = py(x1, y1),\n px2 = px(x2, y2),\n py2 = py(x2, y2);\n quadExtrema(lx, px1, px2, addX);\n quadExtrema(ly, py1, py2, addY);\n addL(px2, py2);\n },\n bezierCurveTo(x1, y1, x2, y2, x3, y3) {\n const px1 = px(x1, y1),\n py1 = py(x1, y1),\n px2 = px(x2, y2),\n py2 = py(x2, y2),\n px3 = px(x3, y3),\n py3 = py(x3, y3);\n cubicExtrema(lx, px1, px2, px3, addX);\n cubicExtrema(ly, py1, py2, py3, addY);\n addL(px3, py3);\n },\n arc(cx, cy, r, sa, ea, ccw) {\n sa += rot;\n ea += rot;\n\n // store last point on path\n lx = r * Math.cos(ea) + cx;\n ly = r * Math.sin(ea) + cy;\n if (Math.abs(ea - sa) > circleThreshold) {\n // treat as full circle\n add(cx - r, cy - r);\n add(cx + r, cy + r);\n } else {\n const update = a => add(r * Math.cos(a) + cx, r * Math.sin(a) + cy);\n let s, i;\n\n // sample end points\n update(sa);\n update(ea);\n\n // sample interior points aligned with 90 degrees\n if (ea !== sa) {\n sa = sa % Tau;\n if (sa < 0) sa += Tau;\n ea = ea % Tau;\n if (ea < 0) ea += Tau;\n if (ea < sa) {\n ccw = !ccw; // flip direction\n s = sa;\n sa = ea;\n ea = s; // swap end-points\n }\n\n if (ccw) {\n ea -= Tau;\n s = sa - sa % HalfPi;\n for (i = 0; i < 4 && s > ea; ++i, s -= HalfPi) update(s);\n } else {\n s = sa - sa % HalfPi + HalfPi;\n for (i = 0; i < 4 && s < ea; ++i, s = s + HalfPi) update(s);\n }\n }\n }\n }\n};\nfunction quadExtrema(x0, x1, x2, cb) {\n const t = (x0 - x1) / (x0 + x2 - 2 * x1);\n if (0 < t && t < 1) cb(x0 + (x1 - x0) * t);\n}\nfunction cubicExtrema(x0, x1, x2, x3, cb) {\n const a = x3 - x0 + 3 * x1 - 3 * x2,\n b = x0 + x2 - 2 * x1,\n c = x0 - x1;\n let t0 = 0,\n t1 = 0,\n r;\n\n // solve for parameter t\n if (Math.abs(a) > Epsilon) {\n // quadratic equation\n r = b * b + c * a;\n if (r >= 0) {\n r = Math.sqrt(r);\n t0 = (-b + r) / a;\n t1 = (-b - r) / a;\n }\n } else {\n // linear equation\n t0 = 0.5 * c / b;\n }\n\n // calculate position\n if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3));\n if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3));\n}\nfunction cubic(t, x0, x1, x2, x3) {\n const s = 1 - t,\n s2 = s * s,\n t2 = t * t;\n return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3;\n}\n\nvar context = (context = canvas(1, 1)) ? context.getContext('2d') : null;\n\nconst b = new Bounds();\nfunction intersectPath(draw) {\n return function (item, brush) {\n // rely on (inaccurate) bounds intersection if no context\n if (!context) return true;\n\n // add path to offscreen graphics context\n draw(context, item);\n\n // get bounds intersection region\n b.clear().union(item.bounds).intersect(brush).round();\n const {\n x1,\n y1,\n x2,\n y2\n } = b;\n\n // iterate over intersection region\n // perform fine grained inclusion test\n for (let y = y1; y <= y2; ++y) {\n for (let x = x1; x <= x2; ++x) {\n if (context.isPointInPath(x, y)) {\n return true;\n }\n }\n }\n\n // false if no hits in intersection region\n return false;\n };\n}\nfunction intersectPoint(item, box) {\n return box.contains(item.x || 0, item.y || 0);\n}\nfunction intersectRect(item, box) {\n const x = item.x || 0,\n y = item.y || 0,\n w = item.width || 0,\n h = item.height || 0;\n return box.intersects(b.set(x, y, x + w, y + h));\n}\nfunction intersectRule(item, box) {\n const x = item.x || 0,\n y = item.y || 0,\n x2 = item.x2 != null ? item.x2 : x,\n y2 = item.y2 != null ? item.y2 : y;\n return intersectBoxLine(box, x, y, x2, y2);\n}\nfunction intersectBoxLine(box, x, y, u, v) {\n const {\n x1,\n y1,\n x2,\n y2\n } = box,\n dx = u - x,\n dy = v - y;\n let t0 = 0,\n t1 = 1,\n p,\n q,\n r,\n e;\n for (e = 0; e < 4; ++e) {\n if (e === 0) {\n p = -dx;\n q = -(x1 - x);\n }\n if (e === 1) {\n p = dx;\n q = x2 - x;\n }\n if (e === 2) {\n p = -dy;\n q = -(y1 - y);\n }\n if (e === 3) {\n p = dy;\n q = y2 - y;\n }\n if (Math.abs(p) < 1e-10 && q < 0) return false;\n r = q / p;\n if (p < 0) {\n if (r > t1) return false;else if (r > t0) t0 = r;\n } else if (p > 0) {\n if (r < t0) return false;else if (r < t1) t1 = r;\n }\n }\n return true;\n}\n\nfunction blend (context, item) {\n context.globalCompositeOperation = item.blend || 'source-over';\n}\n\nfunction value (value, dflt) {\n return value == null ? dflt : value;\n}\n\nfunction addStops(gradient, stops) {\n const n = stops.length;\n for (let i = 0; i < n; ++i) {\n gradient.addColorStop(stops[i].offset, stops[i].color);\n }\n return gradient;\n}\nfunction gradient (context, spec, bounds) {\n const w = bounds.width(),\n h = bounds.height();\n let gradient;\n if (spec.gradient === 'radial') {\n gradient = context.createRadialGradient(bounds.x1 + value(spec.x1, 0.5) * w, bounds.y1 + value(spec.y1, 0.5) * h, Math.max(w, h) * value(spec.r1, 0), bounds.x1 + value(spec.x2, 0.5) * w, bounds.y1 + value(spec.y2, 0.5) * h, Math.max(w, h) * value(spec.r2, 0.5));\n } else {\n // linear gradient\n const x1 = value(spec.x1, 0),\n y1 = value(spec.y1, 0),\n x2 = value(spec.x2, 1),\n y2 = value(spec.y2, 0);\n if (x1 === x2 || y1 === y2 || w === h) {\n // axis aligned: use normal gradient\n gradient = context.createLinearGradient(bounds.x1 + x1 * w, bounds.y1 + y1 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h);\n } else {\n // not axis aligned: render gradient into a pattern (#2365)\n // this allows us to use normalized bounding box coordinates\n const image = canvas(Math.ceil(w), Math.ceil(h)),\n ictx = image.getContext('2d');\n ictx.scale(w, h);\n ictx.fillStyle = addStops(ictx.createLinearGradient(x1, y1, x2, y2), spec.stops);\n ictx.fillRect(0, 0, w, h);\n return context.createPattern(image, 'no-repeat');\n }\n }\n return addStops(gradient, spec.stops);\n}\n\nfunction color (context, item, value) {\n return isGradient(value) ? gradient(context, value, item.bounds) : value;\n}\n\nfunction fill (context, item, opacity) {\n opacity *= item.fillOpacity == null ? 1 : item.fillOpacity;\n if (opacity > 0) {\n context.globalAlpha = opacity;\n context.fillStyle = color(context, item, item.fill);\n return true;\n } else {\n return false;\n }\n}\n\nvar Empty = [];\nfunction stroke (context, item, opacity) {\n var lw = (lw = item.strokeWidth) != null ? lw : 1;\n if (lw <= 0) return false;\n opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity;\n if (opacity > 0) {\n context.globalAlpha = opacity;\n context.strokeStyle = color(context, item, item.stroke);\n context.lineWidth = lw;\n context.lineCap = item.strokeCap || 'butt';\n context.lineJoin = item.strokeJoin || 'miter';\n context.miterLimit = item.strokeMiterLimit || 10;\n if (context.setLineDash) {\n context.setLineDash(item.strokeDash || Empty);\n context.lineDashOffset = item.strokeDashOffset || 0;\n }\n return true;\n } else {\n return false;\n }\n}\n\nfunction compare(a, b) {\n return a.zindex - b.zindex || a.index - b.index;\n}\nfunction zorder(scene) {\n if (!scene.zdirty) return scene.zitems;\n var items = scene.items,\n output = [],\n item,\n i,\n n;\n for (i = 0, n = items.length; i < n; ++i) {\n item = items[i];\n item.index = i;\n if (item.zindex) output.push(item);\n }\n scene.zdirty = false;\n return scene.zitems = output.sort(compare);\n}\nfunction visit(scene, visitor) {\n var items = scene.items,\n i,\n n;\n if (!items || !items.length) return;\n const zitems = zorder(scene);\n if (zitems && zitems.length) {\n for (i = 0, n = items.length; i < n; ++i) {\n if (!items[i].zindex) visitor(items[i]);\n }\n items = zitems;\n }\n for (i = 0, n = items.length; i < n; ++i) {\n visitor(items[i]);\n }\n}\nfunction pickVisit(scene, visitor) {\n var items = scene.items,\n hit,\n i;\n if (!items || !items.length) return null;\n const zitems = zorder(scene);\n if (zitems && zitems.length) items = zitems;\n for (i = items.length; --i >= 0;) {\n if (hit = visitor(items[i])) return hit;\n }\n if (items === zitems) {\n for (items = scene.items, i = items.length; --i >= 0;) {\n if (!items[i].zindex) {\n if (hit = visitor(items[i])) return hit;\n }\n }\n }\n return null;\n}\n\nfunction drawAll(path) {\n return function (context, scene, bounds) {\n visit(scene, item => {\n if (!bounds || bounds.intersects(item.bounds)) {\n drawPath(path, context, item, item);\n }\n });\n };\n}\nfunction drawOne(path) {\n return function (context, scene, bounds) {\n if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) {\n drawPath(path, context, scene.items[0], scene.items);\n }\n };\n}\nfunction drawPath(path, context, item, items) {\n var opacity = item.opacity == null ? 1 : item.opacity;\n if (opacity === 0) return;\n if (path(context, items)) return;\n blend(context, item);\n if (item.fill && fill(context, item, opacity)) {\n context.fill();\n }\n if (item.stroke && stroke(context, item, opacity)) {\n context.stroke();\n }\n}\n\nfunction pick$1(test) {\n test = test || truthy;\n return function (context, scene, x, y, gx, gy) {\n x *= context.pixelRatio;\n y *= context.pixelRatio;\n return pickVisit(scene, item => {\n const b = item.bounds;\n // first hit test against bounding box\n if (b && !b.contains(gx, gy) || !b) return;\n // if in bounding box, perform more careful test\n if (test(context, item, x, y, gx, gy)) return item;\n });\n };\n}\nfunction hitPath(path, filled) {\n return function (context, o, x, y) {\n var item = Array.isArray(o) ? o[0] : o,\n fill = filled == null ? item.fill : filled,\n stroke = item.stroke && context.isPointInStroke,\n lw,\n lc;\n if (stroke) {\n lw = item.strokeWidth;\n lc = item.strokeCap;\n context.lineWidth = lw != null ? lw : 1;\n context.lineCap = lc != null ? lc : 'butt';\n }\n return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y);\n };\n}\nfunction pickPath(path) {\n return pick$1(hitPath(path));\n}\n\nfunction translate(x, y) {\n return 'translate(' + x + ',' + y + ')';\n}\nfunction rotate(a) {\n return 'rotate(' + a + ')';\n}\nfunction scale(scaleX, scaleY) {\n return 'scale(' + scaleX + ',' + scaleY + ')';\n}\nfunction translateItem(item) {\n return translate(item.x || 0, item.y || 0);\n}\nfunction rotateItem(item) {\n return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '');\n}\nfunction transformItem(item) {\n return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale(item.scaleX || 1, item.scaleY || 1) : '');\n}\n\nfunction markItemPath (type, shape, isect) {\n function attr(emit, item) {\n emit('transform', rotateItem(item));\n emit('d', shape(null, item));\n }\n function bound(bounds, item) {\n shape(boundContext(bounds, item.angle), item);\n return boundStroke(bounds, item).translate(item.x || 0, item.y || 0);\n }\n function draw(context, item) {\n var x = item.x || 0,\n y = item.y || 0,\n a = item.angle || 0;\n context.translate(x, y);\n if (a) context.rotate(a *= DegToRad);\n context.beginPath();\n shape(context, item);\n if (a) context.rotate(-a);\n context.translate(-x, -y);\n }\n return {\n type: type,\n tag: 'path',\n nested: false,\n attr: attr,\n bound: bound,\n draw: drawAll(draw),\n pick: pickPath(draw),\n isect: isect || intersectPath(draw)\n };\n}\n\nvar arc = markItemPath('arc', arc$1);\n\nfunction pickArea(a, p) {\n var v = a[0].orient === 'horizontal' ? p[1] : p[0],\n z = a[0].orient === 'horizontal' ? 'y' : 'x',\n i = a.length,\n min = +Infinity,\n hit,\n d;\n while (--i >= 0) {\n if (a[i].defined === false) continue;\n d = Math.abs(a[i][z] - v);\n if (d < min) {\n min = d;\n hit = a[i];\n }\n }\n return hit;\n}\nfunction pickLine(a, p) {\n var t = Math.pow(a[0].strokeWidth || 1, 2),\n i = a.length,\n dx,\n dy,\n dd;\n while (--i >= 0) {\n if (a[i].defined === false) continue;\n dx = a[i].x - p[0];\n dy = a[i].y - p[1];\n dd = dx * dx + dy * dy;\n if (dd < t) return a[i];\n }\n return null;\n}\nfunction pickTrail(a, p) {\n var i = a.length,\n dx,\n dy,\n dd;\n while (--i >= 0) {\n if (a[i].defined === false) continue;\n dx = a[i].x - p[0];\n dy = a[i].y - p[1];\n dd = dx * dx + dy * dy;\n dx = a[i].size || 1;\n if (dd < dx * dx) return a[i];\n }\n return null;\n}\n\nfunction markMultiItemPath (type, shape, tip) {\n function attr(emit, item) {\n var items = item.mark.items;\n if (items.length) emit('d', shape(null, items));\n }\n function bound(bounds, mark) {\n var items = mark.items;\n if (items.length === 0) {\n return bounds;\n } else {\n shape(boundContext(bounds), items);\n return boundStroke(bounds, items[0]);\n }\n }\n function draw(context, items) {\n context.beginPath();\n shape(context, items);\n }\n const hit = hitPath(draw);\n function pick(context, scene, x, y, gx, gy) {\n var items = scene.items,\n b = scene.bounds;\n if (!items || !items.length || b && !b.contains(gx, gy)) {\n return null;\n }\n x *= context.pixelRatio;\n y *= context.pixelRatio;\n return hit(context, items, x, y) ? items[0] : null;\n }\n return {\n type: type,\n tag: 'path',\n nested: true,\n attr: attr,\n bound: bound,\n draw: drawOne(draw),\n pick: pick,\n isect: intersectPoint,\n tip: tip\n };\n}\n\nvar area = markMultiItemPath('area', area$1, pickArea);\n\nfunction clip (context, scene) {\n var clip = scene.clip;\n context.save();\n if (isFunction(clip)) {\n context.beginPath();\n clip(context);\n context.clip();\n } else {\n clipGroup(context, scene.group);\n }\n}\nfunction clipGroup(context, group) {\n context.beginPath();\n hasCornerRadius(group) ? rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0);\n context.clip();\n}\n\nfunction offset$1(item) {\n const sw = value(item.strokeWidth, 1);\n return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0;\n}\nfunction attr$5(emit, item) {\n emit('transform', translateItem(item));\n}\nfunction emitRectangle(emit, item) {\n const off = offset$1(item);\n emit('d', rectangle(null, item, off, off));\n}\nfunction background(emit, item) {\n emit('class', 'background');\n emit('aria-hidden', true);\n emitRectangle(emit, item);\n}\nfunction foreground(emit, item) {\n emit('class', 'foreground');\n emit('aria-hidden', true);\n if (item.strokeForeground) {\n emitRectangle(emit, item);\n } else {\n emit('d', '');\n }\n}\nfunction content(emit, item, renderer) {\n const url = item.clip ? clip$1(renderer, item, item) : null;\n emit('clip-path', url);\n}\nfunction bound$5(bounds, group) {\n if (!group.clip && group.items) {\n const items = group.items,\n m = items.length;\n for (let j = 0; j < m; ++j) {\n bounds.union(items[j].bounds);\n }\n }\n if ((group.clip || group.width || group.height) && !group.noBound) {\n bounds.add(0, 0).add(group.width || 0, group.height || 0);\n }\n boundStroke(bounds, group);\n return bounds.translate(group.x || 0, group.y || 0);\n}\nfunction rectanglePath(context, group, x, y) {\n const off = offset$1(group);\n context.beginPath();\n rectangle(context, group, (x || 0) + off, (y || 0) + off);\n}\nconst hitBackground = hitPath(rectanglePath);\nconst hitForeground = hitPath(rectanglePath, false);\nconst hitCorner = hitPath(rectanglePath, true);\nfunction draw$4(context, scene, bounds, markTypes) {\n visit(scene, group => {\n const gx = group.x || 0,\n gy = group.y || 0,\n fore = group.strokeForeground,\n opacity = group.opacity == null ? 1 : group.opacity;\n\n // draw group background\n if ((group.stroke || group.fill) && opacity) {\n rectanglePath(context, group, gx, gy);\n blend(context, group);\n if (group.fill && fill(context, group, opacity)) {\n context.fill();\n }\n if (group.stroke && !fore && stroke(context, group, opacity)) {\n context.stroke();\n }\n }\n\n // setup graphics context, set clip and bounds\n context.save();\n context.translate(gx, gy);\n if (group.clip) clipGroup(context, group);\n if (bounds) bounds.translate(-gx, -gy);\n\n // draw group contents\n visit(group, item => {\n if (item.marktype === 'group' || markTypes == null || markTypes.includes(item.marktype)) {\n this.draw(context, item, bounds, markTypes);\n }\n });\n\n // restore graphics context\n if (bounds) bounds.translate(gx, gy);\n context.restore();\n\n // draw group foreground\n if (fore && group.stroke && opacity) {\n rectanglePath(context, group, gx, gy);\n blend(context, group);\n if (stroke(context, group, opacity)) {\n context.stroke();\n }\n }\n });\n}\nfunction pick(context, scene, x, y, gx, gy) {\n if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) {\n return null;\n }\n const cx = x * context.pixelRatio,\n cy = y * context.pixelRatio;\n return pickVisit(scene, group => {\n let hit, dx, dy;\n\n // first hit test bounding box\n const b = group.bounds;\n if (b && !b.contains(gx, gy)) return;\n\n // passed bounds check, test rectangular clip\n dx = group.x || 0;\n dy = group.y || 0;\n const dw = dx + (group.width || 0),\n dh = dy + (group.height || 0),\n c = group.clip;\n if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return;\n\n // adjust coordinate system\n context.save();\n context.translate(dx, dy);\n dx = gx - dx;\n dy = gy - dy;\n\n // test background for rounded corner clip\n if (c && hasCornerRadius(group) && !hitCorner(context, group, cx, cy)) {\n context.restore();\n return null;\n }\n const fore = group.strokeForeground,\n ix = scene.interactive !== false;\n\n // hit test against group foreground\n if (ix && fore && group.stroke && hitForeground(context, group, cx, cy)) {\n context.restore();\n return group;\n }\n\n // hit test against contained marks\n hit = pickVisit(group, mark => pickMark(mark, dx, dy) ? this.pick(mark, x, y, dx, dy) : null);\n\n // hit test against group background\n if (!hit && ix && (group.fill || !fore && group.stroke) && hitBackground(context, group, cx, cy)) {\n hit = group;\n }\n\n // restore state and return\n context.restore();\n return hit || null;\n });\n}\nfunction pickMark(mark, x, y) {\n return (mark.interactive !== false || mark.marktype === 'group') && mark.bounds && mark.bounds.contains(x, y);\n}\nvar group = {\n type: 'group',\n tag: 'g',\n nested: false,\n attr: attr$5,\n bound: bound$5,\n draw: draw$4,\n pick: pick,\n isect: intersectRect,\n content: content,\n background: background,\n foreground: foreground\n};\n\nvar metadata = {\n 'xmlns': 'http://www.w3.org/2000/svg',\n 'xmlns:xlink': 'http://www.w3.org/1999/xlink',\n 'version': '1.1'\n};\n\nfunction getImage(item, renderer) {\n var image = item.image;\n if (!image || item.url && item.url !== image.url) {\n image = {\n complete: false,\n width: 0,\n height: 0\n };\n renderer.loadImage(item.url).then(image => {\n item.image = image;\n item.image.url = item.url;\n });\n }\n return image;\n}\nfunction imageWidth(item, image) {\n return item.width != null ? item.width : !image || !image.width ? 0 : item.aspect !== false && item.height ? item.height * image.width / image.height : image.width;\n}\nfunction imageHeight(item, image) {\n return item.height != null ? item.height : !image || !image.height ? 0 : item.aspect !== false && item.width ? item.width * image.height / image.width : image.height;\n}\nfunction imageXOffset(align, w) {\n return align === 'center' ? w / 2 : align === 'right' ? w : 0;\n}\nfunction imageYOffset(baseline, h) {\n return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0;\n}\nfunction attr$4(emit, item, renderer) {\n const img = getImage(item, renderer),\n w = imageWidth(item, img),\n h = imageHeight(item, img),\n x = (item.x || 0) - imageXOffset(item.align, w),\n y = (item.y || 0) - imageYOffset(item.baseline, h),\n i = !img.src && img.toDataURL ? img.toDataURL() : img.src || '';\n emit('href', i, metadata['xmlns:xlink'], 'xlink:href');\n emit('transform', translate(x, y));\n emit('width', w);\n emit('height', h);\n emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid');\n}\nfunction bound$4(bounds, item) {\n const img = item.image,\n w = imageWidth(item, img),\n h = imageHeight(item, img),\n x = (item.x || 0) - imageXOffset(item.align, w),\n y = (item.y || 0) - imageYOffset(item.baseline, h);\n return bounds.set(x, y, x + w, y + h);\n}\nfunction draw$3(context, scene, bounds) {\n visit(scene, item => {\n if (bounds && !bounds.intersects(item.bounds)) return; // bounds check\n\n const img = getImage(item, this);\n let w = imageWidth(item, img);\n let h = imageHeight(item, img);\n if (w === 0 || h === 0) return; // early exit\n\n let x = (item.x || 0) - imageXOffset(item.align, w),\n y = (item.y || 0) - imageYOffset(item.baseline, h),\n opacity,\n ar0,\n ar1,\n t;\n if (item.aspect !== false) {\n ar0 = img.width / img.height;\n ar1 = item.width / item.height;\n if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) {\n if (ar1 < ar0) {\n t = w / ar0;\n y += (h - t) / 2;\n h = t;\n } else {\n t = h * ar0;\n x += (w - t) / 2;\n w = t;\n }\n }\n }\n if (img.complete || img.toDataURL) {\n blend(context, item);\n context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1;\n context.imageSmoothingEnabled = item.smooth !== false;\n context.drawImage(img, x, y, w, h);\n }\n });\n}\nvar image = {\n type: 'image',\n tag: 'image',\n nested: false,\n attr: attr$4,\n bound: bound$4,\n draw: draw$3,\n pick: pick$1(),\n isect: truthy,\n // bounds check is sufficient\n get: getImage,\n xOffset: imageXOffset,\n yOffset: imageYOffset\n};\n\nvar line = markMultiItemPath('line', line$1, pickLine);\n\nfunction attr$3(emit, item) {\n var sx = item.scaleX || 1,\n sy = item.scaleY || 1;\n if (sx !== 1 || sy !== 1) {\n emit('vector-effect', 'non-scaling-stroke');\n }\n emit('transform', transformItem(item));\n emit('d', item.path);\n}\nfunction path$1(context, item) {\n var path = item.path;\n if (path == null) return true;\n var x = item.x || 0,\n y = item.y || 0,\n sx = item.scaleX || 1,\n sy = item.scaleY || 1,\n a = (item.angle || 0) * DegToRad,\n cache = item.pathCache;\n if (!cache || cache.path !== path) {\n (item.pathCache = cache = parse(path)).path = path;\n }\n if (a && context.rotate && context.translate) {\n context.translate(x, y);\n context.rotate(a);\n pathRender(context, cache, 0, 0, sx, sy);\n context.rotate(-a);\n context.translate(-x, -y);\n } else {\n pathRender(context, cache, x, y, sx, sy);\n }\n}\nfunction bound$3(bounds, item) {\n return path$1(boundContext(bounds, item.angle), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true);\n}\nvar path$2 = {\n type: 'path',\n tag: 'path',\n nested: false,\n attr: attr$3,\n bound: bound$3,\n draw: drawAll(path$1),\n pick: pickPath(path$1),\n isect: intersectPath(path$1)\n};\n\nfunction attr$2(emit, item) {\n emit('d', rectangle(null, item));\n}\nfunction bound$2(bounds, item) {\n var x, y;\n return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item);\n}\nfunction draw$2(context, item) {\n context.beginPath();\n rectangle(context, item);\n}\nvar rect = {\n type: 'rect',\n tag: 'path',\n nested: false,\n attr: attr$2,\n bound: bound$2,\n draw: drawAll(draw$2),\n pick: pickPath(draw$2),\n isect: intersectRect\n};\n\nfunction attr$1(emit, item) {\n emit('transform', translateItem(item));\n emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0);\n emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0);\n}\nfunction bound$1(bounds, item) {\n var x1, y1;\n return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item);\n}\nfunction path(context, item, opacity) {\n var x1, y1, x2, y2;\n if (item.stroke && stroke(context, item, opacity)) {\n x1 = item.x || 0;\n y1 = item.y || 0;\n x2 = item.x2 != null ? item.x2 : x1;\n y2 = item.y2 != null ? item.y2 : y1;\n context.beginPath();\n context.moveTo(x1, y1);\n context.lineTo(x2, y2);\n return true;\n }\n return false;\n}\nfunction draw$1(context, scene, bounds) {\n visit(scene, item => {\n if (bounds && !bounds.intersects(item.bounds)) return; // bounds check\n var opacity = item.opacity == null ? 1 : item.opacity;\n if (opacity && path(context, item, opacity)) {\n blend(context, item);\n context.stroke();\n }\n });\n}\nfunction hit$1(context, item, x, y) {\n if (!context.isPointInStroke) return false;\n return path(context, item, 1) && context.isPointInStroke(x, y);\n}\nvar rule = {\n type: 'rule',\n tag: 'line',\n nested: false,\n attr: attr$1,\n bound: bound$1,\n draw: draw$1,\n pick: pick$1(hit$1),\n isect: intersectRule\n};\n\nvar shape = markItemPath('shape', shape$1);\n\nvar symbol = markItemPath('symbol', symbol$1, intersectPoint);\n\n// memoize text width measurement\nconst widthCache = lruCache();\nvar textMetrics = {\n height: fontSize,\n measureWidth: measureWidth,\n estimateWidth: estimateWidth,\n width: estimateWidth,\n canvas: useCanvas\n};\nuseCanvas(true);\nfunction useCanvas(use) {\n textMetrics.width = use && context ? measureWidth : estimateWidth;\n}\n\n// make simple estimate if no canvas is available\nfunction estimateWidth(item, text) {\n return _estimateWidth(textValue(item, text), fontSize(item));\n}\nfunction _estimateWidth(text, currentFontHeight) {\n return ~~(0.8 * text.length * currentFontHeight);\n}\n\n// measure text width if canvas is available\nfunction measureWidth(item, text) {\n return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, font(item));\n}\nfunction _measureWidth(text, currentFont) {\n const key = `(${currentFont}) ${text}`;\n let width = widthCache.get(key);\n if (width === undefined) {\n context.font = currentFont;\n width = context.measureText(text).width;\n widthCache.set(key, width);\n }\n return width;\n}\nfunction fontSize(item) {\n return item.fontSize != null ? +item.fontSize || 0 : 11;\n}\nfunction lineHeight(item) {\n return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2;\n}\nfunction lineArray(_) {\n return isArray(_) ? _.length > 1 ? _ : _[0] : _;\n}\nfunction textLines(item) {\n return lineArray(item.lineBreak && item.text && !isArray(item.text) ? item.text.split(item.lineBreak) : item.text);\n}\nfunction multiLineOffset(item) {\n const tl = textLines(item);\n return (isArray(tl) ? tl.length - 1 : 0) * lineHeight(item);\n}\nfunction textValue(item, line) {\n const text = line == null ? '' : (line + '').trim();\n return item.limit > 0 && text.length ? truncate(item, text) : text;\n}\nfunction widthGetter(item) {\n if (textMetrics.width === measureWidth) {\n // we are using canvas\n const currentFont = font(item);\n return text => _measureWidth(text, currentFont);\n } else if (textMetrics.width === estimateWidth) {\n // we are relying on estimates\n const currentFontHeight = fontSize(item);\n return text => _estimateWidth(text, currentFontHeight);\n } else {\n // User defined textMetrics.width function in use (e.g. vl-convert)\n return text => textMetrics.width(item, text);\n }\n}\nfunction truncate(item, text) {\n var limit = +item.limit,\n width = widthGetter(item);\n if (width(text) < limit) return text;\n var ellipsis = item.ellipsis || '\\u2026',\n rtl = item.dir === 'rtl',\n lo = 0,\n hi = text.length,\n mid;\n limit -= width(ellipsis);\n if (rtl) {\n while (lo < hi) {\n mid = lo + hi >>> 1;\n if (width(text.slice(mid)) > limit) lo = mid + 1;else hi = mid;\n }\n return ellipsis + text.slice(lo);\n } else {\n while (lo < hi) {\n mid = 1 + (lo + hi >>> 1);\n if (width(text.slice(0, mid)) < limit) lo = mid;else hi = mid - 1;\n }\n return text.slice(0, lo) + ellipsis;\n }\n}\nfunction fontFamily(item, quote) {\n var font = item.font;\n return (quote && font ? String(font).replace(/\"/g, '\\'') : font) || 'sans-serif';\n}\nfunction font(item, quote) {\n return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote);\n}\nfunction offset(item) {\n // perform our own font baseline calculation\n // why? not all browsers support SVG 1.1 'alignment-baseline' :(\n // this also ensures consistent layout across renderers\n var baseline = item.baseline,\n h = fontSize(item);\n return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0);\n}\n\nconst textAlign = {\n 'left': 'start',\n 'center': 'middle',\n 'right': 'end'\n};\nconst tempBounds = new Bounds();\nfunction anchorPoint(item) {\n var x = item.x || 0,\n y = item.y || 0,\n r = item.radius || 0,\n t;\n if (r) {\n t = (item.theta || 0) - HalfPi;\n x += r * Math.cos(t);\n y += r * Math.sin(t);\n }\n tempBounds.x1 = x;\n tempBounds.y1 = y;\n return tempBounds;\n}\nfunction attr(emit, item) {\n var dx = item.dx || 0,\n dy = (item.dy || 0) + offset(item),\n p = anchorPoint(item),\n x = p.x1,\n y = p.y1,\n a = item.angle || 0,\n t;\n emit('text-anchor', textAlign[item.align] || 'start');\n if (a) {\n t = translate(x, y) + ' ' + rotate(a);\n if (dx || dy) t += ' ' + translate(dx, dy);\n } else {\n t = translate(x + dx, y + dy);\n }\n emit('transform', t);\n}\nfunction bound(bounds, item, mode) {\n var h = textMetrics.height(item),\n a = item.align,\n p = anchorPoint(item),\n x = p.x1,\n y = p.y1,\n dx = item.dx || 0,\n dy = (item.dy || 0) + offset(item) - Math.round(0.8 * h),\n // use 4/5 offset\n tl = textLines(item),\n w;\n\n // get dimensions\n if (isArray(tl)) {\n // multi-line text\n h += lineHeight(item) * (tl.length - 1);\n w = tl.reduce((w, t) => Math.max(w, textMetrics.width(item, t)), 0);\n } else {\n // single-line text\n w = textMetrics.width(item, tl);\n }\n\n // horizontal alignment\n if (a === 'center') {\n dx -= w / 2;\n } else if (a === 'right') {\n dx -= w;\n } else ;\n bounds.set(dx += x, dy += y, dx + w, dy + h);\n if (item.angle && !mode) {\n bounds.rotate(item.angle * DegToRad, x, y);\n } else if (mode === 2) {\n return bounds.rotatedPoints(item.angle * DegToRad, x, y);\n }\n return bounds;\n}\nfunction draw(context, scene, bounds) {\n visit(scene, item => {\n var opacity = item.opacity == null ? 1 : item.opacity,\n p,\n x,\n y,\n i,\n lh,\n tl,\n str;\n if (bounds && !bounds.intersects(item.bounds) ||\n // bounds check\n opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return;\n context.font = font(item);\n context.textAlign = item.align || 'left';\n p = anchorPoint(item);\n x = p.x1, y = p.y1;\n if (item.angle) {\n context.save();\n context.translate(x, y);\n context.rotate(item.angle * DegToRad);\n x = y = 0; // reset x, y\n }\n\n x += item.dx || 0;\n y += (item.dy || 0) + offset(item);\n tl = textLines(item);\n blend(context, item);\n if (isArray(tl)) {\n lh = lineHeight(item);\n for (i = 0; i < tl.length; ++i) {\n str = textValue(item, tl[i]);\n if (item.fill && fill(context, item, opacity)) {\n context.fillText(str, x, y);\n }\n if (item.stroke && stroke(context, item, opacity)) {\n context.strokeText(str, x, y);\n }\n y += lh;\n }\n } else {\n str = textValue(item, tl);\n if (item.fill && fill(context, item, opacity)) {\n context.fillText(str, x, y);\n }\n if (item.stroke && stroke(context, item, opacity)) {\n context.strokeText(str, x, y);\n }\n }\n if (item.angle) context.restore();\n });\n}\nfunction hit(context, item, x, y, gx, gy) {\n if (item.fontSize <= 0) return false;\n if (!item.angle) return true; // bounds sufficient if no rotation\n\n // project point into space of unrotated bounds\n var p = anchorPoint(item),\n ax = p.x1,\n ay = p.y1,\n b = bound(tempBounds, item, 1),\n a = -item.angle * DegToRad,\n cos = Math.cos(a),\n sin = Math.sin(a),\n px = cos * gx - sin * gy + (ax - cos * ax + sin * ay),\n py = sin * gx + cos * gy + (ay - sin * ax - cos * ay);\n return b.contains(px, py);\n}\nfunction intersectText(item, box) {\n const p = bound(tempBounds, item, 2);\n return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]);\n}\nvar text = {\n type: 'text',\n tag: 'text',\n nested: false,\n attr: attr,\n bound: bound,\n draw: draw,\n pick: pick$1(hit),\n isect: intersectText\n};\n\nvar trail = markMultiItemPath('trail', trail$1, pickTrail);\n\nvar Marks = {\n arc: arc,\n area: area,\n group: group,\n image: image,\n line: line,\n path: path$2,\n rect: rect,\n rule: rule,\n shape: shape,\n symbol: symbol,\n text: text,\n trail: trail\n};\n\nfunction boundItem (item, func, opt) {\n var type = Marks[item.mark.marktype],\n bound = func || type.bound;\n if (type.nested) item = item.mark;\n return bound(item.bounds || (item.bounds = new Bounds()), item, opt);\n}\n\nvar DUMMY = {\n mark: null\n};\nfunction boundMark (mark, bounds, opt) {\n var type = Marks[mark.marktype],\n bound = type.bound,\n items = mark.items,\n hasItems = items && items.length,\n i,\n n,\n item,\n b;\n if (type.nested) {\n if (hasItems) {\n item = items[0];\n } else {\n // no items, fake it\n DUMMY.mark = mark;\n item = DUMMY;\n }\n b = boundItem(item, bound, opt);\n bounds = bounds && bounds.union(b) || b;\n return bounds;\n }\n bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds();\n if (hasItems) {\n for (i = 0, n = items.length; i < n; ++i) {\n bounds.union(boundItem(items[i], bound, opt));\n }\n }\n return mark.bounds = bounds;\n}\n\nconst keys = ['marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex', 'x', 'y', 'width', 'height', 'align', 'baseline',\n// layout\n'fill', 'fillOpacity', 'opacity', 'blend',\n// fill\n'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap',\n// stroke\n'strokeDash', 'strokeDashOffset',\n// stroke dash\n'strokeForeground', 'strokeOffset',\n// group\n'startAngle', 'endAngle', 'innerRadius', 'outerRadius',\n// arc\n'cornerRadius', 'padAngle',\n// arc, rect\n'cornerRadiusTopLeft', 'cornerRadiusTopRight',\n// rect, group\n'cornerRadiusBottomLeft', 'cornerRadiusBottomRight', 'interpolate', 'tension', 'orient', 'defined',\n// area, line\n'url', 'aspect', 'smooth',\n// image\n'path', 'scaleX', 'scaleY',\n// path\n'x2', 'y2',\n// rule\n'size', 'shape',\n// symbol\n'text', 'angle', 'theta', 'radius', 'dir', 'dx', 'dy',\n// text\n'ellipsis', 'limit', 'lineBreak', 'lineHeight', 'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant',\n// font\n'description', 'aria', 'ariaRole', 'ariaRoleDescription' // aria\n];\n\nfunction sceneToJSON(scene, indent) {\n return JSON.stringify(scene, keys, indent);\n}\nfunction sceneFromJSON(json) {\n const scene = typeof json === 'string' ? JSON.parse(json) : json;\n return initialize(scene);\n}\nfunction initialize(scene) {\n var type = scene.marktype,\n items = scene.items,\n parent,\n i,\n n;\n if (items) {\n for (i = 0, n = items.length; i < n; ++i) {\n parent = type ? 'mark' : 'group';\n items[i][parent] = scene;\n if (items[i].zindex) items[i][parent].zdirty = true;\n if ('group' === (type || parent)) initialize(items[i]);\n }\n }\n if (type) boundMark(scene);\n return scene;\n}\n\nfunction Scenegraph(scene) {\n if (arguments.length) {\n this.root = sceneFromJSON(scene);\n } else {\n this.root = createMark({\n marktype: 'group',\n name: 'root',\n role: 'frame'\n });\n this.root.items = [new GroupItem(this.root)];\n }\n}\nScenegraph.prototype = {\n toJSON(indent) {\n return sceneToJSON(this.root, indent || 0);\n },\n mark(markdef, group, index) {\n group = group || this.root.items[0];\n const mark = createMark(markdef, group);\n group.items[index] = mark;\n if (mark.zindex) mark.group.zdirty = true;\n return mark;\n }\n};\nfunction createMark(def, group) {\n const mark = {\n bounds: new Bounds(),\n clip: !!def.clip,\n group: group,\n interactive: def.interactive === false ? false : true,\n items: [],\n marktype: def.marktype,\n name: def.name || undefined,\n role: def.role || undefined,\n zindex: def.zindex || 0\n };\n\n // add accessibility properties if defined\n if (def.aria != null) {\n mark.aria = def.aria;\n }\n if (def.description) {\n mark.description = def.description;\n }\n return mark;\n}\n\n// create a new DOM element\nfunction domCreate(doc, tag, ns) {\n if (!doc && typeof document !== 'undefined' && document.createElement) {\n doc = document;\n }\n return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null;\n}\n\n// find first child element with matching tag\nfunction domFind(el, tag) {\n tag = tag.toLowerCase();\n var nodes = el.childNodes,\n i = 0,\n n = nodes.length;\n for (; i < n; ++i) if (nodes[i].tagName.toLowerCase() === tag) {\n return nodes[i];\n }\n}\n\n// retrieve child element at given index\n// create & insert if doesn't exist or if tags do not match\nfunction domChild(el, index, tag, ns) {\n var a = el.childNodes[index],\n b;\n if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) {\n b = a || null;\n a = domCreate(el.ownerDocument, tag, ns);\n el.insertBefore(a, b);\n }\n return a;\n}\n\n// remove all child elements at or above the given index\nfunction domClear(el, index) {\n var nodes = el.childNodes,\n curr = nodes.length;\n while (curr > index) el.removeChild(nodes[--curr]);\n return el;\n}\n\n// generate css class name for mark\nfunction cssClass(mark) {\n return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : '');\n}\n\nfunction point (event, el) {\n const rect = el.getBoundingClientRect();\n return [event.clientX - rect.left - (el.clientLeft || 0), event.clientY - rect.top - (el.clientTop || 0)];\n}\n\nfunction resolveItem (item, event, el, origin) {\n var mark = item && item.mark,\n mdef,\n p;\n if (mark && (mdef = Marks[mark.marktype]).tip) {\n p = point(event, el);\n p[0] -= origin[0];\n p[1] -= origin[1];\n while (item = item.mark.group) {\n p[0] -= item.x || 0;\n p[1] -= item.y || 0;\n }\n item = mdef.tip(mark.items, p);\n }\n return item;\n}\n\n/**\n * Create a new Handler instance.\n * @param {object} [customLoader] - Optional loader instance for\n * href URL sanitization. If not specified, a standard loader\n * instance will be generated.\n * @param {function} [customTooltip] - Optional tooltip handler\n * function for custom tooltip display.\n * @constructor\n */\nfunction Handler(customLoader, customTooltip) {\n this._active = null;\n this._handlers = {};\n this._loader = customLoader || loader();\n this._tooltip = customTooltip || defaultTooltip;\n}\n\n// The default tooltip display handler.\n// Sets the HTML title attribute on the visualization container.\nfunction defaultTooltip(handler, event, item, value) {\n handler.element().setAttribute('title', value || '');\n}\nHandler.prototype = {\n /**\n * Initialize a new Handler instance.\n * @param {DOMElement} el - The containing DOM element for the display.\n * @param {Array} origin - The origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {object} [obj] - Optional context object that should serve as\n * the \"this\" context for event callbacks.\n * @return {Handler} - This handler instance.\n */\n initialize(el, origin, obj) {\n this._el = el;\n this._obj = obj || null;\n return this.origin(origin);\n },\n /**\n * Returns the parent container element for a visualization.\n * @return {DOMElement} - The containing DOM element.\n */\n element() {\n return this._el;\n },\n /**\n * Returns the scene element (e.g., canvas or SVG) of the visualization\n * Subclasses must override if the first child is not the scene element.\n * @return {DOMElement} - The scene (e.g., canvas or SVG) element.\n */\n canvas() {\n return this._el && this._el.firstChild;\n },\n /**\n * Get / set the origin coordinates of the visualization.\n */\n origin(origin) {\n if (arguments.length) {\n this._origin = origin || [0, 0];\n return this;\n } else {\n return this._origin.slice();\n }\n },\n /**\n * Get / set the scenegraph root.\n */\n scene(scene) {\n if (!arguments.length) return this._scene;\n this._scene = scene;\n return this;\n },\n /**\n * Add an event handler. Subclasses should override this method.\n */\n on( /*type, handler*/) {},\n /**\n * Remove an event handler. Subclasses should override this method.\n */\n off( /*type, handler*/) {},\n /**\n * Utility method for finding the array index of an event handler.\n * @param {Array} h - An array of registered event handlers.\n * @param {string} type - The event type.\n * @param {function} handler - The event handler instance to find.\n * @return {number} - The handler's array index or -1 if not registered.\n */\n _handlerIndex(h, type, handler) {\n for (let i = h ? h.length : 0; --i >= 0;) {\n if (h[i].type === type && (!handler || h[i].handler === handler)) {\n return i;\n }\n }\n return -1;\n },\n /**\n * Returns an array with registered event handlers.\n * @param {string} [type] - The event type to query. Any annotations\n * are ignored; for example, for the argument \"click.foo\", \".foo\" will\n * be ignored and the method returns all \"click\" handlers. If type is\n * null or unspecified, this method returns handlers for all types.\n * @return {Array} - A new array containing all registered event handlers.\n */\n handlers(type) {\n const h = this._handlers,\n a = [];\n if (type) {\n a.push(...h[this.eventName(type)]);\n } else {\n for (const k in h) {\n a.push(...h[k]);\n }\n }\n return a;\n },\n /**\n * Parses an event name string to return the specific event type.\n * For example, given \"click.foo\" returns \"click\"\n * @param {string} name - The input event type string.\n * @return {string} - A string with the event type only.\n */\n eventName(name) {\n const i = name.indexOf('.');\n return i < 0 ? name : name.slice(0, i);\n },\n /**\n * Handle hyperlink navigation in response to an item.href value.\n * @param {Event} event - The event triggering hyperlink navigation.\n * @param {Item} item - The scenegraph item.\n * @param {string} href - The URL to navigate to.\n */\n handleHref(event, item, href) {\n this._loader.sanitize(href, {\n context: 'href'\n }).then(opt => {\n const e = new MouseEvent(event.type, event),\n a = domCreate(null, 'a');\n for (const name in opt) a.setAttribute(name, opt[name]);\n a.dispatchEvent(e);\n }).catch(() => {/* do nothing */});\n },\n /**\n * Handle tooltip display in response to an item.tooltip value.\n * @param {Event} event - The event triggering tooltip display.\n * @param {Item} item - The scenegraph item.\n * @param {boolean} show - A boolean flag indicating whether\n * to show or hide a tooltip for the given item.\n */\n handleTooltip(event, item, show) {\n if (item && item.tooltip != null) {\n item = resolveItem(item, event, this.canvas(), this._origin);\n const value = show && item && item.tooltip || null;\n this._tooltip.call(this._obj, this, event, item, value);\n }\n },\n /**\n * Returns the size of a scenegraph item and its position relative\n * to the viewport.\n * @param {Item} item - The scenegraph item.\n * @return {object} - A bounding box object (compatible with the\n * DOMRect type) consisting of x, y, width, heigh, top, left,\n * right, and bottom properties.\n */\n getItemBoundingClientRect(item) {\n const el = this.canvas();\n if (!el) return;\n const rect = el.getBoundingClientRect(),\n origin = this._origin,\n bounds = item.bounds,\n width = bounds.width(),\n height = bounds.height();\n let x = bounds.x1 + origin[0] + rect.left,\n y = bounds.y1 + origin[1] + rect.top;\n\n // translate coordinate for each parent group\n while (item.mark && (item = item.mark.group)) {\n x += item.x || 0;\n y += item.y || 0;\n }\n\n // return DOMRect-compatible bounding box\n return {\n x,\n y,\n width,\n height,\n left: x,\n top: y,\n right: x + width,\n bottom: y + height\n };\n }\n};\n\n/**\n * Create a new Renderer instance.\n * @param {object} [loader] - Optional loader instance for\n * image and href URL sanitization. If not specified, a\n * standard loader instance will be generated.\n * @constructor\n */\nfunction Renderer(loader) {\n this._el = null;\n this._bgcolor = null;\n this._loader = new ResourceLoader(loader);\n}\nRenderer.prototype = {\n /**\n * Initialize a new Renderer instance.\n * @param {DOMElement} el - The containing DOM element for the display.\n * @param {number} width - The coordinate width of the display, in pixels.\n * @param {number} height - The coordinate height of the display, in pixels.\n * @param {Array} origin - The origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {Renderer} - This renderer instance.\n */\n initialize(el, width, height, origin, scaleFactor) {\n this._el = el;\n return this.resize(width, height, origin, scaleFactor);\n },\n /**\n * Returns the parent container element for a visualization.\n * @return {DOMElement} - The containing DOM element.\n */\n element() {\n return this._el;\n },\n /**\n * Returns the scene element (e.g., canvas or SVG) of the visualization\n * Subclasses must override if the first child is not the scene element.\n * @return {DOMElement} - The scene (e.g., canvas or SVG) element.\n */\n canvas() {\n return this._el && this._el.firstChild;\n },\n /**\n * Get / set the background color.\n */\n background(bgcolor) {\n if (arguments.length === 0) return this._bgcolor;\n this._bgcolor = bgcolor;\n return this;\n },\n /**\n * Resize the display.\n * @param {number} width - The new coordinate width of the display, in pixels.\n * @param {number} height - The new coordinate height of the display, in pixels.\n * @param {Array} origin - The new origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {Renderer} - This renderer instance;\n */\n resize(width, height, origin, scaleFactor) {\n this._width = width;\n this._height = height;\n this._origin = origin || [0, 0];\n this._scale = scaleFactor || 1;\n return this;\n },\n /**\n * Report a dirty item whose bounds should be redrawn.\n * This base class method does nothing. Subclasses that perform\n * incremental should implement this method.\n * @param {Item} item - The dirty item whose bounds should be redrawn.\n */\n dirty( /*item*/) {},\n /**\n * Render an input scenegraph, potentially with a set of dirty items.\n * This method will perform an immediate rendering with available resources.\n * The renderer may also need to perform image loading to perform a complete\n * render. This process can lead to asynchronous re-rendering of the scene\n * after this method returns. To receive notification when rendering is\n * complete, use the renderAsync method instead.\n * @param {object} scene - The root mark of a scenegraph to render.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n * @return {Renderer} - This renderer instance.\n */\n render(scene, markTypes) {\n const r = this;\n\n // bind arguments into a render call, and cache it\n // this function may be subsequently called for async redraw\n r._call = function () {\n r._render(scene, markTypes);\n };\n\n // invoke the renderer\n r._call();\n\n // clear the cached call for garbage collection\n // async redraws will stash their own copy\n r._call = null;\n return r;\n },\n /**\n * Internal rendering method. Renderer subclasses should override this\n * method to actually perform rendering.\n * @param {object} scene - The root mark of a scenegraph to render.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n */\n _render( /*scene, markTypes*/\n ) {\n // subclasses to override\n },\n /**\n * Asynchronous rendering method. Similar to render, but returns a Promise\n * that resolves when all rendering is completed. Sometimes a renderer must\n * perform image loading to get a complete rendering. The returned\n * Promise will not resolve until this process completes.\n * @param {object} scene - The root mark of a scenegraph to render.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n * @return {Promise} - A Promise that resolves when rendering is complete.\n */\n renderAsync(scene, markTypes) {\n const r = this.render(scene, markTypes);\n return this._ready ? this._ready.then(() => r) : Promise.resolve(r);\n },\n /**\n * Internal method for asynchronous resource loading.\n * Proxies method calls to the ImageLoader, and tracks loading\n * progress to invoke a re-render once complete.\n * @param {string} method - The method name to invoke on the ImageLoader.\n * @param {string} uri - The URI for the requested resource.\n * @return {Promise} - A Promise that resolves to the requested resource.\n */\n _load(method, uri) {\n var r = this,\n p = r._loader[method](uri);\n if (!r._ready) {\n // re-render the scene when loading completes\n const call = r._call;\n r._ready = r._loader.ready().then(redraw => {\n if (redraw) call();\n r._ready = null;\n });\n }\n return p;\n },\n /**\n * Sanitize a URL to include as a hyperlink in the rendered scene.\n * This method proxies a call to ImageLoader.sanitizeURL, but also tracks\n * image loading progress and invokes a re-render once complete.\n * @param {string} uri - The URI string to sanitize.\n * @return {Promise} - A Promise that resolves to the sanitized URL.\n */\n sanitizeURL(uri) {\n return this._load('sanitizeURL', uri);\n },\n /**\n * Requests an image to include in the rendered scene.\n * This method proxies a call to ImageLoader.loadImage, but also tracks\n * image loading progress and invokes a re-render once complete.\n * @param {string} uri - The URI string of the image.\n * @return {Promise} - A Promise that resolves to the loaded Image.\n */\n loadImage(uri) {\n return this._load('loadImage', uri);\n }\n};\n\nconst KeyDownEvent = 'keydown';\nconst KeyPressEvent = 'keypress';\nconst KeyUpEvent = 'keyup';\nconst DragEnterEvent = 'dragenter';\nconst DragLeaveEvent = 'dragleave';\nconst DragOverEvent = 'dragover';\nconst PointerDownEvent = 'pointerdown';\nconst PointerUpEvent = 'pointerup';\nconst PointerMoveEvent = 'pointermove';\nconst PointerOutEvent = 'pointerout';\nconst PointerOverEvent = 'pointerover';\nconst ClickEvent = 'click';\nconst DoubleClickEvent = 'dblclick';\nconst WheelEvent = 'wheel';\nconst MouseWheelEvent = 'mousewheel';\nconst TouchStartEvent = 'touchstart';\nconst TouchMoveEvent = 'touchmove';\nconst TouchEndEvent = 'touchend';\nconst Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, PointerDownEvent, PointerUpEvent, PointerMoveEvent, PointerOutEvent, PointerOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent];\nconst TooltipShowEvent = PointerMoveEvent;\nconst TooltipHideEvent = PointerOutEvent;\nconst HrefEvent = ClickEvent;\n\nfunction CanvasHandler(loader, tooltip) {\n Handler.call(this, loader, tooltip);\n this._down = null;\n this._touch = null;\n this._first = true;\n this._events = {};\n}\nconst eventBundle = type => type === TouchStartEvent || type === TouchMoveEvent || type === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [type];\n\n// lazily add listeners to the canvas as needed\nfunction eventListenerCheck(handler, type) {\n eventBundle(type).forEach(_ => addEventListener(handler, _));\n}\nfunction addEventListener(handler, type) {\n const canvas = handler.canvas();\n if (canvas && !handler._events[type]) {\n handler._events[type] = 1;\n canvas.addEventListener(type, handler[type] ? evt => handler[type](evt) : evt => handler.fire(type, evt));\n }\n}\nfunction move(moveEvent, overEvent, outEvent) {\n return function (evt) {\n const a = this._active,\n p = this.pickEvent(evt);\n if (p === a) {\n // active item and picked item are the same\n this.fire(moveEvent, evt); // fire move\n } else {\n // active item and picked item are different\n if (!a || !a.exit) {\n // fire out for prior active item\n // suppress if active item was removed from scene\n this.fire(outEvent, evt);\n }\n this._active = p; // set new active item\n this.fire(overEvent, evt); // fire over for new active item\n this.fire(moveEvent, evt); // fire move for new active item\n }\n };\n}\n\nfunction inactive(type) {\n return function (evt) {\n this.fire(type, evt);\n this._active = null;\n };\n}\ninherits(CanvasHandler, Handler, {\n initialize(el, origin, obj) {\n this._canvas = el && domFind(el, 'canvas');\n\n // add minimal events required for proper state management\n [ClickEvent, PointerDownEvent, PointerMoveEvent, PointerOutEvent, DragLeaveEvent].forEach(type => eventListenerCheck(this, type));\n return Handler.prototype.initialize.call(this, el, origin, obj);\n },\n // return the backing canvas instance\n canvas() {\n return this._canvas;\n },\n // retrieve the current canvas context\n context() {\n return this._canvas.getContext('2d');\n },\n // supported events\n events: Events,\n // to keep old versions of firefox happy\n DOMMouseScroll(evt) {\n this.fire(MouseWheelEvent, evt);\n },\n pointermove: move(PointerMoveEvent, PointerOverEvent, PointerOutEvent),\n dragover: move(DragOverEvent, DragEnterEvent, DragLeaveEvent),\n pointerout: inactive(PointerOutEvent),\n dragleave: inactive(DragLeaveEvent),\n pointerdown(evt) {\n this._down = this._active;\n this.fire(PointerDownEvent, evt);\n },\n click(evt) {\n if (this._down === this._active) {\n this.fire(ClickEvent, evt);\n this._down = null;\n }\n },\n touchstart(evt) {\n this._touch = this.pickEvent(evt.changedTouches[0]);\n if (this._first) {\n this._active = this._touch;\n this._first = false;\n }\n this.fire(TouchStartEvent, evt, true);\n },\n touchmove(evt) {\n this.fire(TouchMoveEvent, evt, true);\n },\n touchend(evt) {\n this.fire(TouchEndEvent, evt, true);\n this._touch = null;\n },\n // fire an event\n fire(type, evt, touch) {\n const a = touch ? this._touch : this._active,\n h = this._handlers[type];\n\n // set event type relative to scenegraph items\n evt.vegaType = type;\n\n // handle hyperlinks and tooltips first\n if (type === HrefEvent && a && a.href) {\n this.handleHref(evt, a, a.href);\n } else if (type === TooltipShowEvent || type === TooltipHideEvent) {\n this.handleTooltip(evt, a, type !== TooltipHideEvent);\n }\n\n // invoke all registered handlers\n if (h) {\n for (let i = 0, len = h.length; i < len; ++i) {\n h[i].handler.call(this._obj, evt, a);\n }\n }\n },\n // add an event handler\n on(type, handler) {\n const name = this.eventName(type),\n h = this._handlers,\n i = this._handlerIndex(h[name], type, handler);\n if (i < 0) {\n eventListenerCheck(this, type);\n (h[name] || (h[name] = [])).push({\n type: type,\n handler: handler\n });\n }\n return this;\n },\n // remove an event handler\n off(type, handler) {\n const name = this.eventName(type),\n h = this._handlers[name],\n i = this._handlerIndex(h, type, handler);\n if (i >= 0) {\n h.splice(i, 1);\n }\n return this;\n },\n pickEvent(evt) {\n const p = point(evt, this._canvas),\n o = this._origin;\n return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]);\n },\n // find the scenegraph item at the current pointer position\n // x, y -- the absolute x, y pointer coordinates on the canvas element\n // gx, gy -- the relative coordinates within the current group\n pick(scene, x, y, gx, gy) {\n const g = this.context(),\n mark = Marks[scene.marktype];\n return mark.pick.call(this, g, scene, x, y, gx, gy);\n }\n});\n\nfunction devicePixelRatio() {\n return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;\n}\nvar pixelRatio = devicePixelRatio();\nfunction resize (canvas, width, height, origin, scaleFactor, opt) {\n const inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null,\n context = canvas.getContext('2d'),\n ratio = inDOM ? pixelRatio : scaleFactor;\n canvas.width = width * ratio;\n canvas.height = height * ratio;\n for (const key in opt) {\n context[key] = opt[key];\n }\n if (inDOM && ratio !== 1) {\n canvas.style.width = width + 'px';\n canvas.style.height = height + 'px';\n }\n context.pixelRatio = ratio;\n context.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]);\n return canvas;\n}\n\nfunction CanvasRenderer(loader) {\n Renderer.call(this, loader);\n this._options = {};\n this._redraw = false;\n this._dirty = new Bounds();\n this._tempb = new Bounds();\n}\nconst base$2 = Renderer.prototype;\nconst viewBounds = (origin, width, height) => new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]);\nfunction clipToBounds(g, b, origin) {\n // expand bounds by 1 pixel, then round to pixel boundaries\n b.expand(1).round();\n\n // align to base pixel grid in case of non-integer scaling (#2425)\n if (g.pixelRatio % 1) {\n b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio);\n }\n\n // to avoid artifacts translate if origin has fractional pixels\n b.translate(-(origin[0] % 1), -(origin[1] % 1));\n\n // set clip path\n g.beginPath();\n g.rect(b.x1, b.y1, b.width(), b.height());\n g.clip();\n return b;\n}\ninherits(CanvasRenderer, Renderer, {\n initialize(el, width, height, origin, scaleFactor, options) {\n this._options = options || {};\n this._canvas = this._options.externalContext ? null : canvas(1, 1, this._options.type); // instantiate a small canvas\n\n if (el && this._canvas) {\n domClear(el, 0).appendChild(this._canvas);\n this._canvas.setAttribute('class', 'marks');\n }\n\n // this method will invoke resize to size the canvas appropriately\n return base$2.initialize.call(this, el, width, height, origin, scaleFactor);\n },\n resize(width, height, origin, scaleFactor) {\n base$2.resize.call(this, width, height, origin, scaleFactor);\n if (this._canvas) {\n // configure canvas size and transform\n resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context);\n } else {\n // external context needs to be scaled and positioned to origin\n const ctx = this._options.externalContext;\n if (!ctx) error('CanvasRenderer is missing a valid canvas or context');\n ctx.scale(this._scale, this._scale);\n ctx.translate(this._origin[0], this._origin[1]);\n }\n this._redraw = true;\n return this;\n },\n canvas() {\n return this._canvas;\n },\n context() {\n return this._options.externalContext || (this._canvas ? this._canvas.getContext('2d') : null);\n },\n dirty(item) {\n const b = this._tempb.clear().union(item.bounds);\n let g = item.mark.group;\n while (g) {\n b.translate(g.x || 0, g.y || 0);\n g = g.mark.group;\n }\n this._dirty.union(b);\n },\n _render(scene, markTypes) {\n const g = this.context(),\n o = this._origin,\n w = this._width,\n h = this._height,\n db = this._dirty,\n vb = viewBounds(o, w, h);\n\n // setup\n g.save();\n const b = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o);\n this.clear(-o[0], -o[1], w, h);\n\n // render\n this.draw(g, scene, b, markTypes);\n\n // takedown\n g.restore();\n db.clear();\n return this;\n },\n draw(ctx, scene, bounds, markTypes) {\n if (scene.marktype !== 'group' && markTypes != null && !markTypes.includes(scene.marktype)) {\n return;\n }\n const mark = Marks[scene.marktype];\n if (scene.clip) clip(ctx, scene);\n mark.draw.call(this, ctx, scene, bounds, markTypes);\n if (scene.clip) ctx.restore();\n },\n clear(x, y, w, h) {\n const opt = this._options,\n g = this.context();\n if (opt.type !== 'pdf' && !opt.externalContext) {\n // calling clear rect voids vector output in pdf mode\n // and could remove external context content (#2615)\n g.clearRect(x, y, w, h);\n }\n if (this._bgcolor != null) {\n g.fillStyle = this._bgcolor;\n g.fillRect(x, y, w, h);\n }\n }\n});\n\nfunction SVGHandler(loader, tooltip) {\n Handler.call(this, loader, tooltip);\n const h = this;\n h._hrefHandler = listener(h, (evt, item) => {\n if (item && item.href) h.handleHref(evt, item, item.href);\n });\n h._tooltipHandler = listener(h, (evt, item) => {\n h.handleTooltip(evt, item, evt.type !== TooltipHideEvent);\n });\n}\n\n// wrap an event listener for the SVG DOM\nconst listener = (context, handler) => evt => {\n let item = evt.target.__data__;\n item = Array.isArray(item) ? item[0] : item;\n evt.vegaType = evt.type;\n handler.call(context._obj, evt, item);\n};\ninherits(SVGHandler, Handler, {\n initialize(el, origin, obj) {\n let svg = this._svg;\n if (svg) {\n svg.removeEventListener(HrefEvent, this._hrefHandler);\n svg.removeEventListener(TooltipShowEvent, this._tooltipHandler);\n svg.removeEventListener(TooltipHideEvent, this._tooltipHandler);\n }\n this._svg = svg = el && domFind(el, 'svg');\n if (svg) {\n svg.addEventListener(HrefEvent, this._hrefHandler);\n svg.addEventListener(TooltipShowEvent, this._tooltipHandler);\n svg.addEventListener(TooltipHideEvent, this._tooltipHandler);\n }\n return Handler.prototype.initialize.call(this, el, origin, obj);\n },\n canvas() {\n return this._svg;\n },\n // add an event handler\n on(type, handler) {\n const name = this.eventName(type),\n h = this._handlers,\n i = this._handlerIndex(h[name], type, handler);\n if (i < 0) {\n const x = {\n type,\n handler,\n listener: listener(this, handler)\n };\n (h[name] || (h[name] = [])).push(x);\n if (this._svg) {\n this._svg.addEventListener(name, x.listener);\n }\n }\n return this;\n },\n // remove an event handler\n off(type, handler) {\n const name = this.eventName(type),\n h = this._handlers[name],\n i = this._handlerIndex(h, type, handler);\n if (i >= 0) {\n if (this._svg) {\n this._svg.removeEventListener(name, h[i].listener);\n }\n h.splice(i, 1);\n }\n return this;\n }\n});\n\nconst ARIA_HIDDEN = 'aria-hidden';\nconst ARIA_LABEL = 'aria-label';\nconst ARIA_ROLE = 'role';\nconst ARIA_ROLEDESCRIPTION = 'aria-roledescription';\nconst GRAPHICS_OBJECT = 'graphics-object';\nconst GRAPHICS_SYMBOL = 'graphics-symbol';\nconst bundle = (role, roledesc, label) => ({\n [ARIA_ROLE]: role,\n [ARIA_ROLEDESCRIPTION]: roledesc,\n [ARIA_LABEL]: label || undefined\n});\n\n// these roles are covered by related roles\n// we can ignore them, no need to generate attributes\nconst AriaIgnore = toSet(['axis-domain', 'axis-grid', 'axis-label', 'axis-tick', 'axis-title', 'legend-band', 'legend-entry', 'legend-gradient', 'legend-label', 'legend-title', 'legend-symbol', 'title']);\n\n// aria attribute generators for guide roles\nconst AriaGuides = {\n 'axis': {\n desc: 'axis',\n caption: axisCaption\n },\n 'legend': {\n desc: 'legend',\n caption: legendCaption\n },\n 'title-text': {\n desc: 'title',\n caption: item => `Title text '${titleCaption(item)}'`\n },\n 'title-subtitle': {\n desc: 'subtitle',\n caption: item => `Subtitle text '${titleCaption(item)}'`\n }\n};\n\n// aria properties generated for mark item encoding channels\nconst AriaEncode = {\n ariaRole: ARIA_ROLE,\n ariaRoleDescription: ARIA_ROLEDESCRIPTION,\n description: ARIA_LABEL\n};\nfunction ariaItemAttributes(emit, item) {\n const hide = item.aria === false;\n emit(ARIA_HIDDEN, hide || undefined);\n if (hide || item.description == null) {\n for (const prop in AriaEncode) {\n emit(AriaEncode[prop], undefined);\n }\n } else {\n const type = item.mark.marktype;\n emit(ARIA_LABEL, item.description);\n emit(ARIA_ROLE, item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL));\n emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type} mark`);\n }\n}\nfunction ariaMarkAttributes(mark) {\n return mark.aria === false ? {\n [ARIA_HIDDEN]: true\n } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark);\n}\nfunction ariaMark(mark) {\n const type = mark.marktype;\n const recurse = type === 'group' || type === 'text' || mark.items.some(_ => _.description != null && _.aria !== false);\n return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type} mark container`, mark.description);\n}\nfunction ariaGuide(mark, opt) {\n try {\n const item = mark.items[0],\n caption = opt.caption || (() => '');\n return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item));\n } catch (err) {\n return null;\n }\n}\nfunction titleCaption(item) {\n return array(item.text).join(' ');\n}\nfunction axisCaption(item) {\n const datum = item.datum,\n orient = item.orient,\n title = datum.title ? extractTitle(item) : null,\n ctx = item.context,\n scale = ctx.scales[datum.scale].value,\n locale = ctx.dataflow.locale(),\n type = scale.type,\n xy = orient === 'left' || orient === 'right' ? 'Y' : 'X';\n return `${xy}-axis` + (title ? ` titled '${title}'` : '') + ` for a ${isDiscrete(type) ? 'discrete' : type} scale` + ` with ${domainCaption(locale, scale, item)}`;\n}\nfunction legendCaption(item) {\n const datum = item.datum,\n title = datum.title ? extractTitle(item) : null,\n type = `${datum.type || ''} legend`.trim(),\n scales = datum.scales,\n props = Object.keys(scales),\n ctx = item.context,\n scale = ctx.scales[scales[props[0]]].value,\n locale = ctx.dataflow.locale();\n return capitalize(type) + (title ? ` titled '${title}'` : '') + ` for ${channelCaption(props)}` + ` with ${domainCaption(locale, scale, item)}`;\n}\nfunction extractTitle(item) {\n try {\n return array(peek(item.items).items[0].text).join(' ');\n } catch (err) {\n return null;\n }\n}\nfunction channelCaption(props) {\n props = props.map(p => p + (p === 'fill' || p === 'stroke' ? ' color' : ''));\n return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + peek(props);\n}\nfunction capitalize(s) {\n return s.length ? s[0].toUpperCase() + s.slice(1) : s;\n}\n\nconst innerText = val => (val + '').replace(/&/g, '&').replace(//g, '>');\nconst attrText = val => innerText(val).replace(/\"/g, '"').replace(/\\t/g, ' ').replace(/\\n/g, ' ').replace(/\\r/g, ' ');\nfunction markup() {\n let buf = '',\n outer = '',\n inner = '';\n const stack = [],\n clear = () => outer = inner = '',\n push = tag => {\n if (outer) {\n buf += `${outer}>${inner}`;\n clear();\n }\n stack.push(tag);\n },\n attr = (name, value) => {\n if (value != null) outer += ` ${name}=\"${attrText(value)}\"`;\n return m;\n },\n m = {\n open(tag) {\n push(tag);\n outer = '<' + tag;\n for (var _len = arguments.length, attrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n attrs[_key - 1] = arguments[_key];\n }\n for (const set of attrs) {\n for (const key in set) attr(key, set[key]);\n }\n return m;\n },\n close() {\n const tag = stack.pop();\n if (outer) {\n buf += outer + (inner ? `>${inner}` : '/>');\n } else {\n buf += ``;\n }\n clear();\n return m;\n },\n attr,\n text: t => (inner += innerText(t), m),\n toString: () => buf\n };\n return m;\n}\nconst serializeXML = node => _serialize(markup(), node) + '';\nfunction _serialize(m, node) {\n m.open(node.tagName);\n if (node.hasAttributes()) {\n const attrs = node.attributes,\n n = attrs.length;\n for (let i = 0; i < n; ++i) {\n m.attr(attrs[i].name, attrs[i].value);\n }\n }\n if (node.hasChildNodes()) {\n const children = node.childNodes;\n for (const child of children) {\n child.nodeType === 3 // text node\n ? m.text(child.nodeValue) : _serialize(m, child);\n }\n }\n return m.close();\n}\n\nconst stylesAttr = {\n fill: 'fill',\n fillOpacity: 'fill-opacity',\n stroke: 'stroke',\n strokeOpacity: 'stroke-opacity',\n strokeWidth: 'stroke-width',\n strokeCap: 'stroke-linecap',\n strokeJoin: 'stroke-linejoin',\n strokeDash: 'stroke-dasharray',\n strokeDashOffset: 'stroke-dashoffset',\n strokeMiterLimit: 'stroke-miterlimit',\n opacity: 'opacity'\n};\nconst stylesCss = {\n blend: 'mix-blend-mode'\n};\n\n// ensure miter limit default is consistent with canvas (#2498)\nconst rootAttributes = {\n 'fill': 'none',\n 'stroke-miterlimit': 10\n};\n\nconst RootIndex = 0,\n xmlns = 'http://www.w3.org/2000/xmlns/',\n svgns = metadata.xmlns;\nfunction SVGRenderer(loader) {\n Renderer.call(this, loader);\n this._dirtyID = 0;\n this._dirty = [];\n this._svg = null;\n this._root = null;\n this._defs = null;\n}\nconst base$1 = Renderer.prototype;\ninherits(SVGRenderer, Renderer, {\n /**\n * Initialize a new SVGRenderer instance.\n * @param {DOMElement} el - The containing DOM element for the display.\n * @param {number} width - The coordinate width of the display, in pixels.\n * @param {number} height - The coordinate height of the display, in pixels.\n * @param {Array} origin - The origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {SVGRenderer} - This renderer instance.\n */\n initialize(el, width, height, origin, scaleFactor) {\n // create the svg definitions cache\n this._defs = {};\n this._clearDefs();\n if (el) {\n this._svg = domChild(el, 0, 'svg', svgns);\n this._svg.setAttributeNS(xmlns, 'xmlns', svgns);\n this._svg.setAttributeNS(xmlns, 'xmlns:xlink', metadata['xmlns:xlink']);\n this._svg.setAttribute('version', metadata['version']);\n this._svg.setAttribute('class', 'marks');\n domClear(el, 1);\n\n // set the svg root group\n this._root = domChild(this._svg, RootIndex, 'g', svgns);\n setAttributes(this._root, rootAttributes);\n\n // ensure no additional child elements\n domClear(this._svg, RootIndex + 1);\n }\n\n // set background color if defined\n this.background(this._bgcolor);\n return base$1.initialize.call(this, el, width, height, origin, scaleFactor);\n },\n /**\n * Get / set the background color.\n */\n background(bgcolor) {\n if (arguments.length && this._svg) {\n this._svg.style.setProperty('background-color', bgcolor);\n }\n return base$1.background.apply(this, arguments);\n },\n /**\n * Resize the display.\n * @param {number} width - The new coordinate width of the display, in pixels.\n * @param {number} height - The new coordinate height of the display, in pixels.\n * @param {Array} origin - The new origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {SVGRenderer} - This renderer instance;\n */\n resize(width, height, origin, scaleFactor) {\n base$1.resize.call(this, width, height, origin, scaleFactor);\n if (this._svg) {\n setAttributes(this._svg, {\n width: this._width * this._scale,\n height: this._height * this._scale,\n viewBox: `0 0 ${this._width} ${this._height}`\n });\n this._root.setAttribute('transform', `translate(${this._origin})`);\n }\n this._dirty = [];\n return this;\n },\n /**\n * Returns the SVG element of the visualization.\n * @return {DOMElement} - The SVG element.\n */\n canvas() {\n return this._svg;\n },\n /**\n * Returns an SVG text string for the rendered content,\n * or null if this renderer is currently headless.\n */\n svg() {\n const svg = this._svg,\n bg = this._bgcolor;\n if (!svg) return null;\n let node;\n if (bg) {\n svg.removeAttribute('style');\n node = domChild(svg, RootIndex, 'rect', svgns);\n setAttributes(node, {\n width: this._width,\n height: this._height,\n fill: bg\n });\n }\n const text = serializeXML(svg);\n if (bg) {\n svg.removeChild(node);\n this._svg.style.setProperty('background-color', bg);\n }\n return text;\n },\n /**\n * Internal rendering method.\n * @param {object} scene - The root mark of a scenegraph to render.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n */\n _render(scene, markTypes) {\n // perform spot updates and re-render markup\n if (this._dirtyCheck()) {\n if (this._dirtyAll) this._clearDefs();\n this.mark(this._root, scene, undefined, markTypes);\n domClear(this._root, 1);\n }\n this.defs();\n this._dirty = [];\n ++this._dirtyID;\n return this;\n },\n // -- Manage rendering of items marked as dirty --\n\n /**\n * Flag a mark item as dirty.\n * @param {Item} item - The mark item.\n */\n dirty(item) {\n if (item.dirty !== this._dirtyID) {\n item.dirty = this._dirtyID;\n this._dirty.push(item);\n }\n },\n /**\n * Check if a mark item is considered dirty.\n * @param {Item} item - The mark item.\n */\n isDirty(item) {\n return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID;\n },\n /**\n * Internal method to check dirty status and, if possible,\n * make targetted updates without a full rendering pass.\n */\n _dirtyCheck() {\n this._dirtyAll = true;\n const items = this._dirty;\n if (!items.length || !this._dirtyID) return true;\n const id = ++this._dirtyID;\n let item, mark, type, mdef, i, n, o;\n for (i = 0, n = items.length; i < n; ++i) {\n item = items[i];\n mark = item.mark;\n if (mark.marktype !== type) {\n // memoize mark instance lookup\n type = mark.marktype;\n mdef = Marks[type];\n }\n if (mark.zdirty && mark.dirty !== id) {\n this._dirtyAll = false;\n dirtyParents(item, id);\n mark.items.forEach(i => {\n i.dirty = id;\n });\n }\n if (mark.zdirty) continue; // handle in standard drawing pass\n\n if (item.exit) {\n // EXIT\n if (mdef.nested && mark.items.length) {\n // if nested mark with remaining points, update instead\n o = mark.items[0];\n if (o._svg) this._update(mdef, o._svg, o);\n } else if (item._svg) {\n // otherwise remove from DOM\n o = item._svg.parentNode;\n if (o) o.removeChild(item._svg);\n }\n item._svg = null;\n continue;\n }\n item = mdef.nested ? mark.items[0] : item;\n if (item._update === id) continue; // already visited\n\n if (!item._svg || !item._svg.ownerSVGElement) {\n // ENTER\n this._dirtyAll = false;\n dirtyParents(item, id);\n } else {\n // IN-PLACE UPDATE\n this._update(mdef, item._svg, item);\n }\n item._update = id;\n }\n return !this._dirtyAll;\n },\n // -- Construct & maintain scenegraph to SVG mapping ---\n\n /**\n * Render a set of mark items.\n * @param {SVGElement} el - The parent element in the SVG tree.\n * @param {object} scene - The mark parent to render.\n * @param {SVGElement} prev - The previous sibling in the SVG tree.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n */\n mark(el, scene, prev, markTypes) {\n if (!this.isDirty(scene)) {\n return scene._svg;\n }\n const svg = this._svg,\n markType = scene.marktype,\n mdef = Marks[markType],\n events = scene.interactive === false ? 'none' : null,\n isGroup = mdef.tag === 'g';\n const parent = bind(scene, el, prev, 'g', svg);\n if (markType !== 'group' && markTypes != null && !markTypes.includes(markType)) {\n domClear(parent, 0);\n return scene._svg;\n }\n parent.setAttribute('class', cssClass(scene));\n\n // apply aria attributes to parent container element\n const aria = ariaMarkAttributes(scene);\n for (const key in aria) setAttribute(parent, key, aria[key]);\n if (!isGroup) {\n setAttribute(parent, 'pointer-events', events);\n }\n setAttribute(parent, 'clip-path', scene.clip ? clip$1(this, scene, scene.group) : null);\n let sibling = null,\n i = 0;\n const process = item => {\n const dirty = this.isDirty(item),\n node = bind(item, parent, sibling, mdef.tag, svg);\n if (dirty) {\n this._update(mdef, node, item);\n if (isGroup) recurse(this, node, item, markTypes);\n }\n sibling = node;\n ++i;\n };\n if (mdef.nested) {\n if (scene.items.length) process(scene.items[0]);\n } else {\n visit(scene, process);\n }\n domClear(parent, i);\n return parent;\n },\n /**\n * Update the attributes of an SVG element for a mark item.\n * @param {object} mdef - The mark definition object\n * @param {SVGElement} el - The SVG element.\n * @param {Item} item - The mark item.\n */\n _update(mdef, el, item) {\n // set dom element and values cache\n // provides access to emit method\n element = el;\n values = el.__values__;\n\n // apply aria-specific properties\n ariaItemAttributes(emit, item);\n\n // apply svg attributes\n mdef.attr(emit, item, this);\n\n // some marks need special treatment\n const extra = mark_extras[mdef.type];\n if (extra) extra.call(this, mdef, el, item);\n\n // apply svg style attributes\n // note: element state may have been modified by 'extra' method\n if (element) this.style(element, item);\n },\n /**\n * Update the presentation attributes of an SVG element for a mark item.\n * @param {SVGElement} el - The SVG element.\n * @param {Item} item - The mark item.\n */\n style(el, item) {\n if (item == null) return;\n for (const prop in stylesAttr) {\n let value = prop === 'font' ? fontFamily(item) : item[prop];\n if (value === values[prop]) continue;\n const name = stylesAttr[prop];\n if (value == null) {\n el.removeAttribute(name);\n } else {\n if (isGradient(value)) {\n value = gradientRef(value, this._defs.gradient, href());\n }\n el.setAttribute(name, value + '');\n }\n values[prop] = value;\n }\n for (const prop in stylesCss) {\n setStyle(el, stylesCss[prop], item[prop]);\n }\n },\n /**\n * Render SVG defs, as needed.\n * Must be called *after* marks have been processed to ensure the\n * collected state is current and accurate.\n */\n defs() {\n const svg = this._svg,\n defs = this._defs;\n let el = defs.el,\n index = 0;\n for (const id in defs.gradient) {\n if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns);\n index = updateGradient(el, defs.gradient[id], index);\n }\n for (const id in defs.clipping) {\n if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns);\n index = updateClipping(el, defs.clipping[id], index);\n }\n\n // clean-up\n if (el) {\n index === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index);\n }\n },\n /**\n * Clear defs caches.\n */\n _clearDefs() {\n const def = this._defs;\n def.gradient = {};\n def.clipping = {};\n }\n});\n\n// mark ancestor chain with a dirty id\nfunction dirtyParents(item, id) {\n for (; item && item.dirty !== id; item = item.mark.group) {\n item.dirty = id;\n if (item.mark && item.mark.dirty !== id) {\n item.mark.dirty = id;\n } else return;\n }\n}\n\n// update gradient definitions\nfunction updateGradient(el, grad, index) {\n let i, n, stop;\n if (grad.gradient === 'radial') {\n // SVG radial gradients automatically transform to normalized bbox\n // coordinates, in a way that is cumbersome to replicate in canvas.\n // We wrap the radial gradient in a pattern element, allowing us to\n // maintain a circular gradient that matches what canvas provides.\n let pt = domChild(el, index++, 'pattern', svgns);\n setAttributes(pt, {\n id: patternPrefix + grad.id,\n viewBox: '0,0,1,1',\n width: '100%',\n height: '100%',\n preserveAspectRatio: 'xMidYMid slice'\n });\n pt = domChild(pt, 0, 'rect', svgns);\n setAttributes(pt, {\n width: 1,\n height: 1,\n fill: `url(${href()}#${grad.id})`\n });\n el = domChild(el, index++, 'radialGradient', svgns);\n setAttributes(el, {\n id: grad.id,\n fx: grad.x1,\n fy: grad.y1,\n fr: grad.r1,\n cx: grad.x2,\n cy: grad.y2,\n r: grad.r2\n });\n } else {\n el = domChild(el, index++, 'linearGradient', svgns);\n setAttributes(el, {\n id: grad.id,\n x1: grad.x1,\n x2: grad.x2,\n y1: grad.y1,\n y2: grad.y2\n });\n }\n for (i = 0, n = grad.stops.length; i < n; ++i) {\n stop = domChild(el, i, 'stop', svgns);\n stop.setAttribute('offset', grad.stops[i].offset);\n stop.setAttribute('stop-color', grad.stops[i].color);\n }\n domClear(el, i);\n return index;\n}\n\n// update clipping path definitions\nfunction updateClipping(el, clip, index) {\n let mask;\n el = domChild(el, index, 'clipPath', svgns);\n el.setAttribute('id', clip.id);\n if (clip.path) {\n mask = domChild(el, 0, 'path', svgns);\n mask.setAttribute('d', clip.path);\n } else {\n mask = domChild(el, 0, 'rect', svgns);\n setAttributes(mask, {\n x: 0,\n y: 0,\n width: clip.width,\n height: clip.height\n });\n }\n domClear(el, 1);\n return index + 1;\n}\n\n// Recursively process group contents.\nfunction recurse(renderer, el, group, markTypes) {\n // child 'g' element is second to last among children (path, g, path)\n // other children here are foreground and background path elements\n el = el.lastChild.previousSibling;\n let prev,\n idx = 0;\n visit(group, item => {\n prev = renderer.mark(el, item, prev, markTypes);\n ++idx;\n });\n\n // remove any extraneous DOM elements\n domClear(el, 1 + idx);\n}\n\n// Bind a scenegraph item to an SVG DOM element.\n// Create new SVG elements as needed.\nfunction bind(item, el, sibling, tag, svg) {\n let node = item._svg,\n doc;\n\n // create a new dom node if needed\n if (!node) {\n doc = el.ownerDocument;\n node = domCreate(doc, tag, svgns);\n item._svg = node;\n if (item.mark) {\n node.__data__ = item;\n node.__values__ = {\n fill: 'default'\n };\n\n // if group, create background, content, and foreground elements\n if (tag === 'g') {\n const bg = domCreate(doc, 'path', svgns);\n node.appendChild(bg);\n bg.__data__ = item;\n const cg = domCreate(doc, 'g', svgns);\n node.appendChild(cg);\n cg.__data__ = item;\n const fg = domCreate(doc, 'path', svgns);\n node.appendChild(fg);\n fg.__data__ = item;\n fg.__values__ = {\n fill: 'default'\n };\n }\n }\n }\n\n // (re-)insert if (a) not contained in SVG or (b) sibling order has changed\n if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) {\n el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild);\n }\n return node;\n}\n\n// check if two nodes are ordered siblings\nfunction siblingCheck(node, sibling) {\n return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same\n}\n\n// -- Set attributes & styles on SVG elements ---\n\nlet element = null,\n // temp var for current SVG element\n values = null; // temp var for current values hash\n\n// Extra configuration for certain mark types\nconst mark_extras = {\n group(mdef, el, item) {\n const fg = element = el.childNodes[2];\n values = fg.__values__;\n mdef.foreground(emit, item, this);\n values = el.__values__; // use parent's values hash\n element = el.childNodes[1];\n mdef.content(emit, item, this);\n const bg = element = el.childNodes[0];\n mdef.background(emit, item, this);\n const value = item.mark.interactive === false ? 'none' : null;\n if (value !== values.events) {\n setAttribute(fg, 'pointer-events', value);\n setAttribute(bg, 'pointer-events', value);\n values.events = value;\n }\n if (item.strokeForeground && item.stroke) {\n const fill = item.fill;\n setAttribute(fg, 'display', null);\n\n // set style of background\n this.style(bg, item);\n setAttribute(bg, 'stroke', null);\n\n // set style of foreground\n if (fill) item.fill = null;\n values = fg.__values__;\n this.style(fg, item);\n if (fill) item.fill = fill;\n\n // leave element null to prevent downstream styling\n element = null;\n } else {\n // ensure foreground is ignored\n setAttribute(fg, 'display', 'none');\n }\n },\n image(mdef, el, item) {\n if (item.smooth === false) {\n setStyle(el, 'image-rendering', 'optimizeSpeed');\n setStyle(el, 'image-rendering', 'pixelated');\n } else {\n setStyle(el, 'image-rendering', null);\n }\n },\n text(mdef, el, item) {\n const tl = textLines(item);\n let key, value, doc, lh;\n if (isArray(tl)) {\n // multi-line text\n value = tl.map(_ => textValue(item, _));\n key = value.join('\\n'); // content cache key\n\n if (key !== values.text) {\n domClear(el, 0);\n doc = el.ownerDocument;\n lh = lineHeight(item);\n value.forEach((t, i) => {\n const ts = domCreate(doc, 'tspan', svgns);\n ts.__data__ = item; // data binding\n ts.textContent = t;\n if (i) {\n ts.setAttribute('x', 0);\n ts.setAttribute('dy', lh);\n }\n el.appendChild(ts);\n });\n values.text = key;\n }\n } else {\n // single-line text\n value = textValue(item, tl);\n if (value !== values.text) {\n el.textContent = value;\n values.text = value;\n }\n }\n setAttribute(el, 'font-family', fontFamily(item));\n setAttribute(el, 'font-size', fontSize(item) + 'px');\n setAttribute(el, 'font-style', item.fontStyle);\n setAttribute(el, 'font-variant', item.fontVariant);\n setAttribute(el, 'font-weight', item.fontWeight);\n }\n};\nfunction emit(name, value, ns) {\n // early exit if value is unchanged\n if (value === values[name]) return;\n\n // use appropriate method given namespace (ns)\n if (ns) {\n setAttributeNS(element, name, value, ns);\n } else {\n setAttribute(element, name, value);\n }\n\n // note current value for future comparison\n values[name] = value;\n}\nfunction setStyle(el, name, value) {\n if (value !== values[name]) {\n if (value == null) {\n el.style.removeProperty(name);\n } else {\n el.style.setProperty(name, value + '');\n }\n values[name] = value;\n }\n}\nfunction setAttributes(el, attrs) {\n for (const key in attrs) {\n setAttribute(el, key, attrs[key]);\n }\n}\nfunction setAttribute(el, name, value) {\n if (value != null) {\n // if value is provided, update DOM attribute\n el.setAttribute(name, value);\n } else {\n // else remove DOM attribute\n el.removeAttribute(name);\n }\n}\nfunction setAttributeNS(el, name, value, ns) {\n if (value != null) {\n // if value is provided, update DOM attribute\n el.setAttributeNS(ns, name, value);\n } else {\n // else remove DOM attribute\n el.removeAttributeNS(ns, name);\n }\n}\nfunction href() {\n let loc;\n return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href;\n}\n\nfunction SVGStringRenderer(loader) {\n Renderer.call(this, loader);\n this._text = null;\n this._defs = {\n gradient: {},\n clipping: {}\n };\n}\ninherits(SVGStringRenderer, Renderer, {\n /**\n * Returns the rendered SVG text string,\n * or null if rendering has not yet occurred.\n */\n svg() {\n return this._text;\n },\n /**\n * Internal rendering method.\n * @param {object} scene - The root mark of a scenegraph to render.\n */\n _render(scene) {\n const m = markup();\n\n // svg tag\n m.open('svg', extend({}, metadata, {\n class: 'marks',\n width: this._width * this._scale,\n height: this._height * this._scale,\n viewBox: `0 0 ${this._width} ${this._height}`\n }));\n\n // background, if defined\n const bg = this._bgcolor;\n if (bg && bg !== 'transparent' && bg !== 'none') {\n m.open('rect', {\n width: this._width,\n height: this._height,\n fill: bg\n }).close();\n }\n\n // root content group\n m.open('g', rootAttributes, {\n transform: 'translate(' + this._origin + ')'\n });\n this.mark(m, scene);\n m.close(); // \n\n // defs\n this.defs(m);\n\n // get SVG text string\n this._text = m.close() + '';\n return this;\n },\n /**\n * Render a set of mark items.\n * @param {object} m - The markup context.\n * @param {object} scene - The mark parent to render.\n */\n mark(m, scene) {\n const mdef = Marks[scene.marktype],\n tag = mdef.tag,\n attrList = [ariaItemAttributes, mdef.attr];\n\n // render opening group tag\n m.open('g', {\n 'class': cssClass(scene),\n 'clip-path': scene.clip ? clip$1(this, scene, scene.group) : null\n }, ariaMarkAttributes(scene), {\n 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null\n });\n\n // render contained elements\n const process = item => {\n const href = this.href(item);\n if (href) m.open('a', href);\n m.open(tag, this.attr(scene, item, attrList, tag !== 'g' ? tag : null));\n if (tag === 'text') {\n const tl = textLines(item);\n if (isArray(tl)) {\n // multi-line text\n const attrs = {\n x: 0,\n dy: lineHeight(item)\n };\n for (let i = 0; i < tl.length; ++i) {\n m.open('tspan', i ? attrs : null).text(textValue(item, tl[i])).close();\n }\n } else {\n // single-line text\n m.text(textValue(item, tl));\n }\n } else if (tag === 'g') {\n const fore = item.strokeForeground,\n fill = item.fill,\n stroke = item.stroke;\n if (fore && stroke) {\n item.stroke = null;\n }\n m.open('path', this.attr(scene, item, mdef.background, 'bgrect')).close();\n\n // recurse for group content\n m.open('g', this.attr(scene, item, mdef.content));\n visit(item, scene => this.mark(m, scene));\n m.close();\n if (fore && stroke) {\n if (fill) item.fill = null;\n item.stroke = stroke;\n m.open('path', this.attr(scene, item, mdef.foreground, 'bgrect')).close();\n if (fill) item.fill = fill;\n } else {\n m.open('path', this.attr(scene, item, mdef.foreground, 'bgfore')).close();\n }\n }\n m.close(); // \n if (href) m.close(); // \n };\n\n if (mdef.nested) {\n if (scene.items && scene.items.length) process(scene.items[0]);\n } else {\n visit(scene, process);\n }\n\n // render closing group tag\n return m.close(); // \n },\n\n /**\n * Get href attributes for a hyperlinked mark item.\n * @param {Item} item - The mark item.\n */\n href(item) {\n const href = item.href;\n let attr;\n if (href) {\n if (attr = this._hrefs && this._hrefs[href]) {\n return attr;\n } else {\n this.sanitizeURL(href).then(attr => {\n // rewrite to use xlink namespace\n attr['xlink:href'] = attr.href;\n attr.href = null;\n (this._hrefs || (this._hrefs = {}))[href] = attr;\n });\n }\n }\n return null;\n },\n /**\n * Get an object of SVG attributes for a mark item.\n * @param {object} scene - The mark parent.\n * @param {Item} item - The mark item.\n * @param {array|function} attrs - One or more attribute emitters.\n * @param {string} tag - The tag being rendered.\n */\n attr(scene, item, attrs, tag) {\n const object = {},\n emit = (name, value, ns, prefixed) => {\n object[prefixed || name] = value;\n };\n\n // apply mark specific attributes\n if (Array.isArray(attrs)) {\n attrs.forEach(fn => fn(emit, item, this));\n } else {\n attrs(emit, item, this);\n }\n\n // apply style attributes\n if (tag) {\n style(object, item, scene, tag, this._defs);\n }\n return object;\n },\n /**\n * Render SVG defs, as needed.\n * Must be called *after* marks have been processed to ensure the\n * collected state is current and accurate.\n * @param {object} m - The markup context.\n */\n defs(m) {\n const gradient = this._defs.gradient,\n clipping = this._defs.clipping,\n count = Object.keys(gradient).length + Object.keys(clipping).length;\n if (count === 0) return; // nothing to do\n\n m.open('defs');\n for (const id in gradient) {\n const def = gradient[id],\n stops = def.stops;\n if (def.gradient === 'radial') {\n // SVG radial gradients automatically transform to normalized bbox\n // coordinates, in a way that is cumbersome to replicate in canvas.\n // We wrap the radial gradient in a pattern element, allowing us to\n // maintain a circular gradient that matches what canvas provides.\n\n m.open('pattern', {\n id: patternPrefix + id,\n viewBox: '0,0,1,1',\n width: '100%',\n height: '100%',\n preserveAspectRatio: 'xMidYMid slice'\n });\n m.open('rect', {\n width: '1',\n height: '1',\n fill: 'url(#' + id + ')'\n }).close();\n m.close(); // \n\n m.open('radialGradient', {\n id: id,\n fx: def.x1,\n fy: def.y1,\n fr: def.r1,\n cx: def.x2,\n cy: def.y2,\n r: def.r2\n });\n } else {\n m.open('linearGradient', {\n id: id,\n x1: def.x1,\n x2: def.x2,\n y1: def.y1,\n y2: def.y2\n });\n }\n for (let i = 0; i < stops.length; ++i) {\n m.open('stop', {\n offset: stops[i].offset,\n 'stop-color': stops[i].color\n }).close();\n }\n m.close();\n }\n for (const id in clipping) {\n const def = clipping[id];\n m.open('clipPath', {\n id: id\n });\n if (def.path) {\n m.open('path', {\n d: def.path\n }).close();\n } else {\n m.open('rect', {\n x: 0,\n y: 0,\n width: def.width,\n height: def.height\n }).close();\n }\n m.close();\n }\n m.close();\n }\n});\n\n// Helper function for attr for style presentation attributes\nfunction style(s, item, scene, tag, defs) {\n let styleList;\n if (item == null) return s;\n if (tag === 'bgrect' && scene.interactive === false) {\n s['pointer-events'] = 'none';\n }\n if (tag === 'bgfore') {\n if (scene.interactive === false) {\n s['pointer-events'] = 'none';\n }\n s.display = 'none';\n if (item.fill !== null) return s;\n }\n if (tag === 'image' && item.smooth === false) {\n styleList = ['image-rendering: optimizeSpeed;', 'image-rendering: pixelated;'];\n }\n if (tag === 'text') {\n s['font-family'] = fontFamily(item);\n s['font-size'] = fontSize(item) + 'px';\n s['font-style'] = item.fontStyle;\n s['font-variant'] = item.fontVariant;\n s['font-weight'] = item.fontWeight;\n }\n for (const prop in stylesAttr) {\n let value = item[prop];\n const name = stylesAttr[prop];\n if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; else if (value != null) {\n if (isGradient(value)) {\n value = gradientRef(value, defs.gradient, '');\n }\n s[name] = value;\n }\n }\n for (const prop in stylesCss) {\n const value = item[prop];\n if (value != null) {\n styleList = styleList || [];\n styleList.push(`${stylesCss[prop]}: ${value};`);\n }\n }\n if (styleList) {\n s.style = styleList.join(' ');\n }\n return s;\n}\n\n/**\n * @typedef {Object} HybridRendererOptions\n *\n * @property {string[]} [svgMarkTypes=['text']] - An array of SVG mark types to render\n * in the SVG layer. All other mark types\n * will be rendered in the Canvas layer.\n * @property {boolean} [svgOnTop=true] - Flag to determine if SVG should be rendered on top.\n * @property {boolean} [debug=false] - Flag to enable or disable debugging mode. When true,\n * the top layer will be stacked below the bottom layer\n * rather than overlaid on top.\n */\n\n/** @type {HybridRendererOptions} */\nconst OPTS = {\n svgMarkTypes: ['text'],\n svgOnTop: true,\n debug: false\n};\n\n/**\n * Configure the HybridRenderer\n *\n * @param {HybridRendererOptions} options - HybridRenderer configuration options.\n */\nfunction setHybridRendererOptions(options) {\n OPTS['svgMarkTypes'] = options.svgMarkTypes ?? ['text'];\n OPTS['svgOnTop'] = options.svgOnTop ?? true;\n OPTS['debug'] = options.debug ?? false;\n}\nfunction HybridRenderer(loader) {\n Renderer.call(this, loader);\n this._svgRenderer = new SVGRenderer(loader);\n this._canvasRenderer = new CanvasRenderer(loader);\n}\nconst base = Renderer.prototype;\ninherits(HybridRenderer, Renderer, {\n /**\n * Initialize a new HybridRenderer instance.\n * @param {DOMElement} el - The containing DOM element for the display.\n * @param {number} width - The coordinate width of the display, in pixels.\n * @param {number} height - The coordinate height of the display, in pixels.\n * @param {Array} origin - The origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {HybridRenderer} - This renderer instance.\n */\n initialize(el, width, height, origin, scaleFactor) {\n this._root_el = domChild(el, 0, 'div');\n const bottomEl = domChild(this._root_el, 0, 'div');\n const topEl = domChild(this._root_el, 1, 'div');\n this._root_el.style.position = 'relative';\n\n // Set position absolute to overlay svg on top of canvas\n if (!OPTS.debug) {\n bottomEl.style.height = '100%';\n topEl.style.position = 'absolute';\n topEl.style.top = '0';\n topEl.style.left = '0';\n topEl.style.height = '100%';\n topEl.style.width = '100%';\n }\n this._svgEl = OPTS.svgOnTop ? topEl : bottomEl;\n this._canvasEl = OPTS.svgOnTop ? bottomEl : topEl;\n\n // pointer-events to none on SVG layer so that canvas gets all events\n this._svgEl.style.pointerEvents = 'none';\n this._canvasRenderer.initialize(this._canvasEl, width, height, origin, scaleFactor);\n this._svgRenderer.initialize(this._svgEl, width, height, origin, scaleFactor);\n return base.initialize.call(this, el, width, height, origin, scaleFactor);\n },\n /**\n * Flag a mark item as dirty.\n * @param {Item} item - The mark item.\n */\n dirty(item) {\n if (OPTS.svgMarkTypes.includes(item.mark.marktype)) {\n this._svgRenderer.dirty(item);\n } else {\n this._canvasRenderer.dirty(item);\n }\n return this;\n },\n /**\n * Internal rendering method.\n * @param {object} scene - The root mark of a scenegraph to render.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n */\n _render(scene, markTypes) {\n const allMarkTypes = markTypes ?? ['arc', 'area', 'image', 'line', 'path', 'rect', 'rule', 'shape', 'symbol', 'text', 'trail'];\n const canvasMarkTypes = allMarkTypes.filter(m => !OPTS.svgMarkTypes.includes(m));\n this._svgRenderer.render(scene, OPTS.svgMarkTypes);\n this._canvasRenderer.render(scene, canvasMarkTypes);\n },\n /**\n * Resize the display.\n * @param {number} width - The new coordinate width of the display, in pixels.\n * @param {number} height - The new coordinate height of the display, in pixels.\n * @param {Array} origin - The new origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {SVGRenderer} - This renderer instance;\n */\n resize(width, height, origin, scaleFactor) {\n base.resize.call(this, width, height, origin, scaleFactor);\n this._svgRenderer.resize(width, height, origin, scaleFactor);\n this._canvasRenderer.resize(width, height, origin, scaleFactor);\n return this;\n },\n background(bgcolor) {\n // Propagate background color to lower canvas renderer\n if (OPTS.svgOnTop) {\n this._canvasRenderer.background(bgcolor);\n } else {\n this._svgRenderer.background(bgcolor);\n }\n return this;\n }\n});\n\nfunction HybridHandler(loader, tooltip) {\n CanvasHandler.call(this, loader, tooltip);\n}\ninherits(HybridHandler, CanvasHandler, {\n initialize(el, origin, obj) {\n const canvas = domChild(domChild(el, 0, 'div'), OPTS.svgOnTop ? 0 : 1, 'div');\n return CanvasHandler.prototype.initialize.call(this, canvas, origin, obj);\n }\n});\n\nconst Canvas = 'canvas';\nconst Hybrid = 'hybrid';\nconst PNG = 'png';\nconst SVG = 'svg';\nconst None = 'none';\nconst RenderType = {\n Canvas: Canvas,\n PNG: PNG,\n SVG: SVG,\n Hybrid: Hybrid,\n None: None\n};\nconst modules = {};\nmodules[Canvas] = modules[PNG] = {\n renderer: CanvasRenderer,\n headless: CanvasRenderer,\n handler: CanvasHandler\n};\nmodules[SVG] = {\n renderer: SVGRenderer,\n headless: SVGStringRenderer,\n handler: SVGHandler\n};\nmodules[Hybrid] = {\n renderer: HybridRenderer,\n headless: HybridRenderer,\n handler: HybridHandler\n};\nmodules[None] = {};\nfunction renderModule(name, _) {\n name = String(name || '').toLowerCase();\n if (arguments.length > 1) {\n modules[name] = _;\n return this;\n } else {\n return modules[name];\n }\n}\n\nfunction intersect(scene, bounds, filter) {\n const hits = [],\n // intersection results\n box = new Bounds().union(bounds),\n // defensive copy\n type = scene.marktype;\n return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : error('Intersect scene must be mark node or group item.');\n}\nfunction intersectMark(mark, box, filter, hits) {\n if (visitMark(mark, box, filter)) {\n const items = mark.items,\n type = mark.marktype,\n n = items.length;\n let i = 0;\n if (type === 'group') {\n for (; i < n; ++i) {\n intersectGroup(items[i], box, filter, hits);\n }\n } else {\n for (const test = Marks[type].isect; i < n; ++i) {\n const item = items[i];\n if (intersectItem(item, box, test)) hits.push(item);\n }\n }\n }\n return hits;\n}\nfunction visitMark(mark, box, filter) {\n // process if bounds intersect and if\n // (1) mark is a group mark (so we must recurse), or\n // (2) mark is interactive and passes filter\n return mark.bounds && box.intersects(mark.bounds) && (mark.marktype === 'group' || mark.interactive !== false && (!filter || filter(mark)));\n}\nfunction intersectGroup(group, box, filter, hits) {\n // test intersect against group\n // skip groups by default unless filter says otherwise\n if (filter && filter(group.mark) && intersectItem(group, box, Marks.group.isect)) {\n hits.push(group);\n }\n\n // recursively test children marks\n // translate box to group coordinate space\n const marks = group.items,\n n = marks && marks.length;\n if (n) {\n const x = group.x || 0,\n y = group.y || 0;\n box.translate(-x, -y);\n for (let i = 0; i < n; ++i) {\n intersectMark(marks[i], box, filter, hits);\n }\n box.translate(x, y);\n }\n return hits;\n}\nfunction intersectItem(item, box, test) {\n // test bounds enclosure, bounds intersection, then detailed test\n const bounds = item.bounds;\n return box.encloses(bounds) || box.intersects(bounds) && test(item, box);\n}\n\nconst clipBounds = new Bounds();\nfunction boundClip (mark) {\n const clip = mark.clip;\n if (isFunction(clip)) {\n clip(boundContext(clipBounds.clear()));\n } else if (clip) {\n clipBounds.set(0, 0, mark.group.width, mark.group.height);\n } else return;\n mark.bounds.intersect(clipBounds);\n}\n\nconst TOLERANCE = 1e-9;\nfunction sceneEqual(a, b, key) {\n return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : isNumber(a) && isNumber(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !isObject(a) && !isObject(b) ? a == b : objectEqual(a, b);\n}\nfunction pathEqual(a, b) {\n return sceneEqual(parse(a), parse(b));\n}\nfunction objectEqual(a, b) {\n var ka = Object.keys(a),\n kb = Object.keys(b),\n key,\n i;\n if (ka.length !== kb.length) return false;\n ka.sort();\n kb.sort();\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i]) return false;\n }\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!sceneEqual(a[key], b[key], key)) return false;\n }\n return typeof a === typeof b;\n}\n\nfunction resetSVGDefIds() {\n resetSVGClipId();\n resetSVGGradientId();\n}\n\nexport { Bounds, CanvasHandler, CanvasRenderer, Gradient, GroupItem, Handler, HybridHandler, HybridRenderer, Item, Marks, RenderType, Renderer, ResourceLoader, SVGHandler, SVGRenderer, SVGStringRenderer, Scenegraph, boundClip, boundContext, boundItem, boundMark, boundStroke, domChild, domClear, domCreate, domFind, font, fontFamily, fontSize, intersect, intersectBoxLine, intersectPath, intersectPoint, intersectRule, lineHeight, markup, multiLineOffset, curves as pathCurves, pathEqual, parse as pathParse, vg_rect as pathRectangle, pathRender, symbols as pathSymbols, vg_trail as pathTrail, point, renderModule, resetSVGClipId, resetSVGDefIds, sceneEqual, sceneFromJSON, pickVisit as scenePickVisit, sceneToJSON, visit as sceneVisit, zorder as sceneZOrder, serializeXML, setHybridRendererOptions, textMetrics };\n","import constant from \"./constant.js\";\nimport {withPath} from \"./path.js\";\nimport asterisk from \"./symbol/asterisk.js\";\nimport circle from \"./symbol/circle.js\";\nimport cross from \"./symbol/cross.js\";\nimport diamond from \"./symbol/diamond.js\";\nimport diamond2 from \"./symbol/diamond2.js\";\nimport plus from \"./symbol/plus.js\";\nimport square from \"./symbol/square.js\";\nimport square2 from \"./symbol/square2.js\";\nimport star from \"./symbol/star.js\";\nimport triangle from \"./symbol/triangle.js\";\nimport triangle2 from \"./symbol/triangle2.js\";\nimport wye from \"./symbol/wye.js\";\nimport times from \"./symbol/times.js\";\n\n// These symbols are designed to be filled.\nexport const symbolsFill = [\n circle,\n cross,\n diamond,\n square,\n star,\n triangle,\n wye\n];\n\n// These symbols are designed to be stroked (with a width of 1.5px and round caps).\nexport const symbolsStroke = [\n circle,\n plus,\n times,\n triangle2,\n asterisk,\n square2,\n diamond2\n];\n\nexport default function Symbol(type, size) {\n let context = null,\n path = withPath(symbol);\n\n type = typeof type === \"function\" ? type : constant(type || circle);\n size = typeof size === \"function\" ? size : constant(size === undefined ? 64 : +size);\n\n function symbol() {\n let buffer;\n if (!context) context = buffer = path();\n type.apply(this, arguments).draw(context, +size.apply(this, arguments));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n symbol.type = function(_) {\n return arguments.length ? (type = typeof _ === \"function\" ? _ : constant(_), symbol) : type;\n };\n\n symbol.size = function(_) {\n return arguments.length ? (size = typeof _ === \"function\" ? _ : constant(+_), symbol) : size;\n };\n\n symbol.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, symbol) : context;\n };\n\n return symbol;\n}\n","import { Transform } from 'vega-dataflow';\nimport { Marks, boundClip, GroupItem, Item, Bounds, multiLineOffset, boundStroke } from 'vega-scenegraph';\nimport { inherits, peek, isObject } from 'vega-util';\n\nconst Top = 'top';\nconst Left = 'left';\nconst Right = 'right';\nconst Bottom = 'bottom';\nconst TopLeft = 'top-left';\nconst TopRight = 'top-right';\nconst BottomLeft = 'bottom-left';\nconst BottomRight = 'bottom-right';\nconst Start = 'start';\nconst Middle = 'middle';\nconst End = 'end';\nconst X = 'x';\nconst Y = 'y';\nconst Group = 'group';\nconst AxisRole = 'axis';\nconst TitleRole = 'title';\nconst FrameRole = 'frame';\nconst ScopeRole = 'scope';\nconst LegendRole = 'legend';\nconst RowHeader = 'row-header';\nconst RowFooter = 'row-footer';\nconst RowTitle = 'row-title';\nconst ColHeader = 'column-header';\nconst ColFooter = 'column-footer';\nconst ColTitle = 'column-title';\nconst Padding = 'padding';\nconst Symbols = 'symbol';\nconst Fit = 'fit';\nconst FitX = 'fit-x';\nconst FitY = 'fit-y';\nconst Pad = 'pad';\nconst None = 'none';\nconst All = 'all';\nconst Each = 'each';\nconst Flush = 'flush';\nconst Column = 'column';\nconst Row = 'row';\n\n/**\n * Calculate bounding boxes for scenegraph items.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {object} params.mark - The scenegraph mark instance to bound.\n */\nfunction Bound(params) {\n Transform.call(this, null, params);\n}\ninherits(Bound, Transform, {\n transform(_, pulse) {\n const view = pulse.dataflow,\n mark = _.mark,\n type = mark.marktype,\n entry = Marks[type],\n bound = entry.bound;\n let markBounds = mark.bounds,\n rebound;\n if (entry.nested) {\n // multi-item marks have a single bounds instance\n if (mark.items.length) view.dirty(mark.items[0]);\n markBounds = boundItem(mark, bound);\n mark.items.forEach(item => {\n item.bounds.clear().union(markBounds);\n });\n } else if (type === Group || _.modified()) {\n // operator parameters modified -> re-bound all items\n // updates group bounds in response to modified group content\n pulse.visit(pulse.MOD, item => view.dirty(item));\n markBounds.clear();\n mark.items.forEach(item => markBounds.union(boundItem(item, bound)));\n\n // force reflow for axes/legends/titles to propagate any layout changes\n switch (mark.role) {\n case AxisRole:\n case LegendRole:\n case TitleRole:\n pulse.reflow();\n }\n } else {\n // incrementally update bounds, re-bound mark as needed\n rebound = pulse.changed(pulse.REM);\n pulse.visit(pulse.ADD, item => {\n markBounds.union(boundItem(item, bound));\n });\n pulse.visit(pulse.MOD, item => {\n rebound = rebound || markBounds.alignsWith(item.bounds);\n view.dirty(item);\n markBounds.union(boundItem(item, bound));\n });\n if (rebound) {\n markBounds.clear();\n mark.items.forEach(item => markBounds.union(item.bounds));\n }\n }\n\n // ensure mark bounds do not exceed any clipping region\n boundClip(mark);\n return pulse.modifies('bounds');\n }\n});\nfunction boundItem(item, bound, opt) {\n return bound(item.bounds.clear(), item, opt);\n}\n\nconst COUNTER_NAME = ':vega_identifier:';\n\n/**\n * Adds a unique identifier to all added tuples.\n * This transform creates a new signal that serves as an id counter.\n * As a result, the id counter is shared across all instances of this\n * transform, generating unique ids across multiple data streams. In\n * addition, this signal value can be included in a snapshot of the\n * dataflow state, enabling correct resumption of id allocation.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {string} params.as - The field name for the generated identifier.\n */\nfunction Identifier(params) {\n Transform.call(this, 0, params);\n}\nIdentifier.Definition = {\n 'type': 'Identifier',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'as',\n 'type': 'string',\n 'required': true\n }]\n};\ninherits(Identifier, Transform, {\n transform(_, pulse) {\n const counter = getCounter(pulse.dataflow),\n as = _.as;\n let id = counter.value;\n pulse.visit(pulse.ADD, t => t[as] = t[as] || ++id);\n counter.set(this.value = id);\n return pulse;\n }\n});\nfunction getCounter(view) {\n return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0));\n}\n\n/**\n * Bind scenegraph items to a scenegraph mark instance.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {object} params.markdef - The mark definition for creating the mark.\n * This is an object of legal scenegraph mark properties which *must* include\n * the 'marktype' property.\n */\nfunction Mark(params) {\n Transform.call(this, null, params);\n}\ninherits(Mark, Transform, {\n transform(_, pulse) {\n let mark = this.value;\n\n // acquire mark on first invocation, bind context and group\n if (!mark) {\n mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index);\n mark.group.context = _.context;\n if (!_.context.group) _.context.group = mark.group;\n mark.source = this.source; // point to upstream collector\n mark.clip = _.clip;\n mark.interactive = _.interactive;\n this.value = mark;\n }\n\n // initialize entering items\n const Init = mark.marktype === Group ? GroupItem : Item;\n pulse.visit(pulse.ADD, item => Init.call(item, mark));\n\n // update clipping and/or interactive status\n if (_.modified('clip') || _.modified('interactive')) {\n mark.clip = _.clip;\n mark.interactive = !!_.interactive;\n mark.zdirty = true; // force scenegraph re-eval\n pulse.reflow();\n }\n\n // bind items array to scenegraph mark\n mark.items = pulse.source;\n return pulse;\n }\n});\nfunction lookup$1(_) {\n const g = _.groups,\n p = _.parent;\n return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null;\n}\n\n/**\n * Analyze items for overlap, changing opacity to hide items with\n * overlapping bounding boxes. This transform will preserve at least\n * two items (e.g., first and last) even if overlap persists.\n * @param {object} params - The parameters for this operator.\n * @param {function(*,*): number} [params.sort] - A comparator\n * function for sorting items.\n * @param {object} [params.method] - The overlap removal method to apply.\n * One of 'parity' (default, hide every other item until there is no\n * more overlap) or 'greedy' (sequentially scan and hide and items that\n * overlap with the last visible item).\n * @param {object} [params.boundScale] - A scale whose range should be used\n * to bound the items. Items exceeding the bounds of the scale range\n * will be treated as overlapping. If null or undefined, no bounds check\n * will be applied.\n * @param {object} [params.boundOrient] - The orientation of the scale\n * (top, bottom, left, or right) used to bound items. This parameter is\n * ignored if boundScale is null or undefined.\n * @param {object} [params.boundTolerance] - The tolerance in pixels for\n * bound inclusion testing (default 1). This specifies by how many pixels\n * an item's bounds may exceed the scale range bounds and not be culled.\n * @constructor\n */\nfunction Overlap(params) {\n Transform.call(this, null, params);\n}\nconst methods = {\n parity: items => items.filter((item, i) => i % 2 ? item.opacity = 0 : 1),\n greedy: (items, sep) => {\n let a;\n return items.filter((b, i) => !i || !intersect(a.bounds, b.bounds, sep) ? (a = b, 1) : b.opacity = 0);\n }\n};\n\n// compute bounding box intersection\n// including padding pixels of separation\nconst intersect = (a, b, sep) => sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);\nconst hasOverlap = (items, pad) => {\n for (var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i) {\n if (intersect(a, b = items[i].bounds, pad)) return true;\n }\n};\nconst hasBounds = item => {\n const b = item.bounds;\n return b.width() > 1 && b.height() > 1;\n};\nconst boundTest = (scale, orient, tolerance) => {\n var range = scale.range(),\n b = new Bounds();\n if (orient === Top || orient === Bottom) {\n b.set(range[0], -Infinity, range[1], +Infinity);\n } else {\n b.set(-Infinity, range[0], +Infinity, range[1]);\n }\n b.expand(tolerance || 1);\n return item => b.encloses(item.bounds);\n};\n\n// reset all items to be fully opaque\nconst reset = source => {\n source.forEach(item => item.opacity = 1);\n return source;\n};\n\n// add all tuples to mod, fork pulse if parameters were modified\n// fork prevents cross-stream tuple pollution (e.g., pulse from scale)\nconst reflow = (pulse, _) => pulse.reflow(_.modified()).modifies('opacity');\ninherits(Overlap, Transform, {\n transform(_, pulse) {\n const reduce = methods[_.method] || methods.parity,\n sep = _.separation || 0;\n let source = pulse.materialize(pulse.SOURCE).source,\n items,\n test;\n if (!source || !source.length) return;\n if (!_.method) {\n // early exit if method is falsy\n if (_.modified('method')) {\n reset(source);\n pulse = reflow(pulse, _);\n }\n return pulse;\n }\n\n // skip labels with no content\n source = source.filter(hasBounds);\n\n // early exit, nothing to do\n if (!source.length) return;\n if (_.sort) {\n source = source.slice().sort(_.sort);\n }\n items = reset(source);\n pulse = reflow(pulse, _);\n if (items.length >= 3 && hasOverlap(items, sep)) {\n do {\n items = reduce(items, sep);\n } while (items.length >= 3 && hasOverlap(items, sep));\n if (items.length < 3 && !peek(source).opacity) {\n if (items.length > 1) peek(items).opacity = 0;\n peek(source).opacity = 1;\n }\n }\n if (_.boundScale && _.boundTolerance >= 0) {\n test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance);\n source.forEach(item => {\n if (!test(item)) item.opacity = 0;\n });\n }\n\n // re-calculate mark bounds\n const bounds = items[0].mark.bounds.clear();\n source.forEach(item => {\n if (item.opacity) bounds.union(item.bounds);\n });\n return pulse;\n }\n});\n\n/**\n * Queue modified scenegraph items for rendering.\n * @constructor\n */\nfunction Render(params) {\n Transform.call(this, null, params);\n}\ninherits(Render, Transform, {\n transform(_, pulse) {\n const view = pulse.dataflow;\n pulse.visit(pulse.ALL, item => view.dirty(item));\n\n // set z-index dirty flag as needed\n if (pulse.fields && pulse.fields['zindex']) {\n const item = pulse.source && pulse.source[0];\n if (item) item.mark.zdirty = true;\n }\n }\n});\n\nconst tempBounds = new Bounds();\nfunction set(item, property, value) {\n return item[property] === value ? 0 : (item[property] = value, 1);\n}\n\nfunction isYAxis(mark) {\n var orient = mark.items[0].orient;\n return orient === Left || orient === Right;\n}\nfunction axisIndices(datum) {\n let index = +datum.grid;\n return [datum.ticks ? index++ : -1,\n // ticks index\n datum.labels ? index++ : -1,\n // labels index\n index + +datum.domain // title index\n ];\n}\n\nfunction axisLayout(view, axis, width, height) {\n var item = axis.items[0],\n datum = item.datum,\n delta = item.translate != null ? item.translate : 0.5,\n orient = item.orient,\n indices = axisIndices(datum),\n range = item.range,\n offset = item.offset,\n position = item.position,\n minExtent = item.minExtent,\n maxExtent = item.maxExtent,\n title = datum.title && item.items[indices[2]].items[0],\n titlePadding = item.titlePadding,\n bounds = item.bounds,\n dl = title && multiLineOffset(title),\n x = 0,\n y = 0,\n i,\n s;\n tempBounds.clear().union(bounds);\n bounds.clear();\n if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds);\n if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds);\n\n // position axis group and title\n switch (orient) {\n case Top:\n x = position || 0;\n y = -offset;\n s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1));\n bounds.add(0, -s).add(range, 0);\n if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds);\n break;\n case Left:\n x = -offset;\n y = position || 0;\n s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1));\n bounds.add(-s, 0).add(0, range);\n if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds);\n break;\n case Right:\n x = width + offset;\n y = position || 0;\n s = Math.max(minExtent, Math.min(maxExtent, bounds.x2));\n bounds.add(0, 0).add(s, range);\n if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds);\n break;\n case Bottom:\n x = position || 0;\n y = height + offset;\n s = Math.max(minExtent, Math.min(maxExtent, bounds.y2));\n bounds.add(0, 0).add(range, s);\n if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds);\n break;\n default:\n x = item.x;\n y = item.y;\n }\n\n // update bounds\n boundStroke(bounds.translate(x, y), item);\n if (set(item, 'x', x + delta) | set(item, 'y', y + delta)) {\n item.bounds = tempBounds;\n view.dirty(item);\n item.bounds = bounds;\n view.dirty(item);\n }\n return item.mark.bounds.clear().union(bounds);\n}\nfunction axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) {\n const b = title.bounds;\n if (title.auto) {\n const v = sign * (offset + dl + pad);\n let dx = 0,\n dy = 0;\n view.dirty(title);\n isYAxis ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v);\n title.mark.bounds.clear().union(b.translate(-dx, -dy));\n view.dirty(title);\n }\n bounds.union(b);\n}\n\n// aggregation functions for grid margin determination\nconst min = (a, b) => Math.floor(Math.min(a, b));\nconst max = (a, b) => Math.ceil(Math.max(a, b));\nfunction gridLayoutGroups(group) {\n var groups = group.items,\n n = groups.length,\n i = 0,\n mark,\n items;\n const views = {\n marks: [],\n rowheaders: [],\n rowfooters: [],\n colheaders: [],\n colfooters: [],\n rowtitle: null,\n coltitle: null\n };\n\n // layout axes, gather legends, collect bounds\n for (; i < n; ++i) {\n mark = groups[i];\n items = mark.items;\n if (mark.marktype === Group) {\n switch (mark.role) {\n case AxisRole:\n case LegendRole:\n case TitleRole:\n break;\n case RowHeader:\n views.rowheaders.push(...items);\n break;\n case RowFooter:\n views.rowfooters.push(...items);\n break;\n case ColHeader:\n views.colheaders.push(...items);\n break;\n case ColFooter:\n views.colfooters.push(...items);\n break;\n case RowTitle:\n views.rowtitle = items[0];\n break;\n case ColTitle:\n views.coltitle = items[0];\n break;\n default:\n views.marks.push(...items);\n }\n }\n }\n return views;\n}\nfunction bboxFlush(item) {\n return new Bounds().set(0, 0, item.width || 0, item.height || 0);\n}\nfunction bboxFull(item) {\n const b = item.bounds.clone();\n return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0));\n}\nfunction get(opt, key, d) {\n const v = isObject(opt) ? opt[key] : opt;\n return v != null ? v : d !== undefined ? d : 0;\n}\nfunction offsetValue(v) {\n return v < 0 ? Math.ceil(-v) : 0;\n}\nfunction gridLayout(view, groups, opt) {\n var dirty = !opt.nodirty,\n bbox = opt.bounds === Flush ? bboxFlush : bboxFull,\n bounds = tempBounds.set(0, 0, 0, 0),\n alignCol = get(opt.align, Column),\n alignRow = get(opt.align, Row),\n padCol = get(opt.padding, Column),\n padRow = get(opt.padding, Row),\n ncols = opt.columns || groups.length,\n nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols),\n n = groups.length,\n xOffset = Array(n),\n xExtent = Array(ncols),\n xMax = 0,\n yOffset = Array(n),\n yExtent = Array(nrows),\n yMax = 0,\n dx = Array(n),\n dy = Array(n),\n boxes = Array(n),\n m,\n i,\n c,\n r,\n b,\n g,\n px,\n py,\n x,\n y,\n offset;\n for (i = 0; i < ncols; ++i) xExtent[i] = 0;\n for (i = 0; i < nrows; ++i) yExtent[i] = 0;\n\n // determine offsets for each group\n for (i = 0; i < n; ++i) {\n g = groups[i];\n b = boxes[i] = bbox(g);\n g.x = g.x || 0;\n dx[i] = 0;\n g.y = g.y || 0;\n dy[i] = 0;\n c = i % ncols;\n r = ~~(i / ncols);\n xMax = Math.max(xMax, px = Math.ceil(b.x2));\n yMax = Math.max(yMax, py = Math.ceil(b.y2));\n xExtent[c] = Math.max(xExtent[c], px);\n yExtent[r] = Math.max(yExtent[r], py);\n xOffset[i] = padCol + offsetValue(b.x1);\n yOffset[i] = padRow + offsetValue(b.y1);\n if (dirty) view.dirty(groups[i]);\n }\n\n // set initial alignment offsets\n for (i = 0; i < n; ++i) {\n if (i % ncols === 0) xOffset[i] = 0;\n if (i < ncols) yOffset[i] = 0;\n }\n\n // enforce column alignment constraints\n if (alignCol === Each) {\n for (c = 1; c < ncols; ++c) {\n for (offset = 0, i = c; i < n; i += ncols) {\n if (offset < xOffset[i]) offset = xOffset[i];\n }\n for (i = c; i < n; i += ncols) {\n xOffset[i] = offset + xExtent[c - 1];\n }\n }\n } else if (alignCol === All) {\n for (offset = 0, i = 0; i < n; ++i) {\n if (i % ncols && offset < xOffset[i]) offset = xOffset[i];\n }\n for (i = 0; i < n; ++i) {\n if (i % ncols) xOffset[i] = offset + xMax;\n }\n } else {\n for (alignCol = false, c = 1; c < ncols; ++c) {\n for (i = c; i < n; i += ncols) {\n xOffset[i] += xExtent[c - 1];\n }\n }\n }\n\n // enforce row alignment constraints\n if (alignRow === Each) {\n for (r = 1; r < nrows; ++r) {\n for (offset = 0, i = r * ncols, m = i + ncols; i < m; ++i) {\n if (offset < yOffset[i]) offset = yOffset[i];\n }\n for (i = r * ncols; i < m; ++i) {\n yOffset[i] = offset + yExtent[r - 1];\n }\n }\n } else if (alignRow === All) {\n for (offset = 0, i = ncols; i < n; ++i) {\n if (offset < yOffset[i]) offset = yOffset[i];\n }\n for (i = ncols; i < n; ++i) {\n yOffset[i] = offset + yMax;\n }\n } else {\n for (alignRow = false, r = 1; r < nrows; ++r) {\n for (i = r * ncols, m = i + ncols; i < m; ++i) {\n yOffset[i] += yExtent[r - 1];\n }\n }\n }\n\n // perform horizontal grid layout\n for (x = 0, i = 0; i < n; ++i) {\n x = xOffset[i] + (i % ncols ? x : 0);\n dx[i] += x - groups[i].x;\n }\n\n // perform vertical grid layout\n for (c = 0; c < ncols; ++c) {\n for (y = 0, i = c; i < n; i += ncols) {\n y += yOffset[i];\n dy[i] += y - groups[i].y;\n }\n }\n\n // perform horizontal centering\n if (alignCol && get(opt.center, Column) && nrows > 1) {\n for (i = 0; i < n; ++i) {\n b = alignCol === All ? xMax : xExtent[i % ncols];\n x = b - boxes[i].x2 - groups[i].x - dx[i];\n if (x > 0) dx[i] += x / 2;\n }\n }\n\n // perform vertical centering\n if (alignRow && get(opt.center, Row) && ncols !== 1) {\n for (i = 0; i < n; ++i) {\n b = alignRow === All ? yMax : yExtent[~~(i / ncols)];\n y = b - boxes[i].y2 - groups[i].y - dy[i];\n if (y > 0) dy[i] += y / 2;\n }\n }\n\n // position grid relative to anchor\n for (i = 0; i < n; ++i) {\n bounds.union(boxes[i].translate(dx[i], dy[i]));\n }\n x = get(opt.anchor, X);\n y = get(opt.anchor, Y);\n switch (get(opt.anchor, Column)) {\n case End:\n x -= bounds.width();\n break;\n case Middle:\n x -= bounds.width() / 2;\n }\n switch (get(opt.anchor, Row)) {\n case End:\n y -= bounds.height();\n break;\n case Middle:\n y -= bounds.height() / 2;\n }\n x = Math.round(x);\n y = Math.round(y);\n\n // update mark positions, bounds, dirty\n bounds.clear();\n for (i = 0; i < n; ++i) {\n groups[i].mark.bounds.clear();\n }\n for (i = 0; i < n; ++i) {\n g = groups[i];\n g.x += dx[i] += x;\n g.y += dy[i] += y;\n bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i])));\n if (dirty) view.dirty(g);\n }\n return bounds;\n}\nfunction trellisLayout(view, group, opt) {\n var views = gridLayoutGroups(group),\n groups = views.marks,\n bbox = opt.bounds === Flush ? boundFlush : boundFull,\n off = opt.offset,\n ncols = opt.columns || groups.length,\n nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols),\n cells = nrows * ncols,\n x,\n y,\n x2,\n y2,\n anchor,\n band,\n offset;\n\n // -- initial grid layout\n const bounds = gridLayout(view, groups, opt);\n if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid\n\n // -- layout grid headers and footers --\n\n // perform row header layout\n if (views.rowheaders) {\n band = get(opt.headerBand, Row, null);\n x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get(off, 'rowHeader'), min, 0, bbox, 'x1', 0, ncols, 1, band);\n }\n\n // perform column header layout\n if (views.colheaders) {\n band = get(opt.headerBand, Column, null);\n y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get(off, 'columnHeader'), min, 1, bbox, 'y1', 0, 1, ncols, band);\n }\n\n // perform row footer layout\n if (views.rowfooters) {\n band = get(opt.footerBand, Row, null);\n x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols - 1, ncols, 1, band);\n }\n\n // perform column footer layout\n if (views.colfooters) {\n band = get(opt.footerBand, Column, null);\n y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells - ncols, 1, ncols, band);\n }\n\n // perform row title layout\n if (views.rowtitle) {\n anchor = get(opt.titleAnchor, Row);\n offset = get(off, 'rowTitle');\n offset = anchor === End ? x2 + offset : x - offset;\n band = get(opt.titleBand, Row, 0.5);\n layoutTitle(view, views.rowtitle, offset, 0, bounds, band);\n }\n\n // perform column title layout\n if (views.coltitle) {\n anchor = get(opt.titleAnchor, Column);\n offset = get(off, 'columnTitle');\n offset = anchor === End ? y2 + offset : y - offset;\n band = get(opt.titleBand, Column, 0.5);\n layoutTitle(view, views.coltitle, offset, 1, bounds, band);\n }\n}\nfunction boundFlush(item, field) {\n return field === 'x1' ? item.x || 0 : field === 'y1' ? item.y || 0 : field === 'x2' ? (item.x || 0) + (item.width || 0) : field === 'y2' ? (item.y || 0) + (item.height || 0) : undefined;\n}\nfunction boundFull(item, field) {\n return item.bounds[field];\n}\nfunction layoutHeaders(view, headers, groups, ncols, limit, offset, agg, isX, bound, bf, start, stride, back, band) {\n var n = groups.length,\n init = 0,\n edge = 0,\n i,\n j,\n k,\n m,\n b,\n h,\n g,\n x,\n y;\n\n // if no groups, early exit and return 0\n if (!n) return init;\n\n // compute margin\n for (i = start; i < n; i += stride) {\n if (groups[i]) init = agg(init, bound(groups[i], bf));\n }\n\n // if no headers, return margin calculation\n if (!headers.length) return init;\n\n // check if number of headers exceeds number of rows or columns\n if (headers.length > limit) {\n view.warn('Grid headers exceed limit: ' + limit);\n headers = headers.slice(0, limit);\n }\n\n // apply offset\n init += offset;\n\n // clear mark bounds for all headers\n for (j = 0, m = headers.length; j < m; ++j) {\n view.dirty(headers[j]);\n headers[j].mark.bounds.clear();\n }\n\n // layout each header\n for (i = start, j = 0, m = headers.length; j < m; ++j, i += stride) {\n h = headers[j];\n b = h.mark.bounds;\n\n // search for nearest group to align to\n // necessary if table has empty cells\n for (k = i; k >= 0 && (g = groups[k]) == null; k -= back);\n\n // assign coordinates and update bounds\n if (isX) {\n x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width());\n y = init;\n } else {\n x = init;\n y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height());\n }\n b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0)));\n h.x = x;\n h.y = y;\n view.dirty(h);\n\n // update current edge of layout bounds\n edge = agg(edge, b[bf]);\n }\n return edge;\n}\nfunction layoutTitle(view, g, offset, isX, bounds, band) {\n if (!g) return;\n view.dirty(g);\n\n // compute title coordinates\n var x = offset,\n y = offset;\n isX ? x = Math.round(bounds.x1 + band * bounds.width()) : y = Math.round(bounds.y1 + band * bounds.height());\n\n // assign coordinates and update bounds\n g.bounds.translate(x - (g.x || 0), y - (g.y || 0));\n g.mark.bounds.clear().union(g.bounds);\n g.x = x;\n g.y = y;\n\n // queue title for redraw\n view.dirty(g);\n}\n\n// utility for looking up legend layout configuration\nfunction lookup(config, orient) {\n const opt = config[orient] || {};\n return (key, d) => opt[key] != null ? opt[key] : config[key] != null ? config[key] : d;\n}\n\n// if legends specify offset directly, use the maximum specified value\nfunction offsets(legends, value) {\n let max = -Infinity;\n legends.forEach(item => {\n if (item.offset != null) max = Math.max(max, item.offset);\n });\n return max > -Infinity ? max : value;\n}\nfunction legendParams(g, orient, config, xb, yb, w, h) {\n const _ = lookup(config, orient),\n offset = offsets(g, _('offset', 0)),\n anchor = _('anchor', Start),\n mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0;\n const p = {\n align: Each,\n bounds: _('bounds', Flush),\n columns: _('direction') === 'vertical' ? 1 : g.length,\n padding: _('margin', 8),\n center: _('center'),\n nodirty: true\n };\n switch (orient) {\n case Left:\n p.anchor = {\n x: Math.floor(xb.x1) - offset,\n column: End,\n y: mult * (h || xb.height() + 2 * xb.y1),\n row: anchor\n };\n break;\n case Right:\n p.anchor = {\n x: Math.ceil(xb.x2) + offset,\n y: mult * (h || xb.height() + 2 * xb.y1),\n row: anchor\n };\n break;\n case Top:\n p.anchor = {\n y: Math.floor(yb.y1) - offset,\n row: End,\n x: mult * (w || yb.width() + 2 * yb.x1),\n column: anchor\n };\n break;\n case Bottom:\n p.anchor = {\n y: Math.ceil(yb.y2) + offset,\n x: mult * (w || yb.width() + 2 * yb.x1),\n column: anchor\n };\n break;\n case TopLeft:\n p.anchor = {\n x: offset,\n y: offset\n };\n break;\n case TopRight:\n p.anchor = {\n x: w - offset,\n y: offset,\n column: End\n };\n break;\n case BottomLeft:\n p.anchor = {\n x: offset,\n y: h - offset,\n row: End\n };\n break;\n case BottomRight:\n p.anchor = {\n x: w - offset,\n y: h - offset,\n column: End,\n row: End\n };\n break;\n }\n return p;\n}\nfunction legendLayout(view, legend) {\n var item = legend.items[0],\n datum = item.datum,\n orient = item.orient,\n bounds = item.bounds,\n x = item.x,\n y = item.y,\n w,\n h;\n\n // cache current bounds for later comparison\n item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone();\n bounds.clear();\n\n // adjust legend to accommodate padding and title\n legendGroupLayout(view, item, item.items[0].items[0]);\n\n // aggregate bounds to determine size, and include origin\n bounds = legendBounds(item, bounds);\n w = 2 * item.padding;\n h = 2 * item.padding;\n if (!bounds.empty()) {\n w = Math.ceil(bounds.width() + w);\n h = Math.ceil(bounds.height() + h);\n }\n if (datum.type === Symbols) {\n legendEntryLayout(item.items[0].items[0].items[0].items);\n }\n if (orient !== None) {\n item.x = x = 0;\n item.y = y = 0;\n }\n item.width = w;\n item.height = h;\n boundStroke(bounds.set(x, y, x + w, y + h), item);\n item.mark.bounds.clear().union(bounds);\n return item;\n}\nfunction legendBounds(item, b) {\n // aggregate item bounds\n item.items.forEach(_ => b.union(_.bounds));\n\n // anchor to legend origin\n b.x1 = item.padding;\n b.y1 = item.padding;\n return b;\n}\nfunction legendGroupLayout(view, item, entry) {\n var pad = item.padding,\n ex = pad - entry.x,\n ey = pad - entry.y;\n if (!item.datum.title) {\n if (ex || ey) translate(view, entry, ex, ey);\n } else {\n var title = item.items[1].items[0],\n anchor = title.anchor,\n tpad = item.titlePadding || 0,\n tx = pad - title.x,\n ty = pad - title.y;\n switch (title.orient) {\n case Left:\n ex += Math.ceil(title.bounds.width()) + tpad;\n break;\n case Right:\n case Bottom:\n break;\n default:\n ey += title.bounds.height() + tpad;\n }\n if (ex || ey) translate(view, entry, ex, ey);\n switch (title.orient) {\n case Left:\n ty += legendTitleOffset(item, entry, title, anchor, 1, 1);\n break;\n case Right:\n tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad;\n ty += legendTitleOffset(item, entry, title, anchor, 1, 1);\n break;\n case Bottom:\n tx += legendTitleOffset(item, entry, title, anchor, 0, 0);\n ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad;\n break;\n default:\n tx += legendTitleOffset(item, entry, title, anchor, 0, 0);\n }\n if (tx || ty) translate(view, title, tx, ty);\n\n // translate legend if title pushes into negative coordinates\n if ((tx = Math.round(title.bounds.x1 - pad)) < 0) {\n translate(view, entry, -tx, 0);\n translate(view, title, -tx, 0);\n }\n }\n}\nfunction legendTitleOffset(item, entry, title, anchor, y, lr, noBar) {\n const grad = item.datum.type !== 'symbol',\n vgrad = title.datum.vgrad,\n e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry,\n s = e.bounds[y ? 'y2' : 'x2'] - item.padding,\n u = vgrad && lr ? s : 0,\n v = vgrad && lr ? 0 : s,\n o = y <= 0 ? 0 : multiLineOffset(title);\n return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o));\n}\nfunction translate(view, item, dx, dy) {\n item.x += dx;\n item.y += dy;\n item.bounds.translate(dx, dy);\n item.mark.bounds.translate(dx, dy);\n view.dirty(item);\n}\nfunction legendEntryLayout(entries) {\n // get max widths for each column\n const widths = entries.reduce((w, g) => {\n w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0);\n return w;\n }, {});\n\n // set dimensions of legend entry groups\n entries.forEach(g => {\n g.width = widths[g.column];\n g.height = g.bounds.y2 - g.y;\n });\n}\n\nfunction titleLayout(view, mark, width, height, viewBounds) {\n var group = mark.items[0],\n frame = group.frame,\n orient = group.orient,\n anchor = group.anchor,\n offset = group.offset,\n padding = group.padding,\n title = group.items[0].items[0],\n subtitle = group.items[1] && group.items[1].items[0],\n end = orient === Left || orient === Right ? height : width,\n start = 0,\n x = 0,\n y = 0,\n sx = 0,\n sy = 0,\n pos;\n if (frame !== Group) {\n orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2);\n } else if (orient === Left) {\n start = height, end = 0;\n }\n pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2;\n if (subtitle && subtitle.text) {\n // position subtitle\n switch (orient) {\n case Top:\n case Bottom:\n sy = title.bounds.height() + padding;\n break;\n case Left:\n sx = title.bounds.width() + padding;\n break;\n case Right:\n sx = -title.bounds.width() - padding;\n break;\n }\n tempBounds.clear().union(subtitle.bounds);\n tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0));\n if (set(subtitle, 'x', sx) | set(subtitle, 'y', sy)) {\n view.dirty(subtitle);\n subtitle.bounds.clear().union(tempBounds);\n subtitle.mark.bounds.clear().union(tempBounds);\n view.dirty(subtitle);\n }\n tempBounds.clear().union(subtitle.bounds);\n } else {\n tempBounds.clear();\n }\n tempBounds.union(title.bounds);\n\n // position title group\n switch (orient) {\n case Top:\n x = pos;\n y = viewBounds.y1 - tempBounds.height() - offset;\n break;\n case Left:\n x = viewBounds.x1 - tempBounds.width() - offset;\n y = pos;\n break;\n case Right:\n x = viewBounds.x2 + tempBounds.width() + offset;\n y = pos;\n break;\n case Bottom:\n x = pos;\n y = viewBounds.y2 + offset;\n break;\n default:\n x = group.x;\n y = group.y;\n }\n if (set(group, 'x', x) | set(group, 'y', y)) {\n tempBounds.translate(x, y);\n view.dirty(group);\n group.bounds.clear().union(tempBounds);\n mark.bounds.clear().union(tempBounds);\n view.dirty(group);\n }\n return group.bounds;\n}\n\n/**\n * Layout view elements such as axes and legends.\n * Also performs size adjustments.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {object} params.mark - Scenegraph mark of groups to layout.\n */\nfunction ViewLayout(params) {\n Transform.call(this, null, params);\n}\ninherits(ViewLayout, Transform, {\n transform(_, pulse) {\n const view = pulse.dataflow;\n _.mark.items.forEach(group => {\n if (_.layout) trellisLayout(view, group, _.layout);\n layoutGroup(view, group, _);\n });\n return shouldReflow(_.mark.group) ? pulse.reflow() : pulse;\n }\n});\nfunction shouldReflow(group) {\n // We typically should reflow if layout is invoked (#2568), as child items\n // may have resized and reflow ensures group bounds are re-calculated.\n // However, legend entries have a special exception to avoid instability.\n // For example, if a selected legend symbol gains a stroke on hover,\n // we don't want to re-position subsequent elements in the legend.\n return group && group.mark.role !== 'legend-entry';\n}\nfunction layoutGroup(view, group, _) {\n var items = group.items,\n width = Math.max(0, group.width || 0),\n height = Math.max(0, group.height || 0),\n viewBounds = new Bounds().set(0, 0, width, height),\n xBounds = viewBounds.clone(),\n yBounds = viewBounds.clone(),\n legends = [],\n title,\n mark,\n orient,\n b,\n i,\n n;\n\n // layout axes, gather legends, collect bounds\n for (i = 0, n = items.length; i < n; ++i) {\n mark = items[i];\n switch (mark.role) {\n case AxisRole:\n b = isYAxis(mark) ? xBounds : yBounds;\n b.union(axisLayout(view, mark, width, height));\n break;\n case TitleRole:\n title = mark;\n break;\n case LegendRole:\n legends.push(legendLayout(view, mark));\n break;\n case FrameRole:\n case ScopeRole:\n case RowHeader:\n case RowFooter:\n case RowTitle:\n case ColHeader:\n case ColFooter:\n case ColTitle:\n xBounds.union(mark.bounds);\n yBounds.union(mark.bounds);\n break;\n default:\n viewBounds.union(mark.bounds);\n }\n }\n\n // layout legends, adjust viewBounds\n if (legends.length) {\n // group legends by orient\n const l = {};\n legends.forEach(item => {\n orient = item.orient || Right;\n if (orient !== None) (l[orient] || (l[orient] = [])).push(item);\n });\n\n // perform grid layout for each orient group\n for (const orient in l) {\n const g = l[orient];\n gridLayout(view, g, legendParams(g, orient, _.legends, xBounds, yBounds, width, height));\n }\n\n // update view bounds\n legends.forEach(item => {\n const b = item.bounds;\n if (!b.equals(item._bounds)) {\n item.bounds = item._bounds;\n view.dirty(item); // dirty previous location\n item.bounds = b;\n view.dirty(item);\n }\n if (_.autosize && (_.autosize.type === Fit || _.autosize.type === FitX || _.autosize.type === FitY)) {\n // For autosize fit, incorporate the orthogonal dimension only.\n // Legends that overrun the chart area will then be clipped;\n // otherwise the chart area gets reduced to nothing!\n switch (item.orient) {\n case Left:\n case Right:\n viewBounds.add(b.x1, 0).add(b.x2, 0);\n break;\n case Top:\n case Bottom:\n viewBounds.add(0, b.y1).add(0, b.y2);\n }\n } else {\n viewBounds.union(b);\n }\n });\n }\n\n // combine bounding boxes\n viewBounds.union(xBounds).union(yBounds);\n\n // layout title, adjust bounds\n if (title) {\n viewBounds.union(titleLayout(view, title, width, height, viewBounds));\n }\n\n // override aggregated view bounds if content is clipped\n if (group.clip) {\n viewBounds.set(0, 0, group.width || 0, group.height || 0);\n }\n\n // perform size adjustment\n viewSizeLayout(view, group, viewBounds, _);\n}\nfunction viewSizeLayout(view, group, viewBounds, _) {\n const auto = _.autosize || {},\n type = auto.type;\n if (view._autosize < 1 || !type) return;\n let viewWidth = view._width,\n viewHeight = view._height,\n width = Math.max(0, group.width || 0),\n left = Math.max(0, Math.ceil(-viewBounds.x1)),\n height = Math.max(0, group.height || 0),\n top = Math.max(0, Math.ceil(-viewBounds.y1));\n const right = Math.max(0, Math.ceil(viewBounds.x2 - width)),\n bottom = Math.max(0, Math.ceil(viewBounds.y2 - height));\n if (auto.contains === Padding) {\n const padding = view.padding();\n viewWidth -= padding.left + padding.right;\n viewHeight -= padding.top + padding.bottom;\n }\n if (type === None) {\n left = 0;\n top = 0;\n width = viewWidth;\n height = viewHeight;\n } else if (type === Fit) {\n width = Math.max(0, viewWidth - left - right);\n height = Math.max(0, viewHeight - top - bottom);\n } else if (type === FitX) {\n width = Math.max(0, viewWidth - left - right);\n viewHeight = height + top + bottom;\n } else if (type === FitY) {\n viewWidth = width + left + right;\n height = Math.max(0, viewHeight - top - bottom);\n } else if (type === Pad) {\n viewWidth = width + left + right;\n viewHeight = height + top + bottom;\n }\n view._resizeView(viewWidth, viewHeight, width, height, [left, top], auto.resize);\n}\n\nexport { Bound as bound, Identifier as identifier, Mark as mark, Overlap as overlap, Render as render, ViewLayout as viewlayout };\n","export default function sum(values, valueof) {\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value = +value) {\n sum += value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if (value = +valueof(value, ++index, values)) {\n sum += value;\n }\n }\n }\n return sum;\n}\n","import { Transform, ingest, tupleid, stableCompare } from 'vega-dataflow';\nimport { tickCount, tickFormat, validTicks, tickValues, SymbolLegend, labelFormat, labelValues, GradientLegend, scaleFraction, labelFraction, scale, Sequential, Linear, isContinuous, Time, UTC, Ordinal, scaleImplicit, Log, Sqrt, Pow, Symlog, isLogarithmic, BinOrdinal, isInterpolating, interpolateColors, interpolate, Band, Point, bandSpace, scheme, Threshold, Quantile, Quantize, quantizeInterpolator, interpolateRange, Diverging } from 'vega-scale';\nimport { inherits, isArray, error, fastmap, falsy, isFunction, constant, peek, one, toSet, isString, zoomLog, zoomPow, zoomSymlog, zoomLinear, stringValue } from 'vega-util';\nimport { sum, range } from 'd3-array';\nimport { interpolateRound, interpolate as interpolate$1 } from 'd3-interpolate';\n\n/**\n * Generates axis ticks for visualizing a spatial scale.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Scale} params.scale - The scale to generate ticks for.\n * @param {*} [params.count=10] - The approximate number of ticks, or\n * desired tick interval, to use.\n * @param {Array<*>} [params.values] - The exact tick values to use.\n * These must be legal domain values for the provided scale.\n * If provided, the count argument is ignored.\n * @param {function(*):string} [params.formatSpecifier] - A format specifier\n * to use in conjunction with scale.tickFormat. Legal values are\n * any valid d3 4.0 format specifier.\n * @param {function(*):string} [params.format] - The format function to use.\n * If provided, the formatSpecifier argument is ignored.\n */\nfunction AxisTicks(params) {\n Transform.call(this, null, params);\n}\ninherits(AxisTicks, Transform, {\n transform(_, pulse) {\n if (this.value && !_.modified()) {\n return pulse.StopPropagation;\n }\n var locale = pulse.dataflow.locale(),\n out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n ticks = this.value,\n scale = _.scale,\n tally = _.count == null ? _.values ? _.values.length : 10 : _.count,\n count = tickCount(scale, tally, _.minstep),\n format = _.format || tickFormat(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values),\n values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count);\n if (ticks) out.rem = ticks;\n ticks = values.map((value, i) => ingest({\n index: i / (values.length - 1 || 1),\n value: value,\n label: format(value)\n }));\n if (_.extra && ticks.length) {\n // add an extra tick pegged to the initial domain value\n // this is used to generate axes with 'binned' domains\n ticks.push(ingest({\n index: -1,\n extra: {\n value: ticks[0].value\n },\n label: ''\n }));\n }\n out.source = ticks;\n out.add = ticks;\n this.value = ticks;\n return out;\n }\n});\n\n/**\n * Joins a set of data elements against a set of visual items.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): object} [params.item] - An item generator function.\n * @param {function(object): *} [params.key] - The key field associating data and visual items.\n */\nfunction DataJoin(params) {\n Transform.call(this, null, params);\n}\nfunction defaultItemCreate() {\n return ingest({});\n}\nfunction newMap(key) {\n const map = fastmap().test(t => t.exit);\n map.lookup = t => map.get(key(t));\n return map;\n}\ninherits(DataJoin, Transform, {\n transform(_, pulse) {\n var df = pulse.dataflow,\n out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n item = _.item || defaultItemCreate,\n key = _.key || tupleid,\n map = this.value;\n\n // prevent transient (e.g., hover) requests from\n // cascading across marks derived from marks\n if (isArray(out.encode)) {\n out.encode = null;\n }\n if (map && (_.modified('key') || pulse.modified(key))) {\n error('DataJoin does not support modified key function or fields.');\n }\n if (!map) {\n pulse = pulse.addAll();\n this.value = map = newMap(key);\n }\n pulse.visit(pulse.ADD, t => {\n const k = key(t);\n let x = map.get(k);\n if (x) {\n if (x.exit) {\n map.empty--;\n out.add.push(x);\n } else {\n out.mod.push(x);\n }\n } else {\n x = item(t);\n map.set(k, x);\n out.add.push(x);\n }\n x.datum = t;\n x.exit = false;\n });\n pulse.visit(pulse.MOD, t => {\n const k = key(t),\n x = map.get(k);\n if (x) {\n x.datum = t;\n out.mod.push(x);\n }\n });\n pulse.visit(pulse.REM, t => {\n const k = key(t),\n x = map.get(k);\n if (t === x.datum && !x.exit) {\n out.rem.push(x);\n x.exit = true;\n ++map.empty;\n }\n });\n if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum');\n if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) {\n df.runAfter(map.clean);\n }\n return out;\n }\n});\n\n/**\n * Invokes encoding functions for visual items.\n * @constructor\n * @param {object} params - The parameters to the encoding functions. This\n * parameter object will be passed through to all invoked encoding functions.\n * @param {object} [params.mod=false] - Flag indicating if tuples in the input\n * mod set that are unmodified by encoders should be included in the output.\n * @param {object} param.encoders - The encoding functions\n * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set\n * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set\n * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set\n */\nfunction Encode(params) {\n Transform.call(this, null, params);\n}\ninherits(Encode, Transform, {\n transform(_, pulse) {\n var out = pulse.fork(pulse.ADD_REM),\n fmod = _.mod || false,\n encoders = _.encoders,\n encode = pulse.encode;\n\n // if an array, the encode directive includes additional sets\n // that must be defined in order for the primary set to be invoked\n // e.g., only run the update set if the hover set is defined\n if (isArray(encode)) {\n if (out.changed() || encode.every(e => encoders[e])) {\n encode = encode[0];\n out.encode = null; // consume targeted encode directive\n } else {\n return pulse.StopPropagation;\n }\n }\n\n // marshall encoder functions\n var reenter = encode === 'enter',\n update = encoders.update || falsy,\n enter = encoders.enter || falsy,\n exit = encoders.exit || falsy,\n set = (encode && !reenter ? encoders[encode] : update) || falsy;\n if (pulse.changed(pulse.ADD)) {\n pulse.visit(pulse.ADD, t => {\n enter(t, _);\n update(t, _);\n });\n out.modifies(enter.output);\n out.modifies(update.output);\n if (set !== falsy && set !== update) {\n pulse.visit(pulse.ADD, t => {\n set(t, _);\n });\n out.modifies(set.output);\n }\n }\n if (pulse.changed(pulse.REM) && exit !== falsy) {\n pulse.visit(pulse.REM, t => {\n exit(t, _);\n });\n out.modifies(exit.output);\n }\n if (reenter || set !== falsy) {\n const flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0);\n if (reenter) {\n pulse.visit(flag, t => {\n const mod = enter(t, _) || fmod;\n if (set(t, _) || mod) out.mod.push(t);\n });\n if (out.mod.length) out.modifies(enter.output);\n } else {\n pulse.visit(flag, t => {\n if (set(t, _) || fmod) out.mod.push(t);\n });\n }\n if (out.mod.length) out.modifies(set.output);\n }\n return out.changed() ? out : pulse.StopPropagation;\n }\n});\n\n/**\n * Generates legend entries for visualizing a scale.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Scale} params.scale - The scale to generate items for.\n * @param {*} [params.count=5] - The approximate number of items, or\n * desired tick interval, to use.\n * @param {*} [params.limit] - The maximum number of entries to\n * include in a symbol legend.\n * @param {Array<*>} [params.values] - The exact tick values to use.\n * These must be legal domain values for the provided scale.\n * If provided, the count argument is ignored.\n * @param {string} [params.formatSpecifier] - A format specifier\n * to use in conjunction with scale.tickFormat. Legal values are\n * any valid D3 format specifier string.\n * @param {function(*):string} [params.format] - The format function to use.\n * If provided, the formatSpecifier argument is ignored.\n */\nfunction LegendEntries(params) {\n Transform.call(this, [], params);\n}\ninherits(LegendEntries, Transform, {\n transform(_, pulse) {\n if (this.value != null && !_.modified()) {\n return pulse.StopPropagation;\n }\n var locale = pulse.dataflow.locale(),\n out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n items = this.value,\n type = _.type || SymbolLegend,\n scale = _.scale,\n limit = +_.limit,\n count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep),\n lskip = !!_.values || type === SymbolLegend,\n format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip),\n values = _.values || labelValues(scale, count),\n domain,\n fraction,\n size,\n offset,\n ellipsis;\n if (items) out.rem = items;\n if (type === SymbolLegend) {\n if (limit && values.length > limit) {\n pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.');\n items = values.slice(0, limit - 1);\n ellipsis = true;\n } else {\n items = values;\n }\n if (isFunction(size = _.size)) {\n // if first value maps to size zero, remove from list (vega#717)\n if (!_.values && scale(items[0]) === 0) {\n items = items.slice(1);\n }\n // compute size offset for legend entries\n offset = items.reduce((max, value) => Math.max(max, size(value, _)), 0);\n } else {\n size = constant(offset = size || 8);\n }\n items = items.map((value, index) => ingest({\n index: index,\n label: format(value, index, items),\n value: value,\n offset: offset,\n size: size(value, _)\n }));\n if (ellipsis) {\n ellipsis = values[items.length];\n items.push(ingest({\n index: items.length,\n label: `\\u2026${values.length - items.length} entries`,\n value: ellipsis,\n offset: offset,\n size: size(ellipsis, _)\n }));\n }\n } else if (type === GradientLegend) {\n domain = scale.domain(), fraction = scaleFraction(scale, domain[0], peek(domain));\n\n // if automatic label generation produces 2 or fewer values,\n // use the domain end points instead (fixes vega/vega#1364)\n if (values.length < 3 && !_.values && domain[0] !== peek(domain)) {\n values = [domain[0], peek(domain)];\n }\n items = values.map((value, index) => ingest({\n index: index,\n label: format(value, index, values),\n value: value,\n perc: fraction(value)\n }));\n } else {\n size = values.length - 1;\n fraction = labelFraction(scale);\n items = values.map((value, index) => ingest({\n index: index,\n label: format(value, index, values),\n value: value,\n perc: index ? fraction(value) : 0,\n perc2: index === size ? 1 : fraction(values[index + 1])\n }));\n }\n out.source = items;\n out.add = items;\n this.value = items;\n return out;\n }\n});\n\nconst sourceX = t => t.source.x;\nconst sourceY = t => t.source.y;\nconst targetX = t => t.target.x;\nconst targetY = t => t.target.y;\n\n/**\n * Layout paths linking source and target elements.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction LinkPath(params) {\n Transform.call(this, {}, params);\n}\nLinkPath.Definition = {\n 'type': 'LinkPath',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'sourceX',\n 'type': 'field',\n 'default': 'source.x'\n }, {\n 'name': 'sourceY',\n 'type': 'field',\n 'default': 'source.y'\n }, {\n 'name': 'targetX',\n 'type': 'field',\n 'default': 'target.x'\n }, {\n 'name': 'targetY',\n 'type': 'field',\n 'default': 'target.y'\n }, {\n 'name': 'orient',\n 'type': 'enum',\n 'default': 'vertical',\n 'values': ['horizontal', 'vertical', 'radial']\n }, {\n 'name': 'shape',\n 'type': 'enum',\n 'default': 'line',\n 'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal']\n }, {\n 'name': 'require',\n 'type': 'signal'\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'path'\n }]\n};\ninherits(LinkPath, Transform, {\n transform(_, pulse) {\n var sx = _.sourceX || sourceX,\n sy = _.sourceY || sourceY,\n tx = _.targetX || targetX,\n ty = _.targetY || targetY,\n as = _.as || 'path',\n orient = _.orient || 'vertical',\n shape = _.shape || 'line',\n path = Paths.get(shape + '-' + orient) || Paths.get(shape);\n if (!path) {\n error('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : ''));\n }\n pulse.visit(pulse.SOURCE, t => {\n t[as] = path(sx(t), sy(t), tx(t), ty(t));\n });\n return pulse.reflow(_.modified()).modifies(as);\n }\n});\nconst line = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'L' + tx + ',' + ty;\nconst lineR = (sa, sr, ta, tr) => line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));\nconst arc = (sx, sy, tx, ty) => {\n var dx = tx - sx,\n dy = ty - sy,\n rr = Math.hypot(dx, dy) / 2,\n ra = 180 * Math.atan2(dy, dx) / Math.PI;\n return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty;\n};\nconst arcR = (sa, sr, ta, tr) => arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));\nconst curve = (sx, sy, tx, ty) => {\n const dx = tx - sx,\n dy = ty - sy,\n ix = 0.2 * (dx + dy),\n iy = 0.2 * (dy - dx);\n return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty;\n};\nconst curveR = (sa, sr, ta, tr) => curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));\nconst orthoX = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'V' + ty + 'H' + tx;\nconst orthoY = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'H' + tx + 'V' + ty;\nconst orthoR = (sa, sr, ta, tr) => {\n const sc = Math.cos(sa),\n ss = Math.sin(sa),\n tc = Math.cos(ta),\n ts = Math.sin(ta),\n sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa;\n return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts;\n};\nconst diagonalX = (sx, sy, tx, ty) => {\n const m = (sx + tx) / 2;\n return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty;\n};\nconst diagonalY = (sx, sy, tx, ty) => {\n const m = (sy + ty) / 2;\n return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty;\n};\nconst diagonalR = (sa, sr, ta, tr) => {\n const sc = Math.cos(sa),\n ss = Math.sin(sa),\n tc = Math.cos(ta),\n ts = Math.sin(ta),\n mr = (sr + tr) / 2;\n return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts;\n};\nconst Paths = fastmap({\n 'line': line,\n 'line-radial': lineR,\n 'arc': arc,\n 'arc-radial': arcR,\n 'curve': curve,\n 'curve-radial': curveR,\n 'orthogonal-horizontal': orthoX,\n 'orthogonal-vertical': orthoY,\n 'orthogonal-radial': orthoR,\n 'diagonal-horizontal': diagonalX,\n 'diagonal-vertical': diagonalY,\n 'diagonal-radial': diagonalR\n});\n\n/**\n * Pie and donut chart layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to size pie segments.\n * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout.\n * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout.\n * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value.\n */\nfunction Pie(params) {\n Transform.call(this, null, params);\n}\nPie.Definition = {\n 'type': 'Pie',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'startAngle',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'endAngle',\n 'type': 'number',\n 'default': 6.283185307179586\n }, {\n 'name': 'sort',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['startAngle', 'endAngle']\n }]\n};\ninherits(Pie, Transform, {\n transform(_, pulse) {\n var as = _.as || ['startAngle', 'endAngle'],\n startAngle = as[0],\n endAngle = as[1],\n field = _.field || one,\n start = _.startAngle || 0,\n stop = _.endAngle != null ? _.endAngle : 2 * Math.PI,\n data = pulse.source,\n values = data.map(field),\n n = values.length,\n a = start,\n k = (stop - start) / sum(values),\n index = range(n),\n i,\n t,\n v;\n if (_.sort) {\n index.sort((a, b) => values[a] - values[b]);\n }\n for (i = 0; i < n; ++i) {\n v = values[index[i]];\n t = data[index[i]];\n t[startAngle] = a;\n t[endAngle] = a += v * k;\n }\n this.value = values;\n return pulse.reflow(_.modified()).modifies(as);\n }\n});\n\nconst DEFAULT_COUNT = 5;\nfunction includeZero(scale) {\n const type = scale.type;\n return !scale.bins && (type === Linear || type === Pow || type === Sqrt);\n}\nfunction includePad(type) {\n return isContinuous(type) && type !== Sequential;\n}\nconst SKIP = toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']);\n\n/**\n * Maintains a scale function mapping data values to visual channels.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction Scale(params) {\n Transform.call(this, null, params);\n this.modified(true); // always treat as modified\n}\n\ninherits(Scale, Transform, {\n transform(_, pulse) {\n var df = pulse.dataflow,\n scale$1 = this.value,\n key = scaleKey(_);\n if (!scale$1 || key !== scale$1.type) {\n this.value = scale$1 = scale(key)();\n }\n for (key in _) if (!SKIP[key]) {\n // padding is a scale property for band/point but not others\n if (key === 'padding' && includePad(scale$1.type)) continue;\n // invoke scale property setter, raise warning if not found\n isFunction(scale$1[key]) ? scale$1[key](_[key]) : df.warn('Unsupported scale property: ' + key);\n }\n configureRange(scale$1, _, configureBins(scale$1, _, configureDomain(scale$1, _, df)));\n return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n }\n});\nfunction scaleKey(_) {\n var t = _.type,\n d = '',\n n;\n\n // backwards compatibility pre Vega 5.\n if (t === Sequential) return Sequential + '-' + Linear;\n if (isContinuousColor(_)) {\n n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0;\n d = n === 2 ? Sequential + '-' : n === 3 ? Diverging + '-' : '';\n }\n return (d + t || Linear).toLowerCase();\n}\nfunction isContinuousColor(_) {\n const t = _.type;\n return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(isString));\n}\nfunction configureDomain(scale, _, df) {\n // check raw domain, if provided use that and exit early\n const raw = rawDomain(scale, _.domainRaw, df);\n if (raw > -1) return raw;\n var domain = _.domain,\n type = scale.type,\n zero = _.zero || _.zero === undefined && includeZero(scale),\n n,\n mid;\n if (!domain) return 0;\n\n // adjust continuous domain for minimum pixel padding\n if (includePad(type) && _.padding && domain[0] !== peek(domain)) {\n domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant);\n }\n\n // adjust domain based on zero, min, max settings\n if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) {\n n = (domain = domain.slice()).length - 1 || 1;\n if (zero) {\n if (domain[0] > 0) domain[0] = 0;\n if (domain[n] < 0) domain[n] = 0;\n }\n if (_.domainMin != null) domain[0] = _.domainMin;\n if (_.domainMax != null) domain[n] = _.domainMax;\n if (_.domainMid != null) {\n mid = _.domainMid;\n const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n;\n if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid);\n domain.splice(i, 0, mid);\n }\n }\n\n // set the scale domain\n scale.domain(domainCheck(type, domain, df));\n\n // if ordinal scale domain is defined, prevent implicit\n // domain construction as side-effect of scale lookup\n if (type === Ordinal) {\n scale.unknown(_.domainImplicit ? scaleImplicit : undefined);\n }\n\n // perform 'nice' adjustment as requested\n if (_.nice && scale.nice) {\n scale.nice(_.nice !== true && tickCount(scale, _.nice) || null);\n }\n\n // return the cardinality of the domain\n return domain.length;\n}\nfunction rawDomain(scale, raw, df) {\n if (raw) {\n scale.domain(domainCheck(scale.type, raw, df));\n return raw.length;\n } else {\n return -1;\n }\n}\nfunction padDomain(type, domain, range, pad, exponent, constant) {\n var span = Math.abs(peek(range) - range[0]),\n frac = span / (span - 2 * pad),\n d = type === Log ? zoomLog(domain, null, frac) : type === Sqrt ? zoomPow(domain, null, frac, 0.5) : type === Pow ? zoomPow(domain, null, frac, exponent || 1) : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) : zoomLinear(domain, null, frac);\n domain = domain.slice();\n domain[0] = d[0];\n domain[domain.length - 1] = d[1];\n return domain;\n}\nfunction domainCheck(type, domain, df) {\n if (isLogarithmic(type)) {\n // sum signs of domain values\n // if all pos or all neg, abs(sum) === domain.length\n var s = Math.abs(domain.reduce((s, v) => s + (v < 0 ? -1 : v > 0 ? 1 : 0), 0));\n if (s !== domain.length) {\n df.warn('Log scale domain includes zero: ' + stringValue(domain));\n }\n }\n return domain;\n}\nfunction configureBins(scale, _, count) {\n let bins = _.bins;\n if (bins && !isArray(bins)) {\n // generate bin boundary array\n const domain = scale.domain(),\n lo = domain[0],\n hi = peek(domain),\n step = bins.step;\n let start = bins.start == null ? lo : bins.start,\n stop = bins.stop == null ? hi : bins.stop;\n if (!step) error('Scale bins parameter missing step property.');\n if (start < lo) start = step * Math.ceil(lo / step);\n if (stop > hi) stop = step * Math.floor(hi / step);\n bins = range(start, stop + step / 2, step);\n }\n if (bins) {\n // assign bin boundaries to scale instance\n scale.bins = bins;\n } else if (scale.bins) {\n // no current bins, remove bins if previously set\n delete scale.bins;\n }\n\n // special handling for bin-ordinal scales\n if (scale.type === BinOrdinal) {\n if (!bins) {\n // the domain specifies the bins\n scale.bins = scale.domain();\n } else if (!_.domain && !_.domainRaw) {\n // the bins specify the domain\n scale.domain(bins);\n count = bins.length;\n }\n }\n\n // return domain cardinality\n return count;\n}\nfunction configureRange(scale, _, count) {\n var type = scale.type,\n round = _.round || false,\n range = _.range;\n\n // if range step specified, calculate full range extent\n if (_.rangeStep != null) {\n range = configureRangeStep(type, _, count);\n }\n\n // else if a range scheme is defined, use that\n else if (_.scheme) {\n range = configureScheme(type, _, count);\n if (isFunction(range)) {\n if (scale.interpolator) {\n return scale.interpolator(range);\n } else {\n error(`Scale type ${type} does not support interpolating color schemes.`);\n }\n }\n }\n\n // given a range array for an interpolating scale, convert to interpolator\n if (range && isInterpolating(type)) {\n return scale.interpolator(interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma));\n }\n\n // configure rounding / interpolation\n if (range && _.interpolate && scale.interpolate) {\n scale.interpolate(interpolate(_.interpolate, _.interpolateGamma));\n } else if (isFunction(scale.round)) {\n scale.round(round);\n } else if (isFunction(scale.rangeRound)) {\n scale.interpolate(round ? interpolateRound : interpolate$1);\n }\n if (range) scale.range(flip(range, _.reverse));\n}\nfunction configureRangeStep(type, _, count) {\n if (type !== Band && type !== Point) {\n error('Only band and point scales support rangeStep.');\n }\n\n // calculate full range based on requested step size and padding\n var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0,\n inner = type === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0;\n return [0, _.rangeStep * bandSpace(count, inner, outer)];\n}\nfunction configureScheme(type, _, count) {\n var extent = _.schemeExtent,\n name,\n scheme$1;\n if (isArray(_.scheme)) {\n scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma);\n } else {\n name = _.scheme.toLowerCase();\n scheme$1 = scheme(name);\n if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`);\n }\n\n // determine size for potential discrete range\n count = type === Threshold ? count + 1 : type === BinOrdinal ? count - 1 : type === Quantile || type === Quantize ? +_.schemeCount || DEFAULT_COUNT : count;\n\n // adjust and/or quantize scheme as appropriate\n return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) : type === Ordinal ? scheme$1 : scheme$1.slice(0, count);\n}\nfunction adjustScheme(scheme, extent, reverse) {\n return isFunction(scheme) && (extent || reverse) ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) : scheme;\n}\nfunction flip(array, reverse) {\n return reverse ? array.slice().reverse() : array;\n}\n\n/**\n * Sorts scenegraph items in the pulse source array.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(*,*): number} [params.sort] - A comparator\n * function for sorting tuples.\n */\nfunction SortItems(params) {\n Transform.call(this, null, params);\n}\ninherits(SortItems, Transform, {\n transform(_, pulse) {\n const mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum');\n if (mod) pulse.source.sort(stableCompare(_.sort));\n this.modified(mod);\n return pulse;\n }\n});\n\nconst Zero = 'zero',\n Center = 'center',\n Normalize = 'normalize',\n DefOutput = ['y0', 'y1'];\n\n/**\n * Stack layout for visualization elements.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to stack.\n * @param {Array} [params.groupby] - An array of accessors to groupby.\n * @param {function(object,object): number} [params.sort] - A comparator for stack sorting.\n * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'.\n */\nfunction Stack(params) {\n Transform.call(this, null, params);\n}\nStack.Definition = {\n 'type': 'Stack',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'offset',\n 'type': 'enum',\n 'default': Zero,\n 'values': [Zero, Center, Normalize]\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': DefOutput\n }]\n};\ninherits(Stack, Transform, {\n transform(_, pulse) {\n var as = _.as || DefOutput,\n y0 = as[0],\n y1 = as[1],\n sort = stableCompare(_.sort),\n field = _.field || one,\n stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero,\n groups,\n i,\n n,\n max;\n\n // partition, sum, and sort the stack groups\n groups = partition(pulse.source, _.groupby, sort, field);\n\n // compute stack layouts per group\n for (i = 0, n = groups.length, max = groups.max; i < n; ++i) {\n stack(groups[i], max, field, y0, y1);\n }\n return pulse.reflow(_.modified()).modifies(as);\n }\n});\nfunction stackCenter(group, max, field, y0, y1) {\n var last = (max - group.sum) / 2,\n m = group.length,\n j = 0,\n t;\n for (; j < m; ++j) {\n t = group[j];\n t[y0] = last;\n t[y1] = last += Math.abs(field(t));\n }\n}\nfunction stackNormalize(group, max, field, y0, y1) {\n var scale = 1 / group.sum,\n last = 0,\n m = group.length,\n j = 0,\n v = 0,\n t;\n for (; j < m; ++j) {\n t = group[j];\n t[y0] = last;\n t[y1] = last = scale * (v += Math.abs(field(t)));\n }\n}\nfunction stackZero(group, max, field, y0, y1) {\n var lastPos = 0,\n lastNeg = 0,\n m = group.length,\n j = 0,\n v,\n t;\n for (; j < m; ++j) {\n t = group[j];\n v = +field(t);\n if (v < 0) {\n t[y0] = lastNeg;\n t[y1] = lastNeg += v;\n } else {\n t[y0] = lastPos;\n t[y1] = lastPos += v;\n }\n }\n}\nfunction partition(data, groupby, sort, field) {\n var groups = [],\n get = f => f(t),\n map,\n i,\n n,\n m,\n t,\n k,\n g,\n s,\n max;\n\n // partition data points into stack groups\n if (groupby == null) {\n groups.push(data.slice());\n } else {\n for (map = {}, i = 0, n = data.length; i < n; ++i) {\n t = data[i];\n k = groupby.map(get);\n g = map[k];\n if (!g) {\n map[k] = g = [];\n groups.push(g);\n }\n g.push(t);\n }\n }\n\n // compute sums of groups, sort groups as needed\n for (k = 0, max = 0, m = groups.length; k < m; ++k) {\n g = groups[k];\n for (i = 0, s = 0, n = g.length; i < n; ++i) {\n s += Math.abs(field(g[i]));\n }\n g.sum = s;\n if (s > max) max = s;\n if (sort) g.sort(sort);\n }\n groups.max = max;\n return groups;\n}\n\nexport { AxisTicks as axisticks, DataJoin as datajoin, Encode as encode, LegendEntries as legendentries, LinkPath as linkpath, Pie as pie, Scale as scale, SortItems as sortitems, Stack as stack };\n","export default x => x;\n","function streamGeometry(geometry, stream) {\n if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {\n streamGeometryType[geometry.type](geometry, stream);\n }\n}\n\nvar streamObjectType = {\n Feature: function(object, stream) {\n streamGeometry(object.geometry, stream);\n },\n FeatureCollection: function(object, stream) {\n var features = object.features, i = -1, n = features.length;\n while (++i < n) streamGeometry(features[i].geometry, stream);\n }\n};\n\nvar streamGeometryType = {\n Sphere: function(object, stream) {\n stream.sphere();\n },\n Point: function(object, stream) {\n object = object.coordinates;\n stream.point(object[0], object[1], object[2]);\n },\n MultiPoint: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);\n },\n LineString: function(object, stream) {\n streamLine(object.coordinates, stream, 0);\n },\n MultiLineString: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamLine(coordinates[i], stream, 0);\n },\n Polygon: function(object, stream) {\n streamPolygon(object.coordinates, stream);\n },\n MultiPolygon: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamPolygon(coordinates[i], stream);\n },\n GeometryCollection: function(object, stream) {\n var geometries = object.geometries, i = -1, n = geometries.length;\n while (++i < n) streamGeometry(geometries[i], stream);\n }\n};\n\nfunction streamLine(coordinates, stream, closed) {\n var i = -1, n = coordinates.length - closed, coordinate;\n stream.lineStart();\n while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);\n stream.lineEnd();\n}\n\nfunction streamPolygon(coordinates, stream) {\n var i = -1, n = coordinates.length;\n stream.polygonStart();\n while (++i < n) streamLine(coordinates[i], stream, 1);\n stream.polygonEnd();\n}\n\nexport default function(object, stream) {\n if (object && streamObjectType.hasOwnProperty(object.type)) {\n streamObjectType[object.type](object, stream);\n } else {\n streamGeometry(object, stream);\n }\n}\n","// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423\nexport class Adder {\n constructor() {\n this._partials = new Float64Array(32);\n this._n = 0;\n }\n add(x) {\n const p = this._partials;\n let i = 0;\n for (let j = 0; j < this._n && j < 32; j++) {\n const y = p[j],\n hi = x + y,\n lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);\n if (lo) p[i++] = lo;\n x = hi;\n }\n p[i] = x;\n this._n = i + 1;\n return this;\n }\n valueOf() {\n const p = this._partials;\n let n = this._n, x, y, lo, hi = 0;\n if (n > 0) {\n hi = p[--n];\n while (n > 0) {\n x = hi;\n y = p[--n];\n hi = x + y;\n lo = y - (hi - x);\n if (lo) break;\n }\n if (n > 0 && ((lo < 0 && p[n - 1] < 0) || (lo > 0 && p[n - 1] > 0))) {\n y = lo * 2;\n x = hi + y;\n if (y == x - hi) hi = x;\n }\n }\n return hi;\n }\n}\n\nexport function fsum(values, valueof) {\n const adder = new Adder();\n if (valueof === undefined) {\n for (let value of values) {\n if (value = +value) {\n adder.add(value);\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if (value = +valueof(value, ++index, values)) {\n adder.add(value);\n }\n }\n }\n return +adder;\n}\n\nexport function fcumsum(values, valueof) {\n const adder = new Adder();\n let index = -1;\n return Float64Array.from(values, valueof === undefined\n ? v => adder.add(+v || 0)\n : v => adder.add(+valueof(v, ++index, values) || 0)\n );\n}\n","export var epsilon = 1e-6;\nexport var epsilon2 = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var quarterPi = pi / 4;\nexport var tau = pi * 2;\n\nexport var degrees = 180 / pi;\nexport var radians = pi / 180;\n\nexport var abs = Math.abs;\nexport var atan = Math.atan;\nexport var atan2 = Math.atan2;\nexport var cos = Math.cos;\nexport var ceil = Math.ceil;\nexport var exp = Math.exp;\nexport var floor = Math.floor;\nexport var hypot = Math.hypot;\nexport var log = Math.log;\nexport var pow = Math.pow;\nexport var sin = Math.sin;\nexport var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };\nexport var sqrt = Math.sqrt;\nexport var tan = Math.tan;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n}\n\nexport function haversin(x) {\n return (x = sin(x / 2)) * x;\n}\n","export default function noop() {}\n","import {Adder} from \"d3-array\";\nimport {abs} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar areaSum = new Adder(),\n areaRingSum = new Adder(),\n x00,\n y00,\n x0,\n y0;\n\nvar areaStream = {\n point: noop,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: function() {\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function() {\n areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop;\n areaSum.add(abs(areaRingSum));\n areaRingSum = new Adder();\n },\n result: function() {\n var area = areaSum / 2;\n areaSum = new Adder();\n return area;\n }\n};\n\nfunction areaRingStart() {\n areaStream.point = areaPointFirst;\n}\n\nfunction areaPointFirst(x, y) {\n areaStream.point = areaPoint;\n x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction areaPoint(x, y) {\n areaRingSum.add(y0 * x - x0 * y);\n x0 = x, y0 = y;\n}\n\nfunction areaRingEnd() {\n areaPoint(x00, y00);\n}\n\nexport default areaStream;\n","import noop from \"../noop.js\";\n\nvar x0 = Infinity,\n y0 = x0,\n x1 = -x0,\n y1 = x1;\n\nvar boundsStream = {\n point: boundsPoint,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: noop,\n polygonEnd: noop,\n result: function() {\n var bounds = [[x0, y0], [x1, y1]];\n x1 = y1 = -(y0 = x0 = Infinity);\n return bounds;\n }\n};\n\nfunction boundsPoint(x, y) {\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n}\n\nexport default boundsStream;\n","import {sqrt} from \"../math.js\";\n\n// TODO Enforce positive area for exterior, negative area for interior?\n\nvar X0 = 0,\n Y0 = 0,\n Z0 = 0,\n X1 = 0,\n Y1 = 0,\n Z1 = 0,\n X2 = 0,\n Y2 = 0,\n Z2 = 0,\n x00,\n y00,\n x0,\n y0;\n\nvar centroidStream = {\n point: centroidPoint,\n lineStart: centroidLineStart,\n lineEnd: centroidLineEnd,\n polygonStart: function() {\n centroidStream.lineStart = centroidRingStart;\n centroidStream.lineEnd = centroidRingEnd;\n },\n polygonEnd: function() {\n centroidStream.point = centroidPoint;\n centroidStream.lineStart = centroidLineStart;\n centroidStream.lineEnd = centroidLineEnd;\n },\n result: function() {\n var centroid = Z2 ? [X2 / Z2, Y2 / Z2]\n : Z1 ? [X1 / Z1, Y1 / Z1]\n : Z0 ? [X0 / Z0, Y0 / Z0]\n : [NaN, NaN];\n X0 = Y0 = Z0 =\n X1 = Y1 = Z1 =\n X2 = Y2 = Z2 = 0;\n return centroid;\n }\n};\n\nfunction centroidPoint(x, y) {\n X0 += x;\n Y0 += y;\n ++Z0;\n}\n\nfunction centroidLineStart() {\n centroidStream.point = centroidPointFirstLine;\n}\n\nfunction centroidPointFirstLine(x, y) {\n centroidStream.point = centroidPointLine;\n centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidPointLine(x, y) {\n var dx = x - x0, dy = y - y0, z = sqrt(dx * dx + dy * dy);\n X1 += z * (x0 + x) / 2;\n Y1 += z * (y0 + y) / 2;\n Z1 += z;\n centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidLineEnd() {\n centroidStream.point = centroidPoint;\n}\n\nfunction centroidRingStart() {\n centroidStream.point = centroidPointFirstRing;\n}\n\nfunction centroidRingEnd() {\n centroidPointRing(x00, y00);\n}\n\nfunction centroidPointFirstRing(x, y) {\n centroidStream.point = centroidPointRing;\n centroidPoint(x00 = x0 = x, y00 = y0 = y);\n}\n\nfunction centroidPointRing(x, y) {\n var dx = x - x0,\n dy = y - y0,\n z = sqrt(dx * dx + dy * dy);\n\n X1 += z * (x0 + x) / 2;\n Y1 += z * (y0 + y) / 2;\n Z1 += z;\n\n z = y0 * x - x0 * y;\n X2 += z * (x0 + x);\n Y2 += z * (y0 + y);\n Z2 += z * 3;\n centroidPoint(x0 = x, y0 = y);\n}\n\nexport default centroidStream;\n","import {tau} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nexport default function PathContext(context) {\n this._context = context;\n}\n\nPathContext.prototype = {\n _radius: 4.5,\n pointRadius: function(_) {\n return this._radius = _, this;\n },\n polygonStart: function() {\n this._line = 0;\n },\n polygonEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line === 0) this._context.closePath();\n this._point = NaN;\n },\n point: function(x, y) {\n switch (this._point) {\n case 0: {\n this._context.moveTo(x, y);\n this._point = 1;\n break;\n }\n case 1: {\n this._context.lineTo(x, y);\n break;\n }\n default: {\n this._context.moveTo(x + this._radius, y);\n this._context.arc(x, y, this._radius, 0, tau);\n break;\n }\n }\n },\n result: noop\n};\n","import {Adder} from \"d3-array\";\nimport {sqrt} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar lengthSum = new Adder(),\n lengthRing,\n x00,\n y00,\n x0,\n y0;\n\nvar lengthStream = {\n point: noop,\n lineStart: function() {\n lengthStream.point = lengthPointFirst;\n },\n lineEnd: function() {\n if (lengthRing) lengthPoint(x00, y00);\n lengthStream.point = noop;\n },\n polygonStart: function() {\n lengthRing = true;\n },\n polygonEnd: function() {\n lengthRing = null;\n },\n result: function() {\n var length = +lengthSum;\n lengthSum = new Adder();\n return length;\n }\n};\n\nfunction lengthPointFirst(x, y) {\n lengthStream.point = lengthPoint;\n x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction lengthPoint(x, y) {\n x0 -= x, y0 -= y;\n lengthSum.add(sqrt(x0 * x0 + y0 * y0));\n x0 = x, y0 = y;\n}\n\nexport default lengthStream;\n","// Simple caching for constant-radius points.\nlet cacheDigits, cacheAppend, cacheRadius, cacheCircle;\n\nexport default class PathString {\n constructor(digits) {\n this._append = digits == null ? append : appendRound(digits);\n this._radius = 4.5;\n this._ = \"\";\n }\n pointRadius(_) {\n this._radius = +_;\n return this;\n }\n polygonStart() {\n this._line = 0;\n }\n polygonEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {\n if (this._line === 0) this._ += \"Z\";\n this._point = NaN;\n }\n point(x, y) {\n switch (this._point) {\n case 0: {\n this._append`M${x},${y}`;\n this._point = 1;\n break;\n }\n case 1: {\n this._append`L${x},${y}`;\n break;\n }\n default: {\n this._append`M${x},${y}`;\n if (this._radius !== cacheRadius || this._append !== cacheAppend) {\n const r = this._radius;\n const s = this._;\n this._ = \"\"; // stash the old string so we can cache the circle path fragment\n this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;\n cacheRadius = r;\n cacheAppend = this._append;\n cacheCircle = this._;\n this._ = s;\n }\n this._ += cacheCircle;\n break;\n }\n }\n }\n result() {\n const result = this._;\n this._ = \"\";\n return result.length ? result : null;\n }\n}\n\nfunction append(strings) {\n let i = 1;\n this._ += strings[0];\n for (const j = strings.length; i < j; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n const d = Math.floor(digits);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`);\n if (d > 15) return append;\n if (d !== cacheDigits) {\n const k = 10 ** d;\n cacheDigits = d;\n cacheAppend = function append(strings) {\n let i = 1;\n this._ += strings[0];\n for (const j = strings.length; i < j; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n }\n return cacheAppend;\n}\n","import identity from \"../identity.js\";\nimport stream from \"../stream.js\";\nimport pathArea from \"./area.js\";\nimport pathBounds from \"./bounds.js\";\nimport pathCentroid from \"./centroid.js\";\nimport PathContext from \"./context.js\";\nimport pathMeasure from \"./measure.js\";\nimport PathString from \"./string.js\";\n\nexport default function(projection, context) {\n let digits = 3,\n pointRadius = 4.5,\n projectionStream,\n contextStream;\n\n function path(object) {\n if (object) {\n if (typeof pointRadius === \"function\") contextStream.pointRadius(+pointRadius.apply(this, arguments));\n stream(object, projectionStream(contextStream));\n }\n return contextStream.result();\n }\n\n path.area = function(object) {\n stream(object, projectionStream(pathArea));\n return pathArea.result();\n };\n\n path.measure = function(object) {\n stream(object, projectionStream(pathMeasure));\n return pathMeasure.result();\n };\n\n path.bounds = function(object) {\n stream(object, projectionStream(pathBounds));\n return pathBounds.result();\n };\n\n path.centroid = function(object) {\n stream(object, projectionStream(pathCentroid));\n return pathCentroid.result();\n };\n\n path.projection = function(_) {\n if (!arguments.length) return projection;\n projectionStream = _ == null ? (projection = null, identity) : (projection = _).stream;\n return path;\n };\n\n path.context = function(_) {\n if (!arguments.length) return context;\n contextStream = _ == null ? (context = null, new PathString(digits)) : new PathContext(context = _);\n if (typeof pointRadius !== \"function\") contextStream.pointRadius(pointRadius);\n return path;\n };\n\n path.pointRadius = function(_) {\n if (!arguments.length) return pointRadius;\n pointRadius = typeof _ === \"function\" ? _ : (contextStream.pointRadius(+_), +_);\n return path;\n };\n\n path.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) digits = null;\n else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n if (context === null) contextStream = new PathString(digits);\n return path;\n };\n\n return path.projection(projection).digits(digits).context(context);\n}\n","import noop from \"../noop.js\";\n\nexport default function() {\n var lines = [],\n line;\n return {\n point: function(x, y, m) {\n line.push([x, y, m]);\n },\n lineStart: function() {\n lines.push(line = []);\n },\n lineEnd: noop,\n rejoin: function() {\n if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));\n },\n result: function() {\n var result = lines;\n lines = [];\n line = null;\n return result;\n }\n };\n}\n","import {abs, epsilon} from \"./math.js\";\n\nexport default function(a, b) {\n return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;\n}\n","import pointEqual from \"../pointEqual.js\";\nimport {epsilon} from \"../math.js\";\n\nfunction Intersection(point, points, other, entry) {\n this.x = point;\n this.z = points;\n this.o = other; // another intersection\n this.e = entry; // is an entry?\n this.v = false; // visited\n this.n = this.p = null; // next & previous\n}\n\n// A generalized polygon clipping algorithm: given a polygon that has been cut\n// into its visible line segments, and rejoins the segments by interpolating\n// along the clip edge.\nexport default function(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}\n\nfunction link(array) {\n if (!(n = array.length)) return;\n var n,\n i = 0,\n a = array[0],\n b;\n while (++i < n) {\n a.n = b = array[i];\n b.p = a;\n a = b;\n }\n a.n = b = array[0];\n b.p = a;\n}\n","import {asin, atan2, cos, sin, sqrt} from \"./math.js\";\n\nexport function spherical(cartesian) {\n return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];\n}\n\nexport function cartesian(spherical) {\n var lambda = spherical[0], phi = spherical[1], cosPhi = cos(phi);\n return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];\n}\n\nexport function cartesianDot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\nexport function cartesianCross(a, b) {\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\n}\n\n// TODO return a\nexport function cartesianAddInPlace(a, b) {\n a[0] += b[0], a[1] += b[1], a[2] += b[2];\n}\n\nexport function cartesianScale(vector, k) {\n return [vector[0] * k, vector[1] * k, vector[2] * k];\n}\n\n// TODO return d\nexport function cartesianNormalizeInPlace(d) {\n var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);\n d[0] /= l, d[1] /= l, d[2] /= l;\n}\n","import {Adder} from \"d3-array\";\nimport {cartesian, cartesianCross, cartesianNormalizeInPlace} from \"./cartesian.js\";\nimport {abs, asin, atan2, cos, epsilon, epsilon2, halfPi, pi, quarterPi, sign, sin, tau} from \"./math.js\";\n\nfunction longitude(point) {\n return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);\n}\n\nexport default function(polygon, point) {\n var lambda = longitude(point),\n phi = point[1],\n sinPhi = sin(phi),\n normal = [sin(lambda), -cos(lambda), 0],\n angle = 0,\n winding = 0;\n\n var sum = new Adder();\n\n if (sinPhi === 1) phi = halfPi + epsilon;\n else if (sinPhi === -1) phi = -halfPi - epsilon;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n if (!(m = (ring = polygon[i]).length)) continue;\n var ring,\n m,\n point0 = ring[m - 1],\n lambda0 = longitude(point0),\n phi0 = point0[1] / 2 + quarterPi,\n sinPhi0 = sin(phi0),\n cosPhi0 = cos(phi0);\n\n for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {\n var point1 = ring[j],\n lambda1 = longitude(point1),\n phi1 = point1[1] / 2 + quarterPi,\n sinPhi1 = sin(phi1),\n cosPhi1 = cos(phi1),\n delta = lambda1 - lambda0,\n sign = delta >= 0 ? 1 : -1,\n absDelta = sign * delta,\n antimeridian = absDelta > pi,\n k = sinPhi0 * sinPhi1;\n\n sum.add(atan2(k * sign * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta)));\n angle += antimeridian ? delta + sign * tau : delta;\n\n // Are the longitudes either side of the point’s meridian (lambda),\n // and are the latitudes smaller than the parallel (phi)?\n if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {\n var arc = cartesianCross(cartesian(point0), cartesian(point1));\n cartesianNormalizeInPlace(arc);\n var intersection = cartesianCross(normal, arc);\n cartesianNormalizeInPlace(intersection);\n var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);\n if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {\n winding += antimeridian ^ delta >= 0 ? 1 : -1;\n }\n }\n }\n }\n\n // First, determine whether the South pole is inside or outside:\n //\n // It is inside if:\n // * the polygon winds around it in a clockwise direction.\n // * the polygon does not (cumulatively) wind around it, but has a negative\n // (counter-clockwise) area.\n //\n // Second, count the (signed) number of times a segment crosses a lambda\n // from the point to the South pole. If it is zero, then the point is the\n // same side as the South pole.\n\n return (angle < -epsilon || angle < epsilon && sum < -epsilon2) ^ (winding & 1);\n}\n","function* flatten(arrays) {\n for (const array of arrays) {\n yield* array;\n }\n}\n\nexport default function merge(arrays) {\n return Array.from(flatten(arrays));\n}\n","import clipBuffer from \"./buffer.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport {epsilon, halfPi} from \"../math.js\";\nimport polygonContains from \"../polygonContains.js\";\nimport {merge} from \"d3-array\";\n\nexport default function(pointVisible, clipLine, interpolate, start) {\n return function(sink) {\n var line = clipLine(sink),\n ringBuffer = clipBuffer(),\n ringSink = clipLine(ringBuffer),\n polygonStarted = false,\n polygon,\n segments,\n ring;\n\n var clip = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() {\n clip.point = pointRing;\n clip.lineStart = ringStart;\n clip.lineEnd = ringEnd;\n segments = [];\n polygon = [];\n },\n polygonEnd: function() {\n clip.point = point;\n clip.lineStart = lineStart;\n clip.lineEnd = lineEnd;\n segments = merge(segments);\n var startInside = polygonContains(polygon, start);\n if (segments.length) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n clipRejoin(segments, compareIntersection, startInside, interpolate, sink);\n } else if (startInside) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n }\n if (polygonStarted) sink.polygonEnd(), polygonStarted = false;\n segments = polygon = null;\n },\n sphere: function() {\n sink.polygonStart();\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n sink.polygonEnd();\n }\n };\n\n function point(lambda, phi) {\n if (pointVisible(lambda, phi)) sink.point(lambda, phi);\n }\n\n function pointLine(lambda, phi) {\n line.point(lambda, phi);\n }\n\n function lineStart() {\n clip.point = pointLine;\n line.lineStart();\n }\n\n function lineEnd() {\n clip.point = point;\n line.lineEnd();\n }\n\n function pointRing(lambda, phi) {\n ring.push([lambda, phi]);\n ringSink.point(lambda, phi);\n }\n\n function ringStart() {\n ringSink.lineStart();\n ring = [];\n }\n\n function ringEnd() {\n pointRing(ring[0][0], ring[0][1]);\n ringSink.lineEnd();\n\n var clean = ringSink.clean(),\n ringSegments = ringBuffer.result(),\n i, n = ringSegments.length, m,\n segment,\n point;\n\n ring.pop();\n polygon.push(ring);\n ring = null;\n\n if (!n) return;\n\n // No intersections.\n if (clean & 1) {\n segment = ringSegments[0];\n if ((m = segment.length - 1) > 0) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);\n sink.lineEnd();\n }\n return;\n }\n\n // Rejoin connected segments.\n // TODO reuse ringBuffer.rejoin()?\n if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));\n\n segments.push(ringSegments.filter(validSegment));\n }\n\n return clip;\n };\n}\n\nfunction validSegment(segment) {\n return segment.length > 1;\n}\n\n// Intersections are sorted along the clip edge. For both antimeridian cutting\n// and circle clipping, the same comparison is used.\nfunction compareIntersection(a, b) {\n return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1])\n - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]);\n}\n","import clip from \"./index.js\";\nimport {abs, atan, cos, epsilon, halfPi, pi, sin} from \"../math.js\";\n\nexport default clip(\n function() { return true; },\n clipAntimeridianLine,\n clipAntimeridianInterpolate,\n [-pi, -halfPi]\n);\n\n// Takes a line and cuts into visible segments. Return values: 0 - there were\n// intersections or the line was empty; 1 - no intersections; 2 - there were\n// intersections, and the first and last segments should be rejoined.\nfunction clipAntimeridianLine(stream) {\n var lambda0 = NaN,\n phi0 = NaN,\n sign0 = NaN,\n clean; // no intersections\n\n return {\n lineStart: function() {\n stream.lineStart();\n clean = 1;\n },\n point: function(lambda1, phi1) {\n var sign1 = lambda1 > 0 ? pi : -pi,\n delta = abs(lambda1 - lambda0);\n if (abs(delta - pi) < epsilon) { // line crosses a pole\n stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n stream.point(lambda1, phi0);\n clean = 0;\n } else if (sign0 !== sign1 && delta >= pi) { // line crosses antimeridian\n if (abs(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon; // handle degeneracies\n if (abs(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon;\n phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n clean = 0;\n }\n stream.point(lambda0 = lambda1, phi0 = phi1);\n sign0 = sign1;\n },\n lineEnd: function() {\n stream.lineEnd();\n lambda0 = phi0 = NaN;\n },\n clean: function() {\n return 2 - clean; // if intersections, rejoin first and last segments\n }\n };\n}\n\nfunction clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {\n var cosPhi0,\n cosPhi1,\n sinLambda0Lambda1 = sin(lambda0 - lambda1);\n return abs(sinLambda0Lambda1) > epsilon\n ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1)\n - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0))\n / (cosPhi0 * cosPhi1 * sinLambda0Lambda1))\n : (phi0 + phi1) / 2;\n}\n\nfunction clipAntimeridianInterpolate(from, to, direction, stream) {\n var phi;\n if (from == null) {\n phi = direction * halfPi;\n stream.point(-pi, phi);\n stream.point(0, phi);\n stream.point(pi, phi);\n stream.point(pi, 0);\n stream.point(pi, -phi);\n stream.point(0, -phi);\n stream.point(-pi, -phi);\n stream.point(-pi, 0);\n stream.point(-pi, phi);\n } else if (abs(from[0] - to[0]) > epsilon) {\n var lambda = from[0] < to[0] ? pi : -pi;\n phi = direction * lambda / 2;\n stream.point(-lambda, phi);\n stream.point(0, phi);\n stream.point(lambda, phi);\n } else {\n stream.point(to[0], to[1]);\n }\n}\n","import {cartesian, cartesianNormalizeInPlace, spherical} from \"./cartesian.js\";\nimport constant from \"./constant.js\";\nimport {acos, cos, degrees, epsilon, radians, sin, tau} from \"./math.js\";\nimport {rotateRadians} from \"./rotation.js\";\n\n// Generates a circle centered at [0°, 0°], with a given radius and precision.\nexport function circleStream(stream, radius, delta, direction, t0, t1) {\n if (!delta) return;\n var cosRadius = cos(radius),\n sinRadius = sin(radius),\n step = direction * delta;\n if (t0 == null) {\n t0 = radius + direction * tau;\n t1 = radius - step / 2;\n } else {\n t0 = circleRadius(cosRadius, t0);\n t1 = circleRadius(cosRadius, t1);\n if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau;\n }\n for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {\n point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);\n stream.point(point[0], point[1]);\n }\n}\n\n// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].\nfunction circleRadius(cosRadius, point) {\n point = cartesian(point), point[0] -= cosRadius;\n cartesianNormalizeInPlace(point);\n var radius = acos(-point[1]);\n return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;\n}\n\nexport default function() {\n var center = constant([0, 0]),\n radius = constant(90),\n precision = constant(6),\n ring,\n rotate,\n stream = {point: point};\n\n function point(x, y) {\n ring.push(x = rotate(x, y));\n x[0] *= degrees, x[1] *= degrees;\n }\n\n function circle() {\n var c = center.apply(this, arguments),\n r = radius.apply(this, arguments) * radians,\n p = precision.apply(this, arguments) * radians;\n ring = [];\n rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert;\n circleStream(stream, r, p, 1);\n c = {type: \"Polygon\", coordinates: [ring]};\n ring = rotate = null;\n return c;\n }\n\n circle.center = function(_) {\n return arguments.length ? (center = typeof _ === \"function\" ? _ : constant([+_[0], +_[1]]), circle) : center;\n };\n\n circle.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant(+_), circle) : radius;\n };\n\n circle.precision = function(_) {\n return arguments.length ? (precision = typeof _ === \"function\" ? _ : constant(+_), circle) : precision;\n };\n\n return circle;\n}\n","import {abs, epsilon} from \"../math.js\";\nimport clipBuffer from \"./buffer.js\";\nimport clipLine from \"./line.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport {merge} from \"d3-array\";\n\nvar clipMax = 1e9, clipMin = -clipMax;\n\n// TODO Use d3-polygon’s polygonContains here for the ring check?\n// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?\n\nexport default function clipRectangle(x0, y0, x1, y1) {\n\n function visible(x, y) {\n return x0 <= x && x <= x1 && y0 <= y && y <= y1;\n }\n\n function interpolate(from, to, direction, stream) {\n var a = 0, a1 = 0;\n if (from == null\n || (a = corner(from, direction)) !== (a1 = corner(to, direction))\n || comparePoint(from, to) < 0 ^ direction > 0) {\n do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);\n while ((a = (a + direction + 4) % 4) !== a1);\n } else {\n stream.point(to[0], to[1]);\n }\n }\n\n function corner(p, direction) {\n return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3\n : abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1\n : abs(p[1] - y0) < epsilon ? direction > 0 ? 1 : 0\n : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon\n }\n\n function compareIntersection(a, b) {\n return comparePoint(a.x, b.x);\n }\n\n function comparePoint(a, b) {\n var ca = corner(a, 1),\n cb = corner(b, 1);\n return ca !== cb ? ca - cb\n : ca === 0 ? b[1] - a[1]\n : ca === 1 ? a[0] - b[0]\n : ca === 2 ? a[1] - b[1]\n : b[0] - a[0];\n }\n\n return function(stream) {\n var activeStream = stream,\n bufferStream = clipBuffer(),\n segments,\n polygon,\n ring,\n x__, y__, v__, // first point\n x_, y_, v_, // previous point\n first,\n clean;\n\n var clipStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: polygonStart,\n polygonEnd: polygonEnd\n };\n\n function point(x, y) {\n if (visible(x, y)) activeStream.point(x, y);\n }\n\n function polygonInside() {\n var winding = 0;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {\n a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];\n if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; }\n else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; }\n }\n }\n\n return winding;\n }\n\n // Buffer geometry within a polygon and then clip it en masse.\n function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }\n\n function polygonEnd() {\n var startInside = polygonInside(),\n cleanInside = clean && startInside,\n visible = (segments = merge(segments)).length;\n if (cleanInside || visible) {\n stream.polygonStart();\n if (cleanInside) {\n stream.lineStart();\n interpolate(null, null, 1, stream);\n stream.lineEnd();\n }\n if (visible) {\n clipRejoin(segments, compareIntersection, startInside, interpolate, stream);\n }\n stream.polygonEnd();\n }\n activeStream = stream, segments = polygon = ring = null;\n }\n\n function lineStart() {\n clipStream.point = linePoint;\n if (polygon) polygon.push(ring = []);\n first = true;\n v_ = false;\n x_ = y_ = NaN;\n }\n\n // TODO rather than special-case polygons, simply handle them separately.\n // Ideally, coincident intersection points should be jittered to avoid\n // clipping issues.\n function lineEnd() {\n if (segments) {\n linePoint(x__, y__);\n if (v__ && v_) bufferStream.rejoin();\n segments.push(bufferStream.result());\n }\n clipStream.point = point;\n if (v_) activeStream.lineEnd();\n }\n\n function linePoint(x, y) {\n var v = visible(x, y);\n if (polygon) ring.push([x, y]);\n if (first) {\n x__ = x, y__ = y, v__ = v;\n first = false;\n if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n }\n } else {\n if (v && v_) activeStream.point(x, y);\n else {\n var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],\n b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];\n if (clipLine(a, b, x0, y0, x1, y1)) {\n if (!v_) {\n activeStream.lineStart();\n activeStream.point(a[0], a[1]);\n }\n activeStream.point(b[0], b[1]);\n if (!v) activeStream.lineEnd();\n clean = false;\n } else if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n clean = false;\n }\n }\n }\n x_ = x, y_ = y, v_ = v;\n }\n\n return clipStream;\n };\n}\n","export default function(a, b, x0, y0, x1, y1) {\n var ax = a[0],\n ay = a[1],\n bx = b[0],\n by = b[1],\n t0 = 0,\n t1 = 1,\n dx = bx - ax,\n dy = by - ay,\n r;\n\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dx > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dx > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dy > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dy > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;\n if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;\n return true;\n}\n","export default function(a, b) {\n\n function compose(x, y) {\n return x = a(x, y), b(x[0], x[1]);\n }\n\n if (a.invert && b.invert) compose.invert = function(x, y) {\n return x = b.invert(x, y), x && a.invert(x[0], x[1]);\n };\n\n return compose;\n}\n","import compose from \"./compose.js\";\nimport {abs, asin, atan2, cos, degrees, pi, radians, sin, tau} from \"./math.js\";\n\nfunction rotationIdentity(lambda, phi) {\n if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;\n return [lambda, phi];\n}\n\nrotationIdentity.invert = rotationIdentity;\n\nexport function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {\n return (deltaLambda %= tau) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma))\n : rotationLambda(deltaLambda))\n : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma)\n : rotationIdentity);\n}\n\nfunction forwardRotationLambda(deltaLambda) {\n return function(lambda, phi) {\n lambda += deltaLambda;\n if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;\n return [lambda, phi];\n };\n}\n\nfunction rotationLambda(deltaLambda) {\n var rotation = forwardRotationLambda(deltaLambda);\n rotation.invert = forwardRotationLambda(-deltaLambda);\n return rotation;\n}\n\nfunction rotationPhiGamma(deltaPhi, deltaGamma) {\n var cosDeltaPhi = cos(deltaPhi),\n sinDeltaPhi = sin(deltaPhi),\n cosDeltaGamma = cos(deltaGamma),\n sinDeltaGamma = sin(deltaGamma);\n\n function rotation(lambda, phi) {\n var cosPhi = cos(phi),\n x = cos(lambda) * cosPhi,\n y = sin(lambda) * cosPhi,\n z = sin(phi),\n k = z * cosDeltaPhi + x * sinDeltaPhi;\n return [\n atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),\n asin(k * cosDeltaGamma + y * sinDeltaGamma)\n ];\n }\n\n rotation.invert = function(lambda, phi) {\n var cosPhi = cos(phi),\n x = cos(lambda) * cosPhi,\n y = sin(lambda) * cosPhi,\n z = sin(phi),\n k = z * cosDeltaGamma - y * sinDeltaGamma;\n return [\n atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),\n asin(k * cosDeltaPhi - x * sinDeltaPhi)\n ];\n };\n\n return rotation;\n}\n\nexport default function(rotate) {\n rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);\n\n function forward(coordinates) {\n coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;\n }\n\n forward.invert = function(coordinates) {\n coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;\n };\n\n return forward;\n}\n","export default function(methods) {\n return {\n stream: transformer(methods)\n };\n}\n\nexport function transformer(methods) {\n return function(stream) {\n var s = new TransformStream;\n for (var key in methods) s[key] = methods[key];\n s.stream = stream;\n return s;\n };\n}\n\nfunction TransformStream() {}\n\nTransformStream.prototype = {\n constructor: TransformStream,\n point: function(x, y) { this.stream.point(x, y); },\n sphere: function() { this.stream.sphere(); },\n lineStart: function() { this.stream.lineStart(); },\n lineEnd: function() { this.stream.lineEnd(); },\n polygonStart: function() { this.stream.polygonStart(); },\n polygonEnd: function() { this.stream.polygonEnd(); }\n};\n","import {default as geoStream} from \"../stream.js\";\nimport boundsStream from \"../path/bounds.js\";\n\nfunction fit(projection, fitBounds, object) {\n var clip = projection.clipExtent && projection.clipExtent();\n projection.scale(150).translate([0, 0]);\n if (clip != null) projection.clipExtent(null);\n geoStream(object, projection.stream(boundsStream));\n fitBounds(boundsStream.result());\n if (clip != null) projection.clipExtent(clip);\n return projection;\n}\n\nexport function fitExtent(projection, extent, object) {\n return fit(projection, function(b) {\n var w = extent[1][0] - extent[0][0],\n h = extent[1][1] - extent[0][1],\n k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),\n x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,\n y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n\nexport function fitSize(projection, size, object) {\n return fitExtent(projection, [[0, 0], size], object);\n}\n\nexport function fitWidth(projection, width, object) {\n return fit(projection, function(b) {\n var w = +width,\n k = w / (b[1][0] - b[0][0]),\n x = (w - k * (b[1][0] + b[0][0])) / 2,\n y = -k * b[0][1];\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n\nexport function fitHeight(projection, height, object) {\n return fit(projection, function(b) {\n var h = +height,\n k = h / (b[1][1] - b[0][1]),\n x = -k * b[0][0],\n y = (h - k * (b[1][1] + b[0][1])) / 2;\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n","import {cartesian} from \"../cartesian.js\";\nimport {abs, asin, atan2, cos, epsilon, radians, sqrt} from \"../math.js\";\nimport {transformer} from \"../transform.js\";\n\nvar maxDepth = 16, // maximum depth of subdivision\n cosMinDistance = cos(30 * radians); // cos(minimum angular distance)\n\nexport default function(project, delta2) {\n return +delta2 ? resample(project, delta2) : resampleNone(project);\n}\n\nfunction resampleNone(project) {\n return transformer({\n point: function(x, y) {\n x = project(x, y);\n this.stream.point(x[0], x[1]);\n }\n });\n}\n\nfunction resample(project, delta2) {\n\n function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {\n var dx = x1 - x0,\n dy = y1 - y0,\n d2 = dx * dx + dy * dy;\n if (d2 > 4 * delta2 && depth--) {\n var a = a0 + a1,\n b = b0 + b1,\n c = c0 + c1,\n m = sqrt(a * a + b * b + c * c),\n phi2 = asin(c /= m),\n lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a),\n p = project(lambda2, phi2),\n x2 = p[0],\n y2 = p[1],\n dx2 = x2 - x0,\n dy2 = y2 - y0,\n dz = dy * dx2 - dx * dy2;\n if (dz * dz / d2 > delta2 // perpendicular projected distance\n || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end\n || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);\n stream.point(x2, y2);\n resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream);\n }\n }\n }\n return function(stream) {\n var lambda00, x00, y00, a00, b00, c00, // first point\n lambda0, x0, y0, a0, b0, c0; // previous point\n\n var resampleStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; },\n polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; }\n };\n\n function point(x, y) {\n x = project(x, y);\n stream.point(x[0], x[1]);\n }\n\n function lineStart() {\n x0 = NaN;\n resampleStream.point = linePoint;\n stream.lineStart();\n }\n\n function linePoint(lambda, phi) {\n var c = cartesian([lambda, phi]), p = project(lambda, phi);\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);\n stream.point(x0, y0);\n }\n\n function lineEnd() {\n resampleStream.point = point;\n stream.lineEnd();\n }\n\n function ringStart() {\n lineStart();\n resampleStream.point = ringPoint;\n resampleStream.lineEnd = ringEnd;\n }\n\n function ringPoint(lambda, phi) {\n linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;\n resampleStream.point = linePoint;\n }\n\n function ringEnd() {\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream);\n resampleStream.lineEnd = lineEnd;\n lineEnd();\n }\n\n return resampleStream;\n };\n}\n","import clipAntimeridian from \"../clip/antimeridian.js\";\nimport clipCircle from \"../clip/circle.js\";\nimport clipRectangle from \"../clip/rectangle.js\";\nimport compose from \"../compose.js\";\nimport identity from \"../identity.js\";\nimport {cos, degrees, radians, sin, sqrt} from \"../math.js\";\nimport {rotateRadians} from \"../rotation.js\";\nimport {transformer} from \"../transform.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\nimport resample from \"./resample.js\";\n\nvar transformRadians = transformer({\n point: function(x, y) {\n this.stream.point(x * radians, y * radians);\n }\n});\n\nfunction transformRotate(rotate) {\n return transformer({\n point: function(x, y) {\n var r = rotate(x, y);\n return this.stream.point(r[0], r[1]);\n }\n });\n}\n\nfunction scaleTranslate(k, dx, dy, sx, sy) {\n function transform(x, y) {\n x *= sx; y *= sy;\n return [dx + k * x, dy - k * y];\n }\n transform.invert = function(x, y) {\n return [(x - dx) / k * sx, (dy - y) / k * sy];\n };\n return transform;\n}\n\nfunction scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {\n if (!alpha) return scaleTranslate(k, dx, dy, sx, sy);\n var cosAlpha = cos(alpha),\n sinAlpha = sin(alpha),\n a = cosAlpha * k,\n b = sinAlpha * k,\n ai = cosAlpha / k,\n bi = sinAlpha / k,\n ci = (sinAlpha * dy - cosAlpha * dx) / k,\n fi = (sinAlpha * dx + cosAlpha * dy) / k;\n function transform(x, y) {\n x *= sx; y *= sy;\n return [a * x - b * y + dx, dy - b * x - a * y];\n }\n transform.invert = function(x, y) {\n return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];\n };\n return transform;\n}\n\nexport default function projection(project) {\n return projectionMutator(function() { return project; })();\n}\n\nexport function projectionMutator(projectAt) {\n var project,\n k = 150, // scale\n x = 480, y = 250, // translate\n lambda = 0, phi = 0, // center\n deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, // pre-rotate\n alpha = 0, // post-rotate angle\n sx = 1, // reflectX\n sy = 1, // reflectX\n theta = null, preclip = clipAntimeridian, // pre-clip angle\n x0 = null, y0, x1, y1, postclip = identity, // post-clip extent\n delta2 = 0.5, // precision\n projectResample,\n projectTransform,\n projectRotateTransform,\n cache,\n cacheStream;\n\n function projection(point) {\n return projectRotateTransform(point[0] * radians, point[1] * radians);\n }\n\n function invert(point) {\n point = projectRotateTransform.invert(point[0], point[1]);\n return point && [point[0] * degrees, point[1] * degrees];\n }\n\n projection.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));\n };\n\n projection.preclip = function(_) {\n return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;\n };\n\n projection.postclip = function(_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n };\n\n projection.clipAngle = function(_) {\n return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees;\n };\n\n projection.clipExtent = function(_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n projection.scale = function(_) {\n return arguments.length ? (k = +_, recenter()) : k;\n };\n\n projection.translate = function(_) {\n return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];\n };\n\n projection.center = function(_) {\n return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];\n };\n\n projection.rotate = function(_) {\n return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];\n };\n\n projection.angle = function(_) {\n return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;\n };\n\n projection.reflectX = function(_) {\n return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;\n };\n\n projection.reflectY = function(_) {\n return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;\n };\n\n projection.precision = function(_) {\n return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);\n };\n\n projection.fitExtent = function(extent, object) {\n return fitExtent(projection, extent, object);\n };\n\n projection.fitSize = function(size, object) {\n return fitSize(projection, size, object);\n };\n\n projection.fitWidth = function(width, object) {\n return fitWidth(projection, width, object);\n };\n\n projection.fitHeight = function(height, object) {\n return fitHeight(projection, height, object);\n };\n\n function recenter() {\n var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)),\n transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha);\n rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);\n projectTransform = compose(project, transform);\n projectRotateTransform = compose(rotate, projectTransform);\n projectResample = resample(projectTransform, delta2);\n return reset();\n }\n\n function reset() {\n cache = cacheStream = null;\n return projection;\n }\n\n return function() {\n project = projectAt.apply(this, arguments);\n projection.invert = project.invert && invert;\n return recenter();\n };\n}\n","import {cartesian, cartesianAddInPlace, cartesianCross, cartesianDot, cartesianScale, spherical} from \"../cartesian.js\";\nimport {circleStream} from \"../circle.js\";\nimport {abs, cos, epsilon, pi, radians, sqrt} from \"../math.js\";\nimport pointEqual from \"../pointEqual.js\";\nimport clip from \"./index.js\";\n\nexport default function(radius) {\n var cr = cos(radius),\n delta = 6 * radians,\n smallRadius = cr > 0,\n notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case\n\n function interpolate(from, to, direction, stream) {\n circleStream(stream, radius, delta, direction, from, to);\n }\n\n function visible(lambda, phi) {\n return cos(lambda) * cos(phi) > cr;\n }\n\n // Takes a line and cuts into visible segments. Return values used for polygon\n // clipping: 0 - there were intersections or the line was empty; 1 - no\n // intersections 2 - there were intersections, and the first and last segments\n // should be rejoined.\n function clipLine(stream) {\n var point0, // previous point\n c0, // code for previous point\n v0, // visibility of previous point\n v00, // visibility of first point\n clean; // no intersections\n return {\n lineStart: function() {\n v00 = v0 = false;\n clean = 1;\n },\n point: function(lambda, phi) {\n var point1 = [lambda, phi],\n point2,\n v = visible(lambda, phi),\n c = smallRadius\n ? v ? 0 : code(lambda, phi)\n : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;\n if (!point0 && (v00 = v0 = v)) stream.lineStart();\n if (v !== v0) {\n point2 = intersect(point0, point1);\n if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2))\n point1[2] = 1;\n }\n if (v !== v0) {\n clean = 0;\n if (v) {\n // outside going in\n stream.lineStart();\n point2 = intersect(point1, point0);\n stream.point(point2[0], point2[1]);\n } else {\n // inside going out\n point2 = intersect(point0, point1);\n stream.point(point2[0], point2[1], 2);\n stream.lineEnd();\n }\n point0 = point2;\n } else if (notHemisphere && point0 && smallRadius ^ v) {\n var t;\n // If the codes for two points are different, or are both zero,\n // and there this segment intersects with the small circle.\n if (!(c & c0) && (t = intersect(point1, point0, true))) {\n clean = 0;\n if (smallRadius) {\n stream.lineStart();\n stream.point(t[0][0], t[0][1]);\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n } else {\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n stream.lineStart();\n stream.point(t[0][0], t[0][1], 3);\n }\n }\n }\n if (v && (!point0 || !pointEqual(point0, point1))) {\n stream.point(point1[0], point1[1]);\n }\n point0 = point1, v0 = v, c0 = c;\n },\n lineEnd: function() {\n if (v0) stream.lineEnd();\n point0 = null;\n },\n // Rejoin first and last segments if there were intersections and the first\n // and last points were visible.\n clean: function() {\n return clean | ((v00 && v0) << 1);\n }\n };\n }\n\n // Intersects the great circle between a and b with the clip circle.\n function intersect(a, b, two) {\n var pa = cartesian(a),\n pb = cartesian(b);\n\n // We have two planes, n1.p = d1 and n2.p = d2.\n // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).\n var n1 = [1, 0, 0], // normal\n n2 = cartesianCross(pa, pb),\n n2n2 = cartesianDot(n2, n2),\n n1n2 = n2[0], // cartesianDot(n1, n2),\n determinant = n2n2 - n1n2 * n1n2;\n\n // Two polar points.\n if (!determinant) return !two && a;\n\n var c1 = cr * n2n2 / determinant,\n c2 = -cr * n1n2 / determinant,\n n1xn2 = cartesianCross(n1, n2),\n A = cartesianScale(n1, c1),\n B = cartesianScale(n2, c2);\n cartesianAddInPlace(A, B);\n\n // Solve |p(t)|^2 = 1.\n var u = n1xn2,\n w = cartesianDot(A, u),\n uu = cartesianDot(u, u),\n t2 = w * w - uu * (cartesianDot(A, A) - 1);\n\n if (t2 < 0) return;\n\n var t = sqrt(t2),\n q = cartesianScale(u, (-w - t) / uu);\n cartesianAddInPlace(q, A);\n q = spherical(q);\n\n if (!two) return q;\n\n // Two intersection points.\n var lambda0 = a[0],\n lambda1 = b[0],\n phi0 = a[1],\n phi1 = b[1],\n z;\n\n if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;\n\n var delta = lambda1 - lambda0,\n polar = abs(delta - pi) < epsilon,\n meridian = polar || delta < epsilon;\n\n if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;\n\n // Check that the first point is between a and b.\n if (meridian\n ? polar\n ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1)\n : phi0 <= q[1] && q[1] <= phi1\n : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) {\n var q1 = cartesianScale(u, (-w + t) / uu);\n cartesianAddInPlace(q1, A);\n return [q, spherical(q1)];\n }\n }\n\n // Generates a 4-bit vector representing the location of a point relative to\n // the small circle's bounding box.\n function code(lambda, phi) {\n var r = smallRadius ? radius : pi - radius,\n code = 0;\n if (lambda < -r) code |= 1; // left\n else if (lambda > r) code |= 2; // right\n if (phi < -r) code |= 4; // below\n else if (phi > r) code |= 8; // above\n return code;\n }\n\n return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);\n}\n","import {degrees, pi, radians} from \"../math.js\";\nimport {projectionMutator} from \"./index.js\";\n\nexport function conicProjection(projectAt) {\n var phi0 = 0,\n phi1 = pi / 3,\n m = projectionMutator(projectAt),\n p = m(phi0, phi1);\n\n p.parallels = function(_) {\n return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees, phi1 * degrees];\n };\n\n return p;\n}\n","import {abs, asin, atan2, cos, epsilon, pi, sign, sin, sqrt} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {cylindricalEqualAreaRaw} from \"./cylindricalEqualArea.js\";\n\nexport function conicEqualAreaRaw(y0, y1) {\n var sy0 = sin(y0), n = (sy0 + sin(y1)) / 2;\n\n // Are the parallels symmetrical around the Equator?\n if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y0);\n\n var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n;\n\n function project(x, y) {\n var r = sqrt(c - 2 * n * sin(y)) / n;\n return [r * sin(x *= n), r0 - r * cos(x)];\n }\n\n project.invert = function(x, y) {\n var r0y = r0 - y,\n l = atan2(x, abs(r0y)) * sign(r0y);\n if (r0y * n < 0)\n l -= pi * sign(x) * sign(r0y);\n return [l / n, asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicEqualAreaRaw)\n .scale(155.424)\n .center([0, 33.6442]);\n}\n","import {asin, cos, sin} from \"../math.js\";\n\nexport function cylindricalEqualAreaRaw(phi0) {\n var cosPhi0 = cos(phi0);\n\n function forward(lambda, phi) {\n return [lambda * cosPhi0, sin(phi) / cosPhi0];\n }\n\n forward.invert = function(x, y) {\n return [x / cosPhi0, asin(y * cosPhi0)];\n };\n\n return forward;\n}\n","import conicEqualArea from \"./conicEqualArea.js\";\n\nexport default function() {\n return conicEqualArea()\n .parallels([29.5, 45.5])\n .scale(1070)\n .translate([480, 250])\n .rotate([96, 0])\n .center([-0.6, 38.7]);\n}\n","import {asin, atan2, cos, sin, sqrt} from \"../math.js\";\n\nexport function azimuthalRaw(scale) {\n return function(x, y) {\n var cx = cos(x),\n cy = cos(y),\n k = scale(cx * cy);\n if (k === Infinity) return [2, 0];\n return [\n k * cy * sin(x),\n k * sin(y)\n ];\n }\n}\n\nexport function azimuthalInvert(angle) {\n return function(x, y) {\n var z = sqrt(x * x + y * y),\n c = angle(z),\n sc = sin(c),\n cc = cos(c);\n return [\n atan2(x * sc, z * cc),\n asin(z && y * sc / z)\n ];\n }\n}\n","import {asin, sqrt} from \"../math.js\";\nimport {azimuthalRaw, azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {\n return sqrt(2 / (1 + cxcy));\n});\n\nazimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {\n return 2 * asin(z / 2);\n});\n\nexport default function() {\n return projection(azimuthalEqualAreaRaw)\n .scale(124.75)\n .clipAngle(180 - 1e-3);\n}\n","import {acos, sin} from \"../math.js\";\nimport {azimuthalRaw, azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport var azimuthalEquidistantRaw = azimuthalRaw(function(c) {\n return (c = acos(c)) && c / sin(c);\n});\n\nazimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {\n return z;\n});\n\nexport default function() {\n return projection(azimuthalEquidistantRaw)\n .scale(79.4188)\n .clipAngle(180 - 1e-3);\n}\n","import {atan, exp, halfPi, log, pi, tan, tau} from \"../math.js\";\nimport rotation from \"../rotation.js\";\nimport projection from \"./index.js\";\n\nexport function mercatorRaw(lambda, phi) {\n return [lambda, log(tan((halfPi + phi) / 2))];\n}\n\nmercatorRaw.invert = function(x, y) {\n return [x, 2 * atan(exp(y)) - halfPi];\n};\n\nexport default function() {\n return mercatorProjection(mercatorRaw)\n .scale(961 / tau);\n}\n\nexport function mercatorProjection(project) {\n var m = projection(project),\n center = m.center,\n scale = m.scale,\n translate = m.translate,\n clipExtent = m.clipExtent,\n x0 = null, y0, x1, y1; // clip extent\n\n m.scale = function(_) {\n return arguments.length ? (scale(_), reclip()) : scale();\n };\n\n m.translate = function(_) {\n return arguments.length ? (translate(_), reclip()) : translate();\n };\n\n m.center = function(_) {\n return arguments.length ? (center(_), reclip()) : center();\n };\n\n m.clipExtent = function(_) {\n return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n function reclip() {\n var k = pi * scale(),\n t = m(rotation(m.rotate()).invert([0, 0]));\n return clipExtent(x0 == null\n ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw\n ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]]\n : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]);\n }\n\n return reclip();\n}\n","import {abs, atan, atan2, cos, epsilon, halfPi, log, pi, pow, sign, sin, sqrt, tan} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {mercatorRaw} from \"./mercator.js\";\n\nfunction tany(y) {\n return tan((halfPi + y) / 2);\n}\n\nexport function conicConformalRaw(y0, y1) {\n var cy0 = cos(y0),\n n = y0 === y1 ? sin(y0) : log(cy0 / cos(y1)) / log(tany(y1) / tany(y0)),\n f = cy0 * pow(tany(y0), n) / n;\n\n if (!n) return mercatorRaw;\n\n function project(x, y) {\n if (f > 0) { if (y < -halfPi + epsilon) y = -halfPi + epsilon; }\n else { if (y > halfPi - epsilon) y = halfPi - epsilon; }\n var r = f / pow(tany(y), n);\n return [r * sin(n * x), f - r * cos(n * x)];\n }\n\n project.invert = function(x, y) {\n var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy),\n l = atan2(x, abs(fy)) * sign(fy);\n if (fy * n < 0)\n l -= pi * sign(x) * sign(fy);\n return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicConformalRaw)\n .scale(109.5)\n .parallels([30, 30]);\n}\n","import projection from \"./index.js\";\n\nexport function equirectangularRaw(lambda, phi) {\n return [lambda, phi];\n}\n\nequirectangularRaw.invert = equirectangularRaw;\n\nexport default function() {\n return projection(equirectangularRaw)\n .scale(152.63);\n}\n","import {abs, atan2, cos, epsilon, pi, sign, sin, sqrt} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {equirectangularRaw} from \"./equirectangular.js\";\n\nexport function conicEquidistantRaw(y0, y1) {\n var cy0 = cos(y0),\n n = y0 === y1 ? sin(y0) : (cy0 - cos(y1)) / (y1 - y0),\n g = cy0 / n + y0;\n\n if (abs(n) < epsilon) return equirectangularRaw;\n\n function project(x, y) {\n var gy = g - y, nx = n * x;\n return [gy * sin(nx), g - gy * cos(nx)];\n }\n\n project.invert = function(x, y) {\n var gy = g - y,\n l = atan2(x, abs(gy)) * sign(gy);\n if (gy * n < 0)\n l -= pi * sign(x) * sign(gy);\n return [l / n, g - sign(n) * sqrt(x * x + gy * gy)];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicEquidistantRaw)\n .scale(131.154)\n .center([0, 13.9389]);\n}\n","import projection from \"./index.js\";\nimport {abs, asin, cos, epsilon2, sin, sqrt} from \"../math.js\";\n\nvar A1 = 1.340264,\n A2 = -0.081106,\n A3 = 0.000893,\n A4 = 0.003796,\n M = sqrt(3) / 2,\n iterations = 12;\n\nexport function equalEarthRaw(lambda, phi) {\n var l = asin(M * sin(phi)), l2 = l * l, l6 = l2 * l2 * l2;\n return [\n lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))),\n l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2))\n ];\n}\n\nequalEarthRaw.invert = function(x, y) {\n var l = y, l2 = l * l, l6 = l2 * l2 * l2;\n for (var i = 0, delta, fy, fpy; i < iterations; ++i) {\n fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y;\n fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2);\n l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2;\n if (abs(delta) < epsilon2) break;\n }\n return [\n M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l),\n asin(sin(l) / M)\n ];\n};\n\nexport default function() {\n return projection(equalEarthRaw)\n .scale(177.158);\n}\n","import {atan, cos, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function gnomonicRaw(x, y) {\n var cy = cos(y), k = cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n}\n\ngnomonicRaw.invert = azimuthalInvert(atan);\n\nexport default function() {\n return projection(gnomonicRaw)\n .scale(144.049)\n .clipAngle(60);\n}\n","import projection from \"./index.js\";\nimport {abs, epsilon} from \"../math.js\";\n\nexport function naturalEarth1Raw(lambda, phi) {\n var phi2 = phi * phi, phi4 = phi2 * phi2;\n return [\n lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))),\n phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4)))\n ];\n}\n\nnaturalEarth1Raw.invert = function(x, y) {\n var phi = y, i = 25, delta;\n do {\n var phi2 = phi * phi, phi4 = phi2 * phi2;\n phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) /\n (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4)));\n } while (abs(delta) > epsilon && --i > 0);\n return [\n x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))),\n phi\n ];\n};\n\nexport default function() {\n return projection(naturalEarth1Raw)\n .scale(175.295);\n}\n","import {asin, cos, epsilon, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function orthographicRaw(x, y) {\n return [cos(y) * sin(x), sin(y)];\n}\n\northographicRaw.invert = azimuthalInvert(asin);\n\nexport default function() {\n return projection(orthographicRaw)\n .scale(249.5)\n .clipAngle(90 + epsilon);\n}\n","import {atan, cos, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function stereographicRaw(x, y) {\n var cy = cos(y), k = 1 + cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n}\n\nstereographicRaw.invert = azimuthalInvert(function(z) {\n return 2 * atan(z);\n});\n\nexport default function() {\n return projection(stereographicRaw)\n .scale(250)\n .clipAngle(142);\n}\n","import {atan, exp, halfPi, log, tan} from \"../math.js\";\nimport {mercatorProjection} from \"./mercator.js\";\n\nexport function transverseMercatorRaw(lambda, phi) {\n return [log(tan((halfPi + phi) / 2)), -lambda];\n}\n\ntransverseMercatorRaw.invert = function(x, y) {\n return [-y, 2 * atan(exp(x)) - halfPi];\n};\n\nexport default function() {\n var m = mercatorProjection(transverseMercatorRaw),\n center = m.center,\n rotate = m.rotate;\n\n m.center = function(_) {\n return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]);\n };\n\n m.rotate = function(_) {\n return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);\n };\n\n return rotate([0, 0, 90])\n .scale(159.155);\n}\n","export var abs = Math.abs;\nexport var atan = Math.atan;\nexport var atan2 = Math.atan2;\nexport var ceil = Math.ceil;\nexport var cos = Math.cos;\nexport var exp = Math.exp;\nexport var floor = Math.floor;\nexport var log = Math.log;\nexport var max = Math.max;\nexport var min = Math.min;\nexport var pow = Math.pow;\nexport var round = Math.round;\nexport var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };\nexport var sin = Math.sin;\nexport var tan = Math.tan;\n\nexport var epsilon = 1e-6;\nexport var epsilon2 = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var quarterPi = pi / 4;\nexport var sqrt1_2 = Math.SQRT1_2;\nexport var sqrt2 = sqrt(2);\nexport var sqrtPi = sqrt(pi);\nexport var tau = pi * 2;\nexport var degrees = 180 / pi;\nexport var radians = pi / 180;\n\nexport function sinci(x) {\n return x ? x / Math.sin(x) : 1;\n}\n\nexport function asin(x) {\n return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n}\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function sqrt(x) {\n return x > 0 ? Math.sqrt(x) : 0;\n}\n\nexport function tanh(x) {\n x = exp(2 * x);\n return (x - 1) / (x + 1);\n}\n\nexport function sinh(x) {\n return (exp(x) - exp(-x)) / 2;\n}\n\nexport function cosh(x) {\n return (exp(x) + exp(-x)) / 2;\n}\n\nexport function arsinh(x) {\n return log(x + sqrt(x * x + 1));\n}\n\nexport function arcosh(x) {\n return log(x + sqrt(x * x - 1));\n}\n","import {geoProjection as projection} from \"d3-geo\";\nimport {abs, asin, cos, epsilon, halfPi, pi, sin, sqrt2} from \"./math.js\";\n\nexport function mollweideBromleyTheta(cp, phi) {\n var cpsinPhi = cp * sin(phi), i = 30, delta;\n do phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi));\n while (abs(delta) > epsilon && --i > 0);\n return phi / 2;\n}\n\nexport function mollweideBromleyRaw(cx, cy, cp) {\n\n function forward(lambda, phi) {\n return [cx * lambda * cos(phi = mollweideBromleyTheta(cp, phi)), cy * sin(phi)];\n }\n\n forward.invert = function(x, y) {\n return y = asin(y / cy), [x / (cx * cos(y)), asin((2 * y + sin(2 * y)) / cp)];\n };\n\n return forward;\n}\n\nexport var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi);\n\nexport default function() {\n return projection(mollweideRaw)\n .scale(169.529);\n}\n","import { geoPath, geoAlbers, geoAlbersUsa, geoAzimuthalEqualArea, geoAzimuthalEquidistant, geoConicConformal, geoConicEqualArea, geoConicEquidistant, geoEqualEarth, geoEquirectangular, geoGnomonic, geoIdentity, geoMercator, geoNaturalEarth1, geoOrthographic, geoStereographic, geoTransverseMercator } from 'd3-geo';\nimport { geoMollweide } from 'd3-geo-projection';\nimport { registerScale } from 'vega-scale';\n\nconst defaultPath = geoPath();\nconst projectionProperties = [\n// standard properties in d3-geo\n'clipAngle', 'clipExtent', 'scale', 'translate', 'center', 'rotate', 'parallels', 'precision', 'reflectX', 'reflectY',\n// extended properties in d3-geo-projections\n'coefficient', 'distance', 'fraction', 'lobes', 'parallel', 'radius', 'ratio', 'spacing', 'tilt'];\n\n/**\n * Augment projections with their type and a copy method.\n */\nfunction create(type, constructor) {\n return function projection() {\n const p = constructor();\n p.type = type;\n p.path = geoPath().projection(p);\n p.copy = p.copy || function () {\n const c = projection();\n projectionProperties.forEach(prop => {\n if (p[prop]) c[prop](p[prop]());\n });\n c.path.pointRadius(p.path.pointRadius());\n return c;\n };\n return registerScale(p);\n };\n}\nfunction projection(type, proj) {\n if (!type || typeof type !== 'string') {\n throw new Error('Projection type must be a name string.');\n }\n type = type.toLowerCase();\n if (arguments.length > 1) {\n projections[type] = create(type, proj);\n return this;\n } else {\n return projections[type] || null;\n }\n}\nfunction getProjectionPath(proj) {\n return proj && proj.path || defaultPath;\n}\nconst projections = {\n // base d3-geo projection types\n albers: geoAlbers,\n albersusa: geoAlbersUsa,\n azimuthalequalarea: geoAzimuthalEqualArea,\n azimuthalequidistant: geoAzimuthalEquidistant,\n conicconformal: geoConicConformal,\n conicequalarea: geoConicEqualArea,\n conicequidistant: geoConicEquidistant,\n equalEarth: geoEqualEarth,\n equirectangular: geoEquirectangular,\n gnomonic: geoGnomonic,\n identity: geoIdentity,\n mercator: geoMercator,\n mollweide: geoMollweide,\n naturalEarth1: geoNaturalEarth1,\n orthographic: geoOrthographic,\n stereographic: geoStereographic,\n transversemercator: geoTransverseMercator\n};\nfor (const key in projections) {\n projection(key, projections[key]);\n}\n\nexport { getProjectionPath, projection, projectionProperties };\n","import {epsilon} from \"../math.js\";\nimport albers from \"./albers.js\";\nimport conicEqualArea from \"./conicEqualArea.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\n\n// The projections must have mutually exclusive clip regions on the sphere,\n// as this will avoid emitting interleaving lines and polygons.\nfunction multiplex(streams) {\n var n = streams.length;\n return {\n point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); },\n sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); },\n lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); },\n lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); },\n polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); },\n polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); }\n };\n}\n\n// A composite projection for the United States, configured by default for\n// 960×500. The projection also works quite well at 960×600 if you change the\n// scale to 1285 and adjust the translate accordingly. The set of standard\n// parallels for each region comes from USGS, which is published here:\n// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers\nexport default function() {\n var cache,\n cacheStream,\n lower48 = albers(), lower48Point,\n alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338\n hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007\n point, pointStream = {point: function(x, y) { point = [x, y]; }};\n\n function albersUsa(coordinates) {\n var x = coordinates[0], y = coordinates[1];\n return point = null,\n (lower48Point.point(x, y), point)\n || (alaskaPoint.point(x, y), point)\n || (hawaiiPoint.point(x, y), point);\n }\n\n albersUsa.invert = function(coordinates) {\n var k = lower48.scale(),\n t = lower48.translate(),\n x = (coordinates[0] - t[0]) / k,\n y = (coordinates[1] - t[1]) / k;\n return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska\n : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii\n : lower48).invert(coordinates);\n };\n\n albersUsa.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);\n };\n\n albersUsa.precision = function(_) {\n if (!arguments.length) return lower48.precision();\n lower48.precision(_), alaska.precision(_), hawaii.precision(_);\n return reset();\n };\n\n albersUsa.scale = function(_) {\n if (!arguments.length) return lower48.scale();\n lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);\n return albersUsa.translate(lower48.translate());\n };\n\n albersUsa.translate = function(_) {\n if (!arguments.length) return lower48.translate();\n var k = lower48.scale(), x = +_[0], y = +_[1];\n\n lower48Point = lower48\n .translate(_)\n .clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])\n .stream(pointStream);\n\n alaskaPoint = alaska\n .translate([x - 0.307 * k, y + 0.201 * k])\n .clipExtent([[x - 0.425 * k + epsilon, y + 0.120 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]])\n .stream(pointStream);\n\n hawaiiPoint = hawaii\n .translate([x - 0.205 * k, y + 0.212 * k])\n .clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]])\n .stream(pointStream);\n\n return reset();\n };\n\n albersUsa.fitExtent = function(extent, object) {\n return fitExtent(albersUsa, extent, object);\n };\n\n albersUsa.fitSize = function(size, object) {\n return fitSize(albersUsa, size, object);\n };\n\n albersUsa.fitWidth = function(width, object) {\n return fitWidth(albersUsa, width, object);\n };\n\n albersUsa.fitHeight = function(height, object) {\n return fitHeight(albersUsa, height, object);\n };\n\n function reset() {\n cache = cacheStream = null;\n return albersUsa;\n }\n\n return albersUsa.scale(1070);\n}\n","import clipRectangle from \"../clip/rectangle.js\";\nimport identity from \"../identity.js\";\nimport {transformer} from \"../transform.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\nimport {cos, degrees, radians, sin} from \"../math.js\";\n\nexport default function() {\n var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, // scale, translate and reflect\n alpha = 0, ca, sa, // angle\n x0 = null, y0, x1, y1, // clip extent\n kx = 1, ky = 1,\n transform = transformer({\n point: function(x, y) {\n var p = projection([x, y])\n this.stream.point(p[0], p[1]);\n }\n }),\n postclip = identity,\n cache,\n cacheStream;\n\n function reset() {\n kx = k * sx;\n ky = k * sy;\n cache = cacheStream = null;\n return projection;\n }\n\n function projection (p) {\n var x = p[0] * kx, y = p[1] * ky;\n if (alpha) {\n var t = y * ca - x * sa;\n x = x * ca + y * sa;\n y = t;\n } \n return [x + tx, y + ty];\n }\n projection.invert = function(p) {\n var x = p[0] - tx, y = p[1] - ty;\n if (alpha) {\n var t = y * ca + x * sa;\n x = x * ca - y * sa;\n y = t;\n }\n return [x / kx, y / ky];\n };\n projection.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream));\n };\n projection.postclip = function(_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n };\n projection.clipExtent = function(_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n projection.scale = function(_) {\n return arguments.length ? (k = +_, reset()) : k;\n };\n projection.translate = function(_) {\n return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty];\n }\n projection.angle = function(_) {\n return arguments.length ? (alpha = _ % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;\n };\n projection.reflectX = function(_) {\n return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0;\n };\n projection.reflectY = function(_) {\n return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0;\n };\n projection.fitExtent = function(extent, object) {\n return fitExtent(projection, extent, object);\n };\n projection.fitSize = function(size, object) {\n return fitSize(projection, size, object);\n };\n projection.fitWidth = function(width, object) {\n return fitWidth(projection, width, object);\n };\n projection.fitHeight = function(height, object) {\n return fitHeight(projection, height, object);\n };\n\n return projection;\n}\n","import {range} from \"d3-array\";\nimport {abs, ceil, epsilon} from \"./math.js\";\n\nfunction graticuleX(y0, y1, dy) {\n var y = range(y0, y1 - epsilon, dy).concat(y1);\n return function(x) { return y.map(function(y) { return [x, y]; }); };\n}\n\nfunction graticuleY(x0, x1, dx) {\n var x = range(x0, x1 - epsilon, dx).concat(x1);\n return function(y) { return x.map(function(x) { return [x, y]; }); };\n}\n\nexport default function graticule() {\n var x1, x0, X1, X0,\n y1, y0, Y1, Y0,\n dx = 10, dy = dx, DX = 90, DY = 360,\n x, y, X, Y,\n precision = 2.5;\n\n function graticule() {\n return {type: \"MultiLineString\", coordinates: lines()};\n }\n\n function lines() {\n return range(ceil(X0 / DX) * DX, X1, DX).map(X)\n .concat(range(ceil(Y0 / DY) * DY, Y1, DY).map(Y))\n .concat(range(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs(x % DX) > epsilon; }).map(x))\n .concat(range(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs(y % DY) > epsilon; }).map(y));\n }\n\n graticule.lines = function() {\n return lines().map(function(coordinates) { return {type: \"LineString\", coordinates: coordinates}; });\n };\n\n graticule.outline = function() {\n return {\n type: \"Polygon\",\n coordinates: [\n X(X0).concat(\n Y(Y1).slice(1),\n X(X1).reverse().slice(1),\n Y(Y0).reverse().slice(1))\n ]\n };\n };\n\n graticule.extent = function(_) {\n if (!arguments.length) return graticule.extentMinor();\n return graticule.extentMajor(_).extentMinor(_);\n };\n\n graticule.extentMajor = function(_) {\n if (!arguments.length) return [[X0, Y0], [X1, Y1]];\n X0 = +_[0][0], X1 = +_[1][0];\n Y0 = +_[0][1], Y1 = +_[1][1];\n if (X0 > X1) _ = X0, X0 = X1, X1 = _;\n if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;\n return graticule.precision(precision);\n };\n\n graticule.extentMinor = function(_) {\n if (!arguments.length) return [[x0, y0], [x1, y1]];\n x0 = +_[0][0], x1 = +_[1][0];\n y0 = +_[0][1], y1 = +_[1][1];\n if (x0 > x1) _ = x0, x0 = x1, x1 = _;\n if (y0 > y1) _ = y0, y0 = y1, y1 = _;\n return graticule.precision(precision);\n };\n\n graticule.step = function(_) {\n if (!arguments.length) return graticule.stepMinor();\n return graticule.stepMajor(_).stepMinor(_);\n };\n\n graticule.stepMajor = function(_) {\n if (!arguments.length) return [DX, DY];\n DX = +_[0], DY = +_[1];\n return graticule;\n };\n\n graticule.stepMinor = function(_) {\n if (!arguments.length) return [dx, dy];\n dx = +_[0], dy = +_[1];\n return graticule;\n };\n\n graticule.precision = function(_) {\n if (!arguments.length) return precision;\n precision = +_;\n x = graticuleX(y0, y1, 90);\n y = graticuleY(x0, x1, precision);\n X = graticuleX(Y0, Y1, 90);\n Y = graticuleY(X0, X1, precision);\n return graticule;\n };\n\n return graticule\n .extentMajor([[-180, -90 + epsilon], [180, 90 - epsilon]])\n .extentMinor([[-180, -80 - epsilon], [180, 80 + epsilon]]);\n}\n\nexport function graticule10() {\n return graticule()();\n}\n","import { Transform, rederive, ingest, replace } from 'vega-dataflow';\nimport { error, extent, inherits, identity, isArray, isFunction, isNumber, array, constant, one, accessorName, accessorFields, field, extend, toSet, zero } from 'vega-util';\nimport { tickStep, range, max, sum } from 'd3-array';\nimport { bandwidthNRD } from 'vega-statistics';\nimport { getProjectionPath, projectionProperties, projection } from 'vega-projection';\nimport { geoGraticule } from 'd3-geo';\nimport { rgb } from 'd3-color';\nimport { canvas } from 'vega-canvas';\n\nfunction noop() {}\nconst cases = [[], [[[1.0, 1.5], [0.5, 1.0]]], [[[1.5, 1.0], [1.0, 1.5]]], [[[1.5, 1.0], [0.5, 1.0]]], [[[1.0, 0.5], [1.5, 1.0]]], [[[1.0, 1.5], [0.5, 1.0]], [[1.0, 0.5], [1.5, 1.0]]], [[[1.0, 0.5], [1.0, 1.5]]], [[[1.0, 0.5], [0.5, 1.0]]], [[[0.5, 1.0], [1.0, 0.5]]], [[[1.0, 1.5], [1.0, 0.5]]], [[[0.5, 1.0], [1.0, 0.5]], [[1.5, 1.0], [1.0, 1.5]]], [[[1.5, 1.0], [1.0, 0.5]]], [[[0.5, 1.0], [1.5, 1.0]]], [[[1.0, 1.5], [1.5, 1.0]]], [[[0.5, 1.0], [1.0, 1.5]]], []];\n\n// Implementation adapted from d3/d3-contour. Thanks!\nfunction contours () {\n var dx = 1,\n dy = 1,\n smooth = smoothLinear;\n function contours(values, tz) {\n return tz.map(value => contour(values, value));\n }\n\n // Accumulate, smooth contour rings, assign holes to exterior rings.\n // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js\n function contour(values, value) {\n var polygons = [],\n holes = [];\n isorings(values, value, ring => {\n smooth(ring, values, value);\n if (area(ring) > 0) polygons.push([ring]);else holes.push(ring);\n });\n holes.forEach(hole => {\n for (var i = 0, n = polygons.length, polygon; i < n; ++i) {\n if (contains((polygon = polygons[i])[0], hole) !== -1) {\n polygon.push(hole);\n return;\n }\n }\n });\n return {\n type: 'MultiPolygon',\n value: value,\n coordinates: polygons\n };\n }\n\n // Marching squares with isolines stitched into rings.\n // Based on https://github.com/topojson/topojson-client/blob/v3.0.0/src/stitch.js\n function isorings(values, value, callback) {\n var fragmentByStart = new Array(),\n fragmentByEnd = new Array(),\n x,\n y,\n t0,\n t1,\n t2,\n t3;\n\n // Special case for the first row (y = -1, t2 = t3 = 0).\n x = y = -1;\n t1 = values[0] >= value;\n cases[t1 << 1].forEach(stitch);\n while (++x < dx - 1) {\n t0 = t1, t1 = values[x + 1] >= value;\n cases[t0 | t1 << 1].forEach(stitch);\n }\n cases[t1 << 0].forEach(stitch);\n\n // General case for the intermediate rows.\n while (++y < dy - 1) {\n x = -1;\n t1 = values[y * dx + dx] >= value;\n t2 = values[y * dx] >= value;\n cases[t1 << 1 | t2 << 2].forEach(stitch);\n while (++x < dx - 1) {\n t0 = t1, t1 = values[y * dx + dx + x + 1] >= value;\n t3 = t2, t2 = values[y * dx + x + 1] >= value;\n cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch);\n }\n cases[t1 | t2 << 3].forEach(stitch);\n }\n\n // Special case for the last row (y = dy - 1, t0 = t1 = 0).\n x = -1;\n t2 = values[y * dx] >= value;\n cases[t2 << 2].forEach(stitch);\n while (++x < dx - 1) {\n t3 = t2, t2 = values[y * dx + x + 1] >= value;\n cases[t2 << 2 | t3 << 3].forEach(stitch);\n }\n cases[t2 << 3].forEach(stitch);\n function stitch(line) {\n var start = [line[0][0] + x, line[0][1] + y],\n end = [line[1][0] + x, line[1][1] + y],\n startIndex = index(start),\n endIndex = index(end),\n f,\n g;\n if (f = fragmentByEnd[startIndex]) {\n if (g = fragmentByStart[endIndex]) {\n delete fragmentByEnd[f.end];\n delete fragmentByStart[g.start];\n if (f === g) {\n f.ring.push(end);\n callback(f.ring);\n } else {\n fragmentByStart[f.start] = fragmentByEnd[g.end] = {\n start: f.start,\n end: g.end,\n ring: f.ring.concat(g.ring)\n };\n }\n } else {\n delete fragmentByEnd[f.end];\n f.ring.push(end);\n fragmentByEnd[f.end = endIndex] = f;\n }\n } else if (f = fragmentByStart[endIndex]) {\n if (g = fragmentByEnd[startIndex]) {\n delete fragmentByStart[f.start];\n delete fragmentByEnd[g.end];\n if (f === g) {\n f.ring.push(end);\n callback(f.ring);\n } else {\n fragmentByStart[g.start] = fragmentByEnd[f.end] = {\n start: g.start,\n end: f.end,\n ring: g.ring.concat(f.ring)\n };\n }\n } else {\n delete fragmentByStart[f.start];\n f.ring.unshift(start);\n fragmentByStart[f.start = startIndex] = f;\n }\n } else {\n fragmentByStart[startIndex] = fragmentByEnd[endIndex] = {\n start: startIndex,\n end: endIndex,\n ring: [start, end]\n };\n }\n }\n }\n function index(point) {\n return point[0] * 2 + point[1] * (dx + 1) * 4;\n }\n function smoothLinear(ring, values, value) {\n ring.forEach(point => {\n var x = point[0],\n y = point[1],\n xt = x | 0,\n yt = y | 0,\n v0,\n v1 = values[yt * dx + xt];\n if (x > 0 && x < dx && xt === x) {\n v0 = values[yt * dx + xt - 1];\n point[0] = x + (value - v0) / (v1 - v0) - 0.5;\n }\n if (y > 0 && y < dy && yt === y) {\n v0 = values[(yt - 1) * dx + xt];\n point[1] = y + (value - v0) / (v1 - v0) - 0.5;\n }\n });\n }\n contours.contour = contour;\n contours.size = function (_) {\n if (!arguments.length) return [dx, dy];\n var _0 = Math.floor(_[0]),\n _1 = Math.floor(_[1]);\n if (!(_0 >= 0 && _1 >= 0)) error('invalid size');\n return dx = _0, dy = _1, contours;\n };\n contours.smooth = function (_) {\n return arguments.length ? (smooth = _ ? smoothLinear : noop, contours) : smooth === smoothLinear;\n };\n return contours;\n}\nfunction area(ring) {\n var i = 0,\n n = ring.length,\n area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1];\n while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1];\n return area;\n}\nfunction contains(ring, hole) {\n var i = -1,\n n = hole.length,\n c;\n while (++i < n) if (c = ringContains(ring, hole[i])) return c;\n return 0;\n}\nfunction ringContains(ring, point) {\n var x = point[0],\n y = point[1],\n contains = -1;\n for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) {\n var pi = ring[i],\n xi = pi[0],\n yi = pi[1],\n pj = ring[j],\n xj = pj[0],\n yj = pj[1];\n if (segmentContains(pi, pj, point)) return 0;\n if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = -contains;\n }\n return contains;\n}\nfunction segmentContains(a, b, c) {\n var i;\n return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]);\n}\nfunction collinear(a, b, c) {\n return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]);\n}\nfunction within(p, q, r) {\n return p <= q && q <= r || r <= q && q <= p;\n}\n\nfunction quantize (k, nice, zero) {\n return function (values) {\n var ex = extent(values),\n start = zero ? Math.min(ex[0], 0) : ex[0],\n stop = ex[1],\n span = stop - start,\n step = nice ? tickStep(start, stop, k) : span / (k + 1);\n return range(start + step, stop, step);\n };\n}\n\n/**\n * Generate isocontours (level sets) based on input raster grid data.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} [params.field] - The field with raster grid\n * data. If unspecified, the tuple itself is interpreted as a raster grid.\n * @param {Array} [params.thresholds] - Contour threshold array. If\n * specified, the levels, nice, resolve, and zero parameters are ignored.\n * @param {number} [params.levels] - The desired number of contour levels.\n * @param {boolean} [params.nice] - Boolean flag indicating if the contour\n * threshold values should be automatically aligned to \"nice\"\n * human-friendly values. Setting this flag may cause the number of\n * thresholds to deviate from the specified levels.\n * @param {string} [params.resolve] - The method for resolving thresholds\n * across multiple input grids. If 'independent' (the default), threshold\n * calculation will be performed separately for each grid. If 'shared', a\n * single set of threshold values will be used for all input grids.\n * @param {boolean} [params.zero] - Boolean flag indicating if the contour\n * threshold values should include zero.\n * @param {boolean} [params.smooth] - Boolean flag indicating if the contour\n * polygons should be smoothed using linear interpolation. The default is\n * true. The parameter is ignored when using density estimation.\n * @param {boolean} [params.scale] - Optional numerical value by which to\n * scale the output isocontour coordinates. This parameter can be useful\n * to scale the contours to match a desired output resolution.\n * @param {string} [params.as='contour'] - The output field in which to store\n * the generated isocontour data (default 'contour').\n */\nfunction Isocontour(params) {\n Transform.call(this, null, params);\n}\nIsocontour.Definition = {\n 'type': 'Isocontour',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'thresholds',\n 'type': 'number',\n 'array': true\n }, {\n 'name': 'levels',\n 'type': 'number'\n }, {\n 'name': 'nice',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'resolve',\n 'type': 'enum',\n 'values': ['shared', 'independent'],\n 'default': 'independent'\n }, {\n 'name': 'zero',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'smooth',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'scale',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'translate',\n 'type': 'number',\n 'array': true,\n 'expr': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'null': true,\n 'default': 'contour'\n }]\n};\ninherits(Isocontour, Transform, {\n transform(_, pulse) {\n if (this.value && !pulse.changed() && !_.modified()) {\n return pulse.StopPropagation;\n }\n var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n source = pulse.materialize(pulse.SOURCE).source,\n field = _.field || identity,\n contour = contours().smooth(_.smooth !== false),\n tz = _.thresholds || levels(source, field, _),\n as = _.as === null ? null : _.as || 'contour',\n values = [];\n source.forEach(t => {\n const grid = field(t);\n\n // generate contour paths in GeoJSON format\n const paths = contour.size([grid.width, grid.height])(grid.values, isArray(tz) ? tz : tz(grid.values));\n\n // adjust contour path coordinates as needed\n transformPaths(paths, grid, t, _);\n\n // ingest; copy source data properties to output\n paths.forEach(p => {\n values.push(rederive(t, ingest(as != null ? {\n [as]: p\n } : p)));\n });\n });\n if (this.value) out.rem = this.value;\n this.value = out.source = out.add = values;\n return out;\n }\n});\nfunction levels(values, f, _) {\n const q = quantize(_.levels || 10, _.nice, _.zero !== false);\n return _.resolve !== 'shared' ? q : q(values.map(t => max(f(t).values)));\n}\nfunction transformPaths(paths, grid, datum, _) {\n let s = _.scale || grid.scale,\n t = _.translate || grid.translate;\n if (isFunction(s)) s = s(datum, _);\n if (isFunction(t)) t = t(datum, _);\n if ((s === 1 || s == null) && !t) return;\n const sx = (isNumber(s) ? s : s[0]) || 1,\n sy = (isNumber(s) ? s : s[1]) || 1,\n tx = t && t[0] || 0,\n ty = t && t[1] || 0;\n paths.forEach(transform(grid, sx, sy, tx, ty));\n}\nfunction transform(grid, sx, sy, tx, ty) {\n const x1 = grid.x1 || 0,\n y1 = grid.y1 || 0,\n flip = sx * sy < 0;\n function transformPolygon(coordinates) {\n coordinates.forEach(transformRing);\n }\n function transformRing(coordinates) {\n if (flip) coordinates.reverse(); // maintain winding order\n coordinates.forEach(transformPoint);\n }\n function transformPoint(coordinates) {\n coordinates[0] = (coordinates[0] - x1) * sx + tx;\n coordinates[1] = (coordinates[1] - y1) * sy + ty;\n }\n return function (geometry) {\n geometry.coordinates.forEach(transformPolygon);\n return geometry;\n };\n}\n\nfunction radius(bw, data, f) {\n const v = bw >= 0 ? bw : bandwidthNRD(data, f);\n return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2);\n}\nfunction number(_) {\n return isFunction(_) ? _ : constant(+_);\n}\n\n// Implementation adapted from d3/d3-contour. Thanks!\nfunction density2D () {\n var x = d => d[0],\n y = d => d[1],\n weight = one,\n bandwidth = [-1, -1],\n dx = 960,\n dy = 500,\n k = 2; // log2(cellSize)\n\n function density(data, counts) {\n const rx = radius(bandwidth[0], data, x) >> k,\n // blur x-radius\n ry = radius(bandwidth[1], data, y) >> k,\n // blur y-radius\n ox = rx ? rx + 2 : 0,\n // x-offset padding for blur\n oy = ry ? ry + 2 : 0,\n // y-offset padding for blur\n n = 2 * ox + (dx >> k),\n // grid width\n m = 2 * oy + (dy >> k),\n // grid height\n values0 = new Float32Array(n * m),\n values1 = new Float32Array(n * m);\n let values = values0;\n data.forEach(d => {\n const xi = ox + (+x(d) >> k),\n yi = oy + (+y(d) >> k);\n if (xi >= 0 && xi < n && yi >= 0 && yi < m) {\n values0[xi + yi * n] += +weight(d);\n }\n });\n if (rx > 0 && ry > 0) {\n blurX(n, m, values0, values1, rx);\n blurY(n, m, values1, values0, ry);\n blurX(n, m, values0, values1, rx);\n blurY(n, m, values1, values0, ry);\n blurX(n, m, values0, values1, rx);\n blurY(n, m, values1, values0, ry);\n } else if (rx > 0) {\n blurX(n, m, values0, values1, rx);\n blurX(n, m, values1, values0, rx);\n blurX(n, m, values0, values1, rx);\n values = values1;\n } else if (ry > 0) {\n blurY(n, m, values0, values1, ry);\n blurY(n, m, values1, values0, ry);\n blurY(n, m, values0, values1, ry);\n values = values1;\n }\n\n // scale density estimates\n // density in points per square pixel or probability density\n const s = counts ? Math.pow(2, -2 * k) : 1 / sum(values);\n for (let i = 0, sz = n * m; i < sz; ++i) values[i] *= s;\n return {\n values: values,\n scale: 1 << k,\n width: n,\n height: m,\n x1: ox,\n y1: oy,\n x2: ox + (dx >> k),\n y2: oy + (dy >> k)\n };\n }\n density.x = function (_) {\n return arguments.length ? (x = number(_), density) : x;\n };\n density.y = function (_) {\n return arguments.length ? (y = number(_), density) : y;\n };\n density.weight = function (_) {\n return arguments.length ? (weight = number(_), density) : weight;\n };\n density.size = function (_) {\n if (!arguments.length) return [dx, dy];\n var _0 = +_[0],\n _1 = +_[1];\n if (!(_0 >= 0 && _1 >= 0)) error('invalid size');\n return dx = _0, dy = _1, density;\n };\n density.cellSize = function (_) {\n if (!arguments.length) return 1 << k;\n if (!((_ = +_) >= 1)) error('invalid cell size');\n k = Math.floor(Math.log(_) / Math.LN2);\n return density;\n };\n density.bandwidth = function (_) {\n if (!arguments.length) return bandwidth;\n _ = array(_);\n if (_.length === 1) _ = [+_[0], +_[0]];\n if (_.length !== 2) error('invalid bandwidth');\n return bandwidth = _, density;\n };\n return density;\n}\nfunction blurX(n, m, source, target, r) {\n const w = (r << 1) + 1;\n for (let j = 0; j < m; ++j) {\n for (let i = 0, sr = 0; i < n + r; ++i) {\n if (i < n) {\n sr += source[i + j * n];\n }\n if (i >= r) {\n if (i >= w) {\n sr -= source[i - w + j * n];\n }\n target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w);\n }\n }\n }\n}\nfunction blurY(n, m, source, target, r) {\n const w = (r << 1) + 1;\n for (let i = 0; i < n; ++i) {\n for (let j = 0, sr = 0; j < m + r; ++j) {\n if (j < m) {\n sr += source[i + j * n];\n }\n if (j >= r) {\n if (j >= w) {\n sr -= source[i + (j - w) * n];\n }\n target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w);\n }\n }\n }\n}\n\n/**\n * Perform 2D kernel-density estimation of point data.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.size - The [width, height] extent (in\n * units of input pixels) over which to perform density estimation.\n * @param {function(object): number} params.x - The x-coordinate accessor.\n * @param {function(object): number} params.y - The y-coordinate accessor.\n * @param {function(object): number} [params.weight] - The weight accessor.\n * @param {Array} [params.groupby] - An array of accessors\n * to groupby.\n * @param {number} [params.cellSize] - Contour density calculation cell size.\n * This parameter determines the level of spatial approximation. For example,\n * the default value of 4 maps to 2x reductions in both x- and y- dimensions.\n * A value of 1 will result in an output raster grid whose dimensions exactly\n * matches the size parameter.\n * @param {Array} [params.bandwidth] - The KDE kernel bandwidths,\n * in pixels. The input can be a two-element array specifying separate\n * x and y bandwidths, or a single-element array specifying both. If the\n * bandwidth is unspecified or less than zero, the bandwidth will be\n * automatically determined.\n * @param {boolean} [params.counts=false] - A boolean flag indicating if the\n * output values should be probability estimates (false, default) or\n * smoothed counts (true).\n * @param {string} [params.as='grid'] - The output field in which to store\n * the generated raster grid (default 'grid').\n */\nfunction KDE2D(params) {\n Transform.call(this, null, params);\n}\nKDE2D.Definition = {\n 'type': 'KDE2D',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2,\n 'required': true\n }, {\n 'name': 'x',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'y',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'weight',\n 'type': 'field'\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'cellSize',\n 'type': 'number'\n }, {\n 'name': 'bandwidth',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'counts',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'grid'\n }]\n};\nconst PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth'];\nfunction params(obj, _) {\n PARAMS.forEach(param => _[param] != null ? obj[param](_[param]) : 0);\n return obj;\n}\ninherits(KDE2D, Transform, {\n transform(_, pulse) {\n if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation;\n var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n source = pulse.materialize(pulse.SOURCE).source,\n groups = partition(source, _.groupby),\n names = (_.groupby || []).map(accessorName),\n kde = params(density2D(), _),\n as = _.as || 'grid',\n values = [];\n function set(t, vals) {\n for (let i = 0; i < names.length; ++i) t[names[i]] = vals[i];\n return t;\n }\n\n // generate density raster grids\n values = groups.map(g => ingest(set({\n [as]: kde(g, _.counts)\n }, g.dims)));\n if (this.value) out.rem = this.value;\n this.value = out.source = out.add = values;\n return out;\n }\n});\nfunction partition(data, groupby) {\n var groups = [],\n get = f => f(t),\n map,\n i,\n n,\n t,\n k,\n g;\n\n // partition data points into groups\n if (groupby == null) {\n groups.push(data);\n } else {\n for (map = {}, i = 0, n = data.length; i < n; ++i) {\n t = data[i];\n k = groupby.map(get);\n g = map[k];\n if (!g) {\n map[k] = g = [];\n g.dims = k;\n groups.push(g);\n }\n g.push(t);\n }\n }\n return groups;\n}\n\n/**\n * Generate contours based on kernel-density estimation of point data.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.size - The dimensions [width, height] over which to compute contours.\n * If the values parameter is provided, this must be the dimensions of the input data.\n * If density estimation is performed, this is the output view dimensions in pixels.\n * @param {Array} [params.values] - An array of numeric values representing an\n * width x height grid of values over which to compute contours. If unspecified, this\n * transform will instead attempt to compute contours for the kernel density estimate\n * using values drawn from data tuples in the input pulse.\n * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation.\n * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation.\n * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation.\n * @param {number} [params.cellSize] - Contour density calculation cell size.\n * @param {number} [params.bandwidth] - Kernel density estimation bandwidth.\n * @param {Array} [params.thresholds] - Contour threshold array. If\n * this parameter is set, the count and nice parameters will be ignored.\n * @param {number} [params.count] - The desired number of contours.\n * @param {boolean} [params.nice] - Boolean flag indicating if the contour\n * threshold values should be automatically aligned to \"nice\"\n * human-friendly values. Setting this flag may cause the number of\n * thresholds to deviate from the specified count.\n * @param {boolean} [params.smooth] - Boolean flag indicating if the contour\n * polygons should be smoothed using linear interpolation. The default is\n * true. The parameter is ignored when using density estimation.\n */\nfunction Contour(params) {\n Transform.call(this, null, params);\n}\nContour.Definition = {\n 'type': 'Contour',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2,\n 'required': true\n }, {\n 'name': 'values',\n 'type': 'number',\n 'array': true\n }, {\n 'name': 'x',\n 'type': 'field'\n }, {\n 'name': 'y',\n 'type': 'field'\n }, {\n 'name': 'weight',\n 'type': 'field'\n }, {\n 'name': 'cellSize',\n 'type': 'number'\n }, {\n 'name': 'bandwidth',\n 'type': 'number'\n }, {\n 'name': 'count',\n 'type': 'number'\n }, {\n 'name': 'nice',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'thresholds',\n 'type': 'number',\n 'array': true\n }, {\n 'name': 'smooth',\n 'type': 'boolean',\n 'default': true\n }]\n};\ninherits(Contour, Transform, {\n transform(_, pulse) {\n if (this.value && !pulse.changed() && !_.modified()) {\n return pulse.StopPropagation;\n }\n var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n contour = contours().smooth(_.smooth !== false),\n values = _.values,\n thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values),\n size = _.size,\n grid,\n post;\n if (!values) {\n values = pulse.materialize(pulse.SOURCE).source;\n grid = params(density2D(), _)(values, true);\n post = transform(grid, grid.scale || 1, grid.scale || 1, 0, 0);\n size = [grid.width, grid.height];\n values = grid.values;\n }\n thresh = isArray(thresh) ? thresh : thresh(values);\n values = contour.size(size)(values, thresh);\n if (post) values.forEach(post);\n if (this.value) out.rem = this.value;\n this.value = out.source = out.add = (values || []).map(ingest);\n return out;\n }\n});\n\nconst Feature = 'Feature';\nconst FeatureCollection = 'FeatureCollection';\nconst MultiPoint = 'MultiPoint';\n\n/**\n * Consolidate an array of [longitude, latitude] points or GeoJSON features\n * into a combined GeoJSON object. This transform is particularly useful for\n * combining geo data for a Projection's fit argument. The resulting GeoJSON\n * data is available as this transform's value. Input pulses are unchanged.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} [params.fields] - A two-element array\n * of field accessors for the longitude and latitude values.\n * @param {function(object): *} params.geojson - A field accessor for\n * retrieving GeoJSON feature data.\n */\nfunction GeoJSON(params) {\n Transform.call(this, null, params);\n}\nGeoJSON.Definition = {\n 'type': 'GeoJSON',\n 'metadata': {},\n 'params': [{\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'geojson',\n 'type': 'field'\n }]\n};\ninherits(GeoJSON, Transform, {\n transform(_, pulse) {\n var features = this._features,\n points = this._points,\n fields = _.fields,\n lon = fields && fields[0],\n lat = fields && fields[1],\n geojson = _.geojson || !fields && identity,\n flag = pulse.ADD,\n mod;\n mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified(accessorFields(geojson)) || lon && pulse.modified(accessorFields(lon)) || lat && pulse.modified(accessorFields(lat));\n if (!this.value || mod) {\n flag = pulse.SOURCE;\n this._features = features = [];\n this._points = points = [];\n }\n if (geojson) {\n pulse.visit(flag, t => features.push(geojson(t)));\n }\n if (lon && lat) {\n pulse.visit(flag, t => {\n var x = lon(t),\n y = lat(t);\n if (x != null && y != null && (x = +x) === x && (y = +y) === y) {\n points.push([x, y]);\n }\n });\n features = features.concat({\n type: Feature,\n geometry: {\n type: MultiPoint,\n coordinates: points\n }\n });\n }\n this.value = {\n type: FeatureCollection,\n features: features\n };\n }\n});\n\n/**\n * Map GeoJSON data to an SVG path string.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(number, number): *} params.projection - The cartographic\n * projection to apply.\n * @param {function(object): *} [params.field] - The field with GeoJSON data,\n * or null if the tuple itself is a GeoJSON feature.\n * @param {string} [params.as='path'] - The output field in which to store\n * the generated path data (default 'path').\n */\nfunction GeoPath(params) {\n Transform.call(this, null, params);\n}\nGeoPath.Definition = {\n 'type': 'GeoPath',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'projection',\n 'type': 'projection'\n }, {\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'pointRadius',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'path'\n }]\n};\ninherits(GeoPath, Transform, {\n transform(_, pulse) {\n var out = pulse.fork(pulse.ALL),\n path = this.value,\n field = _.field || identity,\n as = _.as || 'path',\n flag = out.SOURCE;\n if (!path || _.modified()) {\n // parameters updated, reset and reflow\n this.value = path = getProjectionPath(_.projection);\n out.materialize().reflow();\n } else {\n flag = field === identity || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD;\n }\n const prev = initPath(path, _.pointRadius);\n out.visit(flag, t => t[as] = path(field(t)));\n path.pointRadius(prev);\n return out.modifies(as);\n }\n});\nfunction initPath(path, pointRadius) {\n const prev = path.pointRadius();\n path.context(null);\n if (pointRadius != null) {\n path.pointRadius(pointRadius);\n }\n return prev;\n}\n\n/**\n * Geo-code a longitude/latitude point to an x/y coordinate.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(number, number): *} params.projection - The cartographic\n * projection to apply.\n * @param {Array} params.fields - A two-element array of\n * field accessors for the longitude and latitude values.\n * @param {Array} [params.as] - A two-element array of field names\n * under which to store the result. Defaults to ['x','y'].\n */\nfunction GeoPoint(params) {\n Transform.call(this, null, params);\n}\nGeoPoint.Definition = {\n 'type': 'GeoPoint',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'projection',\n 'type': 'projection',\n 'required': true\n }, {\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'required': true,\n 'length': 2\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['x', 'y']\n }]\n};\ninherits(GeoPoint, Transform, {\n transform(_, pulse) {\n var proj = _.projection,\n lon = _.fields[0],\n lat = _.fields[1],\n as = _.as || ['x', 'y'],\n x = as[0],\n y = as[1],\n mod;\n function set(t) {\n const xy = proj([lon(t), lat(t)]);\n if (xy) {\n t[x] = xy[0];\n t[y] = xy[1];\n } else {\n t[x] = undefined;\n t[y] = undefined;\n }\n }\n if (_.modified()) {\n // parameters updated, reflow\n pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set);\n } else {\n mod = pulse.modified(lon.fields) || pulse.modified(lat.fields);\n pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set);\n }\n return pulse.modifies(as);\n }\n});\n\n/**\n * Annotate items with a geopath shape generator.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(number, number): *} params.projection - The cartographic\n * projection to apply.\n * @param {function(object): *} [params.field] - The field with GeoJSON data,\n * or null if the tuple itself is a GeoJSON feature.\n * @param {string} [params.as='shape'] - The output field in which to store\n * the generated path data (default 'shape').\n */\nfunction GeoShape(params) {\n Transform.call(this, null, params);\n}\nGeoShape.Definition = {\n 'type': 'GeoShape',\n 'metadata': {\n 'modifies': true,\n 'nomod': true\n },\n 'params': [{\n 'name': 'projection',\n 'type': 'projection'\n }, {\n 'name': 'field',\n 'type': 'field',\n 'default': 'datum'\n }, {\n 'name': 'pointRadius',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'shape'\n }]\n};\ninherits(GeoShape, Transform, {\n transform(_, pulse) {\n var out = pulse.fork(pulse.ALL),\n shape = this.value,\n as = _.as || 'shape',\n flag = out.ADD;\n if (!shape || _.modified()) {\n // parameters updated, reset and reflow\n this.value = shape = shapeGenerator(getProjectionPath(_.projection), _.field || field('datum'), _.pointRadius);\n out.materialize().reflow();\n flag = out.SOURCE;\n }\n out.visit(flag, t => t[as] = shape);\n return out.modifies(as);\n }\n});\nfunction shapeGenerator(path, field, pointRadius) {\n const shape = pointRadius == null ? _ => path(field(_)) : _ => {\n var prev = path.pointRadius(),\n value = path.pointRadius(pointRadius)(field(_));\n path.pointRadius(prev);\n return value;\n };\n shape.context = _ => {\n path.context(_);\n return shape;\n };\n return shape;\n}\n\n/**\n * GeoJSON feature generator for creating graticules.\n * @constructor\n */\nfunction Graticule(params) {\n Transform.call(this, [], params);\n this.generator = geoGraticule();\n}\nGraticule.Definition = {\n 'type': 'Graticule',\n 'metadata': {\n 'changes': true,\n 'generates': true\n },\n 'params': [{\n 'name': 'extent',\n 'type': 'array',\n 'array': true,\n 'length': 2,\n 'content': {\n 'type': 'number',\n 'array': true,\n 'length': 2\n }\n }, {\n 'name': 'extentMajor',\n 'type': 'array',\n 'array': true,\n 'length': 2,\n 'content': {\n 'type': 'number',\n 'array': true,\n 'length': 2\n }\n }, {\n 'name': 'extentMinor',\n 'type': 'array',\n 'array': true,\n 'length': 2,\n 'content': {\n 'type': 'number',\n 'array': true,\n 'length': 2\n }\n }, {\n 'name': 'step',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'stepMajor',\n 'type': 'number',\n 'array': true,\n 'length': 2,\n 'default': [90, 360]\n }, {\n 'name': 'stepMinor',\n 'type': 'number',\n 'array': true,\n 'length': 2,\n 'default': [10, 10]\n }, {\n 'name': 'precision',\n 'type': 'number',\n 'default': 2.5\n }]\n};\ninherits(Graticule, Transform, {\n transform(_, pulse) {\n var src = this.value,\n gen = this.generator,\n t;\n if (!src.length || _.modified()) {\n for (const prop in _) {\n if (isFunction(gen[prop])) {\n gen[prop](_[prop]);\n }\n }\n }\n t = gen();\n if (src.length) {\n pulse.mod.push(replace(src[0], t));\n } else {\n pulse.add.push(ingest(t));\n }\n src[0] = t;\n return pulse;\n }\n});\n\n/**\n * Render a heatmap image for input raster grid data.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} [params.field] - The field with raster grid\n * data. If unspecified, the tuple itself is interpreted as a raster grid.\n * @param {string} [params.color] - A constant color value or function for\n * individual pixel color. If a function, it will be invoked with an input\n * object that includes $x, $y, $value, and $max fields for the grid.\n * @param {number} [params.opacity] - A constant opacity value or function for\n * individual pixel opacity. If a function, it will be invoked with an input\n * object that includes $x, $y, $value, and $max fields for the grid.\n * @param {string} [params.resolve] - The method for resolving maximum values\n * across multiple input grids. If 'independent' (the default), maximum\n * calculation will be performed separately for each grid. If 'shared',\n * a single global maximum will be used for all input grids.\n * @param {string} [params.as='image'] - The output field in which to store\n * the generated bitmap canvas images (default 'image').\n */\nfunction Heatmap(params) {\n Transform.call(this, null, params);\n}\nHeatmap.Definition = {\n 'type': 'heatmap',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'color',\n 'type': 'string',\n 'expr': true\n }, {\n 'name': 'opacity',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'resolve',\n 'type': 'enum',\n 'values': ['shared', 'independent'],\n 'default': 'independent'\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'image'\n }]\n};\ninherits(Heatmap, Transform, {\n transform(_, pulse) {\n if (!pulse.changed() && !_.modified()) {\n return pulse.StopPropagation;\n }\n var source = pulse.materialize(pulse.SOURCE).source,\n shared = _.resolve === 'shared',\n field = _.field || identity,\n opacity = opacity_(_.opacity, _),\n color = color_(_.color, _),\n as = _.as || 'image',\n obj = {\n $x: 0,\n $y: 0,\n $value: 0,\n $max: shared ? max(source.map(t => max(field(t).values))) : 0\n };\n source.forEach(t => {\n const v = field(t);\n\n // build proxy data object\n const o = extend({}, t, obj);\n // set maximum value if not globally shared\n if (!shared) o.$max = max(v.values || []);\n\n // generate canvas image\n // optimize color/opacity if not pixel-dependent\n t[as] = toCanvas(v, o, color.dep ? color : constant(color(o)), opacity.dep ? opacity : constant(opacity(o)));\n });\n return pulse.reflow(true).modifies(as);\n }\n});\n\n// get image color function\nfunction color_(color, _) {\n let f;\n if (isFunction(color)) {\n f = obj => rgb(color(obj, _));\n f.dep = dependency(color);\n } else {\n // default to mid-grey\n f = constant(rgb(color || '#888'));\n }\n return f;\n}\n\n// get image opacity function\nfunction opacity_(opacity, _) {\n let f;\n if (isFunction(opacity)) {\n f = obj => opacity(obj, _);\n f.dep = dependency(opacity);\n } else if (opacity) {\n f = constant(opacity);\n } else {\n // default to [0, max] opacity gradient\n f = obj => obj.$value / obj.$max || 0;\n f.dep = true;\n }\n return f;\n}\n\n// check if function depends on individual pixel data\nfunction dependency(f) {\n if (!isFunction(f)) return false;\n const set = toSet(accessorFields(f));\n return set.$x || set.$y || set.$value || set.$max;\n}\n\n// render raster grid to canvas\nfunction toCanvas(grid, obj, color, opacity) {\n const n = grid.width,\n m = grid.height,\n x1 = grid.x1 || 0,\n y1 = grid.y1 || 0,\n x2 = grid.x2 || n,\n y2 = grid.y2 || m,\n val = grid.values,\n value = val ? i => val[i] : zero,\n can = canvas(x2 - x1, y2 - y1),\n ctx = can.getContext('2d'),\n img = ctx.getImageData(0, 0, x2 - x1, y2 - y1),\n pix = img.data;\n for (let j = y1, k = 0; j < y2; ++j) {\n obj.$y = j - y1;\n for (let i = x1, r = j * n; i < x2; ++i, k += 4) {\n obj.$x = i - x1;\n obj.$value = value(i + r);\n const v = color(obj);\n pix[k + 0] = v.r;\n pix[k + 1] = v.g;\n pix[k + 2] = v.b;\n pix[k + 3] = ~~(255 * opacity(obj));\n }\n }\n ctx.putImageData(img, 0, 0);\n return can;\n}\n\n/**\n * Maintains a cartographic projection.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction Projection(params) {\n Transform.call(this, null, params);\n this.modified(true); // always treat as modified\n}\n\ninherits(Projection, Transform, {\n transform(_, pulse) {\n let proj = this.value;\n if (!proj || _.modified('type')) {\n this.value = proj = create(_.type);\n projectionProperties.forEach(prop => {\n if (_[prop] != null) set(proj, prop, _[prop]);\n });\n } else {\n projectionProperties.forEach(prop => {\n if (_.modified(prop)) set(proj, prop, _[prop]);\n });\n }\n if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius);\n if (_.fit) fit(proj, _);\n return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n }\n});\nfunction fit(proj, _) {\n const data = collectGeoJSON(_.fit);\n _.extent ? proj.fitExtent(_.extent, data) : _.size ? proj.fitSize(_.size, data) : 0;\n}\nfunction create(type) {\n const constructor = projection((type || 'mercator').toLowerCase());\n if (!constructor) error('Unrecognized projection type: ' + type);\n return constructor();\n}\nfunction set(proj, key, value) {\n if (isFunction(proj[key])) proj[key](value);\n}\nfunction collectGeoJSON(data) {\n data = array(data);\n return data.length === 1 ? data[0] : {\n type: FeatureCollection,\n features: data.reduce((a, f) => a.concat(featurize(f)), [])\n };\n}\nfunction featurize(f) {\n return f.type === FeatureCollection ? f.features : array(f).filter(d => d != null).map(d => d.type === Feature ? d : {\n type: Feature,\n geometry: d\n });\n}\n\nexport { Contour as contour, GeoJSON as geojson, GeoPath as geopath, GeoPoint as geopoint, GeoShape as geoshape, Graticule as graticule, Heatmap as heatmap, Isocontour as isocontour, KDE2D as kde2d, Projection as projection };\n","export default function(d) {\n const x = +this._x.call(null, d),\n y = +this._y.call(null, d);\n return add(this.cover(x, y), x, y, d);\n}\n\nfunction add(tree, x, y, d) {\n if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points\n\n var parent,\n node = tree._root,\n leaf = {data: d},\n x0 = tree._x0,\n y0 = tree._y0,\n x1 = tree._x1,\n y1 = tree._y1,\n xm,\n ym,\n xp,\n yp,\n right,\n bottom,\n i,\n j;\n\n // If the tree is empty, initialize the root as a leaf.\n if (!node) return tree._root = leaf, tree;\n\n // Find the existing leaf for the new point, or add it.\n while (node.length) {\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;\n }\n\n // Is the new point is exactly coincident with the existing point?\n xp = +tree._x.call(null, node.data);\n yp = +tree._y.call(null, node.data);\n if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;\n\n // Otherwise, split the leaf node until the old and new point are separated.\n do {\n parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm)));\n return parent[j] = node, parent[i] = leaf, tree;\n}\n\nexport function addAll(data) {\n var d, i, n = data.length,\n x,\n y,\n xz = new Array(n),\n yz = new Array(n),\n x0 = Infinity,\n y0 = Infinity,\n x1 = -Infinity,\n y1 = -Infinity;\n\n // Compute the points and their extent.\n for (i = 0; i < n; ++i) {\n if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;\n xz[i] = x;\n yz[i] = y;\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n\n // If there were no (valid) points, abort.\n if (x0 > x1 || y0 > y1) return this;\n\n // Expand the tree to cover the new points.\n this.cover(x0, y0).cover(x1, y1);\n\n // Add the new points.\n for (i = 0; i < n; ++i) {\n add(this, xz[i], yz[i], data[i]);\n }\n\n return this;\n}\n","export default function(node, x0, y0, x1, y1) {\n this.node = node;\n this.x0 = x0;\n this.y0 = y0;\n this.x1 = x1;\n this.y1 = y1;\n}\n","export function defaultX(d) {\n return d[0];\n}\n\nexport default function(_) {\n return arguments.length ? (this._x = _, this) : this._x;\n}\n","export function defaultY(d) {\n return d[1];\n}\n\nexport default function(_) {\n return arguments.length ? (this._y = _, this) : this._y;\n}\n","import tree_add, {addAll as tree_addAll} from \"./add.js\";\nimport tree_cover from \"./cover.js\";\nimport tree_data from \"./data.js\";\nimport tree_extent from \"./extent.js\";\nimport tree_find from \"./find.js\";\nimport tree_remove, {removeAll as tree_removeAll} from \"./remove.js\";\nimport tree_root from \"./root.js\";\nimport tree_size from \"./size.js\";\nimport tree_visit from \"./visit.js\";\nimport tree_visitAfter from \"./visitAfter.js\";\nimport tree_x, {defaultX} from \"./x.js\";\nimport tree_y, {defaultY} from \"./y.js\";\n\nexport default function quadtree(nodes, x, y) {\n var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);\n return nodes == null ? tree : tree.addAll(nodes);\n}\n\nfunction Quadtree(x, y, x0, y0, x1, y1) {\n this._x = x;\n this._y = y;\n this._x0 = x0;\n this._y0 = y0;\n this._x1 = x1;\n this._y1 = y1;\n this._root = undefined;\n}\n\nfunction leaf_copy(leaf) {\n var copy = {data: leaf.data}, next = copy;\n while (leaf = leaf.next) next = next.next = {data: leaf.data};\n return copy;\n}\n\nvar treeProto = quadtree.prototype = Quadtree.prototype;\n\ntreeProto.copy = function() {\n var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1),\n node = this._root,\n nodes,\n child;\n\n if (!node) return copy;\n\n if (!node.length) return copy._root = leaf_copy(node), copy;\n\n nodes = [{source: node, target: copy._root = new Array(4)}];\n while (node = nodes.pop()) {\n for (var i = 0; i < 4; ++i) {\n if (child = node.source[i]) {\n if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)});\n else node.target[i] = leaf_copy(child);\n }\n }\n }\n\n return copy;\n};\n\ntreeProto.add = tree_add;\ntreeProto.addAll = tree_addAll;\ntreeProto.cover = tree_cover;\ntreeProto.data = tree_data;\ntreeProto.extent = tree_extent;\ntreeProto.find = tree_find;\ntreeProto.remove = tree_remove;\ntreeProto.removeAll = tree_removeAll;\ntreeProto.root = tree_root;\ntreeProto.size = tree_size;\ntreeProto.visit = tree_visit;\ntreeProto.visitAfter = tree_visitAfter;\ntreeProto.x = tree_x;\ntreeProto.y = tree_y;\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","export default function(random) {\n return (random() - 0.5) * 1e-6;\n}\n","import {quadtree} from \"d3-quadtree\";\nimport constant from \"./constant.js\";\nimport jiggle from \"./jiggle.js\";\n\nfunction x(d) {\n return d.x + d.vx;\n}\n\nfunction y(d) {\n return d.y + d.vy;\n}\n\nexport default function(radius) {\n var nodes,\n radii,\n random,\n strength = 1,\n iterations = 1;\n\n if (typeof radius !== \"function\") radius = constant(radius == null ? 1 : +radius);\n\n function force() {\n var i, n = nodes.length,\n tree,\n node,\n xi,\n yi,\n ri,\n ri2;\n\n for (var k = 0; k < iterations; ++k) {\n tree = quadtree(nodes, x, y).visitAfter(prepare);\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n ri = radii[node.index], ri2 = ri * ri;\n xi = node.x + node.vx;\n yi = node.y + node.vy;\n tree.visit(apply);\n }\n }\n\n function apply(quad, x0, y0, x1, y1) {\n var data = quad.data, rj = quad.r, r = ri + rj;\n if (data) {\n if (data.index > node.index) {\n var x = xi - data.x - data.vx,\n y = yi - data.y - data.vy,\n l = x * x + y * y;\n if (l < r * r) {\n if (x === 0) x = jiggle(random), l += x * x;\n if (y === 0) y = jiggle(random), l += y * y;\n l = (r - (l = Math.sqrt(l))) / l * strength;\n node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));\n node.vy += (y *= l) * r;\n data.vx -= x * (r = 1 - r);\n data.vy -= y * r;\n }\n }\n return;\n }\n return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;\n }\n }\n\n function prepare(quad) {\n if (quad.data) return quad.r = radii[quad.data.index];\n for (var i = quad.r = 0; i < 4; ++i) {\n if (quad[i] && quad[i].r > quad.r) {\n quad.r = quad[i].r;\n }\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, node;\n radii = new Array(n);\n for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);\n }\n\n force.initialize = function(_nodes, _random) {\n nodes = _nodes;\n random = _random;\n initialize();\n };\n\n force.iterations = function(_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = +_, force) : strength;\n };\n\n force.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : radius;\n };\n\n return force;\n}\n","export default function(x, y) {\n if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points\n\n var x0 = this._x0,\n y0 = this._y0,\n x1 = this._x1,\n y1 = this._y1;\n\n // If the quadtree has no extent, initialize them.\n // Integer extent are necessary so that if we later double the extent,\n // the existing quadrant boundaries don’t change due to floating point error!\n if (isNaN(x0)) {\n x1 = (x0 = Math.floor(x)) + 1;\n y1 = (y0 = Math.floor(y)) + 1;\n }\n\n // Otherwise, double repeatedly to cover.\n else {\n var z = x1 - x0 || 1,\n node = this._root,\n parent,\n i;\n\n while (x0 > x || x >= x1 || y0 > y || y >= y1) {\n i = (y < y0) << 1 | (x < x0);\n parent = new Array(4), parent[i] = node, node = parent, z *= 2;\n switch (i) {\n case 0: x1 = x0 + z, y1 = y0 + z; break;\n case 1: x0 = x1 - z, y1 = y0 + z; break;\n case 2: x1 = x0 + z, y0 = y1 - z; break;\n case 3: x0 = x1 - z, y0 = y1 - z; break;\n }\n }\n\n if (this._root && this._root.length) this._root = node;\n }\n\n this._x0 = x0;\n this._y0 = y0;\n this._x1 = x1;\n this._y1 = y1;\n return this;\n}\n","export default function() {\n var data = [];\n this.visit(function(node) {\n if (!node.length) do data.push(node.data); while (node = node.next)\n });\n return data;\n}\n","export default function(_) {\n return arguments.length\n ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1])\n : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];\n}\n","import Quad from \"./quad.js\";\n\nexport default function(x, y, radius) {\n var data,\n x0 = this._x0,\n y0 = this._y0,\n x1,\n y1,\n x2,\n y2,\n x3 = this._x1,\n y3 = this._y1,\n quads = [],\n node = this._root,\n q,\n i;\n\n if (node) quads.push(new Quad(node, x0, y0, x3, y3));\n if (radius == null) radius = Infinity;\n else {\n x0 = x - radius, y0 = y - radius;\n x3 = x + radius, y3 = y + radius;\n radius *= radius;\n }\n\n while (q = quads.pop()) {\n\n // Stop searching if this quadrant can’t contain a closer node.\n if (!(node = q.node)\n || (x1 = q.x0) > x3\n || (y1 = q.y0) > y3\n || (x2 = q.x1) < x0\n || (y2 = q.y1) < y0) continue;\n\n // Bisect the current quadrant.\n if (node.length) {\n var xm = (x1 + x2) / 2,\n ym = (y1 + y2) / 2;\n\n quads.push(\n new Quad(node[3], xm, ym, x2, y2),\n new Quad(node[2], x1, ym, xm, y2),\n new Quad(node[1], xm, y1, x2, ym),\n new Quad(node[0], x1, y1, xm, ym)\n );\n\n // Visit the closest quadrant first.\n if (i = (y >= ym) << 1 | (x >= xm)) {\n q = quads[quads.length - 1];\n quads[quads.length - 1] = quads[quads.length - 1 - i];\n quads[quads.length - 1 - i] = q;\n }\n }\n\n // Visit this point. (Visiting coincident points isn’t necessary!)\n else {\n var dx = x - +this._x.call(null, node.data),\n dy = y - +this._y.call(null, node.data),\n d2 = dx * dx + dy * dy;\n if (d2 < radius) {\n var d = Math.sqrt(radius = d2);\n x0 = x - d, y0 = y - d;\n x3 = x + d, y3 = y + d;\n data = node.data;\n }\n }\n }\n\n return data;\n}\n","export default function(d) {\n if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points\n\n var parent,\n node = this._root,\n retainer,\n previous,\n next,\n x0 = this._x0,\n y0 = this._y0,\n x1 = this._x1,\n y1 = this._y1,\n x,\n y,\n xm,\n ym,\n right,\n bottom,\n i,\n j;\n\n // If the tree is empty, initialize the root as a leaf.\n if (!node) return this;\n\n // Find the leaf node for the point.\n // While descending, also retain the deepest parent with a non-removed sibling.\n if (node.length) while (true) {\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n if (!(parent = node, node = node[i = bottom << 1 | right])) return this;\n if (!node.length) break;\n if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i;\n }\n\n // Find the point to remove.\n while (node.data !== d) if (!(previous = node, node = node.next)) return this;\n if (next = node.next) delete node.next;\n\n // If there are multiple coincident points, remove just the point.\n if (previous) return (next ? previous.next = next : delete previous.next), this;\n\n // If this is the root point, remove it.\n if (!parent) return this._root = next, this;\n\n // Remove this leaf.\n next ? parent[i] = next : delete parent[i];\n\n // If the parent now contains exactly one leaf, collapse superfluous parents.\n if ((node = parent[0] || parent[1] || parent[2] || parent[3])\n && node === (parent[3] || parent[2] || parent[1] || parent[0])\n && !node.length) {\n if (retainer) retainer[j] = node;\n else this._root = node;\n }\n\n return this;\n}\n\nexport function removeAll(data) {\n for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);\n return this;\n}\n","export default function() {\n return this._root;\n}\n","export default function() {\n var size = 0;\n this.visit(function(node) {\n if (!node.length) do ++size; while (node = node.next)\n });\n return size;\n}\n","import Quad from \"./quad.js\";\n\nexport default function(callback) {\n var quads = [], q, node = this._root, child, x0, y0, x1, y1;\n if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1));\n while (q = quads.pop()) {\n if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {\n var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;\n if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));\n if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));\n if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));\n if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));\n }\n }\n return this;\n}\n","import Quad from \"./quad.js\";\n\nexport default function(callback) {\n var quads = [], next = [], q;\n if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));\n while (q = quads.pop()) {\n var node = q.node;\n if (node.length) {\n var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;\n if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));\n if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));\n if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));\n if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));\n }\n next.push(q);\n }\n while (q = next.pop()) {\n callback(q.node, q.x0, q.y0, q.x1, q.y1);\n }\n return this;\n}\n","var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n","var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we’ve set an alarm, if we haven’t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n","// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use\nconst a = 1664525;\nconst c = 1013904223;\nconst m = 4294967296; // 2^32\n\nexport default function() {\n let s = 1;\n return () => (s = (a * s + c) % m) / m;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {timer} from \"d3-timer\";\nimport lcg from \"./lcg.js\";\n\nexport function x(d) {\n return d.x;\n}\n\nexport function y(d) {\n return d.y;\n}\n\nvar initialRadius = 10,\n initialAngle = Math.PI * (3 - Math.sqrt(5));\n\nexport default function(nodes) {\n var simulation,\n alpha = 1,\n alphaMin = 0.001,\n alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),\n alphaTarget = 0,\n velocityDecay = 0.6,\n forces = new Map(),\n stepper = timer(step),\n event = dispatch(\"tick\", \"end\"),\n random = lcg();\n\n if (nodes == null) nodes = [];\n\n function step() {\n tick();\n event.call(\"tick\", simulation);\n if (alpha < alphaMin) {\n stepper.stop();\n event.call(\"end\", simulation);\n }\n }\n\n function tick(iterations) {\n var i, n = nodes.length, node;\n\n if (iterations === undefined) iterations = 1;\n\n for (var k = 0; k < iterations; ++k) {\n alpha += (alphaTarget - alpha) * alphaDecay;\n\n forces.forEach(function(force) {\n force(alpha);\n });\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (node.fx == null) node.x += node.vx *= velocityDecay;\n else node.x = node.fx, node.vx = 0;\n if (node.fy == null) node.y += node.vy *= velocityDecay;\n else node.y = node.fy, node.vy = 0;\n }\n }\n\n return simulation;\n }\n\n function initializeNodes() {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.index = i;\n if (node.fx != null) node.x = node.fx;\n if (node.fy != null) node.y = node.fy;\n if (isNaN(node.x) || isNaN(node.y)) {\n var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle;\n node.x = radius * Math.cos(angle);\n node.y = radius * Math.sin(angle);\n }\n if (isNaN(node.vx) || isNaN(node.vy)) {\n node.vx = node.vy = 0;\n }\n }\n }\n\n function initializeForce(force) {\n if (force.initialize) force.initialize(nodes, random);\n return force;\n }\n\n initializeNodes();\n\n return simulation = {\n tick: tick,\n\n restart: function() {\n return stepper.restart(step), simulation;\n },\n\n stop: function() {\n return stepper.stop(), simulation;\n },\n\n nodes: function(_) {\n return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes;\n },\n\n alpha: function(_) {\n return arguments.length ? (alpha = +_, simulation) : alpha;\n },\n\n alphaMin: function(_) {\n return arguments.length ? (alphaMin = +_, simulation) : alphaMin;\n },\n\n alphaDecay: function(_) {\n return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;\n },\n\n alphaTarget: function(_) {\n return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;\n },\n\n velocityDecay: function(_) {\n return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;\n },\n\n randomSource: function(_) {\n return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random;\n },\n\n force: function(name, _) {\n return arguments.length > 1 ? ((_ == null ? forces.delete(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);\n },\n\n find: function(x, y, radius) {\n var i = 0,\n n = nodes.length,\n dx,\n dy,\n d2,\n node,\n closest;\n\n if (radius == null) radius = Infinity;\n else radius *= radius;\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n dx = x - node.x;\n dy = y - node.y;\n d2 = dx * dx + dy * dy;\n if (d2 < radius) closest = node, radius = d2;\n }\n\n return closest;\n },\n\n on: function(name, _) {\n return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);\n }\n };\n}\n","import constant from \"./constant.js\";\nimport jiggle from \"./jiggle.js\";\n\nfunction index(d) {\n return d.index;\n}\n\nfunction find(nodeById, nodeId) {\n var node = nodeById.get(nodeId);\n if (!node) throw new Error(\"node not found: \" + nodeId);\n return node;\n}\n\nexport default function(links) {\n var id = index,\n strength = defaultStrength,\n strengths,\n distance = constant(30),\n distances,\n nodes,\n count,\n bias,\n random,\n iterations = 1;\n\n if (links == null) links = [];\n\n function defaultStrength(link) {\n return 1 / Math.min(count[link.source.index], count[link.target.index]);\n }\n\n function force(alpha) {\n for (var k = 0, n = links.length; k < iterations; ++k) {\n for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {\n link = links[i], source = link.source, target = link.target;\n x = target.x + target.vx - source.x - source.vx || jiggle(random);\n y = target.y + target.vy - source.y - source.vy || jiggle(random);\n l = Math.sqrt(x * x + y * y);\n l = (l - distances[i]) / l * alpha * strengths[i];\n x *= l, y *= l;\n target.vx -= x * (b = bias[i]);\n target.vy -= y * b;\n source.vx += x * (b = 1 - b);\n source.vy += y * b;\n }\n }\n }\n\n function initialize() {\n if (!nodes) return;\n\n var i,\n n = nodes.length,\n m = links.length,\n nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d])),\n link;\n\n for (i = 0, count = new Array(n); i < m; ++i) {\n link = links[i], link.index = i;\n if (typeof link.source !== \"object\") link.source = find(nodeById, link.source);\n if (typeof link.target !== \"object\") link.target = find(nodeById, link.target);\n count[link.source.index] = (count[link.source.index] || 0) + 1;\n count[link.target.index] = (count[link.target.index] || 0) + 1;\n }\n\n for (i = 0, bias = new Array(m); i < m; ++i) {\n link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);\n }\n\n strengths = new Array(m), initializeStrength();\n distances = new Array(m), initializeDistance();\n }\n\n function initializeStrength() {\n if (!nodes) return;\n\n for (var i = 0, n = links.length; i < n; ++i) {\n strengths[i] = +strength(links[i], i, links);\n }\n }\n\n function initializeDistance() {\n if (!nodes) return;\n\n for (var i = 0, n = links.length; i < n; ++i) {\n distances[i] = +distance(links[i], i, links);\n }\n }\n\n force.initialize = function(_nodes, _random) {\n nodes = _nodes;\n random = _random;\n initialize();\n };\n\n force.links = function(_) {\n return arguments.length ? (links = _, initialize(), force) : links;\n };\n\n force.id = function(_) {\n return arguments.length ? (id = _, force) : id;\n };\n\n force.iterations = function(_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initializeStrength(), force) : strength;\n };\n\n force.distance = function(_) {\n return arguments.length ? (distance = typeof _ === \"function\" ? _ : constant(+_), initializeDistance(), force) : distance;\n };\n\n return force;\n}\n","import { Transform } from 'vega-dataflow';\nimport { inherits, array, isFunction, accessorFields, hasOwnProperty, error } from 'vega-util';\nimport { forceSimulation, forceCenter, forceCollide, forceManyBody, forceLink, forceX, forceY } from 'd3-force';\n\nconst ForceMap = {\n center: forceCenter,\n collide: forceCollide,\n nbody: forceManyBody,\n link: forceLink,\n x: forceX,\n y: forceY\n};\nconst Forces = 'forces',\n ForceParams = ['alpha', 'alphaMin', 'alphaTarget', 'velocityDecay', 'forces'],\n ForceConfig = ['static', 'iterations'],\n ForceOutput = ['x', 'y', 'vx', 'vy'];\n\n/**\n * Force simulation layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.forces - The forces to apply.\n */\nfunction Force(params) {\n Transform.call(this, null, params);\n}\nForce.Definition = {\n 'type': 'Force',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'static',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'restart',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'iterations',\n 'type': 'number',\n 'default': 300\n }, {\n 'name': 'alpha',\n 'type': 'number',\n 'default': 1\n }, {\n 'name': 'alphaMin',\n 'type': 'number',\n 'default': 0.001\n }, {\n 'name': 'alphaTarget',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'velocityDecay',\n 'type': 'number',\n 'default': 0.4\n }, {\n 'name': 'forces',\n 'type': 'param',\n 'array': true,\n 'params': [{\n 'key': {\n 'force': 'center'\n },\n 'params': [{\n 'name': 'x',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'y',\n 'type': 'number',\n 'default': 0\n }]\n }, {\n 'key': {\n 'force': 'collide'\n },\n 'params': [{\n 'name': 'radius',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'strength',\n 'type': 'number',\n 'default': 0.7\n }, {\n 'name': 'iterations',\n 'type': 'number',\n 'default': 1\n }]\n }, {\n 'key': {\n 'force': 'nbody'\n },\n 'params': [{\n 'name': 'strength',\n 'type': 'number',\n 'default': -30,\n 'expr': true\n }, {\n 'name': 'theta',\n 'type': 'number',\n 'default': 0.9\n }, {\n 'name': 'distanceMin',\n 'type': 'number',\n 'default': 1\n }, {\n 'name': 'distanceMax',\n 'type': 'number'\n }]\n }, {\n 'key': {\n 'force': 'link'\n },\n 'params': [{\n 'name': 'links',\n 'type': 'data'\n }, {\n 'name': 'id',\n 'type': 'field'\n }, {\n 'name': 'distance',\n 'type': 'number',\n 'default': 30,\n 'expr': true\n }, {\n 'name': 'strength',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'iterations',\n 'type': 'number',\n 'default': 1\n }]\n }, {\n 'key': {\n 'force': 'x'\n },\n 'params': [{\n 'name': 'strength',\n 'type': 'number',\n 'default': 0.1\n }, {\n 'name': 'x',\n 'type': 'field'\n }]\n }, {\n 'key': {\n 'force': 'y'\n },\n 'params': [{\n 'name': 'strength',\n 'type': 'number',\n 'default': 0.1\n }, {\n 'name': 'y',\n 'type': 'field'\n }]\n }]\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'modify': false,\n 'default': ForceOutput\n }]\n};\ninherits(Force, Transform, {\n transform(_, pulse) {\n var sim = this.value,\n change = pulse.changed(pulse.ADD_REM),\n params = _.modified(ForceParams),\n iters = _.iterations || 300;\n\n // configure simulation\n if (!sim) {\n this.value = sim = simulation(pulse.source, _);\n sim.on('tick', rerun(pulse.dataflow, this));\n if (!_.static) {\n change = true;\n sim.tick(); // ensure we run on init\n }\n\n pulse.modifies('index');\n } else {\n if (change) {\n pulse.modifies('index');\n sim.nodes(pulse.source);\n }\n if (params || pulse.changed(pulse.MOD)) {\n setup(sim, _, 0, pulse);\n }\n }\n\n // run simulation\n if (params || change || _.modified(ForceConfig) || pulse.changed() && _.restart) {\n sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters));\n if (_.static) {\n for (sim.stop(); --iters >= 0;) sim.tick();\n } else {\n if (sim.stopped()) sim.restart();\n if (!change) return pulse.StopPropagation; // defer to sim ticks\n }\n }\n\n return this.finish(_, pulse);\n },\n finish(_, pulse) {\n const dataflow = pulse.dataflow;\n\n // inspect dependencies, touch link source data\n for (let args = this._argops, j = 0, m = args.length, arg; j < m; ++j) {\n arg = args[j];\n if (arg.name !== Forces || arg.op._argval.force !== 'link') {\n continue;\n }\n for (var ops = arg.op._argops, i = 0, n = ops.length, op; i < n; ++i) {\n if (ops[i].name === 'links' && (op = ops[i].op.source)) {\n dataflow.pulse(op, dataflow.changeset().reflow());\n break;\n }\n }\n }\n\n // reflow all nodes\n return pulse.reflow(_.modified()).modifies(ForceOutput);\n }\n});\nfunction rerun(df, op) {\n return () => df.touch(op).run();\n}\nfunction simulation(nodes, _) {\n const sim = forceSimulation(nodes),\n stop = sim.stop,\n restart = sim.restart;\n let stopped = false;\n sim.stopped = () => stopped;\n sim.restart = () => (stopped = false, restart());\n sim.stop = () => (stopped = true, stop());\n return setup(sim, _, true).on('end', () => stopped = true);\n}\nfunction setup(sim, _, init, pulse) {\n var f = array(_.forces),\n i,\n n,\n p,\n name;\n for (i = 0, n = ForceParams.length; i < n; ++i) {\n p = ForceParams[i];\n if (p !== Forces && _.modified(p)) sim[p](_[p]);\n }\n for (i = 0, n = f.length; i < n; ++i) {\n name = Forces + i;\n p = init || _.modified(Forces, i) ? getForce(f[i]) : pulse && modified(f[i], pulse) ? sim.force(name) : null;\n if (p) sim.force(name, p);\n }\n for (n = sim.numForces || 0; i < n; ++i) {\n sim.force(Forces + i, null); // remove\n }\n\n sim.numForces = f.length;\n return sim;\n}\nfunction modified(f, pulse) {\n var k, v;\n for (k in f) {\n if (isFunction(v = f[k]) && pulse.modified(accessorFields(v))) return 1;\n }\n return 0;\n}\nfunction getForce(_) {\n var f, p;\n if (!hasOwnProperty(ForceMap, _.force)) {\n error('Unrecognized force: ' + _.force);\n }\n f = ForceMap[_.force]();\n for (p in _) {\n if (isFunction(f[p])) setForceParam(f[p], _[p], _);\n }\n return f;\n}\nfunction setForceParam(f, v, _) {\n f(isFunction(v) ? d => v(d, _) : v);\n}\n\nexport { Force as force };\n","export default function(x, y) {\n var nodes, strength = 1;\n\n if (x == null) x = 0;\n if (y == null) y = 0;\n\n function force() {\n var i,\n n = nodes.length,\n node,\n sx = 0,\n sy = 0;\n\n for (i = 0; i < n; ++i) {\n node = nodes[i], sx += node.x, sy += node.y;\n }\n\n for (sx = (sx / n - x) * strength, sy = (sy / n - y) * strength, i = 0; i < n; ++i) {\n node = nodes[i], node.x -= sx, node.y -= sy;\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n };\n\n force.x = function(_) {\n return arguments.length ? (x = +_, force) : x;\n };\n\n force.y = function(_) {\n return arguments.length ? (y = +_, force) : y;\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = +_, force) : strength;\n };\n\n return force;\n}\n","import {quadtree} from \"d3-quadtree\";\nimport constant from \"./constant.js\";\nimport jiggle from \"./jiggle.js\";\nimport {x, y} from \"./simulation.js\";\n\nexport default function() {\n var nodes,\n node,\n random,\n alpha,\n strength = constant(-30),\n strengths,\n distanceMin2 = 1,\n distanceMax2 = Infinity,\n theta2 = 0.81;\n\n function force(_) {\n var i, n = nodes.length, tree = quadtree(nodes, x, y).visitAfter(accumulate);\n for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, node;\n strengths = new Array(n);\n for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);\n }\n\n function accumulate(quad) {\n var strength = 0, q, c, weight = 0, x, y, i;\n\n // For internal nodes, accumulate forces from child quadrants.\n if (quad.length) {\n for (x = y = i = 0; i < 4; ++i) {\n if ((q = quad[i]) && (c = Math.abs(q.value))) {\n strength += q.value, weight += c, x += c * q.x, y += c * q.y;\n }\n }\n quad.x = x / weight;\n quad.y = y / weight;\n }\n\n // For leaf nodes, accumulate forces from coincident quadrants.\n else {\n q = quad;\n q.x = q.data.x;\n q.y = q.data.y;\n do strength += strengths[q.data.index];\n while (q = q.next);\n }\n\n quad.value = strength;\n }\n\n function apply(quad, x1, _, x2) {\n if (!quad.value) return true;\n\n var x = quad.x - node.x,\n y = quad.y - node.y,\n w = x2 - x1,\n l = x * x + y * y;\n\n // Apply the Barnes-Hut approximation if possible.\n // Limit forces for very close nodes; randomize direction if coincident.\n if (w * w / theta2 < l) {\n if (l < distanceMax2) {\n if (x === 0) x = jiggle(random), l += x * x;\n if (y === 0) y = jiggle(random), l += y * y;\n if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);\n node.vx += x * quad.value * alpha / l;\n node.vy += y * quad.value * alpha / l;\n }\n return true;\n }\n\n // Otherwise, process points directly.\n else if (quad.length || l >= distanceMax2) return;\n\n // Limit forces for very close nodes; randomize direction if coincident.\n if (quad.data !== node || quad.next) {\n if (x === 0) x = jiggle(random), l += x * x;\n if (y === 0) y = jiggle(random), l += y * y;\n if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);\n }\n\n do if (quad.data !== node) {\n w = strengths[quad.data.index] * alpha / l;\n node.vx += x * w;\n node.vy += y * w;\n } while (quad = quad.next);\n }\n\n force.initialize = function(_nodes, _random) {\n nodes = _nodes;\n random = _random;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n };\n\n force.distanceMin = function(_) {\n return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);\n };\n\n force.distanceMax = function(_) {\n return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);\n };\n\n force.theta = function(_) {\n return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);\n };\n\n return force;\n}\n","import constant from \"./constant.js\";\n\nexport default function(x) {\n var strength = constant(0.1),\n nodes,\n strengths,\n xz;\n\n if (typeof x !== \"function\") x = constant(x == null ? 0 : +x);\n\n function force(alpha) {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n xz = new Array(n);\n for (i = 0; i < n; ++i) {\n strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n };\n\n force.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : x;\n };\n\n return force;\n}\n","import constant from \"./constant.js\";\n\nexport default function(y) {\n var strength = constant(0.1),\n nodes,\n strengths,\n yz;\n\n if (typeof y !== \"function\") y = constant(y == null ? 0 : +y);\n\n function force(alpha) {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n yz = new Array(n);\n for (i = 0; i < n; ++i) {\n strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n };\n\n force.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : y;\n };\n\n return force;\n}\n","function count(node) {\n var sum = 0,\n children = node.children,\n i = children && children.length;\n if (!i) sum = 1;\n else while (--i >= 0) sum += children[i].value;\n node.value = sum;\n}\n\nexport default function() {\n return this.eachAfter(count);\n}\n","import node_count from \"./count.js\";\nimport node_each from \"./each.js\";\nimport node_eachBefore from \"./eachBefore.js\";\nimport node_eachAfter from \"./eachAfter.js\";\nimport node_find from \"./find.js\";\nimport node_sum from \"./sum.js\";\nimport node_sort from \"./sort.js\";\nimport node_path from \"./path.js\";\nimport node_ancestors from \"./ancestors.js\";\nimport node_descendants from \"./descendants.js\";\nimport node_leaves from \"./leaves.js\";\nimport node_links from \"./links.js\";\nimport node_iterator from \"./iterator.js\";\n\nexport default function hierarchy(data, children) {\n if (data instanceof Map) {\n data = [undefined, data];\n if (children === undefined) children = mapChildren;\n } else if (children === undefined) {\n children = objectChildren;\n }\n\n var root = new Node(data),\n node,\n nodes = [root],\n child,\n childs,\n i,\n n;\n\n while (node = nodes.pop()) {\n if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {\n node.children = childs;\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = childs[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n\n return root.eachBefore(computeHeight);\n}\n\nfunction node_copy() {\n return hierarchy(this).eachBefore(copyData);\n}\n\nfunction objectChildren(d) {\n return d.children;\n}\n\nfunction mapChildren(d) {\n return Array.isArray(d) ? d[1] : null;\n}\n\nfunction copyData(node) {\n if (node.data.value !== undefined) node.value = node.data.value;\n node.data = node.data.data;\n}\n\nexport function computeHeight(node) {\n var height = 0;\n do node.height = height;\n while ((node = node.parent) && (node.height < ++height));\n}\n\nexport function Node(data) {\n this.data = data;\n this.depth =\n this.height = 0;\n this.parent = null;\n}\n\nNode.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n find: node_find,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy,\n [Symbol.iterator]: node_iterator\n};\n","export function optional(f) {\n return f == null ? null : required(f);\n}\n\nexport function required(f) {\n if (typeof f !== \"function\") throw new Error;\n return f;\n}\n","export function constantZero() {\n return 0;\n}\n\nexport default function(x) {\n return function() {\n return x;\n };\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], next = [], children, i, n, index = -1;\n while (node = nodes.pop()) {\n next.push(node);\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n }\n while (node = next.pop()) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], children, i, index = -1;\n while (node = nodes.pop()) {\n callback.call(that, node, ++index, this);\n if (children = node.children) {\n for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n }\n return this;\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n if (callback.call(that, node, ++index, this)) {\n return node;\n }\n }\n}\n","export default function(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0,\n children = node.children,\n i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n}\n","export default function(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n}\n","export default function(end) {\n var start = this,\n ancestor = leastCommonAncestor(start, end),\n nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n}\n\nfunction leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(),\n bNodes = b.ancestors(),\n c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n}\n","export default function() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n}\n","export default function() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) { // Don’t include the root’s parent, if any.\n links.push({source: node.parent, target: node});\n }\n });\n return links;\n}\n","export default function*() {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n yield node;\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n }\n } while (next.length);\n}\n","// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use\nconst a = 1664525;\nconst c = 1013904223;\nconst m = 4294967296; // 2^32\n\nexport default function() {\n let s = 1;\n return () => (s = (a * s + c) % m) / m;\n}\n","import {shuffle} from \"../array.js\";\nimport lcg from \"../lcg.js\";\n\nexport default function(circles) {\n return packEncloseRandom(circles, lcg());\n}\n\nexport function packEncloseRandom(circles, random) {\n var i = 0, n = (circles = shuffle(Array.from(circles), random)).length, B = [], p, e;\n\n while (i < n) {\n p = circles[i];\n if (e && enclosesWeak(e, p)) ++i;\n else e = encloseBasis(B = extendBasis(B, p)), i = 0;\n }\n\n return e;\n}\n\nfunction extendBasis(B, p) {\n var i, j;\n\n if (enclosesWeakAll(p, B)) return [p];\n\n // If we get here then B must have at least one element.\n for (i = 0; i < B.length; ++i) {\n if (enclosesNot(p, B[i])\n && enclosesWeakAll(encloseBasis2(B[i], p), B)) {\n return [B[i], p];\n }\n }\n\n // If we get here then B must have at least two elements.\n for (i = 0; i < B.length - 1; ++i) {\n for (j = i + 1; j < B.length; ++j) {\n if (enclosesNot(encloseBasis2(B[i], B[j]), p)\n && enclosesNot(encloseBasis2(B[i], p), B[j])\n && enclosesNot(encloseBasis2(B[j], p), B[i])\n && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) {\n return [B[i], B[j], p];\n }\n }\n }\n\n // If we get here then something is very wrong.\n throw new Error;\n}\n\nfunction enclosesNot(a, b) {\n var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y;\n return dr < 0 || dr * dr < dx * dx + dy * dy;\n}\n\nfunction enclosesWeak(a, b) {\n var dr = a.r - b.r + Math.max(a.r, b.r, 1) * 1e-9, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n}\n\nfunction enclosesWeakAll(a, B) {\n for (var i = 0; i < B.length; ++i) {\n if (!enclosesWeak(a, B[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction encloseBasis(B) {\n switch (B.length) {\n case 1: return encloseBasis1(B[0]);\n case 2: return encloseBasis2(B[0], B[1]);\n case 3: return encloseBasis3(B[0], B[1], B[2]);\n }\n}\n\nfunction encloseBasis1(a) {\n return {\n x: a.x,\n y: a.y,\n r: a.r\n };\n}\n\nfunction encloseBasis2(a, b) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1,\n l = Math.sqrt(x21 * x21 + y21 * y21);\n return {\n x: (x1 + x2 + x21 / l * r21) / 2,\n y: (y1 + y2 + y21 / l * r21) / 2,\n r: (l + r1 + r2) / 2\n };\n}\n\nfunction encloseBasis3(a, b, c) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x3 = c.x, y3 = c.y, r3 = c.r,\n a2 = x1 - x2,\n a3 = x1 - x3,\n b2 = y1 - y2,\n b3 = y1 - y3,\n c2 = r2 - r1,\n c3 = r3 - r1,\n d1 = x1 * x1 + y1 * y1 - r1 * r1,\n d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2,\n d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3,\n ab = a3 * b2 - a2 * b3,\n xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1,\n xb = (b3 * c2 - b2 * c3) / ab,\n ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1,\n yb = (a2 * c3 - a3 * c2) / ab,\n A = xb * xb + yb * yb - 1,\n B = 2 * (r1 + xa * xb + ya * yb),\n C = xa * xa + ya * ya - r1 * r1,\n r = -(Math.abs(A) > 1e-6 ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B);\n return {\n x: x1 + xa + xb * r,\n y: y1 + ya + yb * r,\n r: r\n };\n}\n","import array from \"../array.js\";\nimport lcg from \"../lcg.js\";\nimport {packEncloseRandom} from \"./enclose.js\";\n\nfunction place(b, a, c) {\n var dx = b.x - a.x, x, a2,\n dy = b.y - a.y, y, b2,\n d2 = dx * dx + dy * dy;\n if (d2) {\n a2 = a.r + c.r, a2 *= a2;\n b2 = b.r + c.r, b2 *= b2;\n if (a2 > b2) {\n x = (d2 + b2 - a2) / (2 * d2);\n y = Math.sqrt(Math.max(0, b2 / d2 - x * x));\n c.x = b.x - x * dx - y * dy;\n c.y = b.y - x * dy + y * dx;\n } else {\n x = (d2 + a2 - b2) / (2 * d2);\n y = Math.sqrt(Math.max(0, a2 / d2 - x * x));\n c.x = a.x + x * dx - y * dy;\n c.y = a.y + x * dy + y * dx;\n }\n } else {\n c.x = a.x + c.r;\n c.y = a.y;\n }\n}\n\nfunction intersects(a, b) {\n var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n}\n\nfunction score(node) {\n var a = node._,\n b = node.next._,\n ab = a.r + b.r,\n dx = (a.x * b.r + b.x * a.r) / ab,\n dy = (a.y * b.r + b.y * a.r) / ab;\n return dx * dx + dy * dy;\n}\n\nfunction Node(circle) {\n this._ = circle;\n this.next = null;\n this.previous = null;\n}\n\nexport function packSiblingsRandom(circles, random) {\n if (!(n = (circles = array(circles)).length)) return 0;\n\n var a, b, c, n, aa, ca, i, j, k, sj, sk;\n\n // Place the first circle.\n a = circles[0], a.x = 0, a.y = 0;\n if (!(n > 1)) return a.r;\n\n // Place the second circle.\n b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0;\n if (!(n > 2)) return a.r + b.r;\n\n // Place the third circle.\n place(b, a, c = circles[2]);\n\n // Initialize the front-chain using the first three circles a, b and c.\n a = new Node(a), b = new Node(b), c = new Node(c);\n a.next = c.previous = b;\n b.next = a.previous = c;\n c.next = b.previous = a;\n\n // Attempt to place each remaining circle…\n pack: for (i = 3; i < n; ++i) {\n place(a._, b._, c = circles[i]), c = new Node(c);\n\n // Find the closest intersecting circle on the front-chain, if any.\n // “Closeness” is determined by linear distance along the front-chain.\n // “Ahead” or “behind” is likewise determined by linear distance.\n j = b.next, k = a.previous, sj = b._.r, sk = a._.r;\n do {\n if (sj <= sk) {\n if (intersects(j._, c._)) {\n b = j, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sj += j._.r, j = j.next;\n } else {\n if (intersects(k._, c._)) {\n a = k, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sk += k._.r, k = k.previous;\n }\n } while (j !== k.next);\n\n // Success! Insert the new circle c between a and b.\n c.previous = a, c.next = b, a.next = b.previous = b = c;\n\n // Compute the new closest circle pair to the centroid.\n aa = score(a);\n while ((c = c.next) !== b) {\n if ((ca = score(c)) < aa) {\n a = c, aa = ca;\n }\n }\n b = a.next;\n }\n\n // Compute the enclosing circle of the front chain.\n a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = packEncloseRandom(a, random);\n\n // Translate the circles to put the enclosing circle around the origin.\n for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;\n\n return c.r;\n}\n\nexport default function(circles) {\n packSiblingsRandom(circles, lcg());\n return circles;\n}\n","export default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n\nexport function shuffle(array, random) {\n let m = array.length,\n t,\n i;\n\n while (m) {\n i = random() * m-- | 0;\n t = array[m];\n array[m] = array[i];\n array[i] = t;\n }\n\n return array;\n}\n","import {optional} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\nimport lcg from \"../lcg.js\";\nimport {packSiblingsRandom} from \"./siblings.js\";\n\nfunction defaultRadius(d) {\n return Math.sqrt(d.value);\n}\n\nexport default function() {\n var radius = null,\n dx = 1,\n dy = 1,\n padding = constantZero;\n\n function pack(root) {\n const random = lcg();\n root.x = dx / 2, root.y = dy / 2;\n if (radius) {\n root.eachBefore(radiusLeaf(radius))\n .eachAfter(packChildrenRandom(padding, 0.5, random))\n .eachBefore(translateChild(1));\n } else {\n root.eachBefore(radiusLeaf(defaultRadius))\n .eachAfter(packChildrenRandom(constantZero, 1, random))\n .eachAfter(packChildrenRandom(padding, root.r / Math.min(dx, dy), random))\n .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));\n }\n return root;\n }\n\n pack.radius = function(x) {\n return arguments.length ? (radius = optional(x), pack) : radius;\n };\n\n pack.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy];\n };\n\n pack.padding = function(x) {\n return arguments.length ? (padding = typeof x === \"function\" ? x : constant(+x), pack) : padding;\n };\n\n return pack;\n}\n\nfunction radiusLeaf(radius) {\n return function(node) {\n if (!node.children) {\n node.r = Math.max(0, +radius(node) || 0);\n }\n };\n}\n\nfunction packChildrenRandom(padding, k, random) {\n return function(node) {\n if (children = node.children) {\n var children,\n i,\n n = children.length,\n r = padding(node) * k || 0,\n e;\n\n if (r) for (i = 0; i < n; ++i) children[i].r += r;\n e = packSiblingsRandom(children, random);\n if (r) for (i = 0; i < n; ++i) children[i].r -= r;\n node.r = e + r;\n }\n };\n}\n\nfunction translateChild(k) {\n return function(node) {\n var parent = node.parent;\n node.r *= k;\n if (parent) {\n node.x = parent.x + k * node.x;\n node.y = parent.y + k * node.y;\n }\n };\n}\n","export default function(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (x1 - x0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n}\n","import {optional} from \"./accessors.js\";\nimport {Node, computeHeight} from \"./hierarchy/index.js\";\n\nvar preroot = {depth: -1},\n ambiguous = {},\n imputed = {};\n\nfunction defaultId(d) {\n return d.id;\n}\n\nfunction defaultParentId(d) {\n return d.parentId;\n}\n\nexport default function() {\n var id = defaultId,\n parentId = defaultParentId,\n path;\n\n function stratify(data) {\n var nodes = Array.from(data),\n currentId = id,\n currentParentId = parentId,\n n,\n d,\n i,\n root,\n parent,\n node,\n nodeId,\n nodeKey,\n nodeByKey = new Map;\n\n if (path != null) {\n const I = nodes.map((d, i) => normalize(path(d, i, data)));\n const P = I.map(parentof);\n const S = new Set(I).add(\"\");\n for (const i of P) {\n if (!S.has(i)) {\n S.add(i);\n I.push(i);\n P.push(parentof(i));\n nodes.push(imputed);\n }\n }\n currentId = (_, i) => I[i];\n currentParentId = (_, i) => P[i];\n }\n\n for (i = 0, n = nodes.length; i < n; ++i) {\n d = nodes[i], node = nodes[i] = new Node(d);\n if ((nodeId = currentId(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = node.id = nodeId;\n nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);\n }\n if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += \"\")) {\n node.parent = nodeId;\n }\n }\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (nodeId = node.parent) {\n parent = nodeByKey.get(nodeId);\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n } else {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n }\n }\n\n if (!root) throw new Error(\"no root\");\n\n // When imputing internal nodes, only introduce roots if needed.\n // Then replace the imputed marker data with null.\n if (path != null) {\n while (root.data === imputed && root.children.length === 1) {\n root = root.children[0], --n;\n }\n for (let i = nodes.length - 1; i >= 0; --i) {\n node = nodes[i];\n if (node.data !== imputed) break;\n node.data = null;\n }\n }\n\n root.parent = preroot;\n root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n\n return root;\n }\n\n stratify.id = function(x) {\n return arguments.length ? (id = optional(x), stratify) : id;\n };\n\n stratify.parentId = function(x) {\n return arguments.length ? (parentId = optional(x), stratify) : parentId;\n };\n\n stratify.path = function(x) {\n return arguments.length ? (path = optional(x), stratify) : path;\n };\n\n return stratify;\n}\n\n// To normalize a path, we coerce to a string, strip the trailing slash if any\n// (as long as the trailing slash is not immediately preceded by another slash),\n// and add leading slash if missing.\nfunction normalize(path) {\n path = `${path}`;\n let i = path.length;\n if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1);\n return path[0] === \"/\" ? path : `/${path}`;\n}\n\n// Walk backwards to find the first slash that is not the leading slash, e.g.:\n// \"/foo/bar\" ⇥ \"/foo\", \"/foo\" ⇥ \"/\", \"/\" ↦ \"\". (The root is special-cased\n// because the id of the root must be a truthy value.)\nfunction parentof(path) {\n let i = path.length;\n if (i < 2) return \"\";\n while (--i > 1) if (slash(path, i)) break;\n return path.slice(0, i);\n}\n\n// Slashes can be escaped; to determine whether a slash is a path delimiter, we\n// count the number of preceding backslashes escaping the forward slash: an odd\n// number indicates an escaped forward slash.\nfunction slash(path, i) {\n if (path[i] === \"/\") {\n let k = 0;\n while (i > 0 && path[--i] === \"\\\\\") ++k;\n if ((k & 1) === 0) return true;\n }\n return false;\n}\n","import {Node} from \"./hierarchy/index.js\";\n\nfunction defaultSeparation(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\n// function radialSeparation(a, b) {\n// return (a.parent === b.parent ? 1 : 2) / a.depth;\n// }\n\n// This function is used to traverse the left contour of a subtree (or\n// subforest). It returns the successor of v on this contour. This successor is\n// either given by the leftmost child of v or by the thread of v. The function\n// returns null if and only if v is on the highest level of its subtree.\nfunction nextLeft(v) {\n var children = v.children;\n return children ? children[0] : v.t;\n}\n\n// This function works analogously to nextLeft.\nfunction nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}\n\n// Shifts the current subtree rooted at w+. This is done by increasing\n// prelim(w+) and mod(w+) by shift.\nfunction moveSubtree(wm, wp, shift) {\n var change = shift / (wp.i - wm.i);\n wp.c -= change;\n wp.s += shift;\n wm.c += change;\n wp.z += shift;\n wp.m += shift;\n}\n\n// All other shifts, applied to the smaller subtrees between w- and w+, are\n// performed by this function. To prepare the shifts, we have to adjust\n// change(w+), shift(w+), and change(w-).\nfunction executeShifts(v) {\n var shift = 0,\n change = 0,\n children = v.children,\n i = children.length,\n w;\n while (--i >= 0) {\n w = children[i];\n w.z += shift;\n w.m += shift;\n shift += w.s + (change += w.c);\n }\n}\n\n// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise,\n// returns the specified (default) ancestor.\nfunction nextAncestor(vim, v, ancestor) {\n return vim.a.parent === v.parent ? vim.a : ancestor;\n}\n\nfunction TreeNode(node, i) {\n this._ = node;\n this.parent = null;\n this.children = null;\n this.A = null; // default ancestor\n this.a = this; // ancestor\n this.z = 0; // prelim\n this.m = 0; // mod\n this.c = 0; // change\n this.s = 0; // shift\n this.t = null; // thread\n this.i = i; // number\n}\n\nTreeNode.prototype = Object.create(Node.prototype);\n\nfunction treeRoot(root) {\n var tree = new TreeNode(root, 0),\n node,\n nodes = [tree],\n child,\n children,\n i,\n n;\n\n while (node = nodes.pop()) {\n if (children = node._.children) {\n node.children = new Array(n = children.length);\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = node.children[i] = new TreeNode(children[i], i));\n child.parent = node;\n }\n }\n }\n\n (tree.parent = new TreeNode(null, 0)).children = [tree];\n return tree;\n}\n\n// Node-link tree diagram using the Reingold-Tilford \"tidy\" algorithm\nexport default function() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n}\n","function defaultSeparation(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\nfunction meanX(children) {\n return children.reduce(meanXReduce, 0) / children.length;\n}\n\nfunction meanXReduce(x, c) {\n return x + c.x;\n}\n\nfunction maxY(children) {\n return 1 + children.reduce(maxYReduce, 0);\n}\n\nfunction maxYReduce(y, c) {\n return Math.max(y, c.y);\n}\n\nfunction leafLeft(node) {\n var children;\n while (children = node.children) node = children[0];\n return node;\n}\n\nfunction leafRight(node) {\n var children;\n while (children = node.children) node = children[children.length - 1];\n return node;\n}\n\nexport default function() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = false;\n\n function cluster(root) {\n var previousNode,\n x = 0;\n\n // First walk, computing the initial x & y values.\n root.eachAfter(function(node) {\n var children = node.children;\n if (children) {\n node.x = meanX(children);\n node.y = maxY(children);\n } else {\n node.x = previousNode ? x += separation(node, previousNode) : 0;\n node.y = 0;\n previousNode = node;\n }\n });\n\n var left = leafLeft(root),\n right = leafRight(root),\n x0 = left.x - separation(left, right) / 2,\n x1 = right.x + separation(right, left) / 2;\n\n // Second walk, normalizing x & y to the desired size.\n return root.eachAfter(nodeSize ? function(node) {\n node.x = (node.x - root.x) * dx;\n node.y = (root.y - node.y) * dy;\n } : function(node) {\n node.x = (node.x - x0) / (x1 - x0) * dx;\n node.y = (1 - (root.y ? node.y / root.y : 1)) * dy;\n });\n }\n\n cluster.separation = function(x) {\n return arguments.length ? (separation = x, cluster) : separation;\n };\n\n cluster.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]);\n };\n\n cluster.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null);\n };\n\n return cluster;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (y1 - y0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n}\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\n\nexport var phi = (1 + Math.sqrt(5)) / 2;\n\nexport function squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [],\n nodes = parent.children,\n row,\n nodeValue,\n i0 = 0,\n i1 = 0,\n n = nodes.length,\n dx, dy,\n value = parent.value,\n sumValue,\n minValue,\n maxValue,\n newRatio,\n minRatio,\n alpha,\n beta;\n\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n\n // Find the next non-empty node.\n do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n\n // Keep adding nodes while the aspect ratio maintains or improves.\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) { sumValue -= nodeValue; break; }\n minRatio = newRatio;\n }\n\n // Position and record the row orientation.\n rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n\n return rows;\n}\n\nexport default (function custom(ratio) {\n\n function squarify(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n\n squarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return squarify;\n})(phi);\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\nimport {phi, squarifyRatio} from \"./squarify.js\";\n\nexport default (function custom(ratio) {\n\n function resquarify(parent, x0, y0, x1, y1) {\n if ((rows = parent._squarify) && (rows.ratio === ratio)) {\n var rows,\n row,\n nodes,\n i,\n j = -1,\n n,\n m = rows.length,\n value = parent.value;\n\n while (++j < m) {\n row = rows[j], nodes = row.children;\n for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1);\n value -= row.value;\n }\n } else {\n parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);\n rows.ratio = ratio;\n }\n }\n\n resquarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return resquarify;\n})(phi);\n","import { Transform, isTuple, ingest, tupleid, stableCompare } from 'vega-dataflow';\nimport { inherits, error, array, one, truthy, hasOwnProperty } from 'vega-util';\nimport { hierarchy, pack, partition, stratify, tree, cluster, treemap, treemapBinary, treemapDice, treemapSlice, treemapSliceDice, treemapSquarify, treemapResquarify } from 'd3-hierarchy';\n\n// Build lookup table mapping tuple keys to tree node instances\nfunction lookup (tree, key, filter) {\n const map = {};\n tree.each(node => {\n const t = node.data;\n if (filter(t)) map[key(t)] = node;\n });\n tree.lookup = map;\n return tree;\n}\n\n/**\n * Nest tuples into a tree structure, grouped by key values.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.keys - The key fields to nest by, in order.\n * @param {boolean} [params.generate=false] - A boolean flag indicating if\n * non-leaf nodes generated by this transform should be included in the\n * output. The default (false) includes only the input data (leaf nodes)\n * in the data stream.\n */\nfunction Nest(params) {\n Transform.call(this, null, params);\n}\nNest.Definition = {\n 'type': 'Nest',\n 'metadata': {\n 'treesource': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'keys',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'generate',\n 'type': 'boolean'\n }]\n};\nconst children = n => n.values;\ninherits(Nest, Transform, {\n transform(_, pulse) {\n if (!pulse.source) {\n error('Nest transform requires an upstream data source.');\n }\n var gen = _.generate,\n mod = _.modified(),\n out = pulse.clone(),\n tree = this.value;\n if (!tree || mod || pulse.changed()) {\n // collect nodes to remove\n if (tree) {\n tree.each(node => {\n if (node.children && isTuple(node.data)) {\n out.rem.push(node.data);\n }\n });\n }\n\n // generate new tree structure\n this.value = tree = hierarchy({\n values: array(_.keys).reduce((n, k) => {\n n.key(k);\n return n;\n }, nest()).entries(out.source)\n }, children);\n\n // collect nodes to add\n if (gen) {\n tree.each(node => {\n if (node.children) {\n node = ingest(node.data);\n out.add.push(node);\n out.source.push(node);\n }\n });\n }\n\n // build lookup table\n lookup(tree, tupleid, tupleid);\n }\n out.source.root = tree;\n return out;\n }\n});\nfunction nest() {\n const keys = [],\n nest = {\n entries: array => entries(apply(array, 0), 0),\n key: d => (keys.push(d), nest)\n };\n function apply(array, depth) {\n if (depth >= keys.length) {\n return array;\n }\n const n = array.length,\n key = keys[depth++],\n valuesByKey = {},\n result = {};\n let i = -1,\n keyValue,\n value,\n values;\n while (++i < n) {\n keyValue = key(value = array[i]) + '';\n if (values = valuesByKey[keyValue]) {\n values.push(value);\n } else {\n valuesByKey[keyValue] = [value];\n }\n }\n for (keyValue in valuesByKey) {\n result[keyValue] = apply(valuesByKey[keyValue], depth);\n }\n return result;\n }\n function entries(map, depth) {\n if (++depth > keys.length) return map;\n const array = [];\n for (const key in map) {\n array.push({\n key,\n values: entries(map[key], depth)\n });\n }\n return array;\n }\n return nest;\n}\n\n/**\n * Abstract class for tree layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction HierarchyLayout(params) {\n Transform.call(this, null, params);\n}\nconst defaultSeparation = (a, b) => a.parent === b.parent ? 1 : 2;\ninherits(HierarchyLayout, Transform, {\n transform(_, pulse) {\n if (!pulse.source || !pulse.source.root) {\n error(this.constructor.name + ' transform requires a backing tree data source.');\n }\n const layout = this.layout(_.method),\n fields = this.fields,\n root = pulse.source.root,\n as = _.as || fields;\n if (_.field) root.sum(_.field);else root.count();\n if (_.sort) root.sort(stableCompare(_.sort, d => d.data));\n setParams(layout, this.params, _);\n if (layout.separation) {\n layout.separation(_.separation !== false ? defaultSeparation : one);\n }\n try {\n this.value = layout(root);\n } catch (err) {\n error(err);\n }\n root.each(node => setFields(node, fields, as));\n return pulse.reflow(_.modified()).modifies(as).modifies('leaf');\n }\n});\nfunction setParams(layout, params, _) {\n for (let p, i = 0, n = params.length; i < n; ++i) {\n p = params[i];\n if (p in _) layout[p](_[p]);\n }\n}\nfunction setFields(node, fields, as) {\n const t = node.data,\n n = fields.length - 1;\n for (let i = 0; i < n; ++i) {\n t[as[i]] = node[fields[i]];\n }\n t[as[n]] = node.children ? node.children.length : 0;\n}\n\nconst Output$3 = ['x', 'y', 'r', 'depth', 'children'];\n\n/**\n * Packed circle tree layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to size nodes.\n */\nfunction Pack(params) {\n HierarchyLayout.call(this, params);\n}\nPack.Definition = {\n 'type': 'Pack',\n 'metadata': {\n 'tree': true,\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'padding',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'radius',\n 'type': 'field',\n 'default': null\n }, {\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': Output$3.length,\n 'default': Output$3\n }]\n};\ninherits(Pack, HierarchyLayout, {\n layout: pack,\n params: ['radius', 'size', 'padding'],\n fields: Output$3\n});\n\nconst Output$2 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];\n\n/**\n * Partition tree layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to size nodes.\n */\nfunction Partition(params) {\n HierarchyLayout.call(this, params);\n}\nPartition.Definition = {\n 'type': 'Partition',\n 'metadata': {\n 'tree': true,\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'padding',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'round',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': Output$2.length,\n 'default': Output$2\n }]\n};\ninherits(Partition, HierarchyLayout, {\n layout: partition,\n params: ['size', 'round', 'padding'],\n fields: Output$2\n});\n\n/**\n * Stratify a collection of tuples into a tree structure based on\n * id and parent id fields.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.key - Unique key field for each tuple.\n * @param {function(object): *} params.parentKey - Field with key for parent tuple.\n */\nfunction Stratify(params) {\n Transform.call(this, null, params);\n}\nStratify.Definition = {\n 'type': 'Stratify',\n 'metadata': {\n 'treesource': true\n },\n 'params': [{\n 'name': 'key',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'parentKey',\n 'type': 'field',\n 'required': true\n }]\n};\ninherits(Stratify, Transform, {\n transform(_, pulse) {\n if (!pulse.source) {\n error('Stratify transform requires an upstream data source.');\n }\n let tree = this.value;\n const mod = _.modified(),\n out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE),\n run = !tree || mod || pulse.changed(pulse.ADD_REM) || pulse.modified(_.key.fields) || pulse.modified(_.parentKey.fields);\n\n // prevent upstream source pollution\n out.source = out.source.slice();\n if (run) {\n tree = out.source.length ? lookup(stratify().id(_.key).parentId(_.parentKey)(out.source), _.key, truthy) : lookup(stratify()([{}]), _.key, _.key);\n }\n out.source.root = this.value = tree;\n return out;\n }\n});\n\nconst Layouts = {\n tidy: tree,\n cluster: cluster\n};\nconst Output$1 = ['x', 'y', 'depth', 'children'];\n\n/**\n * Tree layout. Depending on the method parameter, performs either\n * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction Tree(params) {\n HierarchyLayout.call(this, params);\n}\nTree.Definition = {\n 'type': 'Tree',\n 'metadata': {\n 'tree': true,\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'method',\n 'type': 'enum',\n 'default': 'tidy',\n 'values': ['tidy', 'cluster']\n }, {\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'nodeSize',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'separation',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': Output$1.length,\n 'default': Output$1\n }]\n};\ninherits(Tree, HierarchyLayout, {\n /**\n * Tree layout generator. Supports both 'tidy' and 'cluster' layouts.\n */\n layout(method) {\n const m = method || 'tidy';\n if (hasOwnProperty(Layouts, m)) return Layouts[m]();else error('Unrecognized Tree layout method: ' + m);\n },\n params: ['size', 'nodeSize'],\n fields: Output$1\n});\n\n/**\n * Generate tuples representing links between tree nodes.\n * The resulting tuples will contain 'source' and 'target' fields,\n * which point to parent and child node tuples, respectively.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction TreeLinks(params) {\n Transform.call(this, [], params);\n}\nTreeLinks.Definition = {\n 'type': 'TreeLinks',\n 'metadata': {\n 'tree': true,\n 'generates': true,\n 'changes': true\n },\n 'params': []\n};\ninherits(TreeLinks, Transform, {\n transform(_, pulse) {\n const links = this.value,\n tree = pulse.source && pulse.source.root,\n out = pulse.fork(pulse.NO_SOURCE),\n lut = {};\n if (!tree) error('TreeLinks transform requires a tree data source.');\n if (pulse.changed(pulse.ADD_REM)) {\n // remove previous links\n out.rem = links;\n\n // build lookup table of valid tuples\n pulse.visit(pulse.SOURCE, t => lut[tupleid(t)] = 1);\n\n // generate links for all edges incident on valid tuples\n tree.each(node => {\n const t = node.data,\n p = node.parent && node.parent.data;\n if (p && lut[tupleid(t)] && lut[tupleid(p)]) {\n out.add.push(ingest({\n source: p,\n target: t\n }));\n }\n });\n this.value = out.add;\n } else if (pulse.changed(pulse.MOD)) {\n // build lookup table of modified tuples\n pulse.visit(pulse.MOD, t => lut[tupleid(t)] = 1);\n\n // gather links incident on modified tuples\n links.forEach(link => {\n if (lut[tupleid(link.source)] || lut[tupleid(link.target)]) {\n out.mod.push(link);\n }\n });\n }\n return out;\n }\n});\n\nconst Tiles = {\n binary: treemapBinary,\n dice: treemapDice,\n slice: treemapSlice,\n slicedice: treemapSliceDice,\n squarify: treemapSquarify,\n resquarify: treemapResquarify\n};\nconst Output = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];\n\n/**\n * Treemap layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to size nodes.\n */\nfunction Treemap(params) {\n HierarchyLayout.call(this, params);\n}\nTreemap.Definition = {\n 'type': 'Treemap',\n 'metadata': {\n 'tree': true,\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'method',\n 'type': 'enum',\n 'default': 'squarify',\n 'values': ['squarify', 'resquarify', 'binary', 'dice', 'slice', 'slicedice']\n }, {\n 'name': 'padding',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingInner',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingOuter',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingTop',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingRight',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingBottom',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingLeft',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'ratio',\n 'type': 'number',\n 'default': 1.618033988749895\n }, {\n 'name': 'round',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': Output.length,\n 'default': Output\n }]\n};\ninherits(Treemap, HierarchyLayout, {\n /**\n * Treemap layout generator. Adds 'method' and 'ratio' parameters\n * to configure the underlying tile method.\n */\n layout() {\n const x = treemap();\n x.ratio = _ => {\n const t = x.tile();\n if (t.ratio) x.tile(t.ratio(_));\n };\n x.method = _ => {\n if (hasOwnProperty(Tiles, _)) x.tile(Tiles[_]);else error('Unrecognized Treemap layout method: ' + _);\n };\n return x;\n },\n params: ['method', 'ratio', 'size', 'round', 'padding', 'paddingInner', 'paddingOuter', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],\n fields: Output\n});\n\nexport { Nest as nest, Pack as pack, Partition as partition, Stratify as stratify, Tree as tree, TreeLinks as treelinks, Treemap as treemap };\n","import roundNode from \"./treemap/round.js\";\nimport treemapDice from \"./treemap/dice.js\";\n\nexport default function() {\n var dx = 1,\n dy = 1,\n padding = 0,\n round = false;\n\n function partition(root) {\n var n = root.height + 1;\n root.x0 =\n root.y0 = padding;\n root.x1 = dx;\n root.y1 = dy / n;\n root.eachBefore(positionNode(dy, n));\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(dy, n) {\n return function(node) {\n if (node.children) {\n treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);\n }\n var x0 = node.x0,\n y0 = node.y0,\n x1 = node.x1 - padding,\n y1 = node.y1 - padding;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n };\n }\n\n partition.round = function(x) {\n return arguments.length ? (round = !!x, partition) : round;\n };\n\n partition.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy];\n };\n\n partition.padding = function(x) {\n return arguments.length ? (padding = +x, partition) : padding;\n };\n\n return partition;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n i, n = nodes.length,\n sum, sums = new Array(n + 1);\n\n for (sums[0] = sum = i = 0; i < n; ++i) {\n sums[i + 1] = sum += nodes[i].value;\n }\n\n partition(0, n, parent.value, x0, y0, x1, y1);\n\n function partition(i, j, value, x0, y0, x1, y1) {\n if (i >= j - 1) {\n var node = nodes[i];\n node.x0 = x0, node.y0 = y0;\n node.x1 = x1, node.y1 = y1;\n return;\n }\n\n var valueOffset = sums[i],\n valueTarget = (value / 2) + valueOffset,\n k = i + 1,\n hi = j - 1;\n\n while (k < hi) {\n var mid = k + hi >>> 1;\n if (sums[mid] < valueTarget) k = mid + 1;\n else hi = mid;\n }\n\n if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k;\n\n var valueLeft = sums[k] - valueOffset,\n valueRight = value - valueLeft;\n\n if ((x1 - x0) > (y1 - y0)) {\n var xk = value ? (x0 * valueRight + x1 * valueLeft) / value : x1;\n partition(i, k, valueLeft, x0, y0, xk, y1);\n partition(k, j, valueRight, xk, y0, x1, y1);\n } else {\n var yk = value ? (y0 * valueRight + y1 * valueLeft) / value : y1;\n partition(i, k, valueLeft, x0, y0, x1, yk);\n partition(k, j, valueRight, x0, yk, x1, y1);\n }\n }\n}\n","import dice from \"./dice.js\";\nimport slice from \"./slice.js\";\n\nexport default function(parent, x0, y0, x1, y1) {\n (parent.depth & 1 ? slice : dice)(parent, x0, y0, x1, y1);\n}\n","import roundNode from \"./round.js\";\nimport squarify from \"./squarify.js\";\nimport {required} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\n\nexport default function() {\n var tile = squarify,\n round = false,\n dx = 1,\n dy = 1,\n paddingStack = [0],\n paddingInner = constantZero,\n paddingTop = constantZero,\n paddingRight = constantZero,\n paddingBottom = constantZero,\n paddingLeft = constantZero;\n\n function treemap(root) {\n root.x0 =\n root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(node) {\n var p = paddingStack[node.depth],\n x0 = node.x0 + p,\n y0 = node.y0 + p,\n x1 = node.x1 - p,\n y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant(+x), treemap) : paddingInner;\n };\n\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant(+x), treemap) : paddingTop;\n };\n\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant(+x), treemap) : paddingRight;\n };\n\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant(+x), treemap) : paddingBottom;\n };\n\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant(+x), treemap) : paddingLeft;\n };\n\n return treemap;\n}\n","import { Marks, textMetrics } from 'vega-scenegraph';\nimport { canvas } from 'vega-canvas';\nimport { rederive, Transform } from 'vega-dataflow';\nimport { inherits, error, array, isFunction } from 'vega-util';\n\n// bit mask for getting first 2 bytes of alpha value\nconst ALPHA_MASK = 0xff000000;\nfunction baseBitmaps($, data) {\n const bitmap = $.bitmap();\n // when there is no base mark but data points are to be avoided\n (data || []).forEach(d => bitmap.set($(d.boundary[0]), $(d.boundary[3])));\n return [bitmap, undefined];\n}\nfunction markBitmaps($, baseMark, avoidMarks, labelInside, isGroupArea) {\n // create canvas\n const width = $.width,\n height = $.height,\n border = labelInside || isGroupArea,\n context = canvas(width, height).getContext('2d'),\n baseMarkContext = canvas(width, height).getContext('2d'),\n strokeContext = border && canvas(width, height).getContext('2d');\n\n // render all marks to be avoided into canvas\n avoidMarks.forEach(items => draw(context, items, false));\n draw(baseMarkContext, baseMark, false);\n if (border) {\n draw(strokeContext, baseMark, true);\n }\n\n // get canvas buffer, create bitmaps\n const buffer = getBuffer(context, width, height),\n baseMarkBuffer = getBuffer(baseMarkContext, width, height),\n strokeBuffer = border && getBuffer(strokeContext, width, height),\n layer1 = $.bitmap(),\n layer2 = border && $.bitmap();\n\n // populate bitmap layers\n let x, y, u, v, index, alpha, strokeAlpha, baseMarkAlpha;\n for (y = 0; y < height; ++y) {\n for (x = 0; x < width; ++x) {\n index = y * width + x;\n alpha = buffer[index] & ALPHA_MASK;\n baseMarkAlpha = baseMarkBuffer[index] & ALPHA_MASK;\n strokeAlpha = border && strokeBuffer[index] & ALPHA_MASK;\n if (alpha || strokeAlpha || baseMarkAlpha) {\n u = $(x);\n v = $(y);\n if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u, v); // update interior bitmap\n if (border && (alpha || strokeAlpha)) layer2.set(u, v); // update border bitmap\n }\n }\n }\n\n return [layer1, layer2];\n}\nfunction getBuffer(context, width, height) {\n return new Uint32Array(context.getImageData(0, 0, width, height).data.buffer);\n}\nfunction draw(context, items, interior) {\n if (!items.length) return;\n const type = items[0].mark.marktype;\n if (type === 'group') {\n items.forEach(group => {\n group.items.forEach(mark => draw(context, mark.items, interior));\n });\n } else {\n Marks[type].draw(context, {\n items: interior ? items.map(prepare) : items\n });\n }\n}\n\n/**\n * Prepare item before drawing into canvas (setting stroke and opacity)\n * @param {object} source item to be prepared\n * @returns prepared item\n */\nfunction prepare(source) {\n const item = rederive(source, {});\n if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) {\n return {\n ...item,\n strokeOpacity: 1,\n stroke: '#000',\n fillOpacity: 0\n };\n }\n return item;\n}\n\nconst DIV = 5,\n // bit shift from x, y index to bit vector array index\n MOD = 31,\n // bit mask for index lookup within a bit vector\n SIZE = 32,\n // individual bit vector size\n RIGHT0 = new Uint32Array(SIZE + 1),\n // left-anchored bit vectors, full -> 0\n RIGHT1 = new Uint32Array(SIZE + 1); // right-anchored bit vectors, 0 -> full\n\nRIGHT1[0] = 0;\nRIGHT0[0] = ~RIGHT1[0];\nfor (let i = 1; i <= SIZE; ++i) {\n RIGHT1[i] = RIGHT1[i - 1] << 1 | 1;\n RIGHT0[i] = ~RIGHT1[i];\n}\nfunction Bitmap (w, h) {\n const array = new Uint32Array(~~((w * h + SIZE) / SIZE));\n function _set(index, mask) {\n array[index] |= mask;\n }\n function _clear(index, mask) {\n array[index] &= mask;\n }\n return {\n array: array,\n get: (x, y) => {\n const index = y * w + x;\n return array[index >>> DIV] & 1 << (index & MOD);\n },\n set: (x, y) => {\n const index = y * w + x;\n _set(index >>> DIV, 1 << (index & MOD));\n },\n clear: (x, y) => {\n const index = y * w + x;\n _clear(index >>> DIV, ~(1 << (index & MOD)));\n },\n getRange: (x, y, x2, y2) => {\n let r = y2,\n start,\n end,\n indexStart,\n indexEnd;\n for (; r >= y; --r) {\n start = r * w + x;\n end = r * w + x2;\n indexStart = start >>> DIV;\n indexEnd = end >>> DIV;\n if (indexStart === indexEnd) {\n if (array[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) {\n return true;\n }\n } else {\n if (array[indexStart] & RIGHT0[start & MOD]) return true;\n if (array[indexEnd] & RIGHT1[(end & MOD) + 1]) return true;\n for (let i = indexStart + 1; i < indexEnd; ++i) {\n if (array[i]) return true;\n }\n }\n }\n return false;\n },\n setRange: (x, y, x2, y2) => {\n let start, end, indexStart, indexEnd, i;\n for (; y <= y2; ++y) {\n start = y * w + x;\n end = y * w + x2;\n indexStart = start >>> DIV;\n indexEnd = end >>> DIV;\n if (indexStart === indexEnd) {\n _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]);\n } else {\n _set(indexStart, RIGHT0[start & MOD]);\n _set(indexEnd, RIGHT1[(end & MOD) + 1]);\n for (i = indexStart + 1; i < indexEnd; ++i) _set(i, 0xffffffff);\n }\n }\n },\n clearRange: (x, y, x2, y2) => {\n let start, end, indexStart, indexEnd, i;\n for (; y <= y2; ++y) {\n start = y * w + x;\n end = y * w + x2;\n indexStart = start >>> DIV;\n indexEnd = end >>> DIV;\n if (indexStart === indexEnd) {\n _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]);\n } else {\n _clear(indexStart, RIGHT1[start & MOD]);\n _clear(indexEnd, RIGHT0[(end & MOD) + 1]);\n for (i = indexStart + 1; i < indexEnd; ++i) _clear(i, 0);\n }\n }\n },\n outOfBounds: (x, y, x2, y2) => x < 0 || y < 0 || y2 >= h || x2 >= w\n };\n}\n\nfunction scaler (width, height, padding) {\n const ratio = Math.max(1, Math.sqrt(width * height / 1e6)),\n w = ~~((width + 2 * padding + ratio) / ratio),\n h = ~~((height + 2 * padding + ratio) / ratio),\n scale = _ => ~~((_ + padding) / ratio);\n scale.invert = _ => _ * ratio - padding;\n scale.bitmap = () => Bitmap(w, h);\n scale.ratio = ratio;\n scale.padding = padding;\n scale.width = width;\n scale.height = height;\n return scale;\n}\n\nfunction placeAreaLabelNaive ($, bitmaps, avoidBaseMark, markIndex) {\n const width = $.width,\n height = $.height;\n\n // try to place a label within an input area mark\n return function (d) {\n const items = d.datum.datum.items[markIndex].items,\n // area points\n n = items.length,\n // number of points\n textHeight = d.datum.fontSize,\n // label width\n textWidth = textMetrics.width(d.datum, d.datum.text); // label height\n\n let maxAreaWidth = 0,\n x1,\n x2,\n y1,\n y2,\n x,\n y,\n areaWidth;\n\n // for each area sample point\n for (let i = 0; i < n; ++i) {\n x1 = items[i].x;\n y1 = items[i].y;\n x2 = items[i].x2 === undefined ? x1 : items[i].x2;\n y2 = items[i].y2 === undefined ? y1 : items[i].y2;\n x = (x1 + x2) / 2;\n y = (y1 + y2) / 2;\n areaWidth = Math.abs(x2 - x1 + y2 - y1);\n if (areaWidth >= maxAreaWidth) {\n maxAreaWidth = areaWidth;\n d.x = x;\n d.y = y;\n }\n }\n x = textWidth / 2;\n y = textHeight / 2;\n x1 = d.x - x;\n x2 = d.x + x;\n y1 = d.y - y;\n y2 = d.y + y;\n d.align = 'center';\n if (x1 < 0 && x2 <= width) {\n d.align = 'left';\n } else if (0 <= x1 && width < x2) {\n d.align = 'right';\n }\n d.baseline = 'middle';\n if (y1 < 0 && y2 <= height) {\n d.baseline = 'top';\n } else if (0 <= y1 && height < y2) {\n d.baseline = 'bottom';\n }\n return true;\n };\n}\n\nfunction outOfBounds(x, y, textWidth, textHeight, width, height) {\n let r = textWidth / 2;\n return x - r < 0 || x + r > width || y - (r = textHeight / 2) < 0 || y + r > height;\n}\nfunction collision($, x, y, textHeight, textWidth, h, bm0, bm1) {\n const w = textWidth * h / (textHeight * 2),\n x1 = $(x - w),\n x2 = $(x + w),\n y1 = $(y - (h = h / 2)),\n y2 = $(y + h);\n return bm0.outOfBounds(x1, y1, x2, y2) || bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2);\n}\n\nfunction placeAreaLabelReducedSearch ($, bitmaps, avoidBaseMark, markIndex) {\n const width = $.width,\n height = $.height,\n bm0 = bitmaps[0],\n // where labels have been placed\n bm1 = bitmaps[1]; // area outlines\n\n function tryLabel(_x, _y, maxSize, textWidth, textHeight) {\n const x = $.invert(_x),\n y = $.invert(_y);\n let lo = maxSize,\n hi = height,\n mid;\n if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {\n // if the label fits at the current sample point,\n // perform binary search to find the largest font size that fits\n while (hi - lo >= 1) {\n mid = (lo + hi) / 2;\n if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) {\n hi = mid;\n } else {\n lo = mid;\n }\n }\n // place label if current lower bound exceeds prior max font size\n if (lo > maxSize) {\n return [x, y, lo, true];\n }\n }\n }\n\n // try to place a label within an input area mark\n return function (d) {\n const items = d.datum.datum.items[markIndex].items,\n // area points\n n = items.length,\n // number of points\n textHeight = d.datum.fontSize,\n // label width\n textWidth = textMetrics.width(d.datum, d.datum.text); // label height\n\n let maxSize = avoidBaseMark ? textHeight : 0,\n labelPlaced = false,\n labelPlaced2 = false,\n maxAreaWidth = 0,\n x1,\n x2,\n y1,\n y2,\n x,\n y,\n _x,\n _y,\n _x1,\n _xMid,\n _x2,\n _y1,\n _yMid,\n _y2,\n areaWidth,\n result,\n swapTmp;\n\n // for each area sample point\n for (let i = 0; i < n; ++i) {\n x1 = items[i].x;\n y1 = items[i].y;\n x2 = items[i].x2 === undefined ? x1 : items[i].x2;\n y2 = items[i].y2 === undefined ? y1 : items[i].y2;\n if (x1 > x2) {\n swapTmp = x1;\n x1 = x2;\n x2 = swapTmp;\n }\n if (y1 > y2) {\n swapTmp = y1;\n y1 = y2;\n y2 = swapTmp;\n }\n _x1 = $(x1);\n _x2 = $(x2);\n _xMid = ~~((_x1 + _x2) / 2);\n _y1 = $(y1);\n _y2 = $(y2);\n _yMid = ~~((_y1 + _y2) / 2);\n\n // search along the line from mid point between the 2 border to lower border\n for (_x = _xMid; _x >= _x1; --_x) {\n for (_y = _yMid; _y >= _y1; --_y) {\n result = tryLabel(_x, _y, maxSize, textWidth, textHeight);\n if (result) {\n [d.x, d.y, maxSize, labelPlaced] = result;\n }\n }\n }\n\n // search along the line from mid point between the 2 border to upper border\n for (_x = _xMid; _x <= _x2; ++_x) {\n for (_y = _yMid; _y <= _y2; ++_y) {\n result = tryLabel(_x, _y, maxSize, textWidth, textHeight);\n if (result) {\n [d.x, d.y, maxSize, labelPlaced] = result;\n }\n }\n }\n\n // place label at slice center if not placed through other means\n // and if we're not avoiding overlap with other areas\n if (!labelPlaced && !avoidBaseMark) {\n // one span is zero, hence we can add\n areaWidth = Math.abs(x2 - x1 + y2 - y1);\n x = (x1 + x2) / 2;\n y = (y1 + y2) / 2;\n\n // place label if it fits and improves the max area width\n if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {\n maxAreaWidth = areaWidth;\n d.x = x;\n d.y = y;\n labelPlaced2 = true;\n }\n }\n }\n\n // record current label placement information, update label bitmap\n if (labelPlaced || labelPlaced2) {\n x = textWidth / 2;\n y = textHeight / 2;\n bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y));\n d.align = 'center';\n d.baseline = 'middle';\n return true;\n } else {\n return false;\n }\n };\n}\n\n// pixel direction offsets for flood fill search\nconst X_DIR = [-1, -1, 1, 1];\nconst Y_DIR = [-1, 1, -1, 1];\nfunction placeAreaLabelFloodFill ($, bitmaps, avoidBaseMark, markIndex) {\n const width = $.width,\n height = $.height,\n bm0 = bitmaps[0],\n // where labels have been placed\n bm1 = bitmaps[1],\n // area outlines\n bm2 = $.bitmap(); // flood-fill visitations\n\n // try to place a label within an input area mark\n return function (d) {\n const items = d.datum.datum.items[markIndex].items,\n // area points\n n = items.length,\n // number of points\n textHeight = d.datum.fontSize,\n // label width\n textWidth = textMetrics.width(d.datum, d.datum.text),\n // label height\n stack = []; // flood fill stack\n\n let maxSize = avoidBaseMark ? textHeight : 0,\n labelPlaced = false,\n labelPlaced2 = false,\n maxAreaWidth = 0,\n x1,\n x2,\n y1,\n y2,\n x,\n y,\n _x,\n _y,\n lo,\n hi,\n mid,\n areaWidth;\n\n // for each area sample point\n for (let i = 0; i < n; ++i) {\n x1 = items[i].x;\n y1 = items[i].y;\n x2 = items[i].x2 === undefined ? x1 : items[i].x2;\n y2 = items[i].y2 === undefined ? y1 : items[i].y2;\n\n // add scaled center point to stack\n stack.push([$((x1 + x2) / 2), $((y1 + y2) / 2)]);\n\n // perform flood fill, visit points\n while (stack.length) {\n [_x, _y] = stack.pop();\n\n // exit if point already marked\n if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue;\n\n // mark point in flood fill bitmap\n // add search points for all (in bound) directions\n bm2.set(_x, _y);\n for (let j = 0; j < 4; ++j) {\n x = _x + X_DIR[j];\n y = _y + Y_DIR[j];\n if (!bm2.outOfBounds(x, y, x, y)) stack.push([x, y]);\n }\n\n // unscale point back to x, y space\n x = $.invert(_x);\n y = $.invert(_y);\n lo = maxSize;\n hi = height; // TODO: make this bound smaller\n\n if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {\n // if the label fits at the current sample point,\n // perform binary search to find the largest font size that fits\n while (hi - lo >= 1) {\n mid = (lo + hi) / 2;\n if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) {\n hi = mid;\n } else {\n lo = mid;\n }\n }\n // place label if current lower bound exceeds prior max font size\n if (lo > maxSize) {\n d.x = x;\n d.y = y;\n maxSize = lo;\n labelPlaced = true;\n }\n }\n }\n\n // place label at slice center if not placed through other means\n // and if we're not avoiding overlap with other areas\n if (!labelPlaced && !avoidBaseMark) {\n // one span is zero, hence we can add\n areaWidth = Math.abs(x2 - x1 + y2 - y1);\n x = (x1 + x2) / 2;\n y = (y1 + y2) / 2;\n\n // place label if it fits and improves the max area width\n if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {\n maxAreaWidth = areaWidth;\n d.x = x;\n d.y = y;\n labelPlaced2 = true;\n }\n }\n }\n\n // record current label placement information, update label bitmap\n if (labelPlaced || labelPlaced2) {\n x = textWidth / 2;\n y = textHeight / 2;\n bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y));\n d.align = 'center';\n d.baseline = 'middle';\n return true;\n } else {\n return false;\n }\n };\n}\n\nconst Aligns = ['right', 'center', 'left'],\n Baselines = ['bottom', 'middle', 'top'];\nfunction placeMarkLabel ($, bitmaps, anchors, offsets) {\n const width = $.width,\n height = $.height,\n bm0 = bitmaps[0],\n bm1 = bitmaps[1],\n n = offsets.length;\n return function (d) {\n const boundary = d.boundary,\n textHeight = d.datum.fontSize;\n\n // can not be placed if the mark is not visible in the graph bound\n if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width || boundary[3] > height) {\n return false;\n }\n let textWidth = d.textWidth ?? 0,\n dx,\n dy,\n isInside,\n sizeFactor,\n insideFactor,\n x1,\n x2,\n y1,\n y2,\n xc,\n yc,\n _x1,\n _x2,\n _y1,\n _y2;\n\n // for each anchor and offset\n for (let i = 0; i < n; ++i) {\n dx = (anchors[i] & 0x3) - 1;\n dy = (anchors[i] >>> 0x2 & 0x3) - 1;\n isInside = dx === 0 && dy === 0 || offsets[i] < 0;\n sizeFactor = dx && dy ? Math.SQRT1_2 : 1;\n insideFactor = offsets[i] < 0 ? -1 : 1;\n x1 = boundary[1 + dx] + offsets[i] * dx * sizeFactor;\n yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets[i] * dy * sizeFactor;\n y1 = yc - textHeight / 2;\n y2 = yc + textHeight / 2;\n _x1 = $(x1);\n _y1 = $(y1);\n _y2 = $(y2);\n if (!textWidth) {\n // to avoid finding width of text label,\n if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x1, x1, y1, y2, boundary, isInside)) {\n // skip this anchor/offset option if we fail to place a label with 1px width\n continue;\n } else {\n // Otherwise, find the label width\n textWidth = textMetrics.width(d.datum, d.datum.text);\n }\n }\n xc = x1 + insideFactor * textWidth * dx / 2;\n x1 = xc - textWidth / 2;\n x2 = xc + textWidth / 2;\n _x1 = $(x1);\n _x2 = $(x2);\n if (test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside)) {\n // place label if the position is placeable\n d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x1;\n d.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y1;\n d.align = Aligns[dx * insideFactor + 1];\n d.baseline = Baselines[dy * insideFactor + 1];\n bm0.setRange(_x1, _y1, _x2, _y2);\n return true;\n }\n }\n return false;\n };\n}\n\n// Test if a label with the given dimensions can be added without overlap\nfunction test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside) {\n return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2));\n}\n\n// 8-bit representation of anchors\nconst TOP = 0x0,\n MIDDLE = 0x4,\n BOTTOM = 0x8,\n LEFT = 0x0,\n CENTER = 0x1,\n RIGHT = 0x2;\n\n// Mapping from text anchor to number representation\nconst anchorCode = {\n 'top-left': TOP + LEFT,\n 'top': TOP + CENTER,\n 'top-right': TOP + RIGHT,\n 'left': MIDDLE + LEFT,\n 'middle': MIDDLE + CENTER,\n 'right': MIDDLE + RIGHT,\n 'bottom-left': BOTTOM + LEFT,\n 'bottom': BOTTOM + CENTER,\n 'bottom-right': BOTTOM + RIGHT\n};\nconst placeAreaLabel = {\n 'naive': placeAreaLabelNaive,\n 'reduced-search': placeAreaLabelReducedSearch,\n 'floodfill': placeAreaLabelFloodFill\n};\nfunction labelLayout (texts, size, compare, offset, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding, method) {\n // early exit for empty data\n if (!texts.length) return texts;\n const positions = Math.max(offset.length, anchor.length),\n offsets = getOffsets(offset, positions),\n anchors = getAnchors(anchor, positions),\n marktype = markType(texts[0].datum),\n grouptype = marktype === 'group' && texts[0].datum.items[markIndex].marktype,\n isGroupArea = grouptype === 'area',\n boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex),\n infPadding = padding === null || padding === Infinity,\n isNaiveGroupArea = isGroupArea && method === 'naive';\n let maxTextWidth = -1,\n maxTextHeight = -1;\n\n // prepare text mark data for placing\n const data = texts.map(d => {\n const textWidth = infPadding ? textMetrics.width(d, d.text) : undefined;\n maxTextWidth = Math.max(maxTextWidth, textWidth);\n maxTextHeight = Math.max(maxTextHeight, d.fontSize);\n return {\n datum: d,\n opacity: 0,\n x: undefined,\n y: undefined,\n align: undefined,\n baseline: undefined,\n boundary: boundary(d),\n textWidth\n };\n });\n padding = padding === null || padding === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset) : padding;\n const $ = scaler(size[0], size[1], padding);\n let bitmaps;\n if (!isNaiveGroupArea) {\n // sort labels in priority order, if comparator is provided\n if (compare) {\n data.sort((a, b) => compare(a.datum, b.datum));\n }\n\n // flag indicating if label can be placed inside its base mark\n let labelInside = false;\n for (let i = 0; i < anchors.length && !labelInside; ++i) {\n // label inside if anchor is at center\n // label inside if offset to be inside the mark bound\n labelInside = anchors[i] === 0x5 || offsets[i] < 0;\n }\n\n // extract data information from base mark when base mark is to be avoided\n // base mark is implicitly avoided if it is a group area\n const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map(d => d.datum);\n\n // generate bitmaps for layout calculation\n bitmaps = avoidMarks.length || baseMark ? markBitmaps($, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($, avoidBaseMark && data);\n }\n\n // generate label placement function\n const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($, bitmaps, anchors, offsets);\n\n // place all labels\n data.forEach(d => d.opacity = +place(d));\n return data;\n}\nfunction getOffsets(_, count) {\n const offsets = new Float64Array(count),\n n = _.length;\n for (let i = 0; i < n; ++i) offsets[i] = _[i] || 0;\n for (let i = n; i < count; ++i) offsets[i] = offsets[n - 1];\n return offsets;\n}\nfunction getAnchors(_, count) {\n const anchors = new Int8Array(count),\n n = _.length;\n for (let i = 0; i < n; ++i) anchors[i] |= anchorCode[_[i]];\n for (let i = n; i < count; ++i) anchors[i] = anchors[n - 1];\n return anchors;\n}\nfunction markType(item) {\n return item && item.mark && item.mark.marktype;\n}\n\n/**\n * Factory function for function for getting base mark boundary, depending\n * on mark and group type. When mark type is undefined, line or area: boundary\n * is the coordinate of each data point. When base mark is grouped line,\n * boundary is either at the start or end of the line depending on the\n * value of lineAnchor. Otherwise, use bounds of base mark.\n */\nfunction markBoundary(marktype, grouptype, lineAnchor, markIndex) {\n const xy = d => [d.x, d.x, d.x, d.y, d.y, d.y];\n if (!marktype) {\n return xy; // no reactive geometry\n } else if (marktype === 'line' || marktype === 'area') {\n return d => xy(d.datum);\n } else if (grouptype === 'line') {\n return d => {\n const items = d.datum.items[markIndex].items;\n return xy(items.length ? items[lineAnchor === 'start' ? 0 : items.length - 1] : {\n x: NaN,\n y: NaN\n });\n };\n } else {\n return d => {\n const b = d.datum.bounds;\n return [b.x1, (b.x1 + b.x2) / 2, b.x2, b.y1, (b.y1 + b.y2) / 2, b.y2];\n };\n }\n}\n\nconst Output = ['x', 'y', 'opacity', 'align', 'baseline'];\nconst Anchors = ['top-left', 'left', 'bottom-left', 'top', 'bottom', 'top-right', 'right', 'bottom-right'];\n\n/**\n * Compute text label layout to annotate marks.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.size - The size of the layout, provided as a [width, height] array.\n * @param {function(*,*): number} [params.sort] - An optional\n * comparator function for sorting label data in priority order.\n * @param {Array} [params.anchor] - Label anchor points relative to the base mark bounding box.\n * The available options are 'top-left', 'left', 'bottom-left', 'top',\n * 'bottom', 'top-right', 'right', 'bottom-right', 'middle'.\n * @param {Array} [params.offset] - Label offsets (in pixels) from the base mark bounding box.\n * This parameter is parallel to the list of anchor points.\n * @param {number | null} [params.padding=0] - The amount (in pixels) that a label may exceed the layout size.\n * If this parameter is null, a label may exceed the layout size without any boundary.\n * @param {string} [params.lineAnchor='end'] - For group line mark labels only, indicates the anchor\n * position for labels. One of 'start' or 'end'.\n * @param {string} [params.markIndex=0] - For group mark labels only, an index indicating\n * which mark within the group should be labeled.\n * @param {Array} [params.avoidMarks] - A list of additional mark names for which the label\n * layout should avoid overlap.\n * @param {boolean} [params.avoidBaseMark=true] - Boolean flag indicating if labels should avoid\n * overlap with the underlying base mark being labeled.\n * @param {string} [params.method='naive'] - For area make labels only, a method for\n * place labels. One of 'naive', 'reduced-search', or 'floodfill'.\n * @param {Array} [params.as] - The output fields written by the transform.\n * The default is ['x', 'y', 'opacity', 'align', 'baseline'].\n */\nfunction Label(params) {\n Transform.call(this, null, params);\n}\nLabel.Definition = {\n type: 'Label',\n metadata: {\n modifies: true\n },\n params: [{\n name: 'size',\n type: 'number',\n array: true,\n length: 2,\n required: true\n }, {\n name: 'sort',\n type: 'compare'\n }, {\n name: 'anchor',\n type: 'string',\n array: true,\n default: Anchors\n }, {\n name: 'offset',\n type: 'number',\n array: true,\n default: [1]\n }, {\n name: 'padding',\n type: 'number',\n default: 0,\n null: true\n }, {\n name: 'lineAnchor',\n type: 'string',\n values: ['start', 'end'],\n default: 'end'\n }, {\n name: 'markIndex',\n type: 'number',\n default: 0\n }, {\n name: 'avoidBaseMark',\n type: 'boolean',\n default: true\n }, {\n name: 'avoidMarks',\n type: 'data',\n array: true\n }, {\n name: 'method',\n type: 'string',\n default: 'naive'\n }, {\n name: 'as',\n type: 'string',\n array: true,\n length: Output.length,\n default: Output\n }]\n};\ninherits(Label, Transform, {\n transform(_, pulse) {\n function modp(param) {\n const p = _[param];\n return isFunction(p) && pulse.modified(p.fields);\n }\n const mod = _.modified();\n if (!(mod || pulse.changed(pulse.ADD_REM) || modp('sort'))) return;\n if (!_.size || _.size.length !== 2) {\n error('Size parameter should be specified as a [width, height] array.');\n }\n const as = _.as || Output;\n\n // run label layout\n labelLayout(pulse.materialize(pulse.SOURCE).source || [], _.size, _.sort, array(_.offset == null ? 1 : _.offset), array(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || 'end', _.markIndex || 0, _.padding === undefined ? 0 : _.padding, _.method || 'naive').forEach(l => {\n // write layout results to data stream\n const t = l.datum;\n t[as[0]] = l.x;\n t[as[1]] = l.y;\n t[as[2]] = l.opacity;\n t[as[3]] = l.align;\n t[as[4]] = l.baseline;\n });\n return pulse.reflow(mod).modifies(as);\n }\n});\n\nexport { Label as label };\n","import { regressionLoess, sampleCurve, regressionConstant, regressionLinear, regressionLog, regressionExp, regressionPow, regressionQuad, regressionPoly } from 'vega-statistics';\nimport { Transform, ingest } from 'vega-dataflow';\nimport { inherits, accessorName, hasOwnProperty, error, extent } from 'vega-util';\n\nfunction partition (data, groupby) {\n var groups = [],\n get = function (f) {\n return f(t);\n },\n map,\n i,\n n,\n t,\n k,\n g;\n\n // partition data points into stack groups\n if (groupby == null) {\n groups.push(data);\n } else {\n for (map = {}, i = 0, n = data.length; i < n; ++i) {\n t = data[i];\n k = groupby.map(get);\n g = map[k];\n if (!g) {\n map[k] = g = [];\n g.dims = k;\n groups.push(g);\n }\n g.push(t);\n }\n }\n return groups;\n}\n\n/**\n * Compute locally-weighted regression fits for one or more data groups.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.x - An accessor for the predictor data field.\n * @param {function(object): *} params.y - An accessor for the predicted data field.\n * @param {Array} [params.groupby] - An array of accessors to groupby.\n * @param {number} [params.bandwidth=0.3] - The loess bandwidth.\n */\nfunction Loess(params) {\n Transform.call(this, null, params);\n}\nLoess.Definition = {\n 'type': 'Loess',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'x',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'y',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'bandwidth',\n 'type': 'number',\n 'default': 0.3\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true\n }]\n};\ninherits(Loess, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n if (!this.value || pulse.changed() || _.modified()) {\n const source = pulse.materialize(pulse.SOURCE).source,\n groups = partition(source, _.groupby),\n names = (_.groupby || []).map(accessorName),\n m = names.length,\n as = _.as || [accessorName(_.x), accessorName(_.y)],\n values = [];\n groups.forEach(g => {\n regressionLoess(g, _.x, _.y, _.bandwidth || 0.3).forEach(p => {\n const t = {};\n for (let i = 0; i < m; ++i) {\n t[names[i]] = g.dims[i];\n }\n t[as[0]] = p[0];\n t[as[1]] = p[1];\n values.push(ingest(t));\n });\n });\n if (this.value) out.rem = this.value;\n this.value = out.add = out.source = values;\n }\n return out;\n }\n});\n\nconst Methods = {\n constant: regressionConstant,\n linear: regressionLinear,\n log: regressionLog,\n exp: regressionExp,\n pow: regressionPow,\n quad: regressionQuad,\n poly: regressionPoly\n};\nconst degreesOfFreedom = (method, order) => method === 'poly' ? order : method === 'quad' ? 2 : 1;\n\n/**\n * Compute regression fits for one or more data groups.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.x - An accessor for the predictor data field.\n * @param {function(object): *} params.y - An accessor for the predicted data field.\n * @param {string} [params.method='linear'] - The regression method to apply.\n * @param {Array} [params.groupby] - An array of accessors to groupby.\n * @param {Array} [params.extent] - The domain extent over which to plot the regression line.\n * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method.\n */\nfunction Regression(params) {\n Transform.call(this, null, params);\n}\nRegression.Definition = {\n 'type': 'Regression',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'x',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'y',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'method',\n 'type': 'string',\n 'default': 'linear',\n 'values': Object.keys(Methods)\n }, {\n 'name': 'order',\n 'type': 'number',\n 'default': 3\n }, {\n 'name': 'extent',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'params',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true\n }]\n};\ninherits(Regression, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n if (!this.value || pulse.changed() || _.modified()) {\n const source = pulse.materialize(pulse.SOURCE).source,\n groups = partition(source, _.groupby),\n names = (_.groupby || []).map(accessorName),\n method = _.method || 'linear',\n order = _.order == null ? 3 : _.order,\n dof = degreesOfFreedom(method, order),\n as = _.as || [accessorName(_.x), accessorName(_.y)],\n fit = Methods[method],\n values = [];\n let domain = _.extent;\n if (!hasOwnProperty(Methods, method)) {\n error('Invalid regression method: ' + method);\n }\n if (domain != null) {\n if (method === 'log' && domain[0] <= 0) {\n pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.');\n domain = null;\n }\n }\n groups.forEach(g => {\n const n = g.length;\n if (n <= dof) {\n pulse.dataflow.warn('Skipping regression with more parameters than data points.');\n return;\n }\n const model = fit(g, _.x, _.y, order);\n if (_.params) {\n // if parameter vectors requested return those\n values.push(ingest({\n keys: g.dims,\n coef: model.coef,\n rSquared: model.rSquared\n }));\n return;\n }\n const dom = domain || extent(g, _.x),\n add = p => {\n const t = {};\n for (let i = 0; i < names.length; ++i) {\n t[names[i]] = g.dims[i];\n }\n t[as[0]] = p[0];\n t[as[1]] = p[1];\n values.push(ingest(t));\n };\n if (method === 'linear' || method === 'constant') {\n // for linear or constant regression we only need the end points\n dom.forEach(x => add([x, model.predict(x)]));\n } else {\n // otherwise return trend line sample points\n sampleCurve(model.predict, dom, 25, 200).forEach(add);\n }\n });\n if (this.value) out.rem = this.value;\n this.value = out.add = out.source = values;\n }\n return out;\n }\n});\n\nexport { Loess as loess, Regression as regression };\n","export const epsilon = 1.1102230246251565e-16;\nexport const splitter = 134217729;\nexport const resulterrbound = (3 + 8 * epsilon) * epsilon;\n\n// fast_expansion_sum_zeroelim routine from oritinal code\nexport function sum(elen, e, flen, f, h) {\n let Q, Qnew, hh, bvirt;\n let enow = e[0];\n let fnow = f[0];\n let eindex = 0;\n let findex = 0;\n if ((fnow > enow) === (fnow > -enow)) {\n Q = enow;\n enow = e[++eindex];\n } else {\n Q = fnow;\n fnow = f[++findex];\n }\n let hindex = 0;\n if (eindex < elen && findex < flen) {\n if ((fnow > enow) === (fnow > -enow)) {\n Qnew = enow + Q;\n hh = Q - (Qnew - enow);\n enow = e[++eindex];\n } else {\n Qnew = fnow + Q;\n hh = Q - (Qnew - fnow);\n fnow = f[++findex];\n }\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n while (eindex < elen && findex < flen) {\n if ((fnow > enow) === (fnow > -enow)) {\n Qnew = Q + enow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (enow - bvirt);\n enow = e[++eindex];\n } else {\n Qnew = Q + fnow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n fnow = f[++findex];\n }\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n }\n while (eindex < elen) {\n Qnew = Q + enow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (enow - bvirt);\n enow = e[++eindex];\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n while (findex < flen) {\n Qnew = Q + fnow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n fnow = f[++findex];\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n if (Q !== 0 || hindex === 0) {\n h[hindex++] = Q;\n }\n return hindex;\n}\n\nexport function sum_three(alen, a, blen, b, clen, c, tmp, out) {\n return sum(sum(alen, a, blen, b, tmp), tmp, clen, c, out);\n}\n\n// scale_expansion_zeroelim routine from oritinal code\nexport function scale(elen, e, b, h) {\n let Q, sum, hh, product1, product0;\n let bvirt, c, ahi, alo, bhi, blo;\n\n c = splitter * b;\n bhi = c - (c - b);\n blo = b - bhi;\n let enow = e[0];\n Q = enow * b;\n c = splitter * enow;\n ahi = c - (c - enow);\n alo = enow - ahi;\n hh = alo * blo - (Q - ahi * bhi - alo * bhi - ahi * blo);\n let hindex = 0;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n for (let i = 1; i < elen; i++) {\n enow = e[i];\n product1 = enow * b;\n c = splitter * enow;\n ahi = c - (c - enow);\n alo = enow - ahi;\n product0 = alo * blo - (product1 - ahi * bhi - alo * bhi - ahi * blo);\n sum = Q + product0;\n bvirt = sum - Q;\n hh = Q - (sum - bvirt) + (product0 - bvirt);\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n Q = product1 + sum;\n hh = sum - (Q - product1);\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n if (Q !== 0 || hindex === 0) {\n h[hindex++] = Q;\n }\n return hindex;\n}\n\nexport function negate(elen, e) {\n for (let i = 0; i < elen; i++) e[i] = -e[i];\n return elen;\n}\n\nexport function estimate(elen, e) {\n let Q = e[0];\n for (let i = 1; i < elen; i++) Q += e[i];\n return Q;\n}\n\nexport function vec(n) {\n return new Float64Array(n);\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum} from './util.js';\n\nconst ccwerrboundA = (3 + 16 * epsilon) * epsilon;\nconst ccwerrboundB = (2 + 12 * epsilon) * epsilon;\nconst ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;\n\nconst B = vec(4);\nconst C1 = vec(8);\nconst C2 = vec(12);\nconst D = vec(16);\nconst u = vec(4);\n\nfunction orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {\n let acxtail, acytail, bcxtail, bcytail;\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;\n\n const acx = ax - cx;\n const bcx = bx - cx;\n const acy = ay - cy;\n const bcy = by - cy;\n\n s1 = acx * bcy;\n c = splitter * acx;\n ahi = c - (c - acx);\n alo = acx - ahi;\n c = splitter * bcy;\n bhi = c - (c - bcy);\n blo = bcy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acy * bcx;\n c = splitter * acy;\n ahi = c - (c - acy);\n alo = acy - ahi;\n c = splitter * bcx;\n bhi = c - (c - bcx);\n blo = bcx - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n B[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n B[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n B[2] = _j - (u3 - bvirt) + (_i - bvirt);\n B[3] = u3;\n\n let det = estimate(4, B);\n let errbound = ccwerrboundB * detsum;\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n bvirt = ax - acx;\n acxtail = ax - (acx + bvirt) + (bvirt - cx);\n bvirt = bx - bcx;\n bcxtail = bx - (bcx + bvirt) + (bvirt - cx);\n bvirt = ay - acy;\n acytail = ay - (acy + bvirt) + (bvirt - cy);\n bvirt = by - bcy;\n bcytail = by - (bcy + bvirt) + (bvirt - cy);\n\n if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {\n return det;\n }\n\n errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);\n det += (acx * bcytail + bcy * acxtail) - (acy * bcxtail + bcx * acytail);\n if (det >= errbound || -det >= errbound) return det;\n\n s1 = acxtail * bcy;\n c = splitter * acxtail;\n ahi = c - (c - acxtail);\n alo = acxtail - ahi;\n c = splitter * bcy;\n bhi = c - (c - bcy);\n blo = bcy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acytail * bcx;\n c = splitter * acytail;\n ahi = c - (c - acytail);\n alo = acytail - ahi;\n c = splitter * bcx;\n bhi = c - (c - bcx);\n blo = bcx - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const C1len = sum(4, B, 4, u, C1);\n\n s1 = acx * bcytail;\n c = splitter * acx;\n ahi = c - (c - acx);\n alo = acx - ahi;\n c = splitter * bcytail;\n bhi = c - (c - bcytail);\n blo = bcytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acy * bcxtail;\n c = splitter * acy;\n ahi = c - (c - acy);\n alo = acy - ahi;\n c = splitter * bcxtail;\n bhi = c - (c - bcxtail);\n blo = bcxtail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const C2len = sum(C1len, C1, 4, u, C2);\n\n s1 = acxtail * bcytail;\n c = splitter * acxtail;\n ahi = c - (c - acxtail);\n alo = acxtail - ahi;\n c = splitter * bcytail;\n bhi = c - (c - bcytail);\n blo = bcytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acytail * bcxtail;\n c = splitter * acytail;\n ahi = c - (c - acytail);\n alo = acytail - ahi;\n c = splitter * bcxtail;\n bhi = c - (c - bcxtail);\n blo = bcxtail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const Dlen = sum(C2len, C2, 4, u, D);\n\n return D[Dlen - 1];\n}\n\nexport function orient2d(ax, ay, bx, by, cx, cy) {\n const detleft = (ay - cy) * (bx - cx);\n const detright = (ax - cx) * (by - cy);\n const det = detleft - detright;\n\n const detsum = Math.abs(detleft + detright);\n if (Math.abs(det) >= ccwerrboundA * detsum) return det;\n\n return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);\n}\n\nexport function orient2dfast(ax, ay, bx, by, cx, cy) {\n return (ay - cy) * (bx - cx) - (ax - cx) * (by - cy);\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum, scale} from './util.js';\n\nconst o3derrboundA = (7 + 56 * epsilon) * epsilon;\nconst o3derrboundB = (3 + 28 * epsilon) * epsilon;\nconst o3derrboundC = (26 + 288 * epsilon) * epsilon * epsilon;\n\nconst bc = vec(4);\nconst ca = vec(4);\nconst ab = vec(4);\nconst at_b = vec(4);\nconst at_c = vec(4);\nconst bt_c = vec(4);\nconst bt_a = vec(4);\nconst ct_a = vec(4);\nconst ct_b = vec(4);\nconst bct = vec(8);\nconst cat = vec(8);\nconst abt = vec(8);\nconst u = vec(4);\n\nconst _8 = vec(8);\nconst _8b = vec(8);\nconst _16 = vec(8);\nconst _12 = vec(12);\n\nlet fin = vec(192);\nlet fin2 = vec(192);\n\nfunction finadd(finlen, alen, a) {\n finlen = sum(finlen, fin, alen, a, fin2);\n const tmp = fin; fin = fin2; fin2 = tmp;\n return finlen;\n}\n\nfunction tailinit(xtail, ytail, ax, ay, bx, by, a, b) {\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3, negate;\n if (xtail === 0) {\n if (ytail === 0) {\n a[0] = 0;\n b[0] = 0;\n return 1;\n } else {\n negate = -ytail;\n s1 = negate * ax;\n c = splitter * negate;\n ahi = c - (c - negate);\n alo = negate - ahi;\n c = splitter * ax;\n bhi = c - (c - ax);\n blo = ax - bhi;\n a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n a[1] = s1;\n s1 = ytail * bx;\n c = splitter * ytail;\n ahi = c - (c - ytail);\n alo = ytail - ahi;\n c = splitter * bx;\n bhi = c - (c - bx);\n blo = bx - bhi;\n b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n b[1] = s1;\n return 2;\n }\n } else {\n if (ytail === 0) {\n s1 = xtail * ay;\n c = splitter * xtail;\n ahi = c - (c - xtail);\n alo = xtail - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n a[1] = s1;\n negate = -xtail;\n s1 = negate * by;\n c = splitter * negate;\n ahi = c - (c - negate);\n alo = negate - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n b[1] = s1;\n return 2;\n } else {\n s1 = xtail * ay;\n c = splitter * xtail;\n ahi = c - (c - xtail);\n alo = xtail - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = ytail * ax;\n c = splitter * ytail;\n ahi = c - (c - ytail);\n alo = ytail - ahi;\n c = splitter * ax;\n bhi = c - (c - ax);\n blo = ax - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n a[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n a[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n a[2] = _j - (u3 - bvirt) + (_i - bvirt);\n a[3] = u3;\n s1 = ytail * bx;\n c = splitter * ytail;\n ahi = c - (c - ytail);\n alo = ytail - ahi;\n c = splitter * bx;\n bhi = c - (c - bx);\n blo = bx - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = xtail * by;\n c = splitter * xtail;\n ahi = c - (c - xtail);\n alo = xtail - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n b[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n b[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n b[2] = _j - (u3 - bvirt) + (_i - bvirt);\n b[3] = u3;\n return 4;\n }\n }\n}\n\nfunction tailadd(finlen, a, b, k, z) {\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, u3;\n s1 = a * b;\n c = splitter * a;\n ahi = c - (c - a);\n alo = a - ahi;\n c = splitter * b;\n bhi = c - (c - b);\n blo = b - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n c = splitter * k;\n bhi = c - (c - k);\n blo = k - bhi;\n _i = s0 * k;\n c = splitter * s0;\n ahi = c - (c - s0);\n alo = s0 - ahi;\n u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo);\n _j = s1 * k;\n c = splitter * s1;\n ahi = c - (c - s1);\n alo = s1 - ahi;\n _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo);\n _k = _i + _0;\n bvirt = _k - _i;\n u[1] = _i - (_k - bvirt) + (_0 - bvirt);\n u3 = _j + _k;\n u[2] = _k - (u3 - _j);\n u[3] = u3;\n finlen = finadd(finlen, 4, u);\n if (z !== 0) {\n c = splitter * z;\n bhi = c - (c - z);\n blo = z - bhi;\n _i = s0 * z;\n c = splitter * s0;\n ahi = c - (c - s0);\n alo = s0 - ahi;\n u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo);\n _j = s1 * z;\n c = splitter * s1;\n ahi = c - (c - s1);\n alo = s1 - ahi;\n _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo);\n _k = _i + _0;\n bvirt = _k - _i;\n u[1] = _i - (_k - bvirt) + (_0 - bvirt);\n u3 = _j + _k;\n u[2] = _k - (u3 - _j);\n u[3] = u3;\n finlen = finadd(finlen, 4, u);\n }\n return finlen;\n}\n\nfunction orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent) {\n let finlen;\n let adxtail, bdxtail, cdxtail;\n let adytail, bdytail, cdytail;\n let adztail, bdztail, cdztail;\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3;\n\n const adx = ax - dx;\n const bdx = bx - dx;\n const cdx = cx - dx;\n const ady = ay - dy;\n const bdy = by - dy;\n const cdy = cy - dy;\n const adz = az - dz;\n const bdz = bz - dz;\n const cdz = cz - dz;\n\n s1 = bdx * cdy;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * cdy;\n bhi = c - (c - cdy);\n blo = cdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cdx * bdy;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * bdy;\n bhi = c - (c - bdy);\n blo = bdy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bc[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bc[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bc[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bc[3] = u3;\n s1 = cdx * ady;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * ady;\n bhi = c - (c - ady);\n blo = ady - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = adx * cdy;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * cdy;\n bhi = c - (c - cdy);\n blo = cdy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ca[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ca[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ca[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ca[3] = u3;\n s1 = adx * bdy;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * bdy;\n bhi = c - (c - bdy);\n blo = bdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bdx * ady;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * ady;\n bhi = c - (c - ady);\n blo = ady - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ab[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ab[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ab[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ab[3] = u3;\n\n finlen = sum(\n sum(\n scale(4, bc, adz, _8), _8,\n scale(4, ca, bdz, _8b), _8b, _16), _16,\n scale(4, ab, cdz, _8), _8, fin);\n\n let det = estimate(finlen, fin);\n let errbound = o3derrboundB * permanent;\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n bvirt = ax - adx;\n adxtail = ax - (adx + bvirt) + (bvirt - dx);\n bvirt = bx - bdx;\n bdxtail = bx - (bdx + bvirt) + (bvirt - dx);\n bvirt = cx - cdx;\n cdxtail = cx - (cdx + bvirt) + (bvirt - dx);\n bvirt = ay - ady;\n adytail = ay - (ady + bvirt) + (bvirt - dy);\n bvirt = by - bdy;\n bdytail = by - (bdy + bvirt) + (bvirt - dy);\n bvirt = cy - cdy;\n cdytail = cy - (cdy + bvirt) + (bvirt - dy);\n bvirt = az - adz;\n adztail = az - (adz + bvirt) + (bvirt - dz);\n bvirt = bz - bdz;\n bdztail = bz - (bdz + bvirt) + (bvirt - dz);\n bvirt = cz - cdz;\n cdztail = cz - (cdz + bvirt) + (bvirt - dz);\n\n if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 &&\n adytail === 0 && bdytail === 0 && cdytail === 0 &&\n adztail === 0 && bdztail === 0 && cdztail === 0) {\n return det;\n }\n\n errbound = o3derrboundC * permanent + resulterrbound * Math.abs(det);\n det +=\n adz * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + adztail * (bdx * cdy - bdy * cdx) +\n bdz * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + bdztail * (cdx * ady - cdy * adx) +\n cdz * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + cdztail * (adx * bdy - ady * bdx);\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n const at_len = tailinit(adxtail, adytail, bdx, bdy, cdx, cdy, at_b, at_c);\n const bt_len = tailinit(bdxtail, bdytail, cdx, cdy, adx, ady, bt_c, bt_a);\n const ct_len = tailinit(cdxtail, cdytail, adx, ady, bdx, bdy, ct_a, ct_b);\n\n const bctlen = sum(bt_len, bt_c, ct_len, ct_b, bct);\n finlen = finadd(finlen, scale(bctlen, bct, adz, _16), _16);\n\n const catlen = sum(ct_len, ct_a, at_len, at_c, cat);\n finlen = finadd(finlen, scale(catlen, cat, bdz, _16), _16);\n\n const abtlen = sum(at_len, at_b, bt_len, bt_a, abt);\n finlen = finadd(finlen, scale(abtlen, abt, cdz, _16), _16);\n\n if (adztail !== 0) {\n finlen = finadd(finlen, scale(4, bc, adztail, _12), _12);\n finlen = finadd(finlen, scale(bctlen, bct, adztail, _16), _16);\n }\n if (bdztail !== 0) {\n finlen = finadd(finlen, scale(4, ca, bdztail, _12), _12);\n finlen = finadd(finlen, scale(catlen, cat, bdztail, _16), _16);\n }\n if (cdztail !== 0) {\n finlen = finadd(finlen, scale(4, ab, cdztail, _12), _12);\n finlen = finadd(finlen, scale(abtlen, abt, cdztail, _16), _16);\n }\n\n if (adxtail !== 0) {\n if (bdytail !== 0) {\n finlen = tailadd(finlen, adxtail, bdytail, cdz, cdztail);\n }\n if (cdytail !== 0) {\n finlen = tailadd(finlen, -adxtail, cdytail, bdz, bdztail);\n }\n }\n if (bdxtail !== 0) {\n if (cdytail !== 0) {\n finlen = tailadd(finlen, bdxtail, cdytail, adz, adztail);\n }\n if (adytail !== 0) {\n finlen = tailadd(finlen, -bdxtail, adytail, cdz, cdztail);\n }\n }\n if (cdxtail !== 0) {\n if (adytail !== 0) {\n finlen = tailadd(finlen, cdxtail, adytail, bdz, bdztail);\n }\n if (bdytail !== 0) {\n finlen = tailadd(finlen, -cdxtail, bdytail, adz, adztail);\n }\n }\n\n return fin[finlen - 1];\n}\n\nexport function orient3d(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) {\n const adx = ax - dx;\n const bdx = bx - dx;\n const cdx = cx - dx;\n const ady = ay - dy;\n const bdy = by - dy;\n const cdy = cy - dy;\n const adz = az - dz;\n const bdz = bz - dz;\n const cdz = cz - dz;\n\n const bdxcdy = bdx * cdy;\n const cdxbdy = cdx * bdy;\n\n const cdxady = cdx * ady;\n const adxcdy = adx * cdy;\n\n const adxbdy = adx * bdy;\n const bdxady = bdx * ady;\n\n const det =\n adz * (bdxcdy - cdxbdy) +\n bdz * (cdxady - adxcdy) +\n cdz * (adxbdy - bdxady);\n\n const permanent =\n (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * Math.abs(adz) +\n (Math.abs(cdxady) + Math.abs(adxcdy)) * Math.abs(bdz) +\n (Math.abs(adxbdy) + Math.abs(bdxady)) * Math.abs(cdz);\n\n const errbound = o3derrboundA * permanent;\n if (det > errbound || -det > errbound) {\n return det;\n }\n\n return orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent);\n}\n\nexport function orient3dfast(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) {\n const adx = ax - dx;\n const bdx = bx - dx;\n const cdx = cx - dx;\n const ady = ay - dy;\n const bdy = by - dy;\n const cdy = cy - dy;\n const adz = az - dz;\n const bdz = bz - dz;\n const cdz = cz - dz;\n\n return adx * (bdy * cdz - bdz * cdy) +\n bdx * (cdy * adz - cdz * ady) +\n cdx * (ady * bdz - adz * bdy);\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum, sum_three, scale} from './util.js';\n\nconst iccerrboundA = (10 + 96 * epsilon) * epsilon;\nconst iccerrboundB = (4 + 48 * epsilon) * epsilon;\nconst iccerrboundC = (44 + 576 * epsilon) * epsilon * epsilon;\n\nconst bc = vec(4);\nconst ca = vec(4);\nconst ab = vec(4);\nconst aa = vec(4);\nconst bb = vec(4);\nconst cc = vec(4);\nconst u = vec(4);\nconst v = vec(4);\nconst axtbc = vec(8);\nconst aytbc = vec(8);\nconst bxtca = vec(8);\nconst bytca = vec(8);\nconst cxtab = vec(8);\nconst cytab = vec(8);\nconst abt = vec(8);\nconst bct = vec(8);\nconst cat = vec(8);\nconst abtt = vec(4);\nconst bctt = vec(4);\nconst catt = vec(4);\n\nconst _8 = vec(8);\nconst _16 = vec(16);\nconst _16b = vec(16);\nconst _16c = vec(16);\nconst _32 = vec(32);\nconst _32b = vec(32);\nconst _48 = vec(48);\nconst _64 = vec(64);\n\nlet fin = vec(1152);\nlet fin2 = vec(1152);\n\nfunction finadd(finlen, a, alen) {\n finlen = sum(finlen, fin, a, alen, fin2);\n const tmp = fin; fin = fin2; fin2 = tmp;\n return finlen;\n}\n\nfunction incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent) {\n let finlen;\n let adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail;\n let axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen;\n let abtlen, bctlen, catlen;\n let abttlen, bcttlen, cattlen;\n let n1, n0;\n\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;\n\n const adx = ax - dx;\n const bdx = bx - dx;\n const cdx = cx - dx;\n const ady = ay - dy;\n const bdy = by - dy;\n const cdy = cy - dy;\n\n s1 = bdx * cdy;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * cdy;\n bhi = c - (c - cdy);\n blo = cdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cdx * bdy;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * bdy;\n bhi = c - (c - bdy);\n blo = bdy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bc[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bc[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bc[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bc[3] = u3;\n s1 = cdx * ady;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * ady;\n bhi = c - (c - ady);\n blo = ady - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = adx * cdy;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * cdy;\n bhi = c - (c - cdy);\n blo = cdy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ca[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ca[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ca[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ca[3] = u3;\n s1 = adx * bdy;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * bdy;\n bhi = c - (c - bdy);\n blo = bdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bdx * ady;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * ady;\n bhi = c - (c - ady);\n blo = ady - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ab[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ab[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ab[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ab[3] = u3;\n\n finlen = sum(\n sum(\n sum(\n scale(scale(4, bc, adx, _8), _8, adx, _16), _16,\n scale(scale(4, bc, ady, _8), _8, ady, _16b), _16b, _32), _32,\n sum(\n scale(scale(4, ca, bdx, _8), _8, bdx, _16), _16,\n scale(scale(4, ca, bdy, _8), _8, bdy, _16b), _16b, _32b), _32b, _64), _64,\n sum(\n scale(scale(4, ab, cdx, _8), _8, cdx, _16), _16,\n scale(scale(4, ab, cdy, _8), _8, cdy, _16b), _16b, _32), _32, fin);\n\n let det = estimate(finlen, fin);\n let errbound = iccerrboundB * permanent;\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n bvirt = ax - adx;\n adxtail = ax - (adx + bvirt) + (bvirt - dx);\n bvirt = ay - ady;\n adytail = ay - (ady + bvirt) + (bvirt - dy);\n bvirt = bx - bdx;\n bdxtail = bx - (bdx + bvirt) + (bvirt - dx);\n bvirt = by - bdy;\n bdytail = by - (bdy + bvirt) + (bvirt - dy);\n bvirt = cx - cdx;\n cdxtail = cx - (cdx + bvirt) + (bvirt - dx);\n bvirt = cy - cdy;\n cdytail = cy - (cdy + bvirt) + (bvirt - dy);\n if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0) {\n return det;\n }\n\n errbound = iccerrboundC * permanent + resulterrbound * Math.abs(det);\n det += ((adx * adx + ady * ady) * ((bdx * cdytail + cdy * bdxtail) - (bdy * cdxtail + cdx * bdytail)) +\n 2 * (adx * adxtail + ady * adytail) * (bdx * cdy - bdy * cdx)) +\n ((bdx * bdx + bdy * bdy) * ((cdx * adytail + ady * cdxtail) - (cdy * adxtail + adx * cdytail)) +\n 2 * (bdx * bdxtail + bdy * bdytail) * (cdx * ady - cdy * adx)) +\n ((cdx * cdx + cdy * cdy) * ((adx * bdytail + bdy * adxtail) - (ady * bdxtail + bdx * adytail)) +\n 2 * (cdx * cdxtail + cdy * cdytail) * (adx * bdy - ady * bdx));\n\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) {\n s1 = adx * adx;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo);\n t1 = ady * ady;\n c = splitter * ady;\n ahi = c - (c - ady);\n alo = ady - ahi;\n t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo);\n _i = s0 + t0;\n bvirt = _i - s0;\n aa[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n aa[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n aa[2] = _j - (u3 - bvirt) + (_i - bvirt);\n aa[3] = u3;\n }\n if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) {\n s1 = bdx * bdx;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo);\n t1 = bdy * bdy;\n c = splitter * bdy;\n ahi = c - (c - bdy);\n alo = bdy - ahi;\n t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo);\n _i = s0 + t0;\n bvirt = _i - s0;\n bb[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n bb[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bb[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bb[3] = u3;\n }\n if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) {\n s1 = cdx * cdx;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo);\n t1 = cdy * cdy;\n c = splitter * cdy;\n ahi = c - (c - cdy);\n alo = cdy - ahi;\n t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo);\n _i = s0 + t0;\n bvirt = _i - s0;\n cc[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n cc[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n cc[2] = _j - (u3 - bvirt) + (_i - bvirt);\n cc[3] = u3;\n }\n\n if (adxtail !== 0) {\n axtbclen = scale(4, bc, adxtail, axtbc);\n finlen = finadd(finlen, sum_three(\n scale(axtbclen, axtbc, 2 * adx, _16), _16,\n scale(scale(4, cc, adxtail, _8), _8, bdy, _16b), _16b,\n scale(scale(4, bb, adxtail, _8), _8, -cdy, _16c), _16c, _32, _48), _48);\n }\n if (adytail !== 0) {\n aytbclen = scale(4, bc, adytail, aytbc);\n finlen = finadd(finlen, sum_three(\n scale(aytbclen, aytbc, 2 * ady, _16), _16,\n scale(scale(4, bb, adytail, _8), _8, cdx, _16b), _16b,\n scale(scale(4, cc, adytail, _8), _8, -bdx, _16c), _16c, _32, _48), _48);\n }\n if (bdxtail !== 0) {\n bxtcalen = scale(4, ca, bdxtail, bxtca);\n finlen = finadd(finlen, sum_three(\n scale(bxtcalen, bxtca, 2 * bdx, _16), _16,\n scale(scale(4, aa, bdxtail, _8), _8, cdy, _16b), _16b,\n scale(scale(4, cc, bdxtail, _8), _8, -ady, _16c), _16c, _32, _48), _48);\n }\n if (bdytail !== 0) {\n bytcalen = scale(4, ca, bdytail, bytca);\n finlen = finadd(finlen, sum_three(\n scale(bytcalen, bytca, 2 * bdy, _16), _16,\n scale(scale(4, cc, bdytail, _8), _8, adx, _16b), _16b,\n scale(scale(4, aa, bdytail, _8), _8, -cdx, _16c), _16c, _32, _48), _48);\n }\n if (cdxtail !== 0) {\n cxtablen = scale(4, ab, cdxtail, cxtab);\n finlen = finadd(finlen, sum_three(\n scale(cxtablen, cxtab, 2 * cdx, _16), _16,\n scale(scale(4, bb, cdxtail, _8), _8, ady, _16b), _16b,\n scale(scale(4, aa, cdxtail, _8), _8, -bdy, _16c), _16c, _32, _48), _48);\n }\n if (cdytail !== 0) {\n cytablen = scale(4, ab, cdytail, cytab);\n finlen = finadd(finlen, sum_three(\n scale(cytablen, cytab, 2 * cdy, _16), _16,\n scale(scale(4, aa, cdytail, _8), _8, bdx, _16b), _16b,\n scale(scale(4, bb, cdytail, _8), _8, -adx, _16c), _16c, _32, _48), _48);\n }\n\n if (adxtail !== 0 || adytail !== 0) {\n if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) {\n s1 = bdxtail * cdy;\n c = splitter * bdxtail;\n ahi = c - (c - bdxtail);\n alo = bdxtail - ahi;\n c = splitter * cdy;\n bhi = c - (c - cdy);\n blo = cdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bdx * cdytail;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * cdytail;\n bhi = c - (c - cdytail);\n blo = cdytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n u[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n u[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n s1 = cdxtail * -bdy;\n c = splitter * cdxtail;\n ahi = c - (c - cdxtail);\n alo = cdxtail - ahi;\n c = splitter * -bdy;\n bhi = c - (c - -bdy);\n blo = -bdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cdx * -bdytail;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * -bdytail;\n bhi = c - (c - -bdytail);\n blo = -bdytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n v[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n v[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n v[2] = _j - (u3 - bvirt) + (_i - bvirt);\n v[3] = u3;\n bctlen = sum(4, u, 4, v, bct);\n s1 = bdxtail * cdytail;\n c = splitter * bdxtail;\n ahi = c - (c - bdxtail);\n alo = bdxtail - ahi;\n c = splitter * cdytail;\n bhi = c - (c - cdytail);\n blo = cdytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cdxtail * bdytail;\n c = splitter * cdxtail;\n ahi = c - (c - cdxtail);\n alo = cdxtail - ahi;\n c = splitter * bdytail;\n bhi = c - (c - bdytail);\n blo = bdytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bctt[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bctt[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bctt[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bctt[3] = u3;\n bcttlen = 4;\n } else {\n bct[0] = 0;\n bctlen = 1;\n bctt[0] = 0;\n bcttlen = 1;\n }\n if (adxtail !== 0) {\n const len = scale(bctlen, bct, adxtail, _16c);\n finlen = finadd(finlen, sum(\n scale(axtbclen, axtbc, adxtail, _16), _16,\n scale(len, _16c, 2 * adx, _32), _32, _48), _48);\n\n const len2 = scale(bcttlen, bctt, adxtail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * adx, _16), _16,\n scale(len2, _8, adxtail, _16b), _16b,\n scale(len, _16c, adxtail, _32), _32, _32b, _64), _64);\n\n if (bdytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, cc, adxtail, _8), _8, bdytail, _16), _16);\n }\n if (cdytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, bb, -adxtail, _8), _8, cdytail, _16), _16);\n }\n }\n if (adytail !== 0) {\n const len = scale(bctlen, bct, adytail, _16c);\n finlen = finadd(finlen, sum(\n scale(aytbclen, aytbc, adytail, _16), _16,\n scale(len, _16c, 2 * ady, _32), _32, _48), _48);\n\n const len2 = scale(bcttlen, bctt, adytail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * ady, _16), _16,\n scale(len2, _8, adytail, _16b), _16b,\n scale(len, _16c, adytail, _32), _32, _32b, _64), _64);\n }\n }\n if (bdxtail !== 0 || bdytail !== 0) {\n if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) {\n s1 = cdxtail * ady;\n c = splitter * cdxtail;\n ahi = c - (c - cdxtail);\n alo = cdxtail - ahi;\n c = splitter * ady;\n bhi = c - (c - ady);\n blo = ady - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cdx * adytail;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * adytail;\n bhi = c - (c - adytail);\n blo = adytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n u[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n u[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n n1 = -cdy;\n n0 = -cdytail;\n s1 = adxtail * n1;\n c = splitter * adxtail;\n ahi = c - (c - adxtail);\n alo = adxtail - ahi;\n c = splitter * n1;\n bhi = c - (c - n1);\n blo = n1 - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = adx * n0;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * n0;\n bhi = c - (c - n0);\n blo = n0 - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n v[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n v[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n v[2] = _j - (u3 - bvirt) + (_i - bvirt);\n v[3] = u3;\n catlen = sum(4, u, 4, v, cat);\n s1 = cdxtail * adytail;\n c = splitter * cdxtail;\n ahi = c - (c - cdxtail);\n alo = cdxtail - ahi;\n c = splitter * adytail;\n bhi = c - (c - adytail);\n blo = adytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = adxtail * cdytail;\n c = splitter * adxtail;\n ahi = c - (c - adxtail);\n alo = adxtail - ahi;\n c = splitter * cdytail;\n bhi = c - (c - cdytail);\n blo = cdytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n catt[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n catt[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n catt[2] = _j - (u3 - bvirt) + (_i - bvirt);\n catt[3] = u3;\n cattlen = 4;\n } else {\n cat[0] = 0;\n catlen = 1;\n catt[0] = 0;\n cattlen = 1;\n }\n if (bdxtail !== 0) {\n const len = scale(catlen, cat, bdxtail, _16c);\n finlen = finadd(finlen, sum(\n scale(bxtcalen, bxtca, bdxtail, _16), _16,\n scale(len, _16c, 2 * bdx, _32), _32, _48), _48);\n\n const len2 = scale(cattlen, catt, bdxtail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * bdx, _16), _16,\n scale(len2, _8, bdxtail, _16b), _16b,\n scale(len, _16c, bdxtail, _32), _32, _32b, _64), _64);\n\n if (cdytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, aa, bdxtail, _8), _8, cdytail, _16), _16);\n }\n if (adytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, cc, -bdxtail, _8), _8, adytail, _16), _16);\n }\n }\n if (bdytail !== 0) {\n const len = scale(catlen, cat, bdytail, _16c);\n finlen = finadd(finlen, sum(\n scale(bytcalen, bytca, bdytail, _16), _16,\n scale(len, _16c, 2 * bdy, _32), _32, _48), _48);\n\n const len2 = scale(cattlen, catt, bdytail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * bdy, _16), _16,\n scale(len2, _8, bdytail, _16b), _16b,\n scale(len, _16c, bdytail, _32), _32, _32b, _64), _64);\n }\n }\n if (cdxtail !== 0 || cdytail !== 0) {\n if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) {\n s1 = adxtail * bdy;\n c = splitter * adxtail;\n ahi = c - (c - adxtail);\n alo = adxtail - ahi;\n c = splitter * bdy;\n bhi = c - (c - bdy);\n blo = bdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = adx * bdytail;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * bdytail;\n bhi = c - (c - bdytail);\n blo = bdytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n u[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n u[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n n1 = -ady;\n n0 = -adytail;\n s1 = bdxtail * n1;\n c = splitter * bdxtail;\n ahi = c - (c - bdxtail);\n alo = bdxtail - ahi;\n c = splitter * n1;\n bhi = c - (c - n1);\n blo = n1 - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bdx * n0;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * n0;\n bhi = c - (c - n0);\n blo = n0 - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n v[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n v[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n v[2] = _j - (u3 - bvirt) + (_i - bvirt);\n v[3] = u3;\n abtlen = sum(4, u, 4, v, abt);\n s1 = adxtail * bdytail;\n c = splitter * adxtail;\n ahi = c - (c - adxtail);\n alo = adxtail - ahi;\n c = splitter * bdytail;\n bhi = c - (c - bdytail);\n blo = bdytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bdxtail * adytail;\n c = splitter * bdxtail;\n ahi = c - (c - bdxtail);\n alo = bdxtail - ahi;\n c = splitter * adytail;\n bhi = c - (c - adytail);\n blo = adytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n abtt[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n abtt[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n abtt[2] = _j - (u3 - bvirt) + (_i - bvirt);\n abtt[3] = u3;\n abttlen = 4;\n } else {\n abt[0] = 0;\n abtlen = 1;\n abtt[0] = 0;\n abttlen = 1;\n }\n if (cdxtail !== 0) {\n const len = scale(abtlen, abt, cdxtail, _16c);\n finlen = finadd(finlen, sum(\n scale(cxtablen, cxtab, cdxtail, _16), _16,\n scale(len, _16c, 2 * cdx, _32), _32, _48), _48);\n\n const len2 = scale(abttlen, abtt, cdxtail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * cdx, _16), _16,\n scale(len2, _8, cdxtail, _16b), _16b,\n scale(len, _16c, cdxtail, _32), _32, _32b, _64), _64);\n\n if (adytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, bb, cdxtail, _8), _8, adytail, _16), _16);\n }\n if (bdytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, aa, -cdxtail, _8), _8, bdytail, _16), _16);\n }\n }\n if (cdytail !== 0) {\n const len = scale(abtlen, abt, cdytail, _16c);\n finlen = finadd(finlen, sum(\n scale(cytablen, cytab, cdytail, _16), _16,\n scale(len, _16c, 2 * cdy, _32), _32, _48), _48);\n\n const len2 = scale(abttlen, abtt, cdytail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * cdy, _16), _16,\n scale(len2, _8, cdytail, _16b), _16b,\n scale(len, _16c, cdytail, _32), _32, _32b, _64), _64);\n }\n }\n\n return fin[finlen - 1];\n}\n\nexport function incircle(ax, ay, bx, by, cx, cy, dx, dy) {\n const adx = ax - dx;\n const bdx = bx - dx;\n const cdx = cx - dx;\n const ady = ay - dy;\n const bdy = by - dy;\n const cdy = cy - dy;\n\n const bdxcdy = bdx * cdy;\n const cdxbdy = cdx * bdy;\n const alift = adx * adx + ady * ady;\n\n const cdxady = cdx * ady;\n const adxcdy = adx * cdy;\n const blift = bdx * bdx + bdy * bdy;\n\n const adxbdy = adx * bdy;\n const bdxady = bdx * ady;\n const clift = cdx * cdx + cdy * cdy;\n\n const det =\n alift * (bdxcdy - cdxbdy) +\n blift * (cdxady - adxcdy) +\n clift * (adxbdy - bdxady);\n\n const permanent =\n (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * alift +\n (Math.abs(cdxady) + Math.abs(adxcdy)) * blift +\n (Math.abs(adxbdy) + Math.abs(bdxady)) * clift;\n\n const errbound = iccerrboundA * permanent;\n\n if (det > errbound || -det > errbound) {\n return det;\n }\n return incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent);\n}\n\nexport function incirclefast(ax, ay, bx, by, cx, cy, dx, dy) {\n const adx = ax - dx;\n const ady = ay - dy;\n const bdx = bx - dx;\n const bdy = by - dy;\n const cdx = cx - dx;\n const cdy = cy - dy;\n\n const abdet = adx * bdy - bdx * ady;\n const bcdet = bdx * cdy - cdx * bdy;\n const cadet = cdx * ady - adx * cdy;\n const alift = adx * adx + ady * ady;\n const blift = bdx * bdx + bdy * bdy;\n const clift = cdx * cdx + cdy * cdy;\n\n return alift * bcdet + blift * cadet + clift * abdet;\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum, sum_three, scale, negate} from './util.js';\n\nconst isperrboundA = (16 + 224 * epsilon) * epsilon;\nconst isperrboundB = (5 + 72 * epsilon) * epsilon;\nconst isperrboundC = (71 + 1408 * epsilon) * epsilon * epsilon;\n\nconst ab = vec(4);\nconst bc = vec(4);\nconst cd = vec(4);\nconst de = vec(4);\nconst ea = vec(4);\nconst ac = vec(4);\nconst bd = vec(4);\nconst ce = vec(4);\nconst da = vec(4);\nconst eb = vec(4);\n\nconst abc = vec(24);\nconst bcd = vec(24);\nconst cde = vec(24);\nconst dea = vec(24);\nconst eab = vec(24);\nconst abd = vec(24);\nconst bce = vec(24);\nconst cda = vec(24);\nconst deb = vec(24);\nconst eac = vec(24);\n\nconst adet = vec(1152);\nconst bdet = vec(1152);\nconst cdet = vec(1152);\nconst ddet = vec(1152);\nconst edet = vec(1152);\nconst abdet = vec(2304);\nconst cddet = vec(2304);\nconst cdedet = vec(3456);\nconst deter = vec(5760);\n\nconst _8 = vec(8);\nconst _8b = vec(8);\nconst _8c = vec(8);\nconst _16 = vec(16);\nconst _24 = vec(24);\nconst _48 = vec(48);\nconst _48b = vec(48);\nconst _96 = vec(96);\nconst _192 = vec(192);\nconst _384x = vec(384);\nconst _384y = vec(384);\nconst _384z = vec(384);\nconst _768 = vec(768);\n\nfunction sum_three_scale(a, b, c, az, bz, cz, out) {\n return sum_three(\n scale(4, a, az, _8), _8,\n scale(4, b, bz, _8b), _8b,\n scale(4, c, cz, _8c), _8c, _16, out);\n}\n\nfunction liftexact(alen, a, blen, b, clen, c, dlen, d, x, y, z, out) {\n const len = sum(\n sum(alen, a, blen, b, _48), _48,\n negate(sum(clen, c, dlen, d, _48b), _48b), _48b, _96);\n\n return sum_three(\n scale(scale(len, _96, x, _192), _192, x, _384x), _384x,\n scale(scale(len, _96, y, _192), _192, y, _384y), _384y,\n scale(scale(len, _96, z, _192), _192, z, _384z), _384z, _768, out);\n}\n\nfunction insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) {\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;\n\n s1 = ax * by;\n c = splitter * ax;\n ahi = c - (c - ax);\n alo = ax - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bx * ay;\n c = splitter * bx;\n ahi = c - (c - bx);\n alo = bx - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ab[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ab[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ab[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ab[3] = u3;\n s1 = bx * cy;\n c = splitter * bx;\n ahi = c - (c - bx);\n alo = bx - ahi;\n c = splitter * cy;\n bhi = c - (c - cy);\n blo = cy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cx * by;\n c = splitter * cx;\n ahi = c - (c - cx);\n alo = cx - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bc[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bc[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bc[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bc[3] = u3;\n s1 = cx * dy;\n c = splitter * cx;\n ahi = c - (c - cx);\n alo = cx - ahi;\n c = splitter * dy;\n bhi = c - (c - dy);\n blo = dy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = dx * cy;\n c = splitter * dx;\n ahi = c - (c - dx);\n alo = dx - ahi;\n c = splitter * cy;\n bhi = c - (c - cy);\n blo = cy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n cd[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n cd[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n cd[2] = _j - (u3 - bvirt) + (_i - bvirt);\n cd[3] = u3;\n s1 = dx * ey;\n c = splitter * dx;\n ahi = c - (c - dx);\n alo = dx - ahi;\n c = splitter * ey;\n bhi = c - (c - ey);\n blo = ey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = ex * dy;\n c = splitter * ex;\n ahi = c - (c - ex);\n alo = ex - ahi;\n c = splitter * dy;\n bhi = c - (c - dy);\n blo = dy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n de[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n de[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n de[2] = _j - (u3 - bvirt) + (_i - bvirt);\n de[3] = u3;\n s1 = ex * ay;\n c = splitter * ex;\n ahi = c - (c - ex);\n alo = ex - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = ax * ey;\n c = splitter * ax;\n ahi = c - (c - ax);\n alo = ax - ahi;\n c = splitter * ey;\n bhi = c - (c - ey);\n blo = ey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ea[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ea[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ea[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ea[3] = u3;\n s1 = ax * cy;\n c = splitter * ax;\n ahi = c - (c - ax);\n alo = ax - ahi;\n c = splitter * cy;\n bhi = c - (c - cy);\n blo = cy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cx * ay;\n c = splitter * cx;\n ahi = c - (c - cx);\n alo = cx - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ac[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ac[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ac[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ac[3] = u3;\n s1 = bx * dy;\n c = splitter * bx;\n ahi = c - (c - bx);\n alo = bx - ahi;\n c = splitter * dy;\n bhi = c - (c - dy);\n blo = dy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = dx * by;\n c = splitter * dx;\n ahi = c - (c - dx);\n alo = dx - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bd[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bd[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bd[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bd[3] = u3;\n s1 = cx * ey;\n c = splitter * cx;\n ahi = c - (c - cx);\n alo = cx - ahi;\n c = splitter * ey;\n bhi = c - (c - ey);\n blo = ey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = ex * cy;\n c = splitter * ex;\n ahi = c - (c - ex);\n alo = ex - ahi;\n c = splitter * cy;\n bhi = c - (c - cy);\n blo = cy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ce[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ce[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ce[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ce[3] = u3;\n s1 = dx * ay;\n c = splitter * dx;\n ahi = c - (c - dx);\n alo = dx - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = ax * dy;\n c = splitter * ax;\n ahi = c - (c - ax);\n alo = ax - ahi;\n c = splitter * dy;\n bhi = c - (c - dy);\n blo = dy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n da[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n da[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n da[2] = _j - (u3 - bvirt) + (_i - bvirt);\n da[3] = u3;\n s1 = ex * by;\n c = splitter * ex;\n ahi = c - (c - ex);\n alo = ex - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bx * ey;\n c = splitter * bx;\n ahi = c - (c - bx);\n alo = bx - ahi;\n c = splitter * ey;\n bhi = c - (c - ey);\n blo = ey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n eb[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n eb[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n eb[2] = _j - (u3 - bvirt) + (_i - bvirt);\n eb[3] = u3;\n\n const abclen = sum_three_scale(ab, bc, ac, cz, az, -bz, abc);\n const bcdlen = sum_three_scale(bc, cd, bd, dz, bz, -cz, bcd);\n const cdelen = sum_three_scale(cd, de, ce, ez, cz, -dz, cde);\n const dealen = sum_three_scale(de, ea, da, az, dz, -ez, dea);\n const eablen = sum_three_scale(ea, ab, eb, bz, ez, -az, eab);\n const abdlen = sum_three_scale(ab, bd, da, dz, az, bz, abd);\n const bcelen = sum_three_scale(bc, ce, eb, ez, bz, cz, bce);\n const cdalen = sum_three_scale(cd, da, ac, az, cz, dz, cda);\n const deblen = sum_three_scale(de, eb, bd, bz, dz, ez, deb);\n const eaclen = sum_three_scale(ea, ac, ce, cz, ez, az, eac);\n\n const deterlen = sum_three(\n liftexact(cdelen, cde, bcelen, bce, deblen, deb, bcdlen, bcd, ax, ay, az, adet), adet,\n liftexact(dealen, dea, cdalen, cda, eaclen, eac, cdelen, cde, bx, by, bz, bdet), bdet,\n sum_three(\n liftexact(eablen, eab, deblen, deb, abdlen, abd, dealen, dea, cx, cy, cz, cdet), cdet,\n liftexact(abclen, abc, eaclen, eac, bcelen, bce, eablen, eab, dx, dy, dz, ddet), ddet,\n liftexact(bcdlen, bcd, abdlen, abd, cdalen, cda, abclen, abc, ex, ey, ez, edet), edet, cddet, cdedet), cdedet, abdet, deter);\n\n return deter[deterlen - 1];\n}\n\nconst xdet = vec(96);\nconst ydet = vec(96);\nconst zdet = vec(96);\nconst fin = vec(1152);\n\nfunction liftadapt(a, b, c, az, bz, cz, x, y, z, out) {\n const len = sum_three_scale(a, b, c, az, bz, cz, _24);\n return sum_three(\n scale(scale(len, _24, x, _48), _48, x, xdet), xdet,\n scale(scale(len, _24, y, _48), _48, y, ydet), ydet,\n scale(scale(len, _24, z, _48), _48, z, zdet), zdet, _192, out);\n}\n\nfunction insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent) {\n let ab3, bc3, cd3, da3, ac3, bd3;\n\n let aextail, bextail, cextail, dextail;\n let aeytail, beytail, ceytail, deytail;\n let aeztail, beztail, ceztail, deztail;\n\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0;\n\n const aex = ax - ex;\n const bex = bx - ex;\n const cex = cx - ex;\n const dex = dx - ex;\n const aey = ay - ey;\n const bey = by - ey;\n const cey = cy - ey;\n const dey = dy - ey;\n const aez = az - ez;\n const bez = bz - ez;\n const cez = cz - ez;\n const dez = dz - ez;\n\n s1 = aex * bey;\n c = splitter * aex;\n ahi = c - (c - aex);\n alo = aex - ahi;\n c = splitter * bey;\n bhi = c - (c - bey);\n blo = bey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bex * aey;\n c = splitter * bex;\n ahi = c - (c - bex);\n alo = bex - ahi;\n c = splitter * aey;\n bhi = c - (c - aey);\n blo = aey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ab[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ab[1] = _0 - (_i + bvirt) + (bvirt - t1);\n ab3 = _j + _i;\n bvirt = ab3 - _j;\n ab[2] = _j - (ab3 - bvirt) + (_i - bvirt);\n ab[3] = ab3;\n s1 = bex * cey;\n c = splitter * bex;\n ahi = c - (c - bex);\n alo = bex - ahi;\n c = splitter * cey;\n bhi = c - (c - cey);\n blo = cey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cex * bey;\n c = splitter * cex;\n ahi = c - (c - cex);\n alo = cex - ahi;\n c = splitter * bey;\n bhi = c - (c - bey);\n blo = bey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bc[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bc[1] = _0 - (_i + bvirt) + (bvirt - t1);\n bc3 = _j + _i;\n bvirt = bc3 - _j;\n bc[2] = _j - (bc3 - bvirt) + (_i - bvirt);\n bc[3] = bc3;\n s1 = cex * dey;\n c = splitter * cex;\n ahi = c - (c - cex);\n alo = cex - ahi;\n c = splitter * dey;\n bhi = c - (c - dey);\n blo = dey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = dex * cey;\n c = splitter * dex;\n ahi = c - (c - dex);\n alo = dex - ahi;\n c = splitter * cey;\n bhi = c - (c - cey);\n blo = cey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n cd[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n cd[1] = _0 - (_i + bvirt) + (bvirt - t1);\n cd3 = _j + _i;\n bvirt = cd3 - _j;\n cd[2] = _j - (cd3 - bvirt) + (_i - bvirt);\n cd[3] = cd3;\n s1 = dex * aey;\n c = splitter * dex;\n ahi = c - (c - dex);\n alo = dex - ahi;\n c = splitter * aey;\n bhi = c - (c - aey);\n blo = aey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = aex * dey;\n c = splitter * aex;\n ahi = c - (c - aex);\n alo = aex - ahi;\n c = splitter * dey;\n bhi = c - (c - dey);\n blo = dey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n da[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n da[1] = _0 - (_i + bvirt) + (bvirt - t1);\n da3 = _j + _i;\n bvirt = da3 - _j;\n da[2] = _j - (da3 - bvirt) + (_i - bvirt);\n da[3] = da3;\n s1 = aex * cey;\n c = splitter * aex;\n ahi = c - (c - aex);\n alo = aex - ahi;\n c = splitter * cey;\n bhi = c - (c - cey);\n blo = cey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cex * aey;\n c = splitter * cex;\n ahi = c - (c - cex);\n alo = cex - ahi;\n c = splitter * aey;\n bhi = c - (c - aey);\n blo = aey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ac[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ac[1] = _0 - (_i + bvirt) + (bvirt - t1);\n ac3 = _j + _i;\n bvirt = ac3 - _j;\n ac[2] = _j - (ac3 - bvirt) + (_i - bvirt);\n ac[3] = ac3;\n s1 = bex * dey;\n c = splitter * bex;\n ahi = c - (c - bex);\n alo = bex - ahi;\n c = splitter * dey;\n bhi = c - (c - dey);\n blo = dey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = dex * bey;\n c = splitter * dex;\n ahi = c - (c - dex);\n alo = dex - ahi;\n c = splitter * bey;\n bhi = c - (c - bey);\n blo = bey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bd[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bd[1] = _0 - (_i + bvirt) + (bvirt - t1);\n bd3 = _j + _i;\n bvirt = bd3 - _j;\n bd[2] = _j - (bd3 - bvirt) + (_i - bvirt);\n bd[3] = bd3;\n\n const finlen = sum(\n sum(\n negate(liftadapt(bc, cd, bd, dez, bez, -cez, aex, aey, aez, adet), adet), adet,\n liftadapt(cd, da, ac, aez, cez, dez, bex, bey, bez, bdet), bdet, abdet), abdet,\n sum(\n negate(liftadapt(da, ab, bd, bez, dez, aez, cex, cey, cez, cdet), cdet), cdet,\n liftadapt(ab, bc, ac, cez, aez, -bez, dex, dey, dez, ddet), ddet, cddet), cddet, fin);\n\n let det = estimate(finlen, fin);\n let errbound = isperrboundB * permanent;\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n bvirt = ax - aex;\n aextail = ax - (aex + bvirt) + (bvirt - ex);\n bvirt = ay - aey;\n aeytail = ay - (aey + bvirt) + (bvirt - ey);\n bvirt = az - aez;\n aeztail = az - (aez + bvirt) + (bvirt - ez);\n bvirt = bx - bex;\n bextail = bx - (bex + bvirt) + (bvirt - ex);\n bvirt = by - bey;\n beytail = by - (bey + bvirt) + (bvirt - ey);\n bvirt = bz - bez;\n beztail = bz - (bez + bvirt) + (bvirt - ez);\n bvirt = cx - cex;\n cextail = cx - (cex + bvirt) + (bvirt - ex);\n bvirt = cy - cey;\n ceytail = cy - (cey + bvirt) + (bvirt - ey);\n bvirt = cz - cez;\n ceztail = cz - (cez + bvirt) + (bvirt - ez);\n bvirt = dx - dex;\n dextail = dx - (dex + bvirt) + (bvirt - ex);\n bvirt = dy - dey;\n deytail = dy - (dey + bvirt) + (bvirt - ey);\n bvirt = dz - dez;\n deztail = dz - (dez + bvirt) + (bvirt - ez);\n if (aextail === 0 && aeytail === 0 && aeztail === 0 &&\n bextail === 0 && beytail === 0 && beztail === 0 &&\n cextail === 0 && ceytail === 0 && ceztail === 0 &&\n dextail === 0 && deytail === 0 && deztail === 0) {\n return det;\n }\n\n errbound = isperrboundC * permanent + resulterrbound * Math.abs(det);\n\n const abeps = (aex * beytail + bey * aextail) - (aey * bextail + bex * aeytail);\n const bceps = (bex * ceytail + cey * bextail) - (bey * cextail + cex * beytail);\n const cdeps = (cex * deytail + dey * cextail) - (cey * dextail + dex * ceytail);\n const daeps = (dex * aeytail + aey * dextail) - (dey * aextail + aex * deytail);\n const aceps = (aex * ceytail + cey * aextail) - (aey * cextail + cex * aeytail);\n const bdeps = (bex * deytail + dey * bextail) - (bey * dextail + dex * beytail);\n det +=\n (((bex * bex + bey * bey + bez * bez) * ((cez * daeps + dez * aceps + aez * cdeps) +\n (ceztail * da3 + deztail * ac3 + aeztail * cd3)) + (dex * dex + dey * dey + dez * dez) *\n ((aez * bceps - bez * aceps + cez * abeps) + (aeztail * bc3 - beztail * ac3 + ceztail * ab3))) -\n ((aex * aex + aey * aey + aez * aez) * ((bez * cdeps - cez * bdeps + dez * bceps) +\n (beztail * cd3 - ceztail * bd3 + deztail * bc3)) + (cex * cex + cey * cey + cez * cez) *\n ((dez * abeps + aez * bdeps + bez * daeps) + (deztail * ab3 + aeztail * bd3 + beztail * da3)))) +\n 2 * (((bex * bextail + bey * beytail + bez * beztail) * (cez * da3 + dez * ac3 + aez * cd3) +\n (dex * dextail + dey * deytail + dez * deztail) * (aez * bc3 - bez * ac3 + cez * ab3)) -\n ((aex * aextail + aey * aeytail + aez * aeztail) * (bez * cd3 - cez * bd3 + dez * bc3) +\n (cex * cextail + cey * ceytail + cez * ceztail) * (dez * ab3 + aez * bd3 + bez * da3)));\n\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n return insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez);\n}\n\nexport function insphere(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) {\n const aex = ax - ex;\n const bex = bx - ex;\n const cex = cx - ex;\n const dex = dx - ex;\n const aey = ay - ey;\n const bey = by - ey;\n const cey = cy - ey;\n const dey = dy - ey;\n const aez = az - ez;\n const bez = bz - ez;\n const cez = cz - ez;\n const dez = dz - ez;\n\n const aexbey = aex * bey;\n const bexaey = bex * aey;\n const ab = aexbey - bexaey;\n const bexcey = bex * cey;\n const cexbey = cex * bey;\n const bc = bexcey - cexbey;\n const cexdey = cex * dey;\n const dexcey = dex * cey;\n const cd = cexdey - dexcey;\n const dexaey = dex * aey;\n const aexdey = aex * dey;\n const da = dexaey - aexdey;\n const aexcey = aex * cey;\n const cexaey = cex * aey;\n const ac = aexcey - cexaey;\n const bexdey = bex * dey;\n const dexbey = dex * bey;\n const bd = bexdey - dexbey;\n\n const alift = aex * aex + aey * aey + aez * aez;\n const blift = bex * bex + bey * bey + bez * bez;\n const clift = cex * cex + cey * cey + cez * cez;\n const dlift = dex * dex + dey * dey + dez * dez;\n\n const det =\n (clift * (dez * ab + aez * bd + bez * da) - dlift * (aez * bc - bez * ac + cez * ab)) +\n (alift * (bez * cd - cez * bd + dez * bc) - blift * (cez * da + dez * ac + aez * cd));\n\n const aezplus = Math.abs(aez);\n const bezplus = Math.abs(bez);\n const cezplus = Math.abs(cez);\n const dezplus = Math.abs(dez);\n const aexbeyplus = Math.abs(aexbey) + Math.abs(bexaey);\n const bexceyplus = Math.abs(bexcey) + Math.abs(cexbey);\n const cexdeyplus = Math.abs(cexdey) + Math.abs(dexcey);\n const dexaeyplus = Math.abs(dexaey) + Math.abs(aexdey);\n const aexceyplus = Math.abs(aexcey) + Math.abs(cexaey);\n const bexdeyplus = Math.abs(bexdey) + Math.abs(dexbey);\n const permanent =\n (cexdeyplus * bezplus + bexdeyplus * cezplus + bexceyplus * dezplus) * alift +\n (dexaeyplus * cezplus + aexceyplus * dezplus + cexdeyplus * aezplus) * blift +\n (aexbeyplus * dezplus + bexdeyplus * aezplus + dexaeyplus * bezplus) * clift +\n (bexceyplus * aezplus + aexceyplus * bezplus + aexbeyplus * cezplus) * dlift;\n\n const errbound = isperrboundA * permanent;\n if (det > errbound || -det > errbound) {\n return det;\n }\n return -insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent);\n}\n\nexport function inspherefast(pax, pay, paz, pbx, pby, pbz, pcx, pcy, pcz, pdx, pdy, pdz, pex, pey, pez) {\n const aex = pax - pex;\n const bex = pbx - pex;\n const cex = pcx - pex;\n const dex = pdx - pex;\n const aey = pay - pey;\n const bey = pby - pey;\n const cey = pcy - pey;\n const dey = pdy - pey;\n const aez = paz - pez;\n const bez = pbz - pez;\n const cez = pcz - pez;\n const dez = pdz - pez;\n\n const ab = aex * bey - bex * aey;\n const bc = bex * cey - cex * bey;\n const cd = cex * dey - dex * cey;\n const da = dex * aey - aex * dey;\n const ac = aex * cey - cex * aey;\n const bd = bex * dey - dex * bey;\n\n const abc = aez * bc - bez * ac + cez * ab;\n const bcd = bez * cd - cez * bd + dez * bc;\n const cda = cez * da + dez * ac + aez * cd;\n const dab = dez * ab + aez * bd + bez * da;\n\n const alift = aex * aex + aey * aey + aez * aez;\n const blift = bex * bex + bey * bey + bez * bez;\n const clift = cex * cex + cey * cey + cez * cez;\n const dlift = dex * dex + dey * dey + dez * dez;\n\n return (clift * dab - dlift * abc) + (alift * bcd - blift * cda);\n}\n","\nconst EPSILON = Math.pow(2, -52);\nconst EDGE_STACK = new Uint32Array(512);\n\nimport {orient2d} from 'robust-predicates';\n\nexport default class Delaunator {\n\n static from(points, getX = defaultGetX, getY = defaultGetY) {\n const n = points.length;\n const coords = new Float64Array(n * 2);\n\n for (let i = 0; i < n; i++) {\n const p = points[i];\n coords[2 * i] = getX(p);\n coords[2 * i + 1] = getY(p);\n }\n\n return new Delaunator(coords);\n }\n\n constructor(coords) {\n const n = coords.length >> 1;\n if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.');\n\n this.coords = coords;\n\n // arrays that will store the triangulation graph\n const maxTriangles = Math.max(2 * n - 5, 0);\n this._triangles = new Uint32Array(maxTriangles * 3);\n this._halfedges = new Int32Array(maxTriangles * 3);\n\n // temporary arrays for tracking the edges of the advancing convex hull\n this._hashSize = Math.ceil(Math.sqrt(n));\n this._hullPrev = new Uint32Array(n); // edge to prev edge\n this._hullNext = new Uint32Array(n); // edge to next edge\n this._hullTri = new Uint32Array(n); // edge to adjacent triangle\n this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash\n\n // temporary arrays for sorting points\n this._ids = new Uint32Array(n);\n this._dists = new Float64Array(n);\n\n this.update();\n }\n\n update() {\n const {coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash} = this;\n const n = coords.length >> 1;\n\n // populate an array of point indices; calculate input data bbox\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n for (let i = 0; i < n; i++) {\n const x = coords[2 * i];\n const y = coords[2 * i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n this._ids[i] = i;\n }\n const cx = (minX + maxX) / 2;\n const cy = (minY + maxY) / 2;\n\n let minDist = Infinity;\n let i0, i1, i2;\n\n // pick a seed point close to the center\n for (let i = 0; i < n; i++) {\n const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]);\n if (d < minDist) {\n i0 = i;\n minDist = d;\n }\n }\n const i0x = coords[2 * i0];\n const i0y = coords[2 * i0 + 1];\n\n minDist = Infinity;\n\n // find the point closest to the seed\n for (let i = 0; i < n; i++) {\n if (i === i0) continue;\n const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]);\n if (d < minDist && d > 0) {\n i1 = i;\n minDist = d;\n }\n }\n let i1x = coords[2 * i1];\n let i1y = coords[2 * i1 + 1];\n\n let minRadius = Infinity;\n\n // find the third point which forms the smallest circumcircle with the first two\n for (let i = 0; i < n; i++) {\n if (i === i0 || i === i1) continue;\n const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]);\n if (r < minRadius) {\n i2 = i;\n minRadius = r;\n }\n }\n let i2x = coords[2 * i2];\n let i2y = coords[2 * i2 + 1];\n\n if (minRadius === Infinity) {\n // order collinear points by dx (or dy if all x are identical)\n // and return the list as a hull\n for (let i = 0; i < n; i++) {\n this._dists[i] = (coords[2 * i] - coords[0]) || (coords[2 * i + 1] - coords[1]);\n }\n quicksort(this._ids, this._dists, 0, n - 1);\n const hull = new Uint32Array(n);\n let j = 0;\n for (let i = 0, d0 = -Infinity; i < n; i++) {\n const id = this._ids[i];\n if (this._dists[id] > d0) {\n hull[j++] = id;\n d0 = this._dists[id];\n }\n }\n this.hull = hull.subarray(0, j);\n this.triangles = new Uint32Array(0);\n this.halfedges = new Uint32Array(0);\n return;\n }\n\n // swap the order of the seed points for counter-clockwise orientation\n if (orient2d(i0x, i0y, i1x, i1y, i2x, i2y) < 0) {\n const i = i1;\n const x = i1x;\n const y = i1y;\n i1 = i2;\n i1x = i2x;\n i1y = i2y;\n i2 = i;\n i2x = x;\n i2y = y;\n }\n\n const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y);\n this._cx = center.x;\n this._cy = center.y;\n\n for (let i = 0; i < n; i++) {\n this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y);\n }\n\n // sort the points by distance from the seed triangle circumcenter\n quicksort(this._ids, this._dists, 0, n - 1);\n\n // set up the seed triangle as the starting hull\n this._hullStart = i0;\n let hullSize = 3;\n\n hullNext[i0] = hullPrev[i2] = i1;\n hullNext[i1] = hullPrev[i0] = i2;\n hullNext[i2] = hullPrev[i1] = i0;\n\n hullTri[i0] = 0;\n hullTri[i1] = 1;\n hullTri[i2] = 2;\n\n hullHash.fill(-1);\n hullHash[this._hashKey(i0x, i0y)] = i0;\n hullHash[this._hashKey(i1x, i1y)] = i1;\n hullHash[this._hashKey(i2x, i2y)] = i2;\n\n this.trianglesLen = 0;\n this._addTriangle(i0, i1, i2, -1, -1, -1);\n\n for (let k = 0, xp, yp; k < this._ids.length; k++) {\n const i = this._ids[k];\n const x = coords[2 * i];\n const y = coords[2 * i + 1];\n\n // skip near-duplicate points\n if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) continue;\n xp = x;\n yp = y;\n\n // skip seed triangle points\n if (i === i0 || i === i1 || i === i2) continue;\n\n // find a visible edge on the convex hull using edge hash\n let start = 0;\n for (let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++) {\n start = hullHash[(key + j) % this._hashSize];\n if (start !== -1 && start !== hullNext[start]) break;\n }\n\n start = hullPrev[start];\n let e = start, q;\n while (q = hullNext[e], orient2d(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0) {\n e = q;\n if (e === start) {\n e = -1;\n break;\n }\n }\n if (e === -1) continue; // likely a near-duplicate point; skip it\n\n // add the first triangle from the point\n let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]);\n\n // recursively flip triangles from the point until they satisfy the Delaunay condition\n hullTri[i] = this._legalize(t + 2);\n hullTri[e] = t; // keep track of boundary triangles on the hull\n hullSize++;\n\n // walk forward through the hull, adding more triangles and flipping recursively\n let n = hullNext[e];\n while (q = hullNext[n], orient2d(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1]) < 0) {\n t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]);\n hullTri[i] = this._legalize(t + 2);\n hullNext[n] = n; // mark as removed\n hullSize--;\n n = q;\n }\n\n // walk backward from the other side, adding more triangles and flipping\n if (e === start) {\n while (q = hullPrev[e], orient2d(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0) {\n t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]);\n this._legalize(t + 2);\n hullTri[q] = t;\n hullNext[e] = e; // mark as removed\n hullSize--;\n e = q;\n }\n }\n\n // update the hull indices\n this._hullStart = hullPrev[i] = e;\n hullNext[e] = hullPrev[n] = i;\n hullNext[i] = n;\n\n // save the two new edges in the hash table\n hullHash[this._hashKey(x, y)] = i;\n hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e;\n }\n\n this.hull = new Uint32Array(hullSize);\n for (let i = 0, e = this._hullStart; i < hullSize; i++) {\n this.hull[i] = e;\n e = hullNext[e];\n }\n\n // trim typed triangle mesh arrays\n this.triangles = this._triangles.subarray(0, this.trianglesLen);\n this.halfedges = this._halfedges.subarray(0, this.trianglesLen);\n }\n\n _hashKey(x, y) {\n return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize;\n }\n\n _legalize(a) {\n const {_triangles: triangles, _halfedges: halfedges, coords} = this;\n\n let i = 0;\n let ar = 0;\n\n // recursion eliminated with a fixed-size stack\n while (true) {\n const b = halfedges[a];\n\n /* if the pair of triangles doesn't satisfy the Delaunay condition\n * (p1 is inside the circumcircle of [p0, pl, pr]), flip them,\n * then do the same check/flip recursively for the new pair of triangles\n *\n * pl pl\n * /||\\ / \\\n * al/ || \\bl al/ \\a\n * / || \\ / \\\n * / a||b \\ flip /___ar___\\\n * p0\\ || /p1 => p0\\---bl---/p1\n * \\ || / \\ /\n * ar\\ || /br b\\ /br\n * \\||/ \\ /\n * pr pr\n */\n const a0 = a - a % 3;\n ar = a0 + (a + 2) % 3;\n\n if (b === -1) { // convex hull edge\n if (i === 0) break;\n a = EDGE_STACK[--i];\n continue;\n }\n\n const b0 = b - b % 3;\n const al = a0 + (a + 1) % 3;\n const bl = b0 + (b + 2) % 3;\n\n const p0 = triangles[ar];\n const pr = triangles[a];\n const pl = triangles[al];\n const p1 = triangles[bl];\n\n const illegal = inCircle(\n coords[2 * p0], coords[2 * p0 + 1],\n coords[2 * pr], coords[2 * pr + 1],\n coords[2 * pl], coords[2 * pl + 1],\n coords[2 * p1], coords[2 * p1 + 1]);\n\n if (illegal) {\n triangles[a] = p1;\n triangles[b] = p0;\n\n const hbl = halfedges[bl];\n\n // edge swapped on the other side of the hull (rare); fix the halfedge reference\n if (hbl === -1) {\n let e = this._hullStart;\n do {\n if (this._hullTri[e] === bl) {\n this._hullTri[e] = a;\n break;\n }\n e = this._hullPrev[e];\n } while (e !== this._hullStart);\n }\n this._link(a, hbl);\n this._link(b, halfedges[ar]);\n this._link(ar, bl);\n\n const br = b0 + (b + 1) % 3;\n\n // don't worry about hitting the cap: it can only happen on extremely degenerate input\n if (i < EDGE_STACK.length) {\n EDGE_STACK[i++] = br;\n }\n } else {\n if (i === 0) break;\n a = EDGE_STACK[--i];\n }\n }\n\n return ar;\n }\n\n _link(a, b) {\n this._halfedges[a] = b;\n if (b !== -1) this._halfedges[b] = a;\n }\n\n // add a new triangle given vertex indices and adjacent half-edge ids\n _addTriangle(i0, i1, i2, a, b, c) {\n const t = this.trianglesLen;\n\n this._triangles[t] = i0;\n this._triangles[t + 1] = i1;\n this._triangles[t + 2] = i2;\n\n this._link(t, a);\n this._link(t + 1, b);\n this._link(t + 2, c);\n\n this.trianglesLen += 3;\n\n return t;\n }\n}\n\n// monotonically increases with real angle, but doesn't need expensive trigonometry\nfunction pseudoAngle(dx, dy) {\n const p = dx / (Math.abs(dx) + Math.abs(dy));\n return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1]\n}\n\nfunction dist(ax, ay, bx, by) {\n const dx = ax - bx;\n const dy = ay - by;\n return dx * dx + dy * dy;\n}\n\nfunction inCircle(ax, ay, bx, by, cx, cy, px, py) {\n const dx = ax - px;\n const dy = ay - py;\n const ex = bx - px;\n const ey = by - py;\n const fx = cx - px;\n const fy = cy - py;\n\n const ap = dx * dx + dy * dy;\n const bp = ex * ex + ey * ey;\n const cp = fx * fx + fy * fy;\n\n return dx * (ey * cp - bp * fy) -\n dy * (ex * cp - bp * fx) +\n ap * (ex * fy - ey * fx) < 0;\n}\n\nfunction circumradius(ax, ay, bx, by, cx, cy) {\n const dx = bx - ax;\n const dy = by - ay;\n const ex = cx - ax;\n const ey = cy - ay;\n\n const bl = dx * dx + dy * dy;\n const cl = ex * ex + ey * ey;\n const d = 0.5 / (dx * ey - dy * ex);\n\n const x = (ey * bl - dy * cl) * d;\n const y = (dx * cl - ex * bl) * d;\n\n return x * x + y * y;\n}\n\nfunction circumcenter(ax, ay, bx, by, cx, cy) {\n const dx = bx - ax;\n const dy = by - ay;\n const ex = cx - ax;\n const ey = cy - ay;\n\n const bl = dx * dx + dy * dy;\n const cl = ex * ex + ey * ey;\n const d = 0.5 / (dx * ey - dy * ex);\n\n const x = ax + (ey * bl - dy * cl) * d;\n const y = ay + (dx * cl - ex * bl) * d;\n\n return {x, y};\n}\n\nfunction quicksort(ids, dists, left, right) {\n if (right - left <= 20) {\n for (let i = left + 1; i <= right; i++) {\n const temp = ids[i];\n const tempDist = dists[temp];\n let j = i - 1;\n while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--];\n ids[j + 1] = temp;\n }\n } else {\n const median = (left + right) >> 1;\n let i = left + 1;\n let j = right;\n swap(ids, median, i);\n if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right);\n if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right);\n if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i);\n\n const temp = ids[i];\n const tempDist = dists[temp];\n while (true) {\n do i++; while (dists[ids[i]] < tempDist);\n do j--; while (dists[ids[j]] > tempDist);\n if (j < i) break;\n swap(ids, i, j);\n }\n ids[left + 1] = ids[j];\n ids[j] = temp;\n\n if (right - i + 1 >= j - left) {\n quicksort(ids, dists, i, right);\n quicksort(ids, dists, left, j - 1);\n } else {\n quicksort(ids, dists, left, j - 1);\n quicksort(ids, dists, i, right);\n }\n }\n}\n\nfunction swap(arr, i, j) {\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n\nfunction defaultGetX(p) {\n return p[0];\n}\nfunction defaultGetY(p) {\n return p[1];\n}\n","const epsilon = 1e-6;\n\nexport default class Path {\n constructor() {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n }\n moveTo(x, y) {\n this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._ += \"Z\";\n }\n }\n lineTo(x, y) {\n this._ += `L${this._x1 = +x},${this._y1 = +y}`;\n }\n arc(x, y, r) {\n x = +x, y = +y, r = +r;\n const x0 = x + r;\n const y0 = y;\n if (r < 0) throw new Error(\"negative radius\");\n if (this._x1 === null) this._ += `M${x0},${y0}`;\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += \"L\" + x0 + \",\" + y0;\n if (!r) return;\n this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`;\n }\n rect(x, y, w, h) {\n this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`;\n }\n value() {\n return this._ || null;\n }\n}\n","export default class Polygon {\n constructor() {\n this._ = [];\n }\n moveTo(x, y) {\n this._.push([x, y]);\n }\n closePath() {\n this._.push(this._[0].slice());\n }\n lineTo(x, y) {\n this._.push([x, y]);\n }\n value() {\n return this._.length ? this._ : null;\n }\n}\n","import Path from \"./path.js\";\nimport Polygon from \"./polygon.js\";\n\nexport default class Voronoi {\n constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) {\n if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error(\"invalid bounds\");\n this.delaunay = delaunay;\n this._circumcenters = new Float64Array(delaunay.points.length * 2);\n this.vectors = new Float64Array(delaunay.points.length * 2);\n this.xmax = xmax, this.xmin = xmin;\n this.ymax = ymax, this.ymin = ymin;\n this._init();\n }\n update() {\n this.delaunay.update();\n this._init();\n return this;\n }\n _init() {\n const {delaunay: {points, hull, triangles}, vectors} = this;\n let bx, by; // lazily computed barycenter of the hull\n\n // Compute circumcenters.\n const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2);\n for (let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2) {\n const t1 = triangles[i] * 2;\n const t2 = triangles[i + 1] * 2;\n const t3 = triangles[i + 2] * 2;\n const x1 = points[t1];\n const y1 = points[t1 + 1];\n const x2 = points[t2];\n const y2 = points[t2 + 1];\n const x3 = points[t3];\n const y3 = points[t3 + 1];\n\n const dx = x2 - x1;\n const dy = y2 - y1;\n const ex = x3 - x1;\n const ey = y3 - y1;\n const ab = (dx * ey - dy * ex) * 2;\n\n if (Math.abs(ab) < 1e-9) {\n // For a degenerate triangle, the circumcenter is at the infinity, in a\n // direction orthogonal to the halfedge and away from the “center” of\n // the diagram , defined as the hull’s barycenter.\n if (bx === undefined) {\n bx = by = 0;\n for (const i of hull) bx += points[i * 2], by += points[i * 2 + 1];\n bx /= hull.length, by /= hull.length;\n }\n const a = 1e9 * Math.sign((bx - x1) * ey - (by - y1) * ex);\n x = (x1 + x3) / 2 - a * ey;\n y = (y1 + y3) / 2 + a * ex;\n } else {\n const d = 1 / ab;\n const bl = dx * dx + dy * dy;\n const cl = ex * ex + ey * ey;\n x = x1 + (ey * bl - dy * cl) * d;\n y = y1 + (dx * cl - ex * bl) * d;\n }\n circumcenters[j] = x;\n circumcenters[j + 1] = y;\n }\n\n // Compute exterior cell rays.\n let h = hull[hull.length - 1];\n let p0, p1 = h * 4;\n let x0, x1 = points[2 * h];\n let y0, y1 = points[2 * h + 1];\n vectors.fill(0);\n for (let i = 0; i < hull.length; ++i) {\n h = hull[i];\n p0 = p1, x0 = x1, y0 = y1;\n p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1];\n vectors[p0 + 2] = vectors[p1] = y0 - y1;\n vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0;\n }\n }\n render(context) {\n const buffer = context == null ? context = new Path : undefined;\n const {delaunay: {halfedges, inedges, hull}, circumcenters, vectors} = this;\n if (hull.length <= 1) return null;\n for (let i = 0, n = halfedges.length; i < n; ++i) {\n const j = halfedges[i];\n if (j < i) continue;\n const ti = Math.floor(i / 3) * 2;\n const tj = Math.floor(j / 3) * 2;\n const xi = circumcenters[ti];\n const yi = circumcenters[ti + 1];\n const xj = circumcenters[tj];\n const yj = circumcenters[tj + 1];\n this._renderSegment(xi, yi, xj, yj, context);\n }\n let h0, h1 = hull[hull.length - 1];\n for (let i = 0; i < hull.length; ++i) {\n h0 = h1, h1 = hull[i];\n const t = Math.floor(inedges[h1] / 3) * 2;\n const x = circumcenters[t];\n const y = circumcenters[t + 1];\n const v = h0 * 4;\n const p = this._project(x, y, vectors[v + 2], vectors[v + 3]);\n if (p) this._renderSegment(x, y, p[0], p[1], context);\n }\n return buffer && buffer.value();\n }\n renderBounds(context) {\n const buffer = context == null ? context = new Path : undefined;\n context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin);\n return buffer && buffer.value();\n }\n renderCell(i, context) {\n const buffer = context == null ? context = new Path : undefined;\n const points = this._clip(i);\n if (points === null || !points.length) return;\n context.moveTo(points[0], points[1]);\n let n = points.length;\n while (points[0] === points[n-2] && points[1] === points[n-1] && n > 1) n -= 2;\n for (let i = 2; i < n; i += 2) {\n if (points[i] !== points[i-2] || points[i+1] !== points[i-1])\n context.lineTo(points[i], points[i + 1]);\n }\n context.closePath();\n return buffer && buffer.value();\n }\n *cellPolygons() {\n const {delaunay: {points}} = this;\n for (let i = 0, n = points.length / 2; i < n; ++i) {\n const cell = this.cellPolygon(i);\n if (cell) cell.index = i, yield cell;\n }\n }\n cellPolygon(i) {\n const polygon = new Polygon;\n this.renderCell(i, polygon);\n return polygon.value();\n }\n _renderSegment(x0, y0, x1, y1, context) {\n let S;\n const c0 = this._regioncode(x0, y0);\n const c1 = this._regioncode(x1, y1);\n if (c0 === 0 && c1 === 0) {\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) {\n context.moveTo(S[0], S[1]);\n context.lineTo(S[2], S[3]);\n }\n }\n contains(i, x, y) {\n if ((x = +x, x !== x) || (y = +y, y !== y)) return false;\n return this.delaunay._step(i, x, y) === i;\n }\n *neighbors(i) {\n const ci = this._clip(i);\n if (ci) for (const j of this.delaunay.neighbors(i)) {\n const cj = this._clip(j);\n // find the common edge\n if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) {\n for (let aj = 0, lj = cj.length; aj < lj; aj += 2) {\n if (ci[ai] === cj[aj]\n && ci[ai + 1] === cj[aj + 1]\n && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj]\n && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) {\n yield j;\n break loop;\n }\n }\n }\n }\n }\n _cell(i) {\n const {circumcenters, delaunay: {inedges, halfedges, triangles}} = this;\n const e0 = inedges[i];\n if (e0 === -1) return null; // coincident point\n const points = [];\n let e = e0;\n do {\n const t = Math.floor(e / 3);\n points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]);\n e = e % 3 === 2 ? e - 2 : e + 1;\n if (triangles[e] !== i) break; // bad triangulation\n e = halfedges[e];\n } while (e !== e0 && e !== -1);\n return points;\n }\n _clip(i) {\n // degenerate case (1 valid point: return the box)\n if (i === 0 && this.delaunay.hull.length === 1) {\n return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];\n }\n const points = this._cell(i);\n if (points === null) return null;\n const {vectors: V} = this;\n const v = i * 4;\n return this._simplify(V[v] || V[v + 1]\n ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3])\n : this._clipFinite(i, points));\n }\n _clipFinite(i, points) {\n const n = points.length;\n let P = null;\n let x0, y0, x1 = points[n - 2], y1 = points[n - 1];\n let c0, c1 = this._regioncode(x1, y1);\n let e0, e1 = 0;\n for (let j = 0; j < n; j += 2) {\n x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1];\n c0 = c1, c1 = this._regioncode(x1, y1);\n if (c0 === 0 && c1 === 0) {\n e0 = e1, e1 = 0;\n if (P) P.push(x1, y1);\n else P = [x1, y1];\n } else {\n let S, sx0, sy0, sx1, sy1;\n if (c0 === 0) {\n if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue;\n [sx0, sy0, sx1, sy1] = S;\n } else {\n if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue;\n [sx1, sy1, sx0, sy0] = S;\n e0 = e1, e1 = this._edgecode(sx0, sy0);\n if (e0 && e1) this._edge(i, e0, e1, P, P.length);\n if (P) P.push(sx0, sy0);\n else P = [sx0, sy0];\n }\n e0 = e1, e1 = this._edgecode(sx1, sy1);\n if (e0 && e1) this._edge(i, e0, e1, P, P.length);\n if (P) P.push(sx1, sy1);\n else P = [sx1, sy1];\n }\n }\n if (P) {\n e0 = e1, e1 = this._edgecode(P[0], P[1]);\n if (e0 && e1) this._edge(i, e0, e1, P, P.length);\n } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) {\n return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];\n }\n return P;\n }\n _clipSegment(x0, y0, x1, y1, c0, c1) {\n // for more robustness, always consider the segment in the same order\n const flip = c0 < c1;\n if (flip) [x0, y0, x1, y1, c0, c1] = [x1, y1, x0, y0, c1, c0];\n while (true) {\n if (c0 === 0 && c1 === 0) return flip ? [x1, y1, x0, y0] : [x0, y0, x1, y1];\n if (c0 & c1) return null;\n let x, y, c = c0 || c1;\n if (c & 0b1000) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax;\n else if (c & 0b0100) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin;\n else if (c & 0b0010) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax;\n else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin;\n if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0);\n else x1 = x, y1 = y, c1 = this._regioncode(x1, y1);\n }\n }\n _clipInfinite(i, points, vx0, vy0, vxn, vyn) {\n let P = Array.from(points), p;\n if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]);\n if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]);\n if (P = this._clipFinite(i, P)) {\n for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) {\n c0 = c1, c1 = this._edgecode(P[j], P[j + 1]);\n if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length;\n }\n } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) {\n P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax];\n }\n return P;\n }\n _edge(i, e0, e1, P, j) {\n while (e0 !== e1) {\n let x, y;\n switch (e0) {\n case 0b0101: e0 = 0b0100; continue; // top-left\n case 0b0100: e0 = 0b0110, x = this.xmax, y = this.ymin; break; // top\n case 0b0110: e0 = 0b0010; continue; // top-right\n case 0b0010: e0 = 0b1010, x = this.xmax, y = this.ymax; break; // right\n case 0b1010: e0 = 0b1000; continue; // bottom-right\n case 0b1000: e0 = 0b1001, x = this.xmin, y = this.ymax; break; // bottom\n case 0b1001: e0 = 0b0001; continue; // bottom-left\n case 0b0001: e0 = 0b0101, x = this.xmin, y = this.ymin; break; // left\n }\n // Note: this implicitly checks for out of bounds: if P[j] or P[j+1] are\n // undefined, the conditional statement will be executed.\n if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) {\n P.splice(j, 0, x, y), j += 2;\n }\n }\n return j;\n }\n _project(x0, y0, vx, vy) {\n let t = Infinity, c, x, y;\n if (vy < 0) { // top\n if (y0 <= this.ymin) return null;\n if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx;\n } else if (vy > 0) { // bottom\n if (y0 >= this.ymax) return null;\n if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx;\n }\n if (vx > 0) { // right\n if (x0 >= this.xmax) return null;\n if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy;\n } else if (vx < 0) { // left\n if (x0 <= this.xmin) return null;\n if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy;\n }\n return [x, y];\n }\n _edgecode(x, y) {\n return (x === this.xmin ? 0b0001\n : x === this.xmax ? 0b0010 : 0b0000)\n | (y === this.ymin ? 0b0100\n : y === this.ymax ? 0b1000 : 0b0000);\n }\n _regioncode(x, y) {\n return (x < this.xmin ? 0b0001\n : x > this.xmax ? 0b0010 : 0b0000)\n | (y < this.ymin ? 0b0100\n : y > this.ymax ? 0b1000 : 0b0000);\n }\n _simplify(P) {\n if (P && P.length > 4) {\n for (let i = 0; i < P.length; i+= 2) {\n const j = (i + 2) % P.length, k = (i + 4) % P.length;\n if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) {\n P.splice(j, 2), i -= 2;\n }\n }\n if (!P.length) P = null;\n }\n return P;\n }\n}\n","import Delaunator from \"delaunator\";\nimport Path from \"./path.js\";\nimport Polygon from \"./polygon.js\";\nimport Voronoi from \"./voronoi.js\";\n\nconst tau = 2 * Math.PI, pow = Math.pow;\n\nfunction pointX(p) {\n return p[0];\n}\n\nfunction pointY(p) {\n return p[1];\n}\n\n// A triangulation is collinear if all its triangles have a non-null area\nfunction collinear(d) {\n const {triangles, coords} = d;\n for (let i = 0; i < triangles.length; i += 3) {\n const a = 2 * triangles[i],\n b = 2 * triangles[i + 1],\n c = 2 * triangles[i + 2],\n cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1])\n - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]);\n if (cross > 1e-10) return false;\n }\n return true;\n}\n\nfunction jitter(x, y, r) {\n return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r];\n}\n\nexport default class Delaunay {\n static from(points, fx = pointX, fy = pointY, that) {\n return new Delaunay(\"length\" in points\n ? flatArray(points, fx, fy, that)\n : Float64Array.from(flatIterable(points, fx, fy, that)));\n }\n constructor(points) {\n this._delaunator = new Delaunator(points);\n this.inedges = new Int32Array(points.length / 2);\n this._hullIndex = new Int32Array(points.length / 2);\n this.points = this._delaunator.coords;\n this._init();\n }\n update() {\n this._delaunator.update();\n this._init();\n return this;\n }\n _init() {\n const d = this._delaunator, points = this.points;\n\n // check for collinear\n if (d.hull && d.hull.length > 2 && collinear(d)) {\n this.collinear = Int32Array.from({length: points.length/2}, (_,i) => i)\n .sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors\n const e = this.collinear[0], f = this.collinear[this.collinear.length - 1],\n bounds = [ points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1] ],\n r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]);\n for (let i = 0, n = points.length / 2; i < n; ++i) {\n const p = jitter(points[2 * i], points[2 * i + 1], r);\n points[2 * i] = p[0];\n points[2 * i + 1] = p[1];\n }\n this._delaunator = new Delaunator(points);\n } else {\n delete this.collinear;\n }\n\n const halfedges = this.halfedges = this._delaunator.halfedges;\n const hull = this.hull = this._delaunator.hull;\n const triangles = this.triangles = this._delaunator.triangles;\n const inedges = this.inedges.fill(-1);\n const hullIndex = this._hullIndex.fill(-1);\n\n // Compute an index from each point to an (arbitrary) incoming halfedge\n // Used to give the first neighbor of each point; for this reason,\n // on the hull we give priority to exterior halfedges\n for (let e = 0, n = halfedges.length; e < n; ++e) {\n const p = triangles[e % 3 === 2 ? e - 2 : e + 1];\n if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e;\n }\n for (let i = 0, n = hull.length; i < n; ++i) {\n hullIndex[hull[i]] = i;\n }\n\n // degenerate case: 1 or 2 (distinct) points\n if (hull.length <= 2 && hull.length > 0) {\n this.triangles = new Int32Array(3).fill(-1);\n this.halfedges = new Int32Array(3).fill(-1);\n this.triangles[0] = hull[0];\n inedges[hull[0]] = 1;\n if (hull.length === 2) {\n inedges[hull[1]] = 0;\n this.triangles[1] = hull[1];\n this.triangles[2] = hull[1];\n }\n }\n }\n voronoi(bounds) {\n return new Voronoi(this, bounds);\n }\n *neighbors(i) {\n const {inedges, hull, _hullIndex, halfedges, triangles, collinear} = this;\n\n // degenerate case with several collinear points\n if (collinear) {\n const l = collinear.indexOf(i);\n if (l > 0) yield collinear[l - 1];\n if (l < collinear.length - 1) yield collinear[l + 1];\n return;\n }\n\n const e0 = inedges[i];\n if (e0 === -1) return; // coincident point\n let e = e0, p0 = -1;\n do {\n yield p0 = triangles[e];\n e = e % 3 === 2 ? e - 2 : e + 1;\n if (triangles[e] !== i) return; // bad triangulation\n e = halfedges[e];\n if (e === -1) {\n const p = hull[(_hullIndex[i] + 1) % hull.length];\n if (p !== p0) yield p;\n return;\n }\n } while (e !== e0);\n }\n find(x, y, i = 0) {\n if ((x = +x, x !== x) || (y = +y, y !== y)) return -1;\n const i0 = i;\n let c;\n while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) i = c;\n return c;\n }\n _step(i, x, y) {\n const {inedges, hull, _hullIndex, halfedges, triangles, points} = this;\n if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1);\n let c = i;\n let dc = pow(x - points[i * 2], 2) + pow(y - points[i * 2 + 1], 2);\n const e0 = inedges[i];\n let e = e0;\n do {\n let t = triangles[e];\n const dt = pow(x - points[t * 2], 2) + pow(y - points[t * 2 + 1], 2);\n if (dt < dc) dc = dt, c = t;\n e = e % 3 === 2 ? e - 2 : e + 1;\n if (triangles[e] !== i) break; // bad triangulation\n e = halfedges[e];\n if (e === -1) {\n e = hull[(_hullIndex[i] + 1) % hull.length];\n if (e !== t) {\n if (pow(x - points[e * 2], 2) + pow(y - points[e * 2 + 1], 2) < dc) return e;\n }\n break;\n }\n } while (e !== e0);\n return c;\n }\n render(context) {\n const buffer = context == null ? context = new Path : undefined;\n const {points, halfedges, triangles} = this;\n for (let i = 0, n = halfedges.length; i < n; ++i) {\n const j = halfedges[i];\n if (j < i) continue;\n const ti = triangles[i] * 2;\n const tj = triangles[j] * 2;\n context.moveTo(points[ti], points[ti + 1]);\n context.lineTo(points[tj], points[tj + 1]);\n }\n this.renderHull(context);\n return buffer && buffer.value();\n }\n renderPoints(context, r) {\n if (r === undefined && (!context || typeof context.moveTo !== \"function\")) r = context, context = null;\n r = r == undefined ? 2 : +r;\n const buffer = context == null ? context = new Path : undefined;\n const {points} = this;\n for (let i = 0, n = points.length; i < n; i += 2) {\n const x = points[i], y = points[i + 1];\n context.moveTo(x + r, y);\n context.arc(x, y, r, 0, tau);\n }\n return buffer && buffer.value();\n }\n renderHull(context) {\n const buffer = context == null ? context = new Path : undefined;\n const {hull, points} = this;\n const h = hull[0] * 2, n = hull.length;\n context.moveTo(points[h], points[h + 1]);\n for (let i = 1; i < n; ++i) {\n const h = 2 * hull[i];\n context.lineTo(points[h], points[h + 1]);\n }\n context.closePath();\n return buffer && buffer.value();\n }\n hullPolygon() {\n const polygon = new Polygon;\n this.renderHull(polygon);\n return polygon.value();\n }\n renderTriangle(i, context) {\n const buffer = context == null ? context = new Path : undefined;\n const {points, triangles} = this;\n const t0 = triangles[i *= 3] * 2;\n const t1 = triangles[i + 1] * 2;\n const t2 = triangles[i + 2] * 2;\n context.moveTo(points[t0], points[t0 + 1]);\n context.lineTo(points[t1], points[t1 + 1]);\n context.lineTo(points[t2], points[t2 + 1]);\n context.closePath();\n return buffer && buffer.value();\n }\n *trianglePolygons() {\n const {triangles} = this;\n for (let i = 0, n = triangles.length / 3; i < n; ++i) {\n yield this.trianglePolygon(i);\n }\n }\n trianglePolygon(i) {\n const polygon = new Polygon;\n this.renderTriangle(i, polygon);\n return polygon.value();\n }\n}\n\nfunction flatArray(points, fx, fy, that) {\n const n = points.length;\n const array = new Float64Array(n * 2);\n for (let i = 0; i < n; ++i) {\n const p = points[i];\n array[i * 2] = fx.call(that, p, i, points);\n array[i * 2 + 1] = fy.call(that, p, i, points);\n }\n return array;\n}\n\nfunction* flatIterable(points, fx, fy, that) {\n let i = 0;\n for (const p of points) {\n yield fx.call(that, p, i, points);\n yield fy.call(that, p, i, points);\n ++i;\n }\n}\n","import { Transform } from 'vega-dataflow';\nimport { inherits } from 'vega-util';\nimport { Delaunay } from 'd3-delaunay';\n\nfunction Voronoi(params) {\n Transform.call(this, null, params);\n}\nVoronoi.Definition = {\n 'type': 'Voronoi',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'x',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'y',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'extent',\n 'type': 'array',\n 'array': true,\n 'length': 2,\n 'default': [[-1e5, -1e5], [1e5, 1e5]],\n 'content': {\n 'type': 'number',\n 'array': true,\n 'length': 2\n }\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'path'\n }]\n};\nconst defaultExtent = [-1e5, -1e5, 1e5, 1e5];\ninherits(Voronoi, Transform, {\n transform(_, pulse) {\n const as = _.as || 'path',\n data = pulse.source;\n\n // nothing to do if no data\n if (!data || !data.length) return pulse;\n\n // configure and construct voronoi diagram\n let s = _.size;\n s = s ? [0, 0, s[0], s[1]] : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] : defaultExtent;\n const voronoi = this.value = Delaunay.from(data, _.x, _.y).voronoi(s);\n\n // map polygons to paths\n for (let i = 0, n = data.length; i < n; ++i) {\n const polygon = voronoi.cellPolygon(i);\n data[i][as] = polygon && !isPoint(polygon) ? toPathString(polygon) : null;\n }\n return pulse.reflow(_.modified()).modifies(as);\n }\n});\n\n// suppress duplicated end point vertices\nfunction toPathString(p) {\n const x = p[0][0],\n y = p[0][1];\n let n = p.length - 1;\n for (; p[n][0] === x && p[n][1] === y; --n);\n return 'M' + p.slice(0, n + 1).join('L') + 'Z';\n}\nfunction isPoint(p) {\n return p.length === 2 && p[0][0] === p[1][0] && p[0][1] === p[1][1];\n}\n\nexport { Voronoi as voronoi };\n","import { canvas } from 'vega-canvas';\nimport { Transform } from 'vega-dataflow';\nimport { inherits, error, isFunction, constant, extent } from 'vega-util';\nimport { scale } from 'vega-scale';\nimport { random } from 'vega-statistics';\n\n/*\nCopyright (c) 2013, Jason Davies.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n * The name Jason Davies may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL JASON DAVIES BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\nOR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\nADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n// Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/\n// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf\n\nvar cloudRadians = Math.PI / 180,\n cw = 1 << 11 >> 5,\n ch = 1 << 11;\nfunction cloud () {\n var size = [256, 256],\n text,\n font,\n fontSize,\n fontStyle,\n fontWeight,\n rotate,\n padding,\n spiral = archimedeanSpiral,\n words = [],\n random = Math.random,\n cloud = {};\n cloud.layout = function () {\n var contextAndRatio = getContext(canvas()),\n board = zeroArray((size[0] >> 5) * size[1]),\n bounds = null,\n n = words.length,\n i = -1,\n tags = [],\n data = words.map(d => ({\n text: text(d),\n font: font(d),\n style: fontStyle(d),\n weight: fontWeight(d),\n rotate: rotate(d),\n size: ~~(fontSize(d) + 1e-14),\n padding: padding(d),\n xoff: 0,\n yoff: 0,\n x1: 0,\n y1: 0,\n x0: 0,\n y0: 0,\n hasText: false,\n sprite: null,\n datum: d\n })).sort((a, b) => b.size - a.size);\n while (++i < n) {\n var d = data[i];\n d.x = size[0] * (random() + .5) >> 1;\n d.y = size[1] * (random() + .5) >> 1;\n cloudSprite(contextAndRatio, d, data, i);\n if (d.hasText && place(board, d, bounds)) {\n tags.push(d);\n if (bounds) cloudBounds(bounds, d);else bounds = [{\n x: d.x + d.x0,\n y: d.y + d.y0\n }, {\n x: d.x + d.x1,\n y: d.y + d.y1\n }];\n // Temporary hack\n d.x -= size[0] >> 1;\n d.y -= size[1] >> 1;\n }\n }\n return tags;\n };\n function getContext(canvas) {\n canvas.width = canvas.height = 1;\n var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2);\n canvas.width = (cw << 5) / ratio;\n canvas.height = ch / ratio;\n var context = canvas.getContext('2d');\n context.fillStyle = context.strokeStyle = 'red';\n context.textAlign = 'center';\n return {\n context: context,\n ratio: ratio\n };\n }\n function place(board, tag, bounds) {\n var startX = tag.x,\n startY = tag.y,\n maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]),\n s = spiral(size),\n dt = random() < .5 ? 1 : -1,\n t = -dt,\n dxdy,\n dx,\n dy;\n while (dxdy = s(t += dt)) {\n dx = ~~dxdy[0];\n dy = ~~dxdy[1];\n if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break;\n tag.x = startX + dx;\n tag.y = startY + dy;\n if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue;\n // TODO only check for collisions within current bounds.\n if (!bounds || !cloudCollide(tag, board, size[0])) {\n if (!bounds || collideRects(tag, bounds)) {\n var sprite = tag.sprite,\n w = tag.width >> 5,\n sw = size[0] >> 5,\n lx = tag.x - (w << 4),\n sx = lx & 0x7f,\n msx = 32 - sx,\n h = tag.y1 - tag.y0,\n x = (tag.y + tag.y0) * sw + (lx >> 5),\n last;\n for (var j = 0; j < h; j++) {\n last = 0;\n for (var i = 0; i <= w; i++) {\n board[x + i] |= last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);\n }\n x += sw;\n }\n tag.sprite = null;\n return true;\n }\n }\n }\n return false;\n }\n cloud.words = function (_) {\n if (arguments.length) {\n words = _;\n return cloud;\n } else {\n return words;\n }\n };\n cloud.size = function (_) {\n if (arguments.length) {\n size = [+_[0], +_[1]];\n return cloud;\n } else {\n return size;\n }\n };\n cloud.font = function (_) {\n if (arguments.length) {\n font = functor(_);\n return cloud;\n } else {\n return font;\n }\n };\n cloud.fontStyle = function (_) {\n if (arguments.length) {\n fontStyle = functor(_);\n return cloud;\n } else {\n return fontStyle;\n }\n };\n cloud.fontWeight = function (_) {\n if (arguments.length) {\n fontWeight = functor(_);\n return cloud;\n } else {\n return fontWeight;\n }\n };\n cloud.rotate = function (_) {\n if (arguments.length) {\n rotate = functor(_);\n return cloud;\n } else {\n return rotate;\n }\n };\n cloud.text = function (_) {\n if (arguments.length) {\n text = functor(_);\n return cloud;\n } else {\n return text;\n }\n };\n cloud.spiral = function (_) {\n if (arguments.length) {\n spiral = spirals[_] || _;\n return cloud;\n } else {\n return spiral;\n }\n };\n cloud.fontSize = function (_) {\n if (arguments.length) {\n fontSize = functor(_);\n return cloud;\n } else {\n return fontSize;\n }\n };\n cloud.padding = function (_) {\n if (arguments.length) {\n padding = functor(_);\n return cloud;\n } else {\n return padding;\n }\n };\n cloud.random = function (_) {\n if (arguments.length) {\n random = _;\n return cloud;\n } else {\n return random;\n }\n };\n return cloud;\n}\n\n// Fetches a monochrome sprite bitmap for the specified text.\n// Load in batches for speed.\nfunction cloudSprite(contextAndRatio, d, data, di) {\n if (d.sprite) return;\n var c = contextAndRatio.context,\n ratio = contextAndRatio.ratio;\n c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);\n var x = 0,\n y = 0,\n maxh = 0,\n n = data.length,\n w,\n w32,\n h,\n i,\n j;\n --di;\n while (++di < n) {\n d = data[di];\n c.save();\n c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font;\n w = c.measureText(d.text + 'm').width * ratio;\n h = d.size << 1;\n if (d.rotate) {\n var sr = Math.sin(d.rotate * cloudRadians),\n cr = Math.cos(d.rotate * cloudRadians),\n wcr = w * cr,\n wsr = w * sr,\n hcr = h * cr,\n hsr = h * sr;\n w = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f >> 5 << 5;\n h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));\n } else {\n w = w + 0x1f >> 5 << 5;\n }\n if (h > maxh) maxh = h;\n if (x + w >= cw << 5) {\n x = 0;\n y += maxh;\n maxh = 0;\n }\n if (y + h >= ch) break;\n c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);\n if (d.rotate) c.rotate(d.rotate * cloudRadians);\n c.fillText(d.text, 0, 0);\n if (d.padding) {\n c.lineWidth = 2 * d.padding;\n c.strokeText(d.text, 0, 0);\n }\n c.restore();\n d.width = w;\n d.height = h;\n d.xoff = x;\n d.yoff = y;\n d.x1 = w >> 1;\n d.y1 = h >> 1;\n d.x0 = -d.x1;\n d.y0 = -d.y1;\n d.hasText = true;\n x += w;\n }\n var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data,\n sprite = [];\n while (--di >= 0) {\n d = data[di];\n if (!d.hasText) continue;\n w = d.width;\n w32 = w >> 5;\n h = d.y1 - d.y0;\n // Zero the buffer\n for (i = 0; i < h * w32; i++) sprite[i] = 0;\n x = d.xoff;\n if (x == null) return;\n y = d.yoff;\n var seen = 0,\n seenRow = -1;\n for (j = 0; j < h; j++) {\n for (i = 0; i < w; i++) {\n var k = w32 * j + (i >> 5),\n m = pixels[(y + j) * (cw << 5) + (x + i) << 2] ? 1 << 31 - i % 32 : 0;\n sprite[k] |= m;\n seen |= m;\n }\n if (seen) seenRow = j;else {\n d.y0++;\n h--;\n j--;\n y++;\n }\n }\n d.y1 = d.y0 + seenRow;\n d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);\n }\n}\n\n// Use mask-based collision detection.\nfunction cloudCollide(tag, board, sw) {\n sw >>= 5;\n var sprite = tag.sprite,\n w = tag.width >> 5,\n lx = tag.x - (w << 4),\n sx = lx & 0x7f,\n msx = 32 - sx,\n h = tag.y1 - tag.y0,\n x = (tag.y + tag.y0) * sw + (lx >> 5),\n last;\n for (var j = 0; j < h; j++) {\n last = 0;\n for (var i = 0; i <= w; i++) {\n if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true;\n }\n x += sw;\n }\n return false;\n}\nfunction cloudBounds(bounds, d) {\n var b0 = bounds[0],\n b1 = bounds[1];\n if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;\n if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;\n if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;\n if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;\n}\nfunction collideRects(a, b) {\n return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;\n}\nfunction archimedeanSpiral(size) {\n var e = size[0] / size[1];\n return function (t) {\n return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)];\n };\n}\nfunction rectangularSpiral(size) {\n var dy = 4,\n dx = dy * size[0] / size[1],\n x = 0,\n y = 0;\n return function (t) {\n var sign = t < 0 ? -1 : 1;\n // See triangular numbers: T_n = n * (n + 1) / 2.\n switch (Math.sqrt(1 + 4 * sign * t) - sign & 3) {\n case 0:\n x += dx;\n break;\n case 1:\n y += dy;\n break;\n case 2:\n x -= dx;\n break;\n default:\n y -= dy;\n break;\n }\n return [x, y];\n };\n}\n\n// TODO reuse arrays?\nfunction zeroArray(n) {\n var a = [],\n i = -1;\n while (++i < n) a[i] = 0;\n return a;\n}\nfunction functor(d) {\n return typeof d === 'function' ? d : function () {\n return d;\n };\n}\nvar spirals = {\n archimedean: archimedeanSpiral,\n rectangular: rectangularSpiral\n};\n\nconst Output = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle'];\nconst Params = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight'];\nfunction Wordcloud(params) {\n Transform.call(this, cloud(), params);\n}\nWordcloud.Definition = {\n 'type': 'Wordcloud',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'font',\n 'type': 'string',\n 'expr': true,\n 'default': 'sans-serif'\n }, {\n 'name': 'fontStyle',\n 'type': 'string',\n 'expr': true,\n 'default': 'normal'\n }, {\n 'name': 'fontWeight',\n 'type': 'string',\n 'expr': true,\n 'default': 'normal'\n }, {\n 'name': 'fontSize',\n 'type': 'number',\n 'expr': true,\n 'default': 14\n }, {\n 'name': 'fontSizeRange',\n 'type': 'number',\n 'array': 'nullable',\n 'default': [10, 50]\n }, {\n 'name': 'rotate',\n 'type': 'number',\n 'expr': true,\n 'default': 0\n }, {\n 'name': 'text',\n 'type': 'field'\n }, {\n 'name': 'spiral',\n 'type': 'string',\n 'values': ['archimedean', 'rectangular']\n }, {\n 'name': 'padding',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 7,\n 'default': Output\n }]\n};\ninherits(Wordcloud, Transform, {\n transform(_, pulse) {\n if (_.size && !(_.size[0] && _.size[1])) {\n error('Wordcloud size dimensions must be non-zero.');\n }\n function modp(param) {\n const p = _[param];\n return isFunction(p) && pulse.modified(p.fields);\n }\n const mod = _.modified();\n if (!(mod || pulse.changed(pulse.ADD_REM) || Params.some(modp))) return;\n const data = pulse.materialize(pulse.SOURCE).source,\n layout = this.value,\n as = _.as || Output;\n let fontSize = _.fontSize || 14,\n range;\n isFunction(fontSize) ? range = _.fontSizeRange : fontSize = constant(fontSize);\n\n // create font size scaling function as needed\n if (range) {\n const fsize = fontSize,\n sizeScale = scale('sqrt')().domain(extent(data, fsize)).range(range);\n fontSize = x => sizeScale(fsize(x));\n }\n data.forEach(t => {\n t[as[0]] = NaN;\n t[as[1]] = NaN;\n t[as[3]] = 0;\n });\n\n // configure layout\n const words = layout.words(data).text(_.text).size(_.size || [500, 500]).padding(_.padding || 1).spiral(_.spiral || 'archimedean').rotate(_.rotate || 0).font(_.font || 'sans-serif').fontStyle(_.fontStyle || 'normal').fontWeight(_.fontWeight || 'normal').fontSize(fontSize).random(random).layout();\n const size = layout.size(),\n dx = size[0] >> 1,\n dy = size[1] >> 1,\n n = words.length;\n for (let i = 0, w, t; i < n; ++i) {\n w = words[i];\n t = w.datum;\n t[as[0]] = w.x + dx;\n t[as[1]] = w.y + dy;\n t[as[2]] = w.font;\n t[as[3]] = w.size;\n t[as[4]] = w.style;\n t[as[5]] = w.weight;\n t[as[6]] = w.rotate;\n }\n return pulse.reflow(mod).modifies(as);\n }\n});\n\nexport { Wordcloud as wordcloud };\n","import { bisectLeft, bisectRight, permute } from 'd3-array';\nimport { Transform } from 'vega-dataflow';\nimport { inherits } from 'vega-util';\n\nconst array8 = n => new Uint8Array(n);\nconst array16 = n => new Uint16Array(n);\nconst array32 = n => new Uint32Array(n);\n\n/**\n * Maintains CrossFilter state.\n */\nfunction Bitmaps() {\n let width = 8,\n data = [],\n seen = array32(0),\n curr = array(0, width),\n prev = array(0, width);\n return {\n data: () => data,\n seen: () => seen = lengthen(seen, data.length),\n add(array) {\n for (let i = 0, j = data.length, n = array.length, t; i < n; ++i) {\n t = array[i];\n t._index = j++;\n data.push(t);\n }\n },\n remove(num, map) {\n // map: index -> boolean (true => remove)\n const n = data.length,\n copy = Array(n - num),\n reindex = data; // reuse old data array for index map\n let t, i, j;\n\n // seek forward to first removal\n for (i = 0; !map[i] && i < n; ++i) {\n copy[i] = data[i];\n reindex[i] = i;\n }\n\n // condense arrays\n for (j = i; i < n; ++i) {\n t = data[i];\n if (!map[i]) {\n reindex[i] = j;\n curr[j] = curr[i];\n prev[j] = prev[i];\n copy[j] = t;\n t._index = j++;\n } else {\n reindex[i] = -1;\n }\n curr[i] = 0; // clear unused bits\n }\n\n data = copy;\n return reindex;\n },\n size: () => data.length,\n curr: () => curr,\n prev: () => prev,\n reset: k => prev[k] = curr[k],\n all: () => width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff,\n set(k, one) {\n curr[k] |= one;\n },\n clear(k, one) {\n curr[k] &= ~one;\n },\n resize(n, m) {\n const k = curr.length;\n if (n > k || m > width) {\n width = Math.max(m, width);\n curr = array(n, width, curr);\n prev = array(n, width);\n }\n }\n };\n}\nfunction lengthen(array, length, copy) {\n if (array.length >= length) return array;\n copy = copy || new array.constructor(length);\n copy.set(array);\n return copy;\n}\nfunction array(n, m, array) {\n const copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n);\n if (array) copy.set(array);\n return copy;\n}\n\nfunction Dimension (index, i, query) {\n const bit = 1 << i;\n return {\n one: bit,\n zero: ~bit,\n range: query.slice(),\n bisect: index.bisect,\n index: index.index,\n size: index.size,\n onAdd(added, curr) {\n const dim = this,\n range = dim.bisect(dim.range, added.value),\n idx = added.index,\n lo = range[0],\n hi = range[1],\n n1 = idx.length;\n let i;\n for (i = 0; i < lo; ++i) curr[idx[i]] |= bit;\n for (i = hi; i < n1; ++i) curr[idx[i]] |= bit;\n return dim;\n }\n };\n}\n\n/**\n * Maintains a list of values, sorted by key.\n */\nfunction SortedIndex() {\n let index = array32(0),\n value = [],\n size = 0;\n function insert(key, data, base) {\n if (!data.length) return [];\n const n0 = size,\n n1 = data.length,\n addi = array32(n1);\n let addv = Array(n1),\n oldv,\n oldi,\n i;\n for (i = 0; i < n1; ++i) {\n addv[i] = key(data[i]);\n addi[i] = i;\n }\n addv = sort(addv, addi);\n if (n0) {\n oldv = value;\n oldi = index;\n value = Array(n0 + n1);\n index = array32(n0 + n1);\n merge(base, oldv, oldi, n0, addv, addi, n1, value, index);\n } else {\n if (base > 0) for (i = 0; i < n1; ++i) {\n addi[i] += base;\n }\n value = addv;\n index = addi;\n }\n size = n0 + n1;\n return {\n index: addi,\n value: addv\n };\n }\n function remove(num, map) {\n // map: index -> remove\n const n = size;\n let idx, i, j;\n\n // seek forward to first removal\n for (i = 0; !map[index[i]] && i < n; ++i);\n\n // condense index and value arrays\n for (j = i; i < n; ++i) {\n if (!map[idx = index[i]]) {\n index[j] = idx;\n value[j] = value[i];\n ++j;\n }\n }\n size = n - num;\n }\n function reindex(map) {\n for (let i = 0, n = size; i < n; ++i) {\n index[i] = map[index[i]];\n }\n }\n function bisect(range, array) {\n let n;\n if (array) {\n n = array.length;\n } else {\n array = value;\n n = size;\n }\n return [bisectLeft(array, range[0], 0, n), bisectRight(array, range[1], 0, n)];\n }\n return {\n insert: insert,\n remove: remove,\n bisect: bisect,\n reindex: reindex,\n index: () => index,\n size: () => size\n };\n}\nfunction sort(values, index) {\n values.sort.call(index, (a, b) => {\n const x = values[a],\n y = values[b];\n return x < y ? -1 : x > y ? 1 : 0;\n });\n return permute(values, index);\n}\nfunction merge(base, value0, index0, n0, value1, index1, n1, value, index) {\n let i0 = 0,\n i1 = 0,\n i;\n for (i = 0; i0 < n0 && i1 < n1; ++i) {\n if (value0[i0] < value1[i1]) {\n value[i] = value0[i0];\n index[i] = index0[i0++];\n } else {\n value[i] = value1[i1];\n index[i] = index1[i1++] + base;\n }\n }\n for (; i0 < n0; ++i0, ++i) {\n value[i] = value0[i0];\n index[i] = index0[i0];\n }\n for (; i1 < n1; ++i1, ++i) {\n value[i] = value1[i1];\n index[i] = index1[i1] + base;\n }\n}\n\n/**\n * An indexed multi-dimensional filter.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.fields - An array of dimension accessors to filter.\n * @param {Array} params.query - An array of per-dimension range queries.\n */\nfunction CrossFilter(params) {\n Transform.call(this, Bitmaps(), params);\n this._indices = null;\n this._dims = null;\n}\nCrossFilter.Definition = {\n 'type': 'CrossFilter',\n 'metadata': {},\n 'params': [{\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'required': true\n }, {\n 'name': 'query',\n 'type': 'array',\n 'array': true,\n 'required': true,\n 'content': {\n 'type': 'number',\n 'array': true,\n 'length': 2\n }\n }]\n};\ninherits(CrossFilter, Transform, {\n transform(_, pulse) {\n if (!this._dims) {\n return this.init(_, pulse);\n } else {\n var init = _.modified('fields') || _.fields.some(f => pulse.modified(f.fields));\n return init ? this.reinit(_, pulse) : this.eval(_, pulse);\n }\n },\n init(_, pulse) {\n const fields = _.fields,\n query = _.query,\n indices = this._indices = {},\n dims = this._dims = [],\n m = query.length;\n let i = 0,\n key,\n index;\n\n // instantiate indices and dimensions\n for (; i < m; ++i) {\n key = fields[i].fname;\n index = indices[key] || (indices[key] = SortedIndex());\n dims.push(Dimension(index, i, query[i]));\n }\n return this.eval(_, pulse);\n },\n reinit(_, pulse) {\n const output = pulse.materialize().fork(),\n fields = _.fields,\n query = _.query,\n indices = this._indices,\n dims = this._dims,\n bits = this.value,\n curr = bits.curr(),\n prev = bits.prev(),\n all = bits.all(),\n out = output.rem = output.add,\n mod = output.mod,\n m = query.length,\n adds = {};\n let add, index, key, mods, remMap, modMap, i, n, f;\n\n // set prev to current state\n prev.set(curr);\n\n // if pulse has remove tuples, process them first\n if (pulse.rem.length) {\n remMap = this.remove(_, pulse, output);\n }\n\n // if pulse has added tuples, add them to state\n if (pulse.add.length) {\n bits.add(pulse.add);\n }\n\n // if pulse has modified tuples, create an index map\n if (pulse.mod.length) {\n modMap = {};\n for (mods = pulse.mod, i = 0, n = mods.length; i < n; ++i) {\n modMap[mods[i]._index] = 1;\n }\n }\n\n // re-initialize indices as needed, update curr bitmap\n for (i = 0; i < m; ++i) {\n f = fields[i];\n if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) {\n key = f.fname;\n if (!(add = adds[key])) {\n indices[key] = index = SortedIndex();\n adds[key] = add = index.insert(f, pulse.source, 0);\n }\n dims[i] = Dimension(index, i, query[i]).onAdd(add, curr);\n }\n }\n\n // visit each tuple\n // if filter state changed, push index to add/rem\n // else if in mod and passes a filter, push index to mod\n for (i = 0, n = bits.data().length; i < n; ++i) {\n if (remMap[i]) {\n // skip if removed tuple\n continue;\n } else if (prev[i] !== curr[i]) {\n // add if state changed\n out.push(i);\n } else if (modMap[i] && curr[i] !== all) {\n // otherwise, pass mods through\n mod.push(i);\n }\n }\n bits.mask = (1 << m) - 1;\n return output;\n },\n eval(_, pulse) {\n const output = pulse.materialize().fork(),\n m = this._dims.length;\n let mask = 0;\n if (pulse.rem.length) {\n this.remove(_, pulse, output);\n mask |= (1 << m) - 1;\n }\n if (_.modified('query') && !_.modified('fields')) {\n mask |= this.update(_, pulse, output);\n }\n if (pulse.add.length) {\n this.insert(_, pulse, output);\n mask |= (1 << m) - 1;\n }\n if (pulse.mod.length) {\n this.modify(pulse, output);\n mask |= (1 << m) - 1;\n }\n this.value.mask = mask;\n return output;\n },\n insert(_, pulse, output) {\n const tuples = pulse.add,\n bits = this.value,\n dims = this._dims,\n indices = this._indices,\n fields = _.fields,\n adds = {},\n out = output.add,\n n = bits.size() + tuples.length,\n m = dims.length;\n let k = bits.size(),\n j,\n key,\n add;\n\n // resize bitmaps and add tuples as needed\n bits.resize(n, m);\n bits.add(tuples);\n const curr = bits.curr(),\n prev = bits.prev(),\n all = bits.all();\n\n // add to dimensional indices\n for (j = 0; j < m; ++j) {\n key = fields[j].fname;\n add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k));\n dims[j].onAdd(add, curr);\n }\n\n // set previous filters, output if passes at least one filter\n for (; k < n; ++k) {\n prev[k] = all;\n if (curr[k] !== all) out.push(k);\n }\n },\n modify(pulse, output) {\n const out = output.mod,\n bits = this.value,\n curr = bits.curr(),\n all = bits.all(),\n tuples = pulse.mod;\n let i, n, k;\n for (i = 0, n = tuples.length; i < n; ++i) {\n k = tuples[i]._index;\n if (curr[k] !== all) out.push(k);\n }\n },\n remove(_, pulse, output) {\n const indices = this._indices,\n bits = this.value,\n curr = bits.curr(),\n prev = bits.prev(),\n all = bits.all(),\n map = {},\n out = output.rem,\n tuples = pulse.rem;\n let i, n, k, f;\n\n // process tuples, output if passes at least one filter\n for (i = 0, n = tuples.length; i < n; ++i) {\n k = tuples[i]._index;\n map[k] = 1; // build index map\n prev[k] = f = curr[k];\n curr[k] = all;\n if (f !== all) out.push(k);\n }\n\n // remove from dimensional indices\n for (k in indices) {\n indices[k].remove(n, map);\n }\n this.reindex(pulse, n, map);\n return map;\n },\n // reindex filters and indices after propagation completes\n reindex(pulse, num, map) {\n const indices = this._indices,\n bits = this.value;\n pulse.runAfter(() => {\n const indexMap = bits.remove(num, map);\n for (const key in indices) indices[key].reindex(indexMap);\n });\n },\n update(_, pulse, output) {\n const dims = this._dims,\n query = _.query,\n stamp = pulse.stamp,\n m = dims.length;\n let mask = 0,\n i,\n q;\n\n // survey how many queries have changed\n output.filters = 0;\n for (q = 0; q < m; ++q) {\n if (_.modified('query', q)) {\n i = q;\n ++mask;\n }\n }\n if (mask === 1) {\n // only one query changed, use more efficient update\n mask = dims[i].one;\n this.incrementOne(dims[i], query[i], output.add, output.rem);\n } else {\n // multiple queries changed, perform full record keeping\n for (q = 0, mask = 0; q < m; ++q) {\n if (!_.modified('query', q)) continue;\n mask |= dims[q].one;\n this.incrementAll(dims[q], query[q], stamp, output.add);\n output.rem = output.add; // duplicate add/rem for downstream resolve\n }\n }\n\n return mask;\n },\n incrementAll(dim, query, stamp, out) {\n const bits = this.value,\n seen = bits.seen(),\n curr = bits.curr(),\n prev = bits.prev(),\n index = dim.index(),\n old = dim.bisect(dim.range),\n range = dim.bisect(query),\n lo1 = range[0],\n hi1 = range[1],\n lo0 = old[0],\n hi0 = old[1],\n one = dim.one;\n let i, j, k;\n\n // Fast incremental update based on previous lo index.\n if (lo1 < lo0) {\n for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {\n k = index[i];\n if (seen[k] !== stamp) {\n prev[k] = curr[k];\n seen[k] = stamp;\n out.push(k);\n }\n curr[k] ^= one;\n }\n } else if (lo1 > lo0) {\n for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {\n k = index[i];\n if (seen[k] !== stamp) {\n prev[k] = curr[k];\n seen[k] = stamp;\n out.push(k);\n }\n curr[k] ^= one;\n }\n }\n\n // Fast incremental update based on previous hi index.\n if (hi1 > hi0) {\n for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {\n k = index[i];\n if (seen[k] !== stamp) {\n prev[k] = curr[k];\n seen[k] = stamp;\n out.push(k);\n }\n curr[k] ^= one;\n }\n } else if (hi1 < hi0) {\n for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {\n k = index[i];\n if (seen[k] !== stamp) {\n prev[k] = curr[k];\n seen[k] = stamp;\n out.push(k);\n }\n curr[k] ^= one;\n }\n }\n dim.range = query.slice();\n },\n incrementOne(dim, query, add, rem) {\n const bits = this.value,\n curr = bits.curr(),\n index = dim.index(),\n old = dim.bisect(dim.range),\n range = dim.bisect(query),\n lo1 = range[0],\n hi1 = range[1],\n lo0 = old[0],\n hi0 = old[1],\n one = dim.one;\n let i, j, k;\n\n // Fast incremental update based on previous lo index.\n if (lo1 < lo0) {\n for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {\n k = index[i];\n curr[k] ^= one;\n add.push(k);\n }\n } else if (lo1 > lo0) {\n for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {\n k = index[i];\n curr[k] ^= one;\n rem.push(k);\n }\n }\n\n // Fast incremental update based on previous hi index.\n if (hi1 > hi0) {\n for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {\n k = index[i];\n curr[k] ^= one;\n add.push(k);\n }\n } else if (hi1 < hi0) {\n for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {\n k = index[i];\n curr[k] ^= one;\n rem.push(k);\n }\n }\n dim.range = query.slice();\n }\n});\n\n/**\n * Selectively filters tuples by resolving against a filter bitmap.\n * Useful for processing the output of a cross-filter transform.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {object} params.ignore - A bit mask indicating which filters to ignore.\n * @param {object} params.filter - The per-tuple filter bitmaps. Typically this\n * parameter value is a reference to a {@link CrossFilter} transform.\n */\nfunction ResolveFilter(params) {\n Transform.call(this, null, params);\n}\nResolveFilter.Definition = {\n 'type': 'ResolveFilter',\n 'metadata': {},\n 'params': [{\n 'name': 'ignore',\n 'type': 'number',\n 'required': true,\n 'description': 'A bit mask indicating which filters to ignore.'\n }, {\n 'name': 'filter',\n 'type': 'object',\n 'required': true,\n 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.'\n }]\n};\ninherits(ResolveFilter, Transform, {\n transform(_, pulse) {\n const ignore = ~(_.ignore || 0),\n // bit mask where zeros -> dims to ignore\n bitmap = _.filter,\n mask = bitmap.mask;\n\n // exit early if no relevant filter changes\n if ((mask & ignore) === 0) return pulse.StopPropagation;\n const output = pulse.fork(pulse.ALL),\n data = bitmap.data(),\n curr = bitmap.curr(),\n prev = bitmap.prev(),\n pass = k => !(curr[k] & ignore) ? data[k] : null;\n\n // propagate all mod tuples that pass the filter\n output.filter(output.MOD, pass);\n\n // determine add & rem tuples via filter functions\n // for efficiency, we do *not* populate new arrays,\n // instead we add filter functions applied downstream\n\n if (!(mask & mask - 1)) {\n // only one filter changed\n output.filter(output.ADD, pass);\n output.filter(output.REM, k => (curr[k] & ignore) === mask ? data[k] : null);\n } else {\n // multiple filters changed\n output.filter(output.ADD, k => {\n const c = curr[k] & ignore,\n f = !c && c ^ prev[k] & ignore;\n return f ? data[k] : null;\n });\n output.filter(output.REM, k => {\n const c = curr[k] & ignore,\n f = c && !(c ^ (c ^ prev[k] & ignore));\n return f ? data[k] : null;\n });\n }\n\n // add filter to source data in case of reflow...\n return output.filter(output.SOURCE, t => pass(t._index));\n }\n});\n\nexport { CrossFilter as crossfilter, ResolveFilter as resolvefilter };\n","export default function permute(source, keys) {\n return Array.from(keys, key => source[key]);\n}\n","import { error, toSet, isFunction, isString, hasOwnProperty } from 'vega-util';\n\nconst RawCode = 'RawCode';\nconst Literal = 'Literal';\nconst Property = 'Property';\nconst Identifier = 'Identifier';\nconst ArrayExpression = 'ArrayExpression';\nconst BinaryExpression = 'BinaryExpression';\nconst CallExpression = 'CallExpression';\nconst ConditionalExpression = 'ConditionalExpression';\nconst LogicalExpression = 'LogicalExpression';\nconst MemberExpression = 'MemberExpression';\nconst ObjectExpression = 'ObjectExpression';\nconst UnaryExpression = 'UnaryExpression';\nfunction ASTNode(type) {\n this.type = type;\n}\nASTNode.prototype.visit = function (visitor) {\n let c, i, n;\n if (visitor(this)) return 1;\n for (c = children(this), i = 0, n = c.length; i < n; ++i) {\n if (c[i].visit(visitor)) return 1;\n }\n};\nfunction children(node) {\n switch (node.type) {\n case ArrayExpression:\n return node.elements;\n case BinaryExpression:\n case LogicalExpression:\n return [node.left, node.right];\n case CallExpression:\n return [node.callee].concat(node.arguments);\n case ConditionalExpression:\n return [node.test, node.consequent, node.alternate];\n case MemberExpression:\n return [node.object, node.property];\n case ObjectExpression:\n return node.properties;\n case Property:\n return [node.key, node.value];\n case UnaryExpression:\n return [node.argument];\n case Identifier:\n case Literal:\n case RawCode:\n default:\n return [];\n }\n}\n\n/*\n The following expression parser is based on Esprima (http://esprima.org/).\n Original header comment and license for Esprima is included here:\n\n Copyright (C) 2013 Ariya Hidayat \n Copyright (C) 2013 Thaddee Tyl \n Copyright (C) 2013 Mathias Bynens \n Copyright (C) 2012 Ariya Hidayat \n Copyright (C) 2012 Mathias Bynens \n Copyright (C) 2012 Joost-Wim Boekesteijn \n Copyright (C) 2012 Kris Kowal \n Copyright (C) 2012 Yusuke Suzuki \n Copyright (C) 2012 Arpad Borsos \n Copyright (C) 2011 Ariya Hidayat \n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\nvar TokenName, source, index, length, lookahead;\nvar TokenBooleanLiteral = 1,\n TokenEOF = 2,\n TokenIdentifier = 3,\n TokenKeyword = 4,\n TokenNullLiteral = 5,\n TokenNumericLiteral = 6,\n TokenPunctuator = 7,\n TokenStringLiteral = 8,\n TokenRegularExpression = 9;\nTokenName = {};\nTokenName[TokenBooleanLiteral] = 'Boolean';\nTokenName[TokenEOF] = '';\nTokenName[TokenIdentifier] = 'Identifier';\nTokenName[TokenKeyword] = 'Keyword';\nTokenName[TokenNullLiteral] = 'Null';\nTokenName[TokenNumericLiteral] = 'Numeric';\nTokenName[TokenPunctuator] = 'Punctuator';\nTokenName[TokenStringLiteral] = 'String';\nTokenName[TokenRegularExpression] = 'RegularExpression';\nvar SyntaxArrayExpression = 'ArrayExpression',\n SyntaxBinaryExpression = 'BinaryExpression',\n SyntaxCallExpression = 'CallExpression',\n SyntaxConditionalExpression = 'ConditionalExpression',\n SyntaxIdentifier = 'Identifier',\n SyntaxLiteral = 'Literal',\n SyntaxLogicalExpression = 'LogicalExpression',\n SyntaxMemberExpression = 'MemberExpression',\n SyntaxObjectExpression = 'ObjectExpression',\n SyntaxProperty = 'Property',\n SyntaxUnaryExpression = 'UnaryExpression';\n\n// Error messages should be identical to V8.\nvar MessageUnexpectedToken = 'Unexpected token %0',\n MessageUnexpectedNumber = 'Unexpected number',\n MessageUnexpectedString = 'Unexpected string',\n MessageUnexpectedIdentifier = 'Unexpected identifier',\n MessageUnexpectedReserved = 'Unexpected reserved word',\n MessageUnexpectedEOS = 'Unexpected end of input',\n MessageInvalidRegExp = 'Invalid regular expression',\n MessageUnterminatedRegExp = 'Invalid regular expression: missing /',\n MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.',\n MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode';\nvar ILLEGAL = 'ILLEGAL',\n DISABLED = 'Disabled.';\n\n// See also tools/generate-unicode-regex.py.\nvar RegexNonAsciiIdentifierStart = new RegExp('[\\\\xAA\\\\xB5\\\\xBA\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0370-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u037F\\\\u0386\\\\u0388-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u048A-\\\\u052F\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0620-\\\\u064A\\\\u066E\\\\u066F\\\\u0671-\\\\u06D3\\\\u06D5\\\\u06E5\\\\u06E6\\\\u06EE\\\\u06EF\\\\u06FA-\\\\u06FC\\\\u06FF\\\\u0710\\\\u0712-\\\\u072F\\\\u074D-\\\\u07A5\\\\u07B1\\\\u07CA-\\\\u07EA\\\\u07F4\\\\u07F5\\\\u07FA\\\\u0800-\\\\u0815\\\\u081A\\\\u0824\\\\u0828\\\\u0840-\\\\u0858\\\\u08A0-\\\\u08B2\\\\u0904-\\\\u0939\\\\u093D\\\\u0950\\\\u0958-\\\\u0961\\\\u0971-\\\\u0980\\\\u0985-\\\\u098C\\\\u098F\\\\u0990\\\\u0993-\\\\u09A8\\\\u09AA-\\\\u09B0\\\\u09B2\\\\u09B6-\\\\u09B9\\\\u09BD\\\\u09CE\\\\u09DC\\\\u09DD\\\\u09DF-\\\\u09E1\\\\u09F0\\\\u09F1\\\\u0A05-\\\\u0A0A\\\\u0A0F\\\\u0A10\\\\u0A13-\\\\u0A28\\\\u0A2A-\\\\u0A30\\\\u0A32\\\\u0A33\\\\u0A35\\\\u0A36\\\\u0A38\\\\u0A39\\\\u0A59-\\\\u0A5C\\\\u0A5E\\\\u0A72-\\\\u0A74\\\\u0A85-\\\\u0A8D\\\\u0A8F-\\\\u0A91\\\\u0A93-\\\\u0AA8\\\\u0AAA-\\\\u0AB0\\\\u0AB2\\\\u0AB3\\\\u0AB5-\\\\u0AB9\\\\u0ABD\\\\u0AD0\\\\u0AE0\\\\u0AE1\\\\u0B05-\\\\u0B0C\\\\u0B0F\\\\u0B10\\\\u0B13-\\\\u0B28\\\\u0B2A-\\\\u0B30\\\\u0B32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\u0F6C\\\\u0F88-\\\\u0F8C\\\\u1000-\\\\u102A\\\\u103F\\\\u1050-\\\\u1055\\\\u105A-\\\\u105D\\\\u1061\\\\u1065\\\\u1066\\\\u106E-\\\\u1070\\\\u1075-\\\\u1081\\\\u108E\\\\u10A0-\\\\u10C5\\\\u10C7\\\\u10CD\\\\u10D0-\\\\u10FA\\\\u10FC-\\\\u1248\\\\u124A-\\\\u124D\\\\u1250-\\\\u1256\\\\u1258\\\\u125A-\\\\u125D\\\\u1260-\\\\u1288\\\\u128A-\\\\u128D\\\\u1290-\\\\u12B0\\\\u12B2-\\\\u12B5\\\\u12B8-\\\\u12BE\\\\u12C0\\\\u12C2-\\\\u12C5\\\\u12C8-\\\\u12D6\\\\u12D8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F4\\\\u1401-\\\\u166C\\\\u166F-\\\\u167F\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u16EE-\\\\u16F8\\\\u1700-\\\\u170C\\\\u170E-\\\\u1711\\\\u1720-\\\\u1731\\\\u1740-\\\\u1751\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1780-\\\\u17B3\\\\u17D7\\\\u17DC\\\\u1820-\\\\u1877\\\\u1880-\\\\u18A8\\\\u18AA\\\\u18B0-\\\\u18F5\\\\u1900-\\\\u191E\\\\u1950-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19AB\\\\u19C1-\\\\u19C7\\\\u1A00-\\\\u1A16\\\\u1A20-\\\\u1A54\\\\u1AA7\\\\u1B05-\\\\u1B33\\\\u1B45-\\\\u1B4B\\\\u1B83-\\\\u1BA0\\\\u1BAE\\\\u1BAF\\\\u1BBA-\\\\u1BE5\\\\u1C00-\\\\u1C23\\\\u1C4D-\\\\u1C4F\\\\u1C5A-\\\\u1C7D\\\\u1CE9-\\\\u1CEC\\\\u1CEE-\\\\u1CF1\\\\u1CF5\\\\u1CF6\\\\u1D00-\\\\u1DBF\\\\u1E00-\\\\u1F15\\\\u1F18-\\\\u1F1D\\\\u1F20-\\\\u1F45\\\\u1F48-\\\\u1F4D\\\\u1F50-\\\\u1F57\\\\u1F59\\\\u1F5B\\\\u1F5D\\\\u1F5F-\\\\u1F7D\\\\u1F80-\\\\u1FB4\\\\u1FB6-\\\\u1FBC\\\\u1FBE\\\\u1FC2-\\\\u1FC4\\\\u1FC6-\\\\u1FCC\\\\u1FD0-\\\\u1FD3\\\\u1FD6-\\\\u1FDB\\\\u1FE0-\\\\u1FEC\\\\u1FF2-\\\\u1FF4\\\\u1FF6-\\\\u1FFC\\\\u2071\\\\u207F\\\\u2090-\\\\u209C\\\\u2102\\\\u2107\\\\u210A-\\\\u2113\\\\u2115\\\\u2119-\\\\u211D\\\\u2124\\\\u2126\\\\u2128\\\\u212A-\\\\u212D\\\\u212F-\\\\u2139\\\\u213C-\\\\u213F\\\\u2145-\\\\u2149\\\\u214E\\\\u2160-\\\\u2188\\\\u2C00-\\\\u2C2E\\\\u2C30-\\\\u2C5E\\\\u2C60-\\\\u2CE4\\\\u2CEB-\\\\u2CEE\\\\u2CF2\\\\u2CF3\\\\u2D00-\\\\u2D25\\\\u2D27\\\\u2D2D\\\\u2D30-\\\\u2D67\\\\u2D6F\\\\u2D80-\\\\u2D96\\\\u2DA0-\\\\u2DA6\\\\u2DA8-\\\\u2DAE\\\\u2DB0-\\\\u2DB6\\\\u2DB8-\\\\u2DBE\\\\u2DC0-\\\\u2DC6\\\\u2DC8-\\\\u2DCE\\\\u2DD0-\\\\u2DD6\\\\u2DD8-\\\\u2DDE\\\\u2E2F\\\\u3005-\\\\u3007\\\\u3021-\\\\u3029\\\\u3031-\\\\u3035\\\\u3038-\\\\u303C\\\\u3041-\\\\u3096\\\\u309D-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31BA\\\\u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D\\\\uFB1F-\\\\uFB28\\\\uFB2A-\\\\uFB36\\\\uFB38-\\\\uFB3C\\\\uFB3E\\\\uFB40\\\\uFB41\\\\uFB43\\\\uFB44\\\\uFB46-\\\\uFBB1\\\\uFBD3-\\\\uFD3D\\\\uFD50-\\\\uFD8F\\\\uFD92-\\\\uFDC7\\\\uFDF0-\\\\uFDFB\\\\uFE70-\\\\uFE74\\\\uFE76-\\\\uFEFC\\\\uFF21-\\\\uFF3A\\\\uFF41-\\\\uFF5A\\\\uFF66-\\\\uFFBE\\\\uFFC2-\\\\uFFC7\\\\uFFCA-\\\\uFFCF\\\\uFFD2-\\\\uFFD7\\\\uFFDA-\\\\uFFDC]'),\n // eslint-disable-next-line no-misleading-character-class\n RegexNonAsciiIdentifierPart = new RegExp('[\\\\xAA\\\\xB5\\\\xBA\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0300-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u037F\\\\u0386\\\\u0388-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u0483-\\\\u0487\\\\u048A-\\\\u052F\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u0591-\\\\u05BD\\\\u05BF\\\\u05C1\\\\u05C2\\\\u05C4\\\\u05C5\\\\u05C7\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0610-\\\\u061A\\\\u0620-\\\\u0669\\\\u066E-\\\\u06D3\\\\u06D5-\\\\u06DC\\\\u06DF-\\\\u06E8\\\\u06EA-\\\\u06FC\\\\u06FF\\\\u0710-\\\\u074A\\\\u074D-\\\\u07B1\\\\u07C0-\\\\u07F5\\\\u07FA\\\\u0800-\\\\u082D\\\\u0840-\\\\u085B\\\\u08A0-\\\\u08B2\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u0DEF\\\\u0DF2\\\\u0DF3\\\\u0E01-\\\\u0E3A\\\\u0E40-\\\\u0E4E\\\\u0E50-\\\\u0E59\\\\u0E81\\\\u0E82\\\\u0E84\\\\u0E87\\\\u0E88\\\\u0E8A\\\\u0E8D\\\\u0E94-\\\\u0E97\\\\u0E99-\\\\u0E9F\\\\u0EA1-\\\\u0EA3\\\\u0EA5\\\\u0EA7\\\\u0EAA\\\\u0EAB\\\\u0EAD-\\\\u0EB9\\\\u0EBB-\\\\u0EBD\\\\u0EC0-\\\\u0EC4\\\\u0EC6\\\\u0EC8-\\\\u0ECD\\\\u0ED0-\\\\u0ED9\\\\u0EDC-\\\\u0EDF\\\\u0F00\\\\u0F18\\\\u0F19\\\\u0F20-\\\\u0F29\\\\u0F35\\\\u0F37\\\\u0F39\\\\u0F3E-\\\\u0F47\\\\u0F49-\\\\u0F6C\\\\u0F71-\\\\u0F84\\\\u0F86-\\\\u0F97\\\\u0F99-\\\\u0FBC\\\\u0FC6\\\\u1000-\\\\u1049\\\\u1050-\\\\u109D\\\\u10A0-\\\\u10C5\\\\u10C7\\\\u10CD\\\\u10D0-\\\\u10FA\\\\u10FC-\\\\u1248\\\\u124A-\\\\u124D\\\\u1250-\\\\u1256\\\\u1258\\\\u125A-\\\\u125D\\\\u1260-\\\\u1288\\\\u128A-\\\\u128D\\\\u1290-\\\\u12B0\\\\u12B2-\\\\u12B5\\\\u12B8-\\\\u12BE\\\\u12C0\\\\u12C2-\\\\u12C5\\\\u12C8-\\\\u12D6\\\\u12D8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u135D-\\\\u135F\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F4\\\\u1401-\\\\u166C\\\\u166F-\\\\u167F\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u16EE-\\\\u16F8\\\\u1700-\\\\u170C\\\\u170E-\\\\u1714\\\\u1720-\\\\u1734\\\\u1740-\\\\u1753\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1772\\\\u1773\\\\u1780-\\\\u17D3\\\\u17D7\\\\u17DC\\\\u17DD\\\\u17E0-\\\\u17E9\\\\u180B-\\\\u180D\\\\u1810-\\\\u1819\\\\u1820-\\\\u1877\\\\u1880-\\\\u18AA\\\\u18B0-\\\\u18F5\\\\u1900-\\\\u191E\\\\u1920-\\\\u192B\\\\u1930-\\\\u193B\\\\u1946-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19AB\\\\u19B0-\\\\u19C9\\\\u19D0-\\\\u19D9\\\\u1A00-\\\\u1A1B\\\\u1A20-\\\\u1A5E\\\\u1A60-\\\\u1A7C\\\\u1A7F-\\\\u1A89\\\\u1A90-\\\\u1A99\\\\u1AA7\\\\u1AB0-\\\\u1ABD\\\\u1B00-\\\\u1B4B\\\\u1B50-\\\\u1B59\\\\u1B6B-\\\\u1B73\\\\u1B80-\\\\u1BF3\\\\u1C00-\\\\u1C37\\\\u1C40-\\\\u1C49\\\\u1C4D-\\\\u1C7D\\\\u1CD0-\\\\u1CD2\\\\u1CD4-\\\\u1CF6\\\\u1CF8\\\\u1CF9\\\\u1D00-\\\\u1DF5\\\\u1DFC-\\\\u1F15\\\\u1F18-\\\\u1F1D\\\\u1F20-\\\\u1F45\\\\u1F48-\\\\u1F4D\\\\u1F50-\\\\u1F57\\\\u1F59\\\\u1F5B\\\\u1F5D\\\\u1F5F-\\\\u1F7D\\\\u1F80-\\\\u1FB4\\\\u1FB6-\\\\u1FBC\\\\u1FBE\\\\u1FC2-\\\\u1FC4\\\\u1FC6-\\\\u1FCC\\\\u1FD0-\\\\u1FD3\\\\u1FD6-\\\\u1FDB\\\\u1FE0-\\\\u1FEC\\\\u1FF2-\\\\u1FF4\\\\u1FF6-\\\\u1FFC\\\\u200C\\\\u200D\\\\u203F\\\\u2040\\\\u2054\\\\u2071\\\\u207F\\\\u2090-\\\\u209C\\\\u20D0-\\\\u20DC\\\\u20E1\\\\u20E5-\\\\u20F0\\\\u2102\\\\u2107\\\\u210A-\\\\u2113\\\\u2115\\\\u2119-\\\\u211D\\\\u2124\\\\u2126\\\\u2128\\\\u212A-\\\\u212D\\\\u212F-\\\\u2139\\\\u213C-\\\\u213F\\\\u2145-\\\\u2149\\\\u214E\\\\u2160-\\\\u2188\\\\u2C00-\\\\u2C2E\\\\u2C30-\\\\u2C5E\\\\u2C60-\\\\u2CE4\\\\u2CEB-\\\\u2CF3\\\\u2D00-\\\\u2D25\\\\u2D27\\\\u2D2D\\\\u2D30-\\\\u2D67\\\\u2D6F\\\\u2D7F-\\\\u2D96\\\\u2DA0-\\\\u2DA6\\\\u2DA8-\\\\u2DAE\\\\u2DB0-\\\\u2DB6\\\\u2DB8-\\\\u2DBE\\\\u2DC0-\\\\u2DC6\\\\u2DC8-\\\\u2DCE\\\\u2DD0-\\\\u2DD6\\\\u2DD8-\\\\u2DDE\\\\u2DE0-\\\\u2DFF\\\\u2E2F\\\\u3005-\\\\u3007\\\\u3021-\\\\u302F\\\\u3031-\\\\u3035\\\\u3038-\\\\u303C\\\\u3041-\\\\u3096\\\\u3099\\\\u309A\\\\u309D-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31BA\\\\u31F0-\\\\u31FF\\\\u3400-\\\\u4DB5\\\\u4E00-\\\\u9FCC\\\\uA000-\\\\uA48C\\\\uA4D0-\\\\uA4FD\\\\uA500-\\\\uA60C\\\\uA610-\\\\uA62B\\\\uA640-\\\\uA66F\\\\uA674-\\\\uA67D\\\\uA67F-\\\\uA69D\\\\uA69F-\\\\uA6F1\\\\uA717-\\\\uA71F\\\\uA722-\\\\uA788\\\\uA78B-\\\\uA78E\\\\uA790-\\\\uA7AD\\\\uA7B0\\\\uA7B1\\\\uA7F7-\\\\uA827\\\\uA840-\\\\uA873\\\\uA880-\\\\uA8C4\\\\uA8D0-\\\\uA8D9\\\\uA8E0-\\\\uA8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n// Ensure the condition is true, otherwise throw an error.\n// This is only to have a better contract semantic, i.e. another safety net\n// to catch a logic error. The condition shall be fulfilled in normal case.\n// Do NOT use this to enforce a certain condition on any user input.\n\nfunction assert(condition, message) {\n /* istanbul ignore next */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n}\nfunction isDecimalDigit(ch) {\n return ch >= 0x30 && ch <= 0x39; // 0..9\n}\n\nfunction isHexDigit(ch) {\n return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n}\nfunction isOctalDigit(ch) {\n return '01234567'.indexOf(ch) >= 0;\n}\n\n// 7.2 White Space\n\nfunction isWhiteSpace(ch) {\n return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0;\n}\n\n// 7.3 Line Terminators\n\nfunction isLineTerminator(ch) {\n return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;\n}\n\n// 7.6 Identifier Names and Identifiers\n\nfunction isIdentifierStart(ch) {\n return ch === 0x24 || ch === 0x5F ||\n // $ (dollar) and _ (underscore)\n ch >= 0x41 && ch <= 0x5A ||\n // A..Z\n ch >= 0x61 && ch <= 0x7A ||\n // a..z\n ch === 0x5C ||\n // \\ (backslash)\n ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));\n}\nfunction isIdentifierPart(ch) {\n return ch === 0x24 || ch === 0x5F ||\n // $ (dollar) and _ (underscore)\n ch >= 0x41 && ch <= 0x5A ||\n // A..Z\n ch >= 0x61 && ch <= 0x7A ||\n // a..z\n ch >= 0x30 && ch <= 0x39 ||\n // 0..9\n ch === 0x5C ||\n // \\ (backslash)\n ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));\n}\n\n// 7.6.1.1 Keywords\n\nconst keywords = {\n 'if': 1,\n 'in': 1,\n 'do': 1,\n 'var': 1,\n 'for': 1,\n 'new': 1,\n 'try': 1,\n 'let': 1,\n 'this': 1,\n 'else': 1,\n 'case': 1,\n 'void': 1,\n 'with': 1,\n 'enum': 1,\n 'while': 1,\n 'break': 1,\n 'catch': 1,\n 'throw': 1,\n 'const': 1,\n 'yield': 1,\n 'class': 1,\n 'super': 1,\n 'return': 1,\n 'typeof': 1,\n 'delete': 1,\n 'switch': 1,\n 'export': 1,\n 'import': 1,\n 'public': 1,\n 'static': 1,\n 'default': 1,\n 'finally': 1,\n 'extends': 1,\n 'package': 1,\n 'private': 1,\n 'function': 1,\n 'continue': 1,\n 'debugger': 1,\n 'interface': 1,\n 'protected': 1,\n 'instanceof': 1,\n 'implements': 1\n};\nfunction skipComment() {\n while (index < length) {\n const ch = source.charCodeAt(index);\n if (isWhiteSpace(ch) || isLineTerminator(ch)) {\n ++index;\n } else {\n break;\n }\n }\n}\nfunction scanHexEscape(prefix) {\n var i,\n len,\n ch,\n code = 0;\n len = prefix === 'u' ? 4 : 2;\n for (i = 0; i < len; ++i) {\n if (index < length && isHexDigit(source[index])) {\n ch = source[index++];\n code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n } else {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n return String.fromCharCode(code);\n}\nfunction scanUnicodeCodePointEscape() {\n var ch, code, cu1, cu2;\n ch = source[index];\n code = 0;\n\n // At least, one hex digit is required.\n if (ch === '}') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n while (index < length) {\n ch = source[index++];\n if (!isHexDigit(ch)) {\n break;\n }\n code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n }\n if (code > 0x10FFFF || ch !== '}') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n // UTF-16 Encoding\n if (code <= 0xFFFF) {\n return String.fromCharCode(code);\n }\n cu1 = (code - 0x10000 >> 10) + 0xD800;\n cu2 = (code - 0x10000 & 1023) + 0xDC00;\n return String.fromCharCode(cu1, cu2);\n}\nfunction getEscapedIdentifier() {\n var ch, id;\n ch = source.charCodeAt(index++);\n id = String.fromCharCode(ch);\n\n // '\\u' (U+005C, U+0075) denotes an escaped character.\n if (ch === 0x5C) {\n if (source.charCodeAt(index) !== 0x75) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierStart(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n id = ch;\n }\n while (index < length) {\n ch = source.charCodeAt(index);\n if (!isIdentifierPart(ch)) {\n break;\n }\n ++index;\n id += String.fromCharCode(ch);\n\n // '\\u' (U+005C, U+0075) denotes an escaped character.\n if (ch === 0x5C) {\n id = id.substr(0, id.length - 1);\n if (source.charCodeAt(index) !== 0x75) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierPart(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n id += ch;\n }\n }\n return id;\n}\nfunction getIdentifier() {\n var start, ch;\n start = index++;\n while (index < length) {\n ch = source.charCodeAt(index);\n if (ch === 0x5C) {\n // Blackslash (U+005C) marks Unicode escape sequence.\n index = start;\n return getEscapedIdentifier();\n }\n if (isIdentifierPart(ch)) {\n ++index;\n } else {\n break;\n }\n }\n return source.slice(start, index);\n}\nfunction scanIdentifier() {\n var start, id, type;\n start = index;\n\n // Backslash (U+005C) starts an escaped character.\n id = source.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier();\n\n // There is no keyword or literal with only one character.\n // Thus, it must be an identifier.\n if (id.length === 1) {\n type = TokenIdentifier;\n } else if (keywords.hasOwnProperty(id)) {\n // eslint-disable-line no-prototype-builtins\n type = TokenKeyword;\n } else if (id === 'null') {\n type = TokenNullLiteral;\n } else if (id === 'true' || id === 'false') {\n type = TokenBooleanLiteral;\n } else {\n type = TokenIdentifier;\n }\n return {\n type: type,\n value: id,\n start: start,\n end: index\n };\n}\n\n// 7.7 Punctuators\n\nfunction scanPunctuator() {\n var start = index,\n code = source.charCodeAt(index),\n code2,\n ch1 = source[index],\n ch2,\n ch3,\n ch4;\n switch (code) {\n // Check for most common single-character punctuators.\n case 0x2E: // . dot\n case 0x28: // ( open bracket\n case 0x29: // ) close bracket\n case 0x3B: // ; semicolon\n case 0x2C: // , comma\n case 0x7B: // { open curly brace\n case 0x7D: // } close curly brace\n case 0x5B: // [\n case 0x5D: // ]\n case 0x3A: // :\n case 0x3F: // ?\n case 0x7E:\n // ~\n ++index;\n return {\n type: TokenPunctuator,\n value: String.fromCharCode(code),\n start: start,\n end: index\n };\n default:\n code2 = source.charCodeAt(index + 1);\n\n // '=' (U+003D) marks an assignment or comparison operator.\n if (code2 === 0x3D) {\n switch (code) {\n case 0x2B: // +\n case 0x2D: // -\n case 0x2F: // /\n case 0x3C: // <\n case 0x3E: // >\n case 0x5E: // ^\n case 0x7C: // |\n case 0x25: // %\n case 0x26: // &\n case 0x2A:\n // *\n index += 2;\n return {\n type: TokenPunctuator,\n value: String.fromCharCode(code) + String.fromCharCode(code2),\n start: start,\n end: index\n };\n case 0x21: // !\n case 0x3D:\n // =\n index += 2;\n\n // !== and ===\n if (source.charCodeAt(index) === 0x3D) {\n ++index;\n }\n return {\n type: TokenPunctuator,\n value: source.slice(start, index),\n start: start,\n end: index\n };\n }\n }\n }\n\n // 4-character punctuator: >>>=\n\n ch4 = source.substr(index, 4);\n if (ch4 === '>>>=') {\n index += 4;\n return {\n type: TokenPunctuator,\n value: ch4,\n start: start,\n end: index\n };\n }\n\n // 3-character punctuators: === !== >>> <<= >>=\n\n ch3 = ch4.substr(0, 3);\n if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {\n index += 3;\n return {\n type: TokenPunctuator,\n value: ch3,\n start: start,\n end: index\n };\n }\n\n // Other 2-character punctuators: ++ -- << >> && ||\n ch2 = ch3.substr(0, 2);\n if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') {\n index += 2;\n return {\n type: TokenPunctuator,\n value: ch2,\n start: start,\n end: index\n };\n }\n if (ch2 === '//') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n // 1-character punctuators: < > = ! + - * % & | ^ /\n\n if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {\n ++index;\n return {\n type: TokenPunctuator,\n value: ch1,\n start: start,\n end: index\n };\n }\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n}\n\n// 7.8.3 Numeric Literals\n\nfunction scanHexLiteral(start) {\n let number = '';\n while (index < length) {\n if (!isHexDigit(source[index])) {\n break;\n }\n number += source[index++];\n }\n if (number.length === 0) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n return {\n type: TokenNumericLiteral,\n value: parseInt('0x' + number, 16),\n start: start,\n end: index\n };\n}\nfunction scanOctalLiteral(start) {\n let number = '0' + source[index++];\n while (index < length) {\n if (!isOctalDigit(source[index])) {\n break;\n }\n number += source[index++];\n }\n if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n return {\n type: TokenNumericLiteral,\n value: parseInt(number, 8),\n octal: true,\n start: start,\n end: index\n };\n}\nfunction scanNumericLiteral() {\n var number, start, ch;\n ch = source[index];\n assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point');\n start = index;\n number = '';\n if (ch !== '.') {\n number = source[index++];\n ch = source[index];\n\n // Hex number starts with '0x'.\n // Octal number starts with '0'.\n if (number === '0') {\n if (ch === 'x' || ch === 'X') {\n ++index;\n return scanHexLiteral(start);\n }\n if (isOctalDigit(ch)) {\n return scanOctalLiteral(start);\n }\n\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDecimalDigit(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n ch = source[index];\n }\n if (ch === '.') {\n number += source[index++];\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n ch = source[index];\n }\n if (ch === 'e' || ch === 'E') {\n number += source[index++];\n ch = source[index];\n if (ch === '+' || ch === '-') {\n number += source[index++];\n }\n if (isDecimalDigit(source.charCodeAt(index))) {\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n } else {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n return {\n type: TokenNumericLiteral,\n value: parseFloat(number),\n start: start,\n end: index\n };\n}\n\n// 7.8.4 String Literals\n\nfunction scanStringLiteral() {\n var str = '',\n quote,\n start,\n ch,\n code,\n octal = false;\n quote = source[index];\n assert(quote === '\\'' || quote === '\"', 'String literal must starts with a quote');\n start = index;\n ++index;\n while (index < length) {\n ch = source[index++];\n if (ch === quote) {\n quote = '';\n break;\n } else if (ch === '\\\\') {\n ch = source[index++];\n if (!ch || !isLineTerminator(ch.charCodeAt(0))) {\n switch (ch) {\n case 'u':\n case 'x':\n if (source[index] === '{') {\n ++index;\n str += scanUnicodeCodePointEscape();\n } else {\n str += scanHexEscape(ch);\n }\n break;\n case 'n':\n str += '\\n';\n break;\n case 'r':\n str += '\\r';\n break;\n case 't':\n str += '\\t';\n break;\n case 'b':\n str += '\\b';\n break;\n case 'f':\n str += '\\f';\n break;\n case 'v':\n str += '\\x0B';\n break;\n default:\n if (isOctalDigit(ch)) {\n code = '01234567'.indexOf(ch);\n\n // \\0 is not octal escape sequence\n if (code !== 0) {\n octal = true;\n }\n if (index < length && isOctalDigit(source[index])) {\n octal = true;\n code = code * 8 + '01234567'.indexOf(source[index++]);\n\n // 3 digits are only allowed when string starts\n // with 0, 1, 2, 3\n if ('0123'.indexOf(ch) >= 0 && index < length && isOctalDigit(source[index])) {\n code = code * 8 + '01234567'.indexOf(source[index++]);\n }\n }\n str += String.fromCharCode(code);\n } else {\n str += ch;\n }\n break;\n }\n } else {\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n break;\n } else {\n str += ch;\n }\n }\n if (quote !== '') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n return {\n type: TokenStringLiteral,\n value: str,\n octal: octal,\n start: start,\n end: index\n };\n}\nfunction testRegExp(pattern, flags) {\n let tmp = pattern;\n if (flags.indexOf('u') >= 0) {\n // Replace each astral symbol and every Unicode code point\n // escape sequence with a single ASCII symbol to avoid throwing on\n // regular expressions that are only valid in combination with the\n // `/u` flag.\n // Note: replacing with the ASCII symbol `x` might cause false\n // negatives in unlikely scenarios. For example, `[\\u{61}-b]` is a\n // perfectly valid pattern that is equivalent to `[a-b]`, but it\n // would be replaced by `[x-b]` which throws an error.\n tmp = tmp.replace(/\\\\u\\{([0-9a-fA-F]+)\\}/g, ($0, $1) => {\n if (parseInt($1, 16) <= 0x10FFFF) {\n return 'x';\n }\n throwError({}, MessageInvalidRegExp);\n }).replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, 'x');\n }\n\n // First, detect invalid regular expressions.\n try {\n new RegExp(tmp);\n } catch (e) {\n throwError({}, MessageInvalidRegExp);\n }\n\n // Return a regular expression object for this pattern-flag pair, or\n // `null` in case the current environment doesn't support the flags it\n // uses.\n try {\n return new RegExp(pattern, flags);\n } catch (exception) {\n return null;\n }\n}\nfunction scanRegExpBody() {\n var ch, str, classMarker, terminated, body;\n ch = source[index];\n assert(ch === '/', 'Regular expression literal must start with a slash');\n str = source[index++];\n classMarker = false;\n terminated = false;\n while (index < length) {\n ch = source[index++];\n str += ch;\n if (ch === '\\\\') {\n ch = source[index++];\n // ECMA-262 7.8.5\n if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, MessageUnterminatedRegExp);\n }\n str += ch;\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, MessageUnterminatedRegExp);\n } else if (classMarker) {\n if (ch === ']') {\n classMarker = false;\n }\n } else {\n if (ch === '/') {\n terminated = true;\n break;\n } else if (ch === '[') {\n classMarker = true;\n }\n }\n }\n if (!terminated) {\n throwError({}, MessageUnterminatedRegExp);\n }\n\n // Exclude leading and trailing slash.\n body = str.substr(1, str.length - 2);\n return {\n value: body,\n literal: str\n };\n}\nfunction scanRegExpFlags() {\n var ch, str, flags;\n str = '';\n flags = '';\n while (index < length) {\n ch = source[index];\n if (!isIdentifierPart(ch.charCodeAt(0))) {\n break;\n }\n ++index;\n if (ch === '\\\\' && index < length) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n } else {\n flags += ch;\n str += ch;\n }\n }\n if (flags.search(/[^gimuy]/g) >= 0) {\n throwError({}, MessageInvalidRegExp, flags);\n }\n return {\n value: flags,\n literal: str\n };\n}\nfunction scanRegExp() {\n var start, body, flags, value;\n lookahead = null;\n skipComment();\n start = index;\n body = scanRegExpBody();\n flags = scanRegExpFlags();\n value = testRegExp(body.value, flags.value);\n return {\n literal: body.literal + flags.literal,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n start: start,\n end: index\n };\n}\nfunction isIdentifierName(token) {\n return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral;\n}\nfunction advance() {\n skipComment();\n if (index >= length) {\n return {\n type: TokenEOF,\n start: index,\n end: index\n };\n }\n const ch = source.charCodeAt(index);\n if (isIdentifierStart(ch)) {\n return scanIdentifier();\n }\n\n // Very common: ( and ) and ;\n if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {\n return scanPunctuator();\n }\n\n // String literal starts with single quote (U+0027) or double quote (U+0022).\n if (ch === 0x27 || ch === 0x22) {\n return scanStringLiteral();\n }\n\n // Dot (.) U+002E can also start a floating-point number, hence the need\n // to check the next character.\n if (ch === 0x2E) {\n if (isDecimalDigit(source.charCodeAt(index + 1))) {\n return scanNumericLiteral();\n }\n return scanPunctuator();\n }\n if (isDecimalDigit(ch)) {\n return scanNumericLiteral();\n }\n return scanPunctuator();\n}\nfunction lex() {\n const token = lookahead;\n index = token.end;\n lookahead = advance();\n index = token.end;\n return token;\n}\nfunction peek() {\n const pos = index;\n lookahead = advance();\n index = pos;\n}\nfunction finishArrayExpression(elements) {\n const node = new ASTNode(SyntaxArrayExpression);\n node.elements = elements;\n return node;\n}\nfunction finishBinaryExpression(operator, left, right) {\n const node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression);\n node.operator = operator;\n node.left = left;\n node.right = right;\n return node;\n}\nfunction finishCallExpression(callee, args) {\n const node = new ASTNode(SyntaxCallExpression);\n node.callee = callee;\n node.arguments = args;\n return node;\n}\nfunction finishConditionalExpression(test, consequent, alternate) {\n const node = new ASTNode(SyntaxConditionalExpression);\n node.test = test;\n node.consequent = consequent;\n node.alternate = alternate;\n return node;\n}\nfunction finishIdentifier(name) {\n const node = new ASTNode(SyntaxIdentifier);\n node.name = name;\n return node;\n}\nfunction finishLiteral(token) {\n const node = new ASTNode(SyntaxLiteral);\n node.value = token.value;\n node.raw = source.slice(token.start, token.end);\n if (token.regex) {\n if (node.raw === '//') {\n node.raw = '/(?:)/';\n }\n node.regex = token.regex;\n }\n return node;\n}\nfunction finishMemberExpression(accessor, object, property) {\n const node = new ASTNode(SyntaxMemberExpression);\n node.computed = accessor === '[';\n node.object = object;\n node.property = property;\n if (!node.computed) property.member = true;\n return node;\n}\nfunction finishObjectExpression(properties) {\n const node = new ASTNode(SyntaxObjectExpression);\n node.properties = properties;\n return node;\n}\nfunction finishProperty(kind, key, value) {\n const node = new ASTNode(SyntaxProperty);\n node.key = key;\n node.value = value;\n node.kind = kind;\n return node;\n}\nfunction finishUnaryExpression(operator, argument) {\n const node = new ASTNode(SyntaxUnaryExpression);\n node.operator = operator;\n node.argument = argument;\n node.prefix = true;\n return node;\n}\n\n// Throw an exception\n\nfunction throwError(token, messageFormat) {\n var error,\n args = Array.prototype.slice.call(arguments, 2),\n msg = messageFormat.replace(/%(\\d)/g, (whole, index) => {\n assert(index < args.length, 'Message reference must be in range');\n return args[index];\n });\n error = new Error(msg);\n error.index = index;\n error.description = msg;\n throw error;\n}\n\n// Throw an exception because of the token.\n\nfunction throwUnexpected(token) {\n if (token.type === TokenEOF) {\n throwError(token, MessageUnexpectedEOS);\n }\n if (token.type === TokenNumericLiteral) {\n throwError(token, MessageUnexpectedNumber);\n }\n if (token.type === TokenStringLiteral) {\n throwError(token, MessageUnexpectedString);\n }\n if (token.type === TokenIdentifier) {\n throwError(token, MessageUnexpectedIdentifier);\n }\n if (token.type === TokenKeyword) {\n throwError(token, MessageUnexpectedReserved);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, MessageUnexpectedToken, token.value);\n}\n\n// Expect the next token to match the specified punctuator.\n// If not, an exception will be thrown.\n\nfunction expect(value) {\n const token = lex();\n if (token.type !== TokenPunctuator || token.value !== value) {\n throwUnexpected(token);\n }\n}\n\n// Return true if the next token matches the specified punctuator.\n\nfunction match(value) {\n return lookahead.type === TokenPunctuator && lookahead.value === value;\n}\n\n// Return true if the next token matches the specified keyword\n\nfunction matchKeyword(keyword) {\n return lookahead.type === TokenKeyword && lookahead.value === keyword;\n}\n\n// 11.1.4 Array Initialiser\n\nfunction parseArrayInitialiser() {\n const elements = [];\n index = lookahead.start;\n expect('[');\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else {\n elements.push(parseConditionalExpression());\n if (!match(']')) {\n expect(',');\n }\n }\n }\n lex();\n return finishArrayExpression(elements);\n}\n\n// 11.1.5 Object Initialiser\n\nfunction parseObjectPropertyKey() {\n index = lookahead.start;\n const token = lex();\n\n // Note: This function is called only from parseObjectProperty(), where\n // EOF and Punctuator tokens are already filtered out.\n\n if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) {\n if (token.octal) {\n throwError(token, MessageStrictOctalLiteral);\n }\n return finishLiteral(token);\n }\n return finishIdentifier(token.value);\n}\nfunction parseObjectProperty() {\n var token, key, id, value;\n index = lookahead.start;\n token = lookahead;\n if (token.type === TokenIdentifier) {\n id = parseObjectPropertyKey();\n expect(':');\n value = parseConditionalExpression();\n return finishProperty('init', id, value);\n }\n if (token.type === TokenEOF || token.type === TokenPunctuator) {\n throwUnexpected(token);\n } else {\n key = parseObjectPropertyKey();\n expect(':');\n value = parseConditionalExpression();\n return finishProperty('init', key, value);\n }\n}\nfunction parseObjectInitialiser() {\n var properties = [],\n property,\n name,\n key,\n map = {},\n toString = String;\n index = lookahead.start;\n expect('{');\n while (!match('}')) {\n property = parseObjectProperty();\n if (property.key.type === SyntaxIdentifier) {\n name = property.key.name;\n } else {\n name = toString(property.key.value);\n }\n key = '$' + name;\n if (Object.prototype.hasOwnProperty.call(map, key)) {\n throwError({}, MessageStrictDuplicateProperty);\n } else {\n map[key] = true;\n }\n properties.push(property);\n if (!match('}')) {\n expect(',');\n }\n }\n expect('}');\n return finishObjectExpression(properties);\n}\n\n// 11.1.6 The Grouping Operator\n\nfunction parseGroupExpression() {\n expect('(');\n const expr = parseExpression();\n expect(')');\n return expr;\n}\n\n// 11.1 Primary Expressions\n\nconst legalKeywords = {\n 'if': 1\n};\nfunction parsePrimaryExpression() {\n var type, token, expr;\n if (match('(')) {\n return parseGroupExpression();\n }\n if (match('[')) {\n return parseArrayInitialiser();\n }\n if (match('{')) {\n return parseObjectInitialiser();\n }\n type = lookahead.type;\n index = lookahead.start;\n if (type === TokenIdentifier || legalKeywords[lookahead.value]) {\n expr = finishIdentifier(lex().value);\n } else if (type === TokenStringLiteral || type === TokenNumericLiteral) {\n if (lookahead.octal) {\n throwError(lookahead, MessageStrictOctalLiteral);\n }\n expr = finishLiteral(lex());\n } else if (type === TokenKeyword) {\n throw new Error(DISABLED);\n } else if (type === TokenBooleanLiteral) {\n token = lex();\n token.value = token.value === 'true';\n expr = finishLiteral(token);\n } else if (type === TokenNullLiteral) {\n token = lex();\n token.value = null;\n expr = finishLiteral(token);\n } else if (match('/') || match('/=')) {\n expr = finishLiteral(scanRegExp());\n peek();\n } else {\n throwUnexpected(lex());\n }\n return expr;\n}\n\n// 11.2 Left-Hand-Side Expressions\n\nfunction parseArguments() {\n const args = [];\n expect('(');\n if (!match(')')) {\n while (index < length) {\n args.push(parseConditionalExpression());\n if (match(')')) {\n break;\n }\n expect(',');\n }\n }\n expect(')');\n return args;\n}\nfunction parseNonComputedProperty() {\n index = lookahead.start;\n const token = lex();\n if (!isIdentifierName(token)) {\n throwUnexpected(token);\n }\n return finishIdentifier(token.value);\n}\nfunction parseNonComputedMember() {\n expect('.');\n return parseNonComputedProperty();\n}\nfunction parseComputedMember() {\n expect('[');\n const expr = parseExpression();\n expect(']');\n return expr;\n}\nfunction parseLeftHandSideExpressionAllowCall() {\n var expr, args, property;\n expr = parsePrimaryExpression();\n for (;;) {\n if (match('.')) {\n property = parseNonComputedMember();\n expr = finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n args = parseArguments();\n expr = finishCallExpression(expr, args);\n } else if (match('[')) {\n property = parseComputedMember();\n expr = finishMemberExpression('[', expr, property);\n } else {\n break;\n }\n }\n return expr;\n}\n\n// 11.3 Postfix Expressions\n\nfunction parsePostfixExpression() {\n const expr = parseLeftHandSideExpressionAllowCall();\n if (lookahead.type === TokenPunctuator) {\n if (match('++') || match('--')) {\n throw new Error(DISABLED);\n }\n }\n return expr;\n}\n\n// 11.4 Unary Operators\n\nfunction parseUnaryExpression() {\n var token, expr;\n if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) {\n expr = parsePostfixExpression();\n } else if (match('++') || match('--')) {\n throw new Error(DISABLED);\n } else if (match('+') || match('-') || match('~') || match('!')) {\n token = lex();\n expr = parseUnaryExpression();\n expr = finishUnaryExpression(token.value, expr);\n } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {\n throw new Error(DISABLED);\n } else {\n expr = parsePostfixExpression();\n }\n return expr;\n}\nfunction binaryPrecedence(token) {\n let prec = 0;\n if (token.type !== TokenPunctuator && token.type !== TokenKeyword) {\n return 0;\n }\n switch (token.value) {\n case '||':\n prec = 1;\n break;\n case '&&':\n prec = 2;\n break;\n case '|':\n prec = 3;\n break;\n case '^':\n prec = 4;\n break;\n case '&':\n prec = 5;\n break;\n case '==':\n case '!=':\n case '===':\n case '!==':\n prec = 6;\n break;\n case '<':\n case '>':\n case '<=':\n case '>=':\n case 'instanceof':\n case 'in':\n prec = 7;\n break;\n case '<<':\n case '>>':\n case '>>>':\n prec = 8;\n break;\n case '+':\n case '-':\n prec = 9;\n break;\n case '*':\n case '/':\n case '%':\n prec = 11;\n break;\n }\n return prec;\n}\n\n// 11.5 Multiplicative Operators\n// 11.6 Additive Operators\n// 11.7 Bitwise Shift Operators\n// 11.8 Relational Operators\n// 11.9 Equality Operators\n// 11.10 Binary Bitwise Operators\n// 11.11 Binary Logical Operators\n\nfunction parseBinaryExpression() {\n var marker, markers, expr, token, prec, stack, right, operator, left, i;\n marker = lookahead;\n left = parseUnaryExpression();\n token = lookahead;\n prec = binaryPrecedence(token);\n if (prec === 0) {\n return left;\n }\n token.prec = prec;\n lex();\n markers = [marker, lookahead];\n right = parseUnaryExpression();\n stack = [left, token, right];\n while ((prec = binaryPrecedence(lookahead)) > 0) {\n // Reduce: make a binary expression from the three topmost entries.\n while (stack.length > 2 && prec <= stack[stack.length - 2].prec) {\n right = stack.pop();\n operator = stack.pop().value;\n left = stack.pop();\n markers.pop();\n expr = finishBinaryExpression(operator, left, right);\n stack.push(expr);\n }\n\n // Shift.\n token = lex();\n token.prec = prec;\n stack.push(token);\n markers.push(lookahead);\n expr = parseUnaryExpression();\n stack.push(expr);\n }\n\n // Final reduce to clean-up the stack.\n i = stack.length - 1;\n expr = stack[i];\n markers.pop();\n while (i > 1) {\n markers.pop();\n expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);\n i -= 2;\n }\n return expr;\n}\n\n// 11.12 Conditional Operator\n\nfunction parseConditionalExpression() {\n var expr, consequent, alternate;\n expr = parseBinaryExpression();\n if (match('?')) {\n lex();\n consequent = parseConditionalExpression();\n expect(':');\n alternate = parseConditionalExpression();\n expr = finishConditionalExpression(expr, consequent, alternate);\n }\n return expr;\n}\n\n// 11.14 Comma Operator\n\nfunction parseExpression() {\n const expr = parseConditionalExpression();\n if (match(',')) {\n throw new Error(DISABLED); // no sequence expressions\n }\n\n return expr;\n}\nfunction parser (code) {\n source = code;\n index = 0;\n length = source.length;\n lookahead = null;\n peek();\n const expr = parseExpression();\n if (lookahead.type !== TokenEOF) {\n throw new Error('Unexpect token after expression.');\n }\n return expr;\n}\n\nvar Constants = {\n NaN: 'NaN',\n E: 'Math.E',\n LN2: 'Math.LN2',\n LN10: 'Math.LN10',\n LOG2E: 'Math.LOG2E',\n LOG10E: 'Math.LOG10E',\n PI: 'Math.PI',\n SQRT1_2: 'Math.SQRT1_2',\n SQRT2: 'Math.SQRT2',\n MIN_VALUE: 'Number.MIN_VALUE',\n MAX_VALUE: 'Number.MAX_VALUE'\n};\n\nfunction Functions (codegen) {\n function fncall(name, args, cast, type) {\n let obj = codegen(args[0]);\n if (cast) {\n obj = cast + '(' + obj + ')';\n if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';\n }\n return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')');\n }\n function fn(name, cast, type) {\n return args => fncall(name, args, cast, type);\n }\n const DATE = 'new Date',\n STRING = 'String',\n REGEXP = 'RegExp';\n return {\n // MATH functions\n isNaN: 'Number.isNaN',\n isFinite: 'Number.isFinite',\n abs: 'Math.abs',\n acos: 'Math.acos',\n asin: 'Math.asin',\n atan: 'Math.atan',\n atan2: 'Math.atan2',\n ceil: 'Math.ceil',\n cos: 'Math.cos',\n exp: 'Math.exp',\n floor: 'Math.floor',\n hypot: 'Math.hypot',\n log: 'Math.log',\n max: 'Math.max',\n min: 'Math.min',\n pow: 'Math.pow',\n random: 'Math.random',\n round: 'Math.round',\n sin: 'Math.sin',\n sqrt: 'Math.sqrt',\n tan: 'Math.tan',\n clamp: function (args) {\n if (args.length < 3) error('Missing arguments to clamp function.');\n if (args.length > 3) error('Too many arguments to clamp function.');\n const a = args.map(codegen);\n return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))';\n },\n // DATE functions\n now: 'Date.now',\n utc: 'Date.UTC',\n datetime: DATE,\n date: fn('getDate', DATE, 0),\n day: fn('getDay', DATE, 0),\n year: fn('getFullYear', DATE, 0),\n month: fn('getMonth', DATE, 0),\n hours: fn('getHours', DATE, 0),\n minutes: fn('getMinutes', DATE, 0),\n seconds: fn('getSeconds', DATE, 0),\n milliseconds: fn('getMilliseconds', DATE, 0),\n time: fn('getTime', DATE, 0),\n timezoneoffset: fn('getTimezoneOffset', DATE, 0),\n utcdate: fn('getUTCDate', DATE, 0),\n utcday: fn('getUTCDay', DATE, 0),\n utcyear: fn('getUTCFullYear', DATE, 0),\n utcmonth: fn('getUTCMonth', DATE, 0),\n utchours: fn('getUTCHours', DATE, 0),\n utcminutes: fn('getUTCMinutes', DATE, 0),\n utcseconds: fn('getUTCSeconds', DATE, 0),\n utcmilliseconds: fn('getUTCMilliseconds', DATE, 0),\n // sequence functions\n length: fn('length', null, -1),\n // STRING functions\n parseFloat: 'parseFloat',\n parseInt: 'parseInt',\n upper: fn('toUpperCase', STRING, 0),\n lower: fn('toLowerCase', STRING, 0),\n substring: fn('substring', STRING),\n split: fn('split', STRING),\n trim: fn('trim', STRING, 0),\n // REGEXP functions\n regexp: REGEXP,\n test: fn('test', REGEXP),\n // Control Flow functions\n if: function (args) {\n if (args.length < 3) error('Missing arguments to if function.');\n if (args.length > 3) error('Too many arguments to if function.');\n const a = args.map(codegen);\n return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')';\n }\n };\n}\n\nfunction stripQuotes(s) {\n const n = s && s.length - 1;\n return n && (s[0] === '\"' && s[n] === '\"' || s[0] === '\\'' && s[n] === '\\'') ? s.slice(1, -1) : s;\n}\nfunction codegen (opt) {\n opt = opt || {};\n const allowed = opt.allowed ? toSet(opt.allowed) : {},\n forbidden = opt.forbidden ? toSet(opt.forbidden) : {},\n constants = opt.constants || Constants,\n functions = (opt.functions || Functions)(visit),\n globalvar = opt.globalvar,\n fieldvar = opt.fieldvar,\n outputGlobal = isFunction(globalvar) ? globalvar : id => `${globalvar}[\"${id}\"]`;\n let globals = {},\n fields = {},\n memberDepth = 0;\n function visit(ast) {\n if (isString(ast)) return ast;\n const generator = Generators[ast.type];\n if (generator == null) error('Unsupported type: ' + ast.type);\n return generator(ast);\n }\n const Generators = {\n Literal: n => n.raw,\n Identifier: n => {\n const id = n.name;\n if (memberDepth > 0) {\n return id;\n } else if (hasOwnProperty(forbidden, id)) {\n return error('Illegal identifier: ' + id);\n } else if (hasOwnProperty(constants, id)) {\n return constants[id];\n } else if (hasOwnProperty(allowed, id)) {\n return id;\n } else {\n globals[id] = 1;\n return outputGlobal(id);\n }\n },\n MemberExpression: n => {\n const d = !n.computed,\n o = visit(n.object);\n if (d) memberDepth += 1;\n const p = visit(n.property);\n if (o === fieldvar) {\n // strip quotes to sanitize field name (#1653)\n fields[stripQuotes(p)] = 1;\n }\n if (d) memberDepth -= 1;\n return o + (d ? '.' + p : '[' + p + ']');\n },\n CallExpression: n => {\n if (n.callee.type !== 'Identifier') {\n error('Illegal callee type: ' + n.callee.type);\n }\n const callee = n.callee.name,\n args = n.arguments,\n fn = hasOwnProperty(functions, callee) && functions[callee];\n if (!fn) error('Unrecognized function: ' + callee);\n return isFunction(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')';\n },\n ArrayExpression: n => '[' + n.elements.map(visit).join(',') + ']',\n BinaryExpression: n => '(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')',\n UnaryExpression: n => '(' + n.operator + visit(n.argument) + ')',\n ConditionalExpression: n => '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')',\n LogicalExpression: n => '(' + visit(n.left) + n.operator + visit(n.right) + ')',\n ObjectExpression: n => '{' + n.properties.map(visit).join(',') + '}',\n Property: n => {\n memberDepth += 1;\n const k = visit(n.key);\n memberDepth -= 1;\n return k + ':' + visit(n.value);\n }\n };\n function codegen(ast) {\n const result = {\n code: visit(ast),\n globals: Object.keys(globals),\n fields: Object.keys(fields)\n };\n globals = {};\n fields = {};\n return result;\n }\n codegen.functions = functions;\n codegen.constants = constants;\n return codegen;\n}\n\nexport { ASTNode, ArrayExpression, BinaryExpression, CallExpression, ConditionalExpression, Identifier, Literal, LogicalExpression, MemberExpression, ObjectExpression, Property, RawCode, UnaryExpression, codegen as codegenExpression, Constants as constants, Functions as functions, parser as parseExpression };\n","import {Adder} from \"d3-array\";\nimport {atan2, cos, quarterPi, radians, sin, tau} from \"./math.js\";\nimport noop from \"./noop.js\";\nimport stream from \"./stream.js\";\n\nexport var areaRingSum = new Adder();\n\n// hello?\n\nvar areaSum = new Adder(),\n lambda00,\n phi00,\n lambda0,\n cosPhi0,\n sinPhi0;\n\nexport var areaStream = {\n point: noop,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: function() {\n areaRingSum = new Adder();\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function() {\n var areaRing = +areaRingSum;\n areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);\n this.lineStart = this.lineEnd = this.point = noop;\n },\n sphere: function() {\n areaSum.add(tau);\n }\n};\n\nfunction areaRingStart() {\n areaStream.point = areaPointFirst;\n}\n\nfunction areaRingEnd() {\n areaPoint(lambda00, phi00);\n}\n\nfunction areaPointFirst(lambda, phi) {\n areaStream.point = areaPoint;\n lambda00 = lambda, phi00 = phi;\n lambda *= radians, phi *= radians;\n lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);\n}\n\nfunction areaPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n phi = phi / 2 + quarterPi; // half the angular distance from south pole\n\n // Spherical excess E for a spherical triangle with vertices: south pole,\n // previous point, current point. Uses a formula derived from Cagnoli’s\n // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).\n var dLambda = lambda - lambda0,\n sdLambda = dLambda >= 0 ? 1 : -1,\n adLambda = sdLambda * dLambda,\n cosPhi = cos(phi),\n sinPhi = sin(phi),\n k = sinPhi0 * sinPhi,\n u = cosPhi0 * cosPhi + k * cos(adLambda),\n v = k * sdLambda * sin(adLambda);\n areaRingSum.add(atan2(v, u));\n\n // Advance the previous points.\n lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;\n}\n\nexport default function(object) {\n areaSum = new Adder();\n stream(object, areaStream);\n return areaSum * 2;\n}\n","import {Adder} from \"d3-array\";\nimport {areaStream, areaRingSum} from \"./area.js\";\nimport {cartesian, cartesianCross, cartesianNormalizeInPlace, spherical} from \"./cartesian.js\";\nimport {abs, degrees, epsilon, radians} from \"./math.js\";\nimport stream from \"./stream.js\";\n\nvar lambda0, phi0, lambda1, phi1, // bounds\n lambda2, // previous lambda-coordinate\n lambda00, phi00, // first point\n p0, // previous 3D point\n deltaSum,\n ranges,\n range;\n\nvar boundsStream = {\n point: boundsPoint,\n lineStart: boundsLineStart,\n lineEnd: boundsLineEnd,\n polygonStart: function() {\n boundsStream.point = boundsRingPoint;\n boundsStream.lineStart = boundsRingStart;\n boundsStream.lineEnd = boundsRingEnd;\n deltaSum = new Adder();\n areaStream.polygonStart();\n },\n polygonEnd: function() {\n areaStream.polygonEnd();\n boundsStream.point = boundsPoint;\n boundsStream.lineStart = boundsLineStart;\n boundsStream.lineEnd = boundsLineEnd;\n if (areaRingSum < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);\n else if (deltaSum > epsilon) phi1 = 90;\n else if (deltaSum < -epsilon) phi0 = -90;\n range[0] = lambda0, range[1] = lambda1;\n },\n sphere: function() {\n lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);\n }\n};\n\nfunction boundsPoint(lambda, phi) {\n ranges.push(range = [lambda0 = lambda, lambda1 = lambda]);\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n}\n\nfunction linePoint(lambda, phi) {\n var p = cartesian([lambda * radians, phi * radians]);\n if (p0) {\n var normal = cartesianCross(p0, p),\n equatorial = [normal[1], -normal[0], 0],\n inflection = cartesianCross(equatorial, normal);\n cartesianNormalizeInPlace(inflection);\n inflection = spherical(inflection);\n var delta = lambda - lambda2,\n sign = delta > 0 ? 1 : -1,\n lambdai = inflection[0] * degrees * sign,\n phii,\n antimeridian = abs(delta) > 180;\n if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {\n phii = inflection[1] * degrees;\n if (phii > phi1) phi1 = phii;\n } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {\n phii = -inflection[1] * degrees;\n if (phii < phi0) phi0 = phii;\n } else {\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n }\n if (antimeridian) {\n if (lambda < lambda2) {\n if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda;\n }\n } else {\n if (lambda1 >= lambda0) {\n if (lambda < lambda0) lambda0 = lambda;\n if (lambda > lambda1) lambda1 = lambda;\n } else {\n if (lambda > lambda2) {\n if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda;\n }\n }\n }\n } else {\n ranges.push(range = [lambda0 = lambda, lambda1 = lambda]);\n }\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n p0 = p, lambda2 = lambda;\n}\n\nfunction boundsLineStart() {\n boundsStream.point = linePoint;\n}\n\nfunction boundsLineEnd() {\n range[0] = lambda0, range[1] = lambda1;\n boundsStream.point = boundsPoint;\n p0 = null;\n}\n\nfunction boundsRingPoint(lambda, phi) {\n if (p0) {\n var delta = lambda - lambda2;\n deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);\n } else {\n lambda00 = lambda, phi00 = phi;\n }\n areaStream.point(lambda, phi);\n linePoint(lambda, phi);\n}\n\nfunction boundsRingStart() {\n areaStream.lineStart();\n}\n\nfunction boundsRingEnd() {\n boundsRingPoint(lambda00, phi00);\n areaStream.lineEnd();\n if (abs(deltaSum) > epsilon) lambda0 = -(lambda1 = 180);\n range[0] = lambda0, range[1] = lambda1;\n p0 = null;\n}\n\n// Finds the left-right distance between two longitudes.\n// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want\n// the distance between ±180° to be 360°.\nfunction angle(lambda0, lambda1) {\n return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1;\n}\n\nfunction rangeCompare(a, b) {\n return a[0] - b[0];\n}\n\nfunction rangeContains(range, x) {\n return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;\n}\n\nexport default function(feature) {\n var i, n, a, b, merged, deltaMax, delta;\n\n phi1 = lambda1 = -(lambda0 = phi0 = Infinity);\n ranges = [];\n stream(feature, boundsStream);\n\n // First, sort ranges by their minimum longitudes.\n if (n = ranges.length) {\n ranges.sort(rangeCompare);\n\n // Then, merge any ranges that overlap.\n for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) {\n b = ranges[i];\n if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {\n if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];\n if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];\n } else {\n merged.push(a = b);\n }\n }\n\n // Finally, find the largest gap between the merged ranges.\n // The final bounding box will be the inverse of this gap.\n for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) {\n b = merged[i];\n if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0 = b[0], lambda1 = a[1];\n }\n }\n\n ranges = range = null;\n\n return lambda0 === Infinity || phi0 === Infinity\n ? [[NaN, NaN], [NaN, NaN]]\n : [[lambda0, phi0], [lambda1, phi1]];\n}\n","import {Adder} from \"d3-array\";\nimport {asin, atan2, cos, degrees, epsilon, epsilon2, hypot, radians, sin, sqrt} from \"./math.js\";\nimport noop from \"./noop.js\";\nimport stream from \"./stream.js\";\n\nvar W0, W1,\n X0, Y0, Z0,\n X1, Y1, Z1,\n X2, Y2, Z2,\n lambda00, phi00, // first point\n x0, y0, z0; // previous point\n\nvar centroidStream = {\n sphere: noop,\n point: centroidPoint,\n lineStart: centroidLineStart,\n lineEnd: centroidLineEnd,\n polygonStart: function() {\n centroidStream.lineStart = centroidRingStart;\n centroidStream.lineEnd = centroidRingEnd;\n },\n polygonEnd: function() {\n centroidStream.lineStart = centroidLineStart;\n centroidStream.lineEnd = centroidLineEnd;\n }\n};\n\n// Arithmetic mean of Cartesian vectors.\nfunction centroidPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos(phi);\n centroidPointCartesian(cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi));\n}\n\nfunction centroidPointCartesian(x, y, z) {\n ++W0;\n X0 += (x - X0) / W0;\n Y0 += (y - Y0) / W0;\n Z0 += (z - Z0) / W0;\n}\n\nfunction centroidLineStart() {\n centroidStream.point = centroidLinePointFirst;\n}\n\nfunction centroidLinePointFirst(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos(phi);\n x0 = cosPhi * cos(lambda);\n y0 = cosPhi * sin(lambda);\n z0 = sin(phi);\n centroidStream.point = centroidLinePoint;\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidLinePoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos(phi),\n x = cosPhi * cos(lambda),\n y = cosPhi * sin(lambda),\n z = sin(phi),\n w = atan2(sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);\n W1 += w;\n X1 += w * (x0 + (x0 = x));\n Y1 += w * (y0 + (y0 = y));\n Z1 += w * (z0 + (z0 = z));\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidLineEnd() {\n centroidStream.point = centroidPoint;\n}\n\n// See J. E. Brock, The Inertia Tensor for a Spherical Triangle,\n// J. Applied Mechanics 42, 239 (1975).\nfunction centroidRingStart() {\n centroidStream.point = centroidRingPointFirst;\n}\n\nfunction centroidRingEnd() {\n centroidRingPoint(lambda00, phi00);\n centroidStream.point = centroidPoint;\n}\n\nfunction centroidRingPointFirst(lambda, phi) {\n lambda00 = lambda, phi00 = phi;\n lambda *= radians, phi *= radians;\n centroidStream.point = centroidRingPoint;\n var cosPhi = cos(phi);\n x0 = cosPhi * cos(lambda);\n y0 = cosPhi * sin(lambda);\n z0 = sin(phi);\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidRingPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos(phi),\n x = cosPhi * cos(lambda),\n y = cosPhi * sin(lambda),\n z = sin(phi),\n cx = y0 * z - z0 * y,\n cy = z0 * x - x0 * z,\n cz = x0 * y - y0 * x,\n m = hypot(cx, cy, cz),\n w = asin(m), // line weight = angle\n v = m && -w / m; // area weight multiplier\n X2.add(v * cx);\n Y2.add(v * cy);\n Z2.add(v * cz);\n W1 += w;\n X1 += w * (x0 + (x0 = x));\n Y1 += w * (y0 + (y0 = y));\n Z1 += w * (z0 + (z0 = z));\n centroidPointCartesian(x0, y0, z0);\n}\n\nexport default function(object) {\n W0 = W1 =\n X0 = Y0 = Z0 =\n X1 = Y1 = Z1 = 0;\n X2 = new Adder();\n Y2 = new Adder();\n Z2 = new Adder();\n stream(object, centroidStream);\n\n var x = +X2,\n y = +Y2,\n z = +Z2,\n m = hypot(x, y, z);\n\n // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid.\n if (m < epsilon2) {\n x = X1, y = Y1, z = Z1;\n // If the feature has zero length, fall back to arithmetic mean of point vectors.\n if (W1 < epsilon) x = X0, y = Y0, z = Z0;\n m = hypot(x, y, z);\n // If the feature still has an undefined ccentroid, then return.\n if (m < epsilon2) return [NaN, NaN];\n }\n\n return [atan2(y, x) * degrees, asin(z / m) * degrees];\n}\n","import {InternSet} from \"internmap\";\n\nexport default function intersection(values, ...others) {\n values = new InternSet(values);\n others = others.map(set);\n out: for (const value of values) {\n for (const other of others) {\n if (!other.has(value)) {\n values.delete(value);\n continue out;\n }\n }\n }\n return values;\n}\n\nfunction set(values) {\n return values instanceof InternSet ? values : new InternSet(values);\n}\n","import { bisector, union, intersection } from 'd3-array';\nimport { field, isDate, toNumber, isArray, inrange, extend, array, error, peek, hasOwnProperty } from 'vega-util';\nimport { Literal } from 'vega-expression';\n\n// Registers vega-util field accessors to protect against XSS attacks\nconst SELECTION_GETTER = Symbol('vega_selection_getter');\nfunction getter(f) {\n if (!f.getter || !f.getter[SELECTION_GETTER]) {\n f.getter = field(f.field);\n f.getter[SELECTION_GETTER] = true;\n }\n return f.getter;\n}\nconst Intersect = 'intersect';\nconst Union = 'union';\nconst VlMulti = 'vlMulti';\nconst VlPoint = 'vlPoint';\nconst Or = 'or';\nconst And = 'and';\nconst SelectionId = '_vgsid_';\nconst $selectionId = field(SelectionId);\n\nconst TYPE_ENUM = 'E',\n TYPE_RANGE_INC = 'R',\n TYPE_RANGE_EXC = 'R-E',\n TYPE_RANGE_LE = 'R-LE',\n TYPE_RANGE_RE = 'R-RE',\n UNIT_INDEX = 'index:unit';\n\n// TODO: revisit date coercion?\nfunction testPoint(datum, entry) {\n var fields = entry.fields,\n values = entry.values,\n n = fields.length,\n i = 0,\n dval,\n f;\n for (; i < n; ++i) {\n f = fields[i];\n dval = getter(f)(datum);\n if (isDate(dval)) dval = toNumber(dval);\n if (isDate(values[i])) values[i] = toNumber(values[i]);\n if (isArray(values[i]) && isDate(values[i][0])) values[i] = values[i].map(toNumber);\n if (f.type === TYPE_ENUM) {\n // Enumerated fields can either specify individual values (single/multi selections)\n // or an array of values (interval selections).\n if (isArray(values[i]) ? values[i].indexOf(dval) < 0 : dval !== values[i]) {\n return false;\n }\n } else {\n if (f.type === TYPE_RANGE_INC) {\n if (!inrange(dval, values[i])) return false;\n } else if (f.type === TYPE_RANGE_RE) {\n // Discrete selection of bins test within the range [bin_start, bin_end).\n if (!inrange(dval, values[i], true, false)) return false;\n } else if (f.type === TYPE_RANGE_EXC) {\n // 'R-E'/'R-LE' included for completeness.\n if (!inrange(dval, values[i], false, false)) return false;\n } else if (f.type === TYPE_RANGE_LE) {\n if (!inrange(dval, values[i], false, true)) return false;\n }\n }\n }\n return true;\n}\n\n/**\n * Tests if a tuple is contained within an interactive selection.\n * @param {string} name - The name of the data set representing the selection.\n * Tuples in the dataset are of the form\n * {unit: string, fields: array, values: array<*>}.\n * Fielddef is of the form\n * {field: string, channel: string, type: 'E' | 'R'} where\n * 'type' identifies whether tuples in the dataset enumerate\n * values for the field, or specify a continuous range.\n * @param {object} datum - The tuple to test for inclusion.\n * @param {string} op - The set operation for combining selections.\n * One of 'intersect' or 'union' (default).\n * @return {boolean} - True if the datum is in the selection, false otherwise.\n */\nfunction selectionTest(name, datum, op) {\n var data = this.context.data[name],\n entries = data ? data.values.value : [],\n unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined,\n intersect = op === Intersect,\n n = entries.length,\n i = 0,\n entry,\n miss,\n count,\n unit,\n b;\n for (; i < n; ++i) {\n entry = entries[i];\n if (unitIdx && intersect) {\n // multi selections union within the same unit and intersect across units.\n miss = miss || {};\n count = miss[unit = entry.unit] || 0;\n\n // if we've already matched this unit, skip.\n if (count === -1) continue;\n b = testPoint(datum, entry);\n miss[unit] = b ? -1 : ++count;\n\n // if we match and there are no other units return true\n // if we've missed against all tuples in this unit return false\n if (b && unitIdx.size === 1) return true;\n if (!b && count === unitIdx.get(unit).count) return false;\n } else {\n b = testPoint(datum, entry);\n\n // if we find a miss and we do require intersection return false\n // if we find a match and we don't require intersection return true\n if (intersect ^ b) return b;\n }\n }\n\n // if intersecting and we made it here, then we saw no misses\n // if not intersecting, then we saw no matches\n // if no active selections, return false\n return n && intersect;\n}\nconst bisect = bisector($selectionId),\n bisectLeft = bisect.left,\n bisectRight = bisect.right;\nfunction selectionIdTest(name, datum, op) {\n const data = this.context.data[name],\n entries = data ? data.values.value : [],\n unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined,\n intersect = op === Intersect,\n value = $selectionId(datum),\n index = bisectLeft(entries, value);\n if (index === entries.length) return false;\n if ($selectionId(entries[index]) !== value) return false;\n if (unitIdx && intersect) {\n if (unitIdx.size === 1) return true;\n if (bisectRight(entries, value) - index < unitIdx.size) return false;\n }\n return true;\n}\n\n/**\n * Maps an array of scene graph items to an array of selection tuples.\n * @param {string} name - The name of the dataset representing the selection.\n * @param {string} base - The base object that generated tuples extend.\n *\n * @returns {array} An array of selection entries for the given unit.\n */\nfunction selectionTuples(array, base) {\n return array.map(x => extend(base.fields ? {\n values: base.fields.map(f => getter(f)(x.datum))\n } : {\n [SelectionId]: $selectionId(x.datum)\n }, base));\n}\n\n/**\n * Resolves selection for use as a scale domain or reads via the API.\n * @param {string} name - The name of the dataset representing the selection\n * @param {string} [op='union'] - The set operation for combining selections.\n * One of 'intersect' or 'union' (default).\n * @param {boolean} isMulti - Identifies a \"multi\" selection to perform more\n * expensive resolution computation.\n * @param {boolean} vl5 - With Vega-Lite v5, \"multi\" selections are now called \"point\"\n * selections, and thus the resolved tuple should reflect this name.\n * This parameter allows us to reflect this change without triggering\n * a major version bump for Vega.\n * @returns {object} An object of selected fields and values.\n */\nfunction selectionResolve(name, op, isMulti, vl5) {\n var data = this.context.data[name],\n entries = data ? data.values.value : [],\n resolved = {},\n multiRes = {},\n types = {},\n entry,\n fields,\n values,\n unit,\n field,\n value,\n res,\n resUnit,\n type,\n union,\n n = entries.length,\n i = 0,\n j,\n m;\n\n // First union all entries within the same unit.\n for (; i < n; ++i) {\n entry = entries[i];\n unit = entry.unit;\n fields = entry.fields;\n values = entry.values;\n if (fields && values) {\n // Intentional selection stores\n for (j = 0, m = fields.length; j < m; ++j) {\n field = fields[j];\n res = resolved[field.field] || (resolved[field.field] = {});\n resUnit = res[unit] || (res[unit] = []);\n types[field.field] = type = field.type.charAt(0);\n union = ops[`${type}_union`];\n res[unit] = union(resUnit, array(values[j]));\n }\n\n // If the same multi-selection is repeated over views and projected over\n // an encoding, it may operate over different fields making it especially\n // tricky to reliably resolve it. At best, we can de-dupe identical entries\n // but doing so may be more computationally expensive than it is worth.\n // Instead, for now, we simply transform our store representation into\n // a more human-friendly one.\n if (isMulti) {\n resUnit = multiRes[unit] || (multiRes[unit] = []);\n resUnit.push(array(values).reduce((obj, curr, j) => (obj[fields[j].field] = curr, obj), {}));\n }\n } else {\n // Short circuit extensional selectionId stores which hold sorted IDs unique to each unit.\n field = SelectionId;\n value = $selectionId(entry);\n res = resolved[field] || (resolved[field] = {});\n resUnit = res[unit] || (res[unit] = []);\n resUnit.push(value);\n if (isMulti) {\n resUnit = multiRes[unit] || (multiRes[unit] = []);\n resUnit.push({\n [SelectionId]: value\n });\n }\n }\n }\n\n // Then resolve fields across units as per the op.\n op = op || Union;\n if (resolved[SelectionId]) {\n resolved[SelectionId] = ops[`${SelectionId}_${op}`](...Object.values(resolved[SelectionId]));\n } else {\n Object.keys(resolved).forEach(field => {\n resolved[field] = Object.keys(resolved[field]).map(unit => resolved[field][unit]).reduce((acc, curr) => acc === undefined ? curr : ops[`${types[field]}_${op}`](acc, curr));\n });\n }\n entries = Object.keys(multiRes);\n if (isMulti && entries.length) {\n const key = vl5 ? VlPoint : VlMulti;\n resolved[key] = op === Union ? {\n [Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), [])\n } : {\n [And]: entries.map(k => ({\n [Or]: multiRes[k]\n }))\n };\n }\n return resolved;\n}\nvar ops = {\n [`${SelectionId}_union`]: union,\n [`${SelectionId}_intersect`]: intersection,\n E_union: function (base, value) {\n if (!base.length) return value;\n var i = 0,\n n = value.length;\n for (; i < n; ++i) if (base.indexOf(value[i]) < 0) base.push(value[i]);\n return base;\n },\n E_intersect: function (base, value) {\n return !base.length ? value : base.filter(v => value.indexOf(v) >= 0);\n },\n R_union: function (base, value) {\n var lo = toNumber(value[0]),\n hi = toNumber(value[1]);\n if (lo > hi) {\n lo = value[1];\n hi = value[0];\n }\n if (!base.length) return [lo, hi];\n if (base[0] > lo) base[0] = lo;\n if (base[1] < hi) base[1] = hi;\n return base;\n },\n R_intersect: function (base, value) {\n var lo = toNumber(value[0]),\n hi = toNumber(value[1]);\n if (lo > hi) {\n lo = value[1];\n hi = value[0];\n }\n if (!base.length) return [lo, hi];\n if (hi < base[0] || base[1] < lo) {\n return [];\n } else {\n if (base[0] < lo) base[0] = lo;\n if (base[1] > hi) base[1] = hi;\n }\n return base;\n }\n};\n\nconst DataPrefix = ':',\n IndexPrefix = '@';\nfunction selectionVisitor(name, args, scope, params) {\n if (args[0].type !== Literal) error('First argument to selection functions must be a string literal.');\n const data = args[0].value,\n op = args.length >= 2 && peek(args).value,\n field = 'unit',\n indexName = IndexPrefix + field,\n dataName = DataPrefix + data;\n\n // eslint-disable-next-line no-prototype-builtins\n if (op === Intersect && !hasOwnProperty(params, indexName)) {\n params[indexName] = scope.getData(data).indataRef(scope, field);\n }\n\n // eslint-disable-next-line no-prototype-builtins\n if (!hasOwnProperty(params, dataName)) {\n params[dataName] = scope.getData(data).tuplesRef();\n }\n}\n\nexport { selectionIdTest, selectionResolve, selectionTest, selectionTuples, selectionVisitor };\n","import {InternSet} from \"internmap\";\n\nexport default function union(...others) {\n const set = new InternSet();\n for (const other of others) {\n for (const o of other) {\n set.add(o);\n }\n }\n return set;\n}\n","import { truthy, error, hasOwnProperty, isFunction, isString, stringValue, extend, isArray, isObject, field, peek, identity, array as array$1, isBoolean, isDate, isNumber, isRegExp, toBoolean, toDate, toNumber, toString, flush, lerp, pad, span, inrange, truncate, quarter, utcquarter, extent, clampRange, panLinear, panLog, panPow, panSymlog, zoomLinear, zoomLog, zoomPow, zoomSymlog } from 'vega-util';\nimport { Literal, codegenExpression, constants, functions, parseExpression, CallExpression } from 'vega-expression';\nimport { isRegisteredScale, bandSpace, scale as scale$1, scaleFraction } from 'vega-scale';\nimport { geoArea as geoArea$1, geoBounds as geoBounds$1, geoCentroid as geoCentroid$1 } from 'd3-geo';\nimport { rgb, lab, hcl, hsl } from 'd3-color';\nimport { isTuple } from 'vega-dataflow';\nimport { Gradient, pathRender, pathParse, Bounds, intersect as intersect$1 } from 'vega-scenegraph';\nimport { selectionVisitor, selectionTest, selectionIdTest, selectionResolve, selectionTuples } from 'vega-selections';\nimport { random, cumulativeNormal, cumulativeLogNormal, cumulativeUniform, densityNormal, densityLogNormal, densityUniform, quantileNormal, quantileLogNormal, quantileUniform, sampleNormal, sampleLogNormal, sampleUniform } from 'vega-statistics';\nimport { utcOffset, utcSequence, timeOffset, timeSequence, timeUnitSpecifier, week, utcweek, dayofyear, utcdayofyear } from 'vega-time';\nimport { range as range$1 } from 'd3-array';\n\nfunction data(name) {\n const data = this.context.data[name];\n return data ? data.values.value : [];\n}\nfunction indata(name, field, value) {\n const index = this.context.data[name]['index:' + field],\n entry = index ? index.value.get(value) : undefined;\n return entry ? entry.count : entry;\n}\nfunction setdata(name, tuples) {\n const df = this.context.dataflow,\n data = this.context.data[name],\n input = data.input;\n df.pulse(input, df.changeset().remove(truthy).insert(tuples));\n return 1;\n}\n\nfunction encode (item, name, retval) {\n if (item) {\n const df = this.context.dataflow,\n target = item.mark.source;\n df.pulse(target, df.changeset().encode(item, name));\n }\n return retval !== undefined ? retval : item;\n}\n\nconst wrap = method => function (value, spec) {\n const locale = this.context.dataflow.locale();\n return locale[method](spec)(value);\n};\nconst format = wrap('format');\nconst timeFormat = wrap('timeFormat');\nconst utcFormat = wrap('utcFormat');\nconst timeParse = wrap('timeParse');\nconst utcParse = wrap('utcParse');\nconst dateObj = new Date(2000, 0, 1);\nfunction time(month, day, specifier) {\n if (!Number.isInteger(month) || !Number.isInteger(day)) return '';\n dateObj.setYear(2000);\n dateObj.setMonth(month);\n dateObj.setDate(day);\n return timeFormat.call(this, dateObj, specifier);\n}\nfunction monthFormat(month) {\n return time.call(this, month, 1, '%B');\n}\nfunction monthAbbrevFormat(month) {\n return time.call(this, month, 1, '%b');\n}\nfunction dayFormat(day) {\n return time.call(this, 0, 2 + day, '%A');\n}\nfunction dayAbbrevFormat(day) {\n return time.call(this, 0, 2 + day, '%a');\n}\n\nconst DataPrefix = ':';\nconst IndexPrefix = '@';\nconst ScalePrefix = '%';\nconst SignalPrefix = '$';\n\nfunction dataVisitor(name, args, scope, params) {\n if (args[0].type !== Literal) {\n error('First argument to data functions must be a string literal.');\n }\n const data = args[0].value,\n dataName = DataPrefix + data;\n if (!hasOwnProperty(dataName, params)) {\n try {\n params[dataName] = scope.getData(data).tuplesRef();\n } catch (err) {\n // if data set does not exist, there's nothing to track\n }\n }\n}\nfunction indataVisitor(name, args, scope, params) {\n if (args[0].type !== Literal) error('First argument to indata must be a string literal.');\n if (args[1].type !== Literal) error('Second argument to indata must be a string literal.');\n const data = args[0].value,\n field = args[1].value,\n indexName = IndexPrefix + field;\n if (!hasOwnProperty(indexName, params)) {\n params[indexName] = scope.getData(data).indataRef(scope, field);\n }\n}\nfunction scaleVisitor(name, args, scope, params) {\n if (args[0].type === Literal) {\n // add scale dependency\n addScaleDependency(scope, params, args[0].value);\n } else {\n // indirect scale lookup; add all scales as parameters\n for (name in scope.scales) {\n addScaleDependency(scope, params, name);\n }\n }\n}\nfunction addScaleDependency(scope, params, name) {\n const scaleName = ScalePrefix + name;\n if (!hasOwnProperty(params, scaleName)) {\n try {\n params[scaleName] = scope.scaleRef(name);\n } catch (err) {\n // TODO: error handling? warning?\n }\n }\n}\n\nfunction getScale(nameOrFunction, ctx) {\n if (isFunction(nameOrFunction)) {\n return nameOrFunction;\n }\n if (isString(nameOrFunction)) {\n const maybeScale = ctx.scales[nameOrFunction];\n return maybeScale && isRegisteredScale(maybeScale.value) ? maybeScale.value : undefined;\n }\n return undefined;\n}\nfunction internalScaleFunctions(codegen, fnctx, visitors) {\n // add helper method to the 'this' expression function context\n fnctx.__bandwidth = s => s && s.bandwidth ? s.bandwidth() : 0;\n\n // register AST visitors for internal scale functions\n visitors._bandwidth = scaleVisitor;\n visitors._range = scaleVisitor;\n visitors._scale = scaleVisitor;\n\n // resolve scale reference directly to the signal hash argument\n const ref = arg => '_[' + (arg.type === Literal ? stringValue(ScalePrefix + arg.value) : stringValue(ScalePrefix) + '+' + codegen(arg)) + ']';\n\n // define and return internal scale function code generators\n // these internal functions are called by mark encoders\n return {\n _bandwidth: args => `this.__bandwidth(${ref(args[0])})`,\n _range: args => `${ref(args[0])}.range()`,\n _scale: args => `${ref(args[0])}(${codegen(args[1])})`\n };\n}\n\nfunction geoMethod(methodName, globalMethod) {\n return function (projection, geojson, group) {\n if (projection) {\n // projection defined, use it\n const p = getScale(projection, (group || this).context);\n return p && p.path[methodName](geojson);\n } else {\n // projection undefined, use global method\n return globalMethod(geojson);\n }\n };\n}\nconst geoArea = geoMethod('area', geoArea$1);\nconst geoBounds = geoMethod('bounds', geoBounds$1);\nconst geoCentroid = geoMethod('centroid', geoCentroid$1);\nfunction geoScale(projection, group) {\n const p = getScale(projection, (group || this).context);\n return p && p.scale();\n}\n\nfunction inScope (item) {\n const group = this.context.group;\n let value = false;\n if (group) while (item) {\n if (item === group) {\n value = true;\n break;\n }\n item = item.mark.group;\n }\n return value;\n}\n\nfunction log(df, method, args) {\n try {\n df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args)));\n } catch (err) {\n df.warn(err);\n }\n return args[args.length - 1];\n}\nfunction warn() {\n return log(this.context.dataflow, 'warn', arguments);\n}\nfunction info() {\n return log(this.context.dataflow, 'info', arguments);\n}\nfunction debug() {\n return log(this.context.dataflow, 'debug', arguments);\n}\n\n// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\nfunction channel_luminance_value(channelValue) {\n const val = channelValue / 255;\n if (val <= 0.03928) {\n return val / 12.92;\n }\n return Math.pow((val + 0.055) / 1.055, 2.4);\n}\nfunction luminance(color) {\n const c = rgb(color),\n r = channel_luminance_value(c.r),\n g = channel_luminance_value(c.g),\n b = channel_luminance_value(c.b);\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n}\n\n// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef\nfunction contrast(color1, color2) {\n const lum1 = luminance(color1),\n lum2 = luminance(color2),\n lumL = Math.max(lum1, lum2),\n lumD = Math.min(lum1, lum2);\n return (lumL + 0.05) / (lumD + 0.05);\n}\n\nfunction merge () {\n const args = [].slice.call(arguments);\n args.unshift({});\n return extend(...args);\n}\n\nfunction equal(a, b) {\n return a === b || a !== a && b !== b ? true : isArray(a) ? isArray(b) && a.length === b.length ? equalArray(a, b) : false : isObject(a) && isObject(b) ? equalObject(a, b) : false;\n}\nfunction equalArray(a, b) {\n for (let i = 0, n = a.length; i < n; ++i) {\n if (!equal(a[i], b[i])) return false;\n }\n return true;\n}\nfunction equalObject(a, b) {\n for (const key in a) {\n if (!equal(a[key], b[key])) return false;\n }\n return true;\n}\nfunction removePredicate(props) {\n return _ => equalObject(props, _);\n}\nfunction modify (name, insert, remove, toggle, modify, values) {\n const df = this.context.dataflow,\n data = this.context.data[name],\n input = data.input,\n stamp = df.stamp();\n let changes = data.changes,\n predicate,\n key;\n if (df._trigger === false || !(input.value.length || insert || toggle)) {\n // nothing to do!\n return 0;\n }\n if (!changes || changes.stamp < stamp) {\n data.changes = changes = df.changeset();\n changes.stamp = stamp;\n df.runAfter(() => {\n data.modified = true;\n df.pulse(input, changes).run();\n }, true, 1);\n }\n if (remove) {\n predicate = remove === true ? truthy : isArray(remove) || isTuple(remove) ? remove : removePredicate(remove);\n changes.remove(predicate);\n }\n if (insert) {\n changes.insert(insert);\n }\n if (toggle) {\n predicate = removePredicate(toggle);\n if (input.value.some(predicate)) {\n changes.remove(predicate);\n } else {\n changes.insert(toggle);\n }\n }\n if (modify) {\n for (key in values) {\n changes.modify(modify, key, values[key]);\n }\n }\n return 1;\n}\n\nfunction pinchDistance(event) {\n const t = event.touches,\n dx = t[0].clientX - t[1].clientX,\n dy = t[0].clientY - t[1].clientY;\n return Math.hypot(dx, dy);\n}\nfunction pinchAngle(event) {\n const t = event.touches;\n return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX);\n}\n\n// memoize accessor functions\nconst accessors = {};\nfunction pluck (data, name) {\n const accessor = accessors[name] || (accessors[name] = field(name));\n return isArray(data) ? data.map(accessor) : accessor(data);\n}\n\nfunction array(seq) {\n return isArray(seq) || ArrayBuffer.isView(seq) ? seq : null;\n}\nfunction sequence(seq) {\n return array(seq) || (isString(seq) ? seq : null);\n}\nfunction join(seq) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n return array(seq).join(...args);\n}\nfunction indexof(seq) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n return sequence(seq).indexOf(...args);\n}\nfunction lastindexof(seq) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n return sequence(seq).lastIndexOf(...args);\n}\nfunction slice(seq) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n return sequence(seq).slice(...args);\n}\nfunction replace(str, pattern, repl) {\n if (isFunction(repl)) error('Function argument passed to replace.');\n return String(str).replace(pattern, repl);\n}\nfunction reverse(seq) {\n return array(seq).slice().reverse();\n}\n\nfunction bandspace(count, paddingInner, paddingOuter) {\n return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0);\n}\nfunction bandwidth(name, group) {\n const s = getScale(name, (group || this).context);\n return s && s.bandwidth ? s.bandwidth() : 0;\n}\nfunction copy(name, group) {\n const s = getScale(name, (group || this).context);\n return s ? s.copy() : undefined;\n}\nfunction domain(name, group) {\n const s = getScale(name, (group || this).context);\n return s ? s.domain() : [];\n}\nfunction invert(name, range, group) {\n const s = getScale(name, (group || this).context);\n return !s ? undefined : isArray(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range);\n}\nfunction range(name, group) {\n const s = getScale(name, (group || this).context);\n return s && s.range ? s.range() : [];\n}\nfunction scale(name, value, group) {\n const s = getScale(name, (group || this).context);\n return s ? s(value) : undefined;\n}\n\nfunction scaleGradient (scale, p0, p1, count, group) {\n scale = getScale(scale, (group || this).context);\n const gradient = Gradient(p0, p1);\n let stops = scale.domain(),\n min = stops[0],\n max = peek(stops),\n fraction = identity;\n if (!(max - min)) {\n // expand scale if domain has zero span, fix #1479\n scale = (scale.interpolator ? scale$1('sequential')().interpolator(scale.interpolator()) : scale$1('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([min = 0, max = 1]);\n } else {\n fraction = scaleFraction(scale, min, max);\n }\n if (scale.ticks) {\n stops = scale.ticks(+count || 15);\n if (min !== stops[0]) stops.unshift(min);\n if (max !== peek(stops)) stops.push(max);\n }\n stops.forEach(_ => gradient.stop(fraction(_), scale(_)));\n return gradient;\n}\n\nfunction geoShape(projection, geojson, group) {\n const p = getScale(projection, (group || this).context);\n return function (context) {\n return p ? p.path.context(context)(geojson) : '';\n };\n}\nfunction pathShape(path) {\n let p = null;\n return function (context) {\n return context ? pathRender(context, p = p || pathParse(path)) : path;\n };\n}\n\nconst datum = d => d.data;\nfunction treeNodes(name, context) {\n const tree = data.call(context, name);\n return tree.root && tree.root.lookup || {};\n}\nfunction treePath(name, source, target) {\n const nodes = treeNodes(name, this),\n s = nodes[source],\n t = nodes[target];\n return s && t ? s.path(t).map(datum) : undefined;\n}\nfunction treeAncestors(name, node) {\n const n = treeNodes(name, this)[node];\n return n ? n.ancestors().map(datum) : undefined;\n}\n\nconst _window = () => typeof window !== 'undefined' && window || null;\nfunction screen() {\n const w = _window();\n return w ? w.screen : {};\n}\nfunction windowSize() {\n const w = _window();\n return w ? [w.innerWidth, w.innerHeight] : [undefined, undefined];\n}\nfunction containerSize() {\n const view = this.context.dataflow,\n el = view.container && view.container();\n return el ? [el.clientWidth, el.clientHeight] : [undefined, undefined];\n}\n\nfunction intersect (b, opt, group) {\n if (!b) return [];\n const [u, v] = b,\n box = new Bounds().set(u[0], u[1], v[0], v[1]),\n scene = group || this.context.dataflow.scenegraph().root;\n return intersect$1(scene, box, filter(opt));\n}\nfunction filter(opt) {\n let p = null;\n if (opt) {\n const types = array$1(opt.marktype),\n names = array$1(opt.markname);\n p = _ => (!types.length || types.some(t => _.marktype === t)) && (!names.length || names.some(s => _.name === s));\n }\n return p;\n}\n\n/**\n * Appends a new point to the lasso\n *\n * @param {*} lasso the lasso in pixel space\n * @param {*} x the x coordinate in pixel space\n * @param {*} y the y coordinate in pixel space\n * @param {*} minDist the minimum distance, in pixels, that thenew point needs to be apart from the last point\n * @returns a new array containing the lasso with the new point\n */\nfunction lassoAppend(lasso, x, y) {\n let minDist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5;\n lasso = array$1(lasso);\n const last = lasso[lasso.length - 1];\n\n // Add point to lasso if its the first point or distance to last point exceed minDist\n return last === undefined || Math.hypot(last[0] - x, last[1] - y) > minDist ? [...lasso, [x, y]] : lasso;\n}\n\n/**\n * Generates a svg path command which draws a lasso\n *\n * @param {*} lasso the lasso in pixel space in the form [[x,y], [x,y], ...]\n * @returns the svg path command that draws the lasso\n */\nfunction lassoPath(lasso) {\n return array$1(lasso).reduce((svg, _ref, i) => {\n let [x, y] = _ref;\n return svg += i == 0 ? `M ${x},${y} ` : i === lasso.length - 1 ? ' Z' : `L ${x},${y} `;\n }, '');\n}\n\n/**\n * Inverts the lasso from pixel space to an array of vega scenegraph tuples\n *\n * @param {*} data the dataset\n * @param {*} pixelLasso the lasso in pixel space, [[x,y], [x,y], ...]\n * @param {*} unit the unit where the lasso is defined\n *\n * @returns an array of vega scenegraph tuples\n */\nfunction intersectLasso(markname, pixelLasso, unit) {\n const {\n x,\n y,\n mark\n } = unit;\n const bb = new Bounds().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER);\n\n // Get bounding box around lasso\n for (const [px, py] of pixelLasso) {\n if (px < bb.x1) bb.x1 = px;\n if (px > bb.x2) bb.x2 = px;\n if (py < bb.y1) bb.y1 = py;\n if (py > bb.y2) bb.y2 = py;\n }\n\n // Translate bb against unit coordinates\n bb.translate(x, y);\n const intersection = intersect([[bb.x1, bb.y1], [bb.x2, bb.y2]], markname, mark);\n\n // Check every point against the lasso\n return intersection.filter(tuple => pointInPolygon(tuple.x, tuple.y, pixelLasso));\n}\n\n/**\n * Performs a test if a point is inside a polygon based on the idea from\n * https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html\n *\n * This method will not need the same start/end point since it wraps around the edges of the array\n *\n * @param {*} test a point to test against\n * @param {*} polygon a polygon in the form [[x,y], [x,y], ...]\n * @returns true if the point lies inside the polygon, false otherwise\n */\nfunction pointInPolygon(testx, testy, polygon) {\n let intersections = 0;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const [prevX, prevY] = polygon[j];\n const [x, y] = polygon[i];\n\n // count intersections\n if (y > testy != prevY > testy && testx < (prevX - x) * (testy - y) / (prevY - y) + x) {\n intersections++;\n }\n }\n\n // point is in polygon if intersection count is odd\n return intersections & 1;\n}\n\n// Expression function context object\nconst functionContext = {\n random() {\n return random();\n },\n // override default\n cumulativeNormal,\n cumulativeLogNormal,\n cumulativeUniform,\n densityNormal,\n densityLogNormal,\n densityUniform,\n quantileNormal,\n quantileLogNormal,\n quantileUniform,\n sampleNormal,\n sampleLogNormal,\n sampleUniform,\n isArray,\n isBoolean,\n isDate,\n isDefined(_) {\n return _ !== undefined;\n },\n isNumber,\n isObject,\n isRegExp,\n isString,\n isTuple,\n isValid(_) {\n return _ != null && _ === _;\n },\n toBoolean,\n toDate(_) {\n return toDate(_);\n },\n // suppress extra arguments\n toNumber,\n toString,\n indexof,\n join,\n lastindexof,\n replace,\n reverse,\n slice,\n flush,\n lerp,\n merge,\n pad,\n peek,\n pluck,\n span,\n inrange,\n truncate,\n rgb,\n lab,\n hcl,\n hsl,\n luminance,\n contrast,\n sequence: range$1,\n format,\n utcFormat,\n utcParse,\n utcOffset,\n utcSequence,\n timeFormat,\n timeParse,\n timeOffset,\n timeSequence,\n timeUnitSpecifier,\n monthFormat,\n monthAbbrevFormat,\n dayFormat,\n dayAbbrevFormat,\n quarter,\n utcquarter,\n week,\n utcweek,\n dayofyear,\n utcdayofyear,\n warn,\n info,\n debug,\n extent(_) {\n return extent(_);\n },\n // suppress extra arguments\n inScope,\n intersect,\n clampRange,\n pinchDistance,\n pinchAngle,\n screen,\n containerSize,\n windowSize,\n bandspace,\n setdata,\n pathShape,\n panLinear,\n panLog,\n panPow,\n panSymlog,\n zoomLinear,\n zoomLog,\n zoomPow,\n zoomSymlog,\n encode,\n modify,\n lassoAppend,\n lassoPath,\n intersectLasso\n};\nconst eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'],\n // event functions\n eventPrefix = 'event.vega.',\n // event function prefix\n thisPrefix = 'this.',\n // function context prefix\n astVisitors = {}; // AST visitors for dependency analysis\n\n// export code generator parameters\nconst codegenParams = {\n forbidden: ['_'],\n allowed: ['datum', 'event', 'item'],\n fieldvar: 'datum',\n globalvar: id => `_[${stringValue(SignalPrefix + id)}]`,\n functions: buildFunctions,\n constants: constants,\n visitors: astVisitors\n};\n\n// export code generator\nconst codeGenerator = codegenExpression(codegenParams);\n\n// Build expression function registry\nfunction buildFunctions(codegen) {\n const fn = functions(codegen);\n eventFunctions.forEach(name => fn[name] = eventPrefix + name);\n for (const name in functionContext) {\n fn[name] = thisPrefix + name;\n }\n extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors));\n return fn;\n}\n\n// Register an expression function\nfunction expressionFunction(name, fn, visitor) {\n if (arguments.length === 1) {\n return functionContext[name];\n }\n\n // register with the functionContext\n functionContext[name] = fn;\n\n // if there is an astVisitor register that, too\n if (visitor) astVisitors[name] = visitor;\n\n // if the code generator has already been initialized,\n // we need to also register the function with it\n if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name;\n return this;\n}\n\n// register expression functions with ast visitors\nexpressionFunction('bandwidth', bandwidth, scaleVisitor);\nexpressionFunction('copy', copy, scaleVisitor);\nexpressionFunction('domain', domain, scaleVisitor);\nexpressionFunction('range', range, scaleVisitor);\nexpressionFunction('invert', invert, scaleVisitor);\nexpressionFunction('scale', scale, scaleVisitor);\nexpressionFunction('gradient', scaleGradient, scaleVisitor);\nexpressionFunction('geoArea', geoArea, scaleVisitor);\nexpressionFunction('geoBounds', geoBounds, scaleVisitor);\nexpressionFunction('geoCentroid', geoCentroid, scaleVisitor);\nexpressionFunction('geoShape', geoShape, scaleVisitor);\nexpressionFunction('geoScale', geoScale, scaleVisitor);\nexpressionFunction('indata', indata, indataVisitor);\nexpressionFunction('data', data, dataVisitor);\nexpressionFunction('treePath', treePath, dataVisitor);\nexpressionFunction('treeAncestors', treeAncestors, dataVisitor);\n\n// register Vega-Lite selection functions\nexpressionFunction('vlSelectionTest', selectionTest, selectionVisitor);\nexpressionFunction('vlSelectionIdTest', selectionIdTest, selectionVisitor);\nexpressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor);\nexpressionFunction('vlSelectionTuples', selectionTuples);\n\nfunction parser (expr, scope) {\n const params = {};\n\n // parse the expression to an abstract syntax tree (ast)\n let ast;\n try {\n expr = isString(expr) ? expr : stringValue(expr) + '';\n ast = parseExpression(expr);\n } catch (err) {\n error('Expression parse error: ' + expr);\n }\n\n // analyze ast function calls for dependencies\n ast.visit(node => {\n if (node.type !== CallExpression) return;\n const name = node.callee.name,\n visit = codegenParams.visitors[name];\n if (visit) visit(name, node.arguments, scope, params);\n });\n\n // perform code generation\n const gen = codeGenerator(ast);\n\n // collect signal dependencies\n gen.globals.forEach(name => {\n const signalName = SignalPrefix + name;\n if (!hasOwnProperty(params, signalName) && scope.getSignal(name)) {\n params[signalName] = scope.signalRef(name);\n }\n });\n\n // return generated expression code and dependencies\n return {\n $expr: extend({\n code: gen.code\n }, scope.options.ast ? {\n ast\n } : null),\n $fields: gen.fields,\n $params: params\n };\n}\n\nexport { DataPrefix, IndexPrefix, ScalePrefix, SignalPrefix, bandspace, bandwidth, codeGenerator, codegenParams, containerSize, contrast, copy, data, dataVisitor, dayAbbrevFormat, dayFormat, debug, domain, encode, expressionFunction, format, functionContext, geoArea, geoBounds, geoCentroid, geoScale, geoShape, inScope, indata, indataVisitor, indexof, info, invert, join, lastindexof, luminance, merge, modify, monthAbbrevFormat, monthFormat, parser as parseExpression, pathShape, pinchAngle, pinchDistance, pluck, range, replace, reverse, scale, scaleGradient, scaleVisitor, screen, setdata, slice, timeFormat, timeParse, treeAncestors, treePath, utcFormat, utcParse, warn, windowSize };\n","import { toSet, stringValue, error, isArray, isObject, hasOwnProperty, accessor, key, field, array, compare, truthy } from 'vega-util';\nimport { tupleid } from 'vega-dataflow';\n\n/**\n * Parse a serialized dataflow specification.\n */\nfunction parse (spec) {\n const ctx = this,\n operators = spec.operators || [];\n\n // parse background\n if (spec.background) {\n ctx.background = spec.background;\n }\n\n // parse event configuration\n if (spec.eventConfig) {\n ctx.eventConfig = spec.eventConfig;\n }\n\n // parse locale configuration\n if (spec.locale) {\n ctx.locale = spec.locale;\n }\n\n // parse operators\n operators.forEach(entry => ctx.parseOperator(entry));\n\n // parse operator parameters\n operators.forEach(entry => ctx.parseOperatorParameters(entry));\n\n // parse streams\n (spec.streams || []).forEach(entry => ctx.parseStream(entry));\n\n // parse updates\n (spec.updates || []).forEach(entry => ctx.parseUpdate(entry));\n return ctx.resolve();\n}\n\nconst Skip = toSet(['rule']),\n Swap = toSet(['group', 'image', 'rect']);\nfunction adjustSpatial(encode, marktype) {\n let code = '';\n if (Skip[marktype]) return code;\n if (encode.x2) {\n if (encode.x) {\n if (Swap[marktype]) {\n code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;';\n }\n code += 'o.width=o.x2-o.x;';\n } else {\n code += 'o.x=o.x2-(o.width||0);';\n }\n }\n if (encode.xc) {\n code += 'o.x=o.xc-(o.width||0)/2;';\n }\n if (encode.y2) {\n if (encode.y) {\n if (Swap[marktype]) {\n code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;';\n }\n code += 'o.height=o.y2-o.y;';\n } else {\n code += 'o.y=o.y2-(o.height||0);';\n }\n }\n if (encode.yc) {\n code += 'o.y=o.yc-(o.height||0)/2;';\n }\n return code;\n}\nfunction canonicalType(type) {\n return (type + '').toLowerCase();\n}\nfunction isOperator(type) {\n return canonicalType(type) === 'operator';\n}\nfunction isCollect(type) {\n return canonicalType(type) === 'collect';\n}\n\nfunction expression(ctx, args, code) {\n // wrap code in return statement if expression does not terminate\n if (!code.endsWith(';')) {\n code = 'return(' + code + ');';\n }\n const fn = Function(...args.concat(code));\n return ctx && ctx.functions ? fn.bind(ctx.functions) : fn;\n}\n\n// generate code for comparing a single field\nfunction _compare(u, v, lt, gt) {\n return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt}\n : (u > v || v == null) && u != null ? ${gt}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt}\n : v !== v && u === u ? ${gt} : `;\n}\nvar expressionCodegen = {\n /**\n * Parse an expression used to update an operator value.\n */\n operator: (ctx, expr) => expression(ctx, ['_'], expr.code),\n /**\n * Parse an expression provided as an operator parameter value.\n */\n parameter: (ctx, expr) => expression(ctx, ['datum', '_'], expr.code),\n /**\n * Parse an expression applied to an event stream.\n */\n event: (ctx, expr) => expression(ctx, ['event'], expr.code),\n /**\n * Parse an expression used to handle an event-driven operator update.\n */\n handler: (ctx, expr) => {\n const code = `var datum=event.item&&event.item.datum;return ${expr.code};`;\n return expression(ctx, ['_', 'event'], code);\n },\n /**\n * Parse an expression that performs visual encoding.\n */\n encode: (ctx, encode) => {\n const {\n marktype,\n channels\n } = encode;\n let code = 'var o=item,datum=o.datum,m=0,$;';\n for (const name in channels) {\n const o = 'o[' + stringValue(name) + ']';\n code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`;\n }\n code += adjustSpatial(channels, marktype);\n code += 'return m;';\n return expression(ctx, ['item', '_'], code);\n },\n /**\n * Optimized code generators for access and comparison.\n */\n codegen: {\n get(path) {\n const ref = `[${path.map(stringValue).join('][')}]`;\n const get = Function('_', `return _${ref};`);\n get.path = ref;\n return get;\n },\n comparator(fields, orders) {\n let t;\n const map = (f, i) => {\n const o = orders[i];\n let u, v;\n if (f.path) {\n u = `a${f.path}`;\n v = `b${f.path}`;\n } else {\n (t = t || {})['f' + i] = f;\n u = `this.f${i}(a)`;\n v = `this.f${i}(b)`;\n }\n return _compare(u, v, -o, o);\n };\n const fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;');\n return t ? fn.bind(t) : fn;\n }\n }\n};\n\n/**\n * Parse a dataflow operator.\n */\nfunction parseOperator(spec) {\n const ctx = this;\n if (isOperator(spec.type) || !spec.type) {\n ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null);\n } else {\n ctx.transform(spec, spec.type);\n }\n}\n\n/**\n * Parse and assign operator parameters.\n */\nfunction parseOperatorParameters(spec) {\n const ctx = this;\n if (spec.params) {\n const op = ctx.get(spec.id);\n if (!op) error('Invalid operator id: ' + spec.id);\n ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly));\n }\n}\n\n/**\n * Parse a set of operator parameters.\n */\nfunction parseParameters(spec, params) {\n params = params || {};\n const ctx = this;\n for (const key in spec) {\n const value = spec[key];\n params[key] = isArray(value) ? value.map(v => parseParameter(v, ctx, params)) : parseParameter(value, ctx, params);\n }\n return params;\n}\n\n/**\n * Parse a single parameter.\n */\nfunction parseParameter(spec, ctx, params) {\n if (!spec || !isObject(spec)) return spec;\n for (let i = 0, n = PARSERS.length, p; i < n; ++i) {\n p = PARSERS[i];\n if (hasOwnProperty(spec, p.key)) {\n return p.parse(spec, ctx, params);\n }\n }\n return spec;\n}\n\n/** Reference parsers. */\nvar PARSERS = [{\n key: '$ref',\n parse: getOperator\n}, {\n key: '$key',\n parse: getKey\n}, {\n key: '$expr',\n parse: getExpression\n}, {\n key: '$field',\n parse: getField\n}, {\n key: '$encode',\n parse: getEncode\n}, {\n key: '$compare',\n parse: getCompare\n}, {\n key: '$context',\n parse: getContext\n}, {\n key: '$subflow',\n parse: getSubflow\n}, {\n key: '$tupleid',\n parse: getTupleId\n}];\n\n/**\n * Resolve an operator reference.\n */\nfunction getOperator(_, ctx) {\n return ctx.get(_.$ref) || error('Operator not defined: ' + _.$ref);\n}\n\n/**\n * Resolve an expression reference.\n */\nfunction getExpression(_, ctx, params) {\n if (_.$params) {\n // parse expression parameters\n ctx.parseParameters(_.$params, params);\n }\n const k = 'e:' + _.$expr.code;\n return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields));\n}\n\n/**\n * Resolve a key accessor reference.\n */\nfunction getKey(_, ctx) {\n const k = 'k:' + _.$key + '_' + !!_.$flat;\n return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat, ctx.expr.codegen));\n}\n\n/**\n * Resolve a field accessor reference.\n */\nfunction getField(_, ctx) {\n if (!_.$field) return null;\n const k = 'f:' + _.$field + '_' + _.$name;\n return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name, ctx.expr.codegen));\n}\n\n/**\n * Resolve a comparator function reference.\n */\nfunction getCompare(_, ctx) {\n // As of Vega 5.5.3, $tupleid sort is no longer used.\n // Keep here for now for backwards compatibility.\n const k = 'c:' + _.$compare + '_' + _.$order,\n c = array(_.$compare).map(_ => _ && _.$tupleid ? tupleid : _);\n return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen));\n}\n\n/**\n * Resolve an encode operator reference.\n */\nfunction getEncode(_, ctx) {\n const spec = _.$encode,\n encode = {};\n for (const name in spec) {\n const enc = spec[name];\n encode[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields);\n encode[name].output = enc.$output;\n }\n return encode;\n}\n\n/**\n * Resolve a context reference.\n */\nfunction getContext(_, ctx) {\n return ctx;\n}\n\n/**\n * Resolve a recursive subflow specification.\n */\nfunction getSubflow(_, ctx) {\n const spec = _.$subflow;\n return function (dataflow, key, parent) {\n const subctx = ctx.fork().parse(spec),\n op = subctx.get(spec.operators[0].id),\n p = subctx.signals.parent;\n if (p) p.set(parent);\n op.detachSubflow = () => ctx.detach(subctx);\n return op;\n };\n}\n\n/**\n * Resolve a tuple id reference.\n */\nfunction getTupleId() {\n return tupleid;\n}\n\n/**\n * Parse an event stream specification.\n */\nfunction parseStream (spec) {\n var ctx = this,\n filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined,\n stream = spec.stream != null ? ctx.get(spec.stream) : undefined,\n args;\n if (spec.source) {\n stream = ctx.events(spec.source, spec.type, filter);\n } else if (spec.merge) {\n args = spec.merge.map(_ => ctx.get(_));\n stream = args[0].merge.apply(args[0], args.slice(1));\n }\n if (spec.between) {\n args = spec.between.map(_ => ctx.get(_));\n stream = stream.between(args[0], args[1]);\n }\n if (spec.filter) {\n stream = stream.filter(filter);\n }\n if (spec.throttle != null) {\n stream = stream.throttle(+spec.throttle);\n }\n if (spec.debounce != null) {\n stream = stream.debounce(+spec.debounce);\n }\n if (stream == null) {\n error('Invalid stream definition: ' + JSON.stringify(spec));\n }\n if (spec.consume) stream.consume(true);\n ctx.stream(spec, stream);\n}\n\n/**\n * Parse an event-driven operator update.\n */\nfunction parseUpdate (spec) {\n var ctx = this,\n srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid,\n source = ctx.get(srcid),\n target = null,\n update = spec.update,\n params = undefined;\n if (!source) error('Source not defined: ' + spec.source);\n target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target);\n if (update && update.$expr) {\n if (update.$params) {\n params = ctx.parseParameters(update.$params);\n }\n update = ctx.handlerExpression(update.$expr);\n }\n ctx.update(spec, source, target, update, params);\n}\n\nconst SKIP = {\n skip: true\n};\nfunction getState(options) {\n var ctx = this,\n state = {};\n if (options.signals) {\n var signals = state.signals = {};\n Object.keys(ctx.signals).forEach(key => {\n const op = ctx.signals[key];\n if (options.signals(key, op)) {\n signals[key] = op.value;\n }\n });\n }\n if (options.data) {\n var data = state.data = {};\n Object.keys(ctx.data).forEach(key => {\n const dataset = ctx.data[key];\n if (options.data(key, dataset)) {\n data[key] = dataset.input.value;\n }\n });\n }\n if (ctx.subcontext && options.recurse !== false) {\n state.subcontext = ctx.subcontext.map(ctx => ctx.getState(options));\n }\n return state;\n}\nfunction setState(state) {\n var ctx = this,\n df = ctx.dataflow,\n data = state.data,\n signals = state.signals;\n Object.keys(signals || {}).forEach(key => {\n df.update(ctx.signals[key], signals[key], SKIP);\n });\n Object.keys(data || {}).forEach(key => {\n df.pulse(ctx.data[key].input, df.changeset().remove(truthy).insert(data[key]));\n });\n (state.subcontext || []).forEach((substate, i) => {\n const subctx = ctx.subcontext[i];\n if (subctx) subctx.setState(substate);\n });\n}\n\n/**\n * Context objects store the current parse state.\n * Enables lookup of parsed operators, event streams, accessors, etc.\n * Provides a 'fork' method for creating child contexts for subflows.\n */\nfunction context (df, transforms, functions, expr) {\n return new Context(df, transforms, functions, expr);\n}\nfunction Context(df, transforms, functions, expr) {\n this.dataflow = df;\n this.transforms = transforms;\n this.events = df.events.bind(df);\n this.expr = expr || expressionCodegen, this.signals = {};\n this.scales = {};\n this.nodes = {};\n this.data = {};\n this.fn = {};\n if (functions) {\n this.functions = Object.create(functions);\n this.functions.context = this;\n }\n}\nfunction Subcontext(ctx) {\n this.dataflow = ctx.dataflow;\n this.transforms = ctx.transforms;\n this.events = ctx.events;\n this.expr = ctx.expr;\n this.signals = Object.create(ctx.signals);\n this.scales = Object.create(ctx.scales);\n this.nodes = Object.create(ctx.nodes);\n this.data = Object.create(ctx.data);\n this.fn = Object.create(ctx.fn);\n if (ctx.functions) {\n this.functions = Object.create(ctx.functions);\n this.functions.context = this;\n }\n}\nContext.prototype = Subcontext.prototype = {\n fork() {\n const ctx = new Subcontext(this);\n (this.subcontext || (this.subcontext = [])).push(ctx);\n return ctx;\n },\n detach(ctx) {\n this.subcontext = this.subcontext.filter(c => c !== ctx);\n\n // disconnect all nodes in the subcontext\n // wipe out targets first for better efficiency\n const keys = Object.keys(ctx.nodes);\n for (const key of keys) ctx.nodes[key]._targets = null;\n for (const key of keys) ctx.nodes[key].detach();\n ctx.nodes = null;\n },\n get(id) {\n return this.nodes[id];\n },\n set(id, node) {\n return this.nodes[id] = node;\n },\n add(spec, op) {\n const ctx = this,\n df = ctx.dataflow,\n data = spec.value;\n ctx.set(spec.id, op);\n if (isCollect(spec.type) && data) {\n if (data.$ingest) {\n df.ingest(op, data.$ingest, data.$format);\n } else if (data.$request) {\n df.preload(op, data.$request, data.$format);\n } else {\n df.pulse(op, df.changeset().insert(data));\n }\n }\n if (spec.root) {\n ctx.root = op;\n }\n if (spec.parent) {\n let p = ctx.get(spec.parent.$ref);\n if (p) {\n df.connect(p, [op]);\n op.targets().add(p);\n } else {\n (ctx.unresolved = ctx.unresolved || []).push(() => {\n p = ctx.get(spec.parent.$ref);\n df.connect(p, [op]);\n op.targets().add(p);\n });\n }\n }\n if (spec.signal) {\n ctx.signals[spec.signal] = op;\n }\n if (spec.scale) {\n ctx.scales[spec.scale] = op;\n }\n if (spec.data) {\n for (const name in spec.data) {\n const data = ctx.data[name] || (ctx.data[name] = {});\n spec.data[name].forEach(role => data[role] = op);\n }\n }\n },\n resolve() {\n (this.unresolved || []).forEach(fn => fn());\n delete this.unresolved;\n return this;\n },\n operator(spec, update) {\n this.add(spec, this.dataflow.add(spec.value, update));\n },\n transform(spec, type) {\n this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)]));\n },\n stream(spec, stream) {\n this.set(spec.id, stream);\n },\n update(spec, stream, target, update, params) {\n this.dataflow.on(stream, target, update, params, spec.options);\n },\n // expression parsing\n operatorExpression(expr) {\n return this.expr.operator(this, expr);\n },\n parameterExpression(expr) {\n return this.expr.parameter(this, expr);\n },\n eventExpression(expr) {\n return this.expr.event(this, expr);\n },\n handlerExpression(expr) {\n return this.expr.handler(this, expr);\n },\n encodeExpression(encode) {\n return this.expr.encode(this, encode);\n },\n // parse methods\n parse,\n parseOperator,\n parseOperatorParameters,\n parseParameters,\n parseStream,\n parseUpdate,\n // state methods\n getState,\n setState\n};\n\nexport { context };\n","import { isString, hasOwnProperty, error, truthy, constant, extend, array, isObject, isArray, toSet, debounce, isDate, inherits, stringValue } from 'vega-util';\nimport { changeset, isChangeSet, EventStream, transforms, Dataflow, asyncCallback } from 'vega-dataflow';\nimport { point, renderModule, CanvasHandler, RenderType, Scenegraph } from 'vega-scenegraph';\nimport { tickStep } from 'd3-array';\nimport { functionContext } from 'vega-functions';\nimport { context } from 'vega-runtime';\nimport { interval } from 'd3-timer';\nimport { locale } from 'vega-format';\n\n// initialize aria role and label attributes\nfunction initializeAria(view) {\n const el = view.container();\n if (el) {\n el.setAttribute('role', 'graphics-document');\n el.setAttribute('aria-roleDescription', 'visualization');\n ariaLabel(el, view.description());\n }\n}\n\n// update aria-label if we have a DOM container element\nfunction ariaLabel(el, desc) {\n if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc);\n}\n\nfunction background (view) {\n // respond to background signal\n view.add(null, _ => {\n view._background = _.bg;\n view._resize = 1;\n return _.bg;\n }, {\n bg: view._signals.background\n });\n}\n\nconst Default = 'default';\nfunction cursor (view) {\n // get cursor signal, add to dataflow if needed\n const cursor = view._signals.cursor || (view._signals.cursor = view.add({\n user: Default,\n item: null\n }));\n\n // evaluate cursor on each mousemove event\n view.on(view.events('view', 'mousemove'), cursor, (_, event) => {\n const value = cursor.value,\n user = value ? isString(value) ? value : value.user : Default,\n item = event.item && event.item.cursor || null;\n return value && user === value.user && item == value.item ? value : {\n user: user,\n item: item\n };\n });\n\n // when cursor signal updates, set visible cursor\n view.add(null, function (_) {\n let user = _.cursor,\n item = this.value;\n if (!isString(user)) {\n item = user.item;\n user = user.user;\n }\n setCursor(view, user && user !== Default ? user : item || user);\n return item;\n }, {\n cursor: cursor\n });\n}\nfunction setCursor(view, cursor) {\n const el = view.globalCursor() ? typeof document !== 'undefined' && document.body : view.container();\n if (el) {\n return cursor == null ? el.style.removeProperty('cursor') : el.style.cursor = cursor;\n }\n}\n\nfunction dataref(view, name) {\n var data = view._runtime.data;\n if (!hasOwnProperty(data, name)) {\n error('Unrecognized data set: ' + name);\n }\n return data[name];\n}\nfunction data(name, values) {\n return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(truthy).insert(values));\n}\nfunction change(name, changes) {\n if (!isChangeSet(changes)) {\n error('Second argument to changes must be a changeset.');\n }\n const dataset = dataref(this, name);\n dataset.modified = true;\n return this.pulse(dataset.input, changes);\n}\nfunction insert(name, _) {\n return change.call(this, name, changeset().insert(_));\n}\nfunction remove(name, _) {\n return change.call(this, name, changeset().remove(_));\n}\n\nfunction width(view) {\n var padding = view.padding();\n return Math.max(0, view._viewWidth + padding.left + padding.right);\n}\nfunction height(view) {\n var padding = view.padding();\n return Math.max(0, view._viewHeight + padding.top + padding.bottom);\n}\nfunction offset(view) {\n var padding = view.padding(),\n origin = view._origin;\n return [padding.left + origin[0], padding.top + origin[1]];\n}\nfunction resizeRenderer(view) {\n var origin = offset(view),\n w = width(view),\n h = height(view);\n view._renderer.background(view.background());\n view._renderer.resize(w, h, origin);\n view._handler.origin(origin);\n view._resizeListeners.forEach(handler => {\n try {\n handler(w, h);\n } catch (error) {\n view.error(error);\n }\n });\n}\n\n/**\n * Extend an event with additional view-specific methods.\n * Adds a new property ('vega') to an event that provides a number\n * of methods for querying information about the current interaction.\n * The vega object provides the following methods:\n * view - Returns the backing View instance.\n * item - Returns the currently active scenegraph item (if any).\n * group - Returns the currently active scenegraph group (if any).\n * This method accepts a single string-typed argument indicating the name\n * of the desired parent group. The scenegraph will be traversed from\n * the item up towards the root to search for a matching group. If no\n * argument is provided the enclosing group for the active item is\n * returned, unless the item it itself a group, in which case it is\n * returned directly.\n * xy - Returns a two-element array containing the x and y coordinates for\n * mouse or touch events. For touch events, this is based on the first\n * elements in the changedTouches array. This method accepts a single\n * argument: either an item instance or mark name that should serve as\n * the reference coordinate system. If no argument is provided the\n * top-level view coordinate system is assumed.\n * x - Returns the current x-coordinate, accepts the same arguments as xy.\n * y - Returns the current y-coordinate, accepts the same arguments as xy.\n * @param {Event} event - The input event to extend.\n * @param {Item} item - The currently active scenegraph item (if any).\n * @return {Event} - The extended input event.\n */\nfunction eventExtend (view, event, item) {\n var r = view._renderer,\n el = r && r.canvas(),\n p,\n e,\n translate;\n if (el) {\n translate = offset(view);\n e = event.changedTouches ? event.changedTouches[0] : event;\n p = point(e, el);\n p[0] -= translate[0];\n p[1] -= translate[1];\n }\n event.dataflow = view;\n event.item = item;\n event.vega = extension(view, item, p);\n return event;\n}\nfunction extension(view, item, point) {\n const itemGroup = item ? item.mark.marktype === 'group' ? item : item.mark.group : null;\n function group(name) {\n var g = itemGroup,\n i;\n if (name) for (i = item; i; i = i.mark.group) {\n if (i.mark.name === name) {\n g = i;\n break;\n }\n }\n return g && g.mark && g.mark.interactive ? g : {};\n }\n function xy(item) {\n if (!item) return point;\n if (isString(item)) item = group(item);\n const p = point.slice();\n while (item) {\n p[0] -= item.x || 0;\n p[1] -= item.y || 0;\n item = item.mark && item.mark.group;\n }\n return p;\n }\n return {\n view: constant(view),\n item: constant(item || {}),\n group: group,\n xy: xy,\n x: item => xy(item)[0],\n y: item => xy(item)[1]\n };\n}\n\nconst VIEW = 'view',\n TIMER = 'timer',\n WINDOW = 'window',\n NO_TRAP = {\n trap: false\n };\n\n/**\n * Initialize event handling configuration.\n * @param {object} config - The configuration settings.\n * @return {object}\n */\nfunction initializeEventConfig(config) {\n const events = extend({\n defaults: {}\n }, config);\n const unpack = (obj, keys) => {\n keys.forEach(k => {\n if (isArray(obj[k])) obj[k] = toSet(obj[k]);\n });\n };\n unpack(events.defaults, ['prevent', 'allow']);\n unpack(events, ['view', 'window', 'selector']);\n return events;\n}\nfunction trackEventListener(view, sources, type, handler) {\n view._eventListeners.push({\n type: type,\n sources: array(sources),\n handler: handler\n });\n}\nfunction prevent(view, type) {\n var def = view._eventConfig.defaults,\n prevent = def.prevent,\n allow = def.allow;\n return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault();\n}\nfunction permit(view, key, type) {\n const rule = view._eventConfig && view._eventConfig[key];\n if (rule === false || isObject(rule) && !rule[type]) {\n view.warn(`Blocked ${key} ${type} event listener.`);\n return false;\n }\n return true;\n}\n\n/**\n * Create a new event stream from an event source.\n * @param {object} source - The event source to monitor.\n * @param {string} type - The event type.\n * @param {function(object): boolean} [filter] - Event filter function.\n * @return {EventStream}\n */\nfunction events(source, type, filter) {\n var view = this,\n s = new EventStream(filter),\n send = function (e, item) {\n view.runAsync(null, () => {\n if (source === VIEW && prevent(view, type)) {\n e.preventDefault();\n }\n s.receive(eventExtend(view, e, item));\n });\n },\n sources;\n if (source === TIMER) {\n if (permit(view, 'timer', type)) {\n view.timer(send, type);\n }\n } else if (source === VIEW) {\n if (permit(view, 'view', type)) {\n // send traps errors, so use {trap: false} option\n view.addEventListener(type, send, NO_TRAP);\n }\n } else {\n if (source === WINDOW) {\n if (permit(view, 'window', type) && typeof window !== 'undefined') {\n sources = [window];\n }\n } else if (typeof document !== 'undefined') {\n if (permit(view, 'selector', type)) {\n sources = Array.from(document.querySelectorAll(source));\n }\n }\n if (!sources) {\n view.warn('Can not resolve event source: ' + source);\n } else {\n for (var i = 0, n = sources.length; i < n; ++i) {\n sources[i].addEventListener(type, send);\n }\n trackEventListener(view, sources, type, send);\n }\n }\n return s;\n}\n\nfunction itemFilter(event) {\n return event.item;\n}\nfunction markTarget(event) {\n // grab upstream collector feeding the mark operator\n return event.item.mark.source;\n}\nfunction invoke(name) {\n return function (_, event) {\n return event.vega.view().changeset().encode(event.item, name);\n };\n}\nfunction hover (hoverSet, leaveSet) {\n hoverSet = [hoverSet || 'hover'];\n leaveSet = [leaveSet || 'update', hoverSet[0]];\n\n // invoke hover set upon mouseover\n this.on(this.events('view', 'mouseover', itemFilter), markTarget, invoke(hoverSet));\n\n // invoke leave set upon mouseout\n this.on(this.events('view', 'mouseout', itemFilter), markTarget, invoke(leaveSet));\n return this;\n}\n\n/**\n * Finalize a View instance that is being removed.\n * Cancel any running timers.\n * Remove all external event listeners.\n * Remove any currently displayed tooltip.\n */\nfunction finalize () {\n var tooltip = this._tooltip,\n timers = this._timers,\n listeners = this._eventListeners,\n n,\n m,\n e;\n n = timers.length;\n while (--n >= 0) {\n timers[n].stop();\n }\n n = listeners.length;\n while (--n >= 0) {\n e = listeners[n];\n m = e.sources.length;\n while (--m >= 0) {\n e.sources[m].removeEventListener(e.type, e.handler);\n }\n }\n if (tooltip) {\n tooltip.call(this, this._handler, null, null, null);\n }\n return this;\n}\n\nfunction element (tag, attr, text) {\n const el = document.createElement(tag);\n for (const key in attr) el.setAttribute(key, attr[key]);\n if (text != null) el.textContent = text;\n return el;\n}\n\nconst BindClass = 'vega-bind',\n NameClass = 'vega-bind-name',\n RadioClass = 'vega-bind-radio';\n\n/**\n * Bind a signal to an external HTML input element. The resulting two-way\n * binding will propagate input changes to signals, and propagate signal\n * changes to the input element state. If this view instance has no parent\n * element, we assume the view is headless and no bindings are created.\n * @param {Element|string} el - The parent DOM element to which the input\n * element should be appended as a child. If string-valued, this argument\n * will be treated as a CSS selector. If null or undefined, the parent\n * element of this view will be used as the element.\n * @param {object} param - The binding parameters which specify the signal\n * to bind to, the input element type, and type-specific configuration.\n * @return {View} - This view instance.\n */\nfunction bind (view, el, binding) {\n if (!el) return;\n const param = binding.param;\n let bind = binding.state;\n if (!bind) {\n bind = binding.state = {\n elements: null,\n active: false,\n set: null,\n update: value => {\n if (value != view.signal(param.signal)) {\n view.runAsync(null, () => {\n bind.source = true;\n view.signal(param.signal, value);\n });\n }\n }\n };\n if (param.debounce) {\n bind.update = debounce(param.debounce, bind.update);\n }\n }\n const create = param.input == null && param.element ? target : generate;\n create(bind, el, param, view);\n if (!bind.active) {\n view.on(view._signals[param.signal], null, () => {\n bind.source ? bind.source = false : bind.set(view.signal(param.signal));\n });\n bind.active = true;\n }\n return bind;\n}\n\n/**\n * Bind the signal to an external EventTarget.\n */\nfunction target(bind, node, param, view) {\n const type = param.event || 'input';\n const handler = () => bind.update(node.value);\n\n // initialize signal value to external input value\n view.signal(param.signal, node.value);\n\n // listen for changes on the element\n node.addEventListener(type, handler);\n\n // register with view, so we can remove it upon finalization\n trackEventListener(view, node, type, handler);\n\n // propagate change to element\n bind.set = value => {\n node.value = value;\n node.dispatchEvent(event(type));\n };\n}\nfunction event(type) {\n return typeof Event !== 'undefined' ? new Event(type) : {\n type\n };\n}\n\n/**\n * Generate an HTML input form element and bind it to a signal.\n */\nfunction generate(bind, el, param, view) {\n const value = view.signal(param.signal);\n const div = element('div', {\n 'class': BindClass\n });\n const wrapper = param.input === 'radio' ? div : div.appendChild(element('label'));\n wrapper.appendChild(element('span', {\n 'class': NameClass\n }, param.name || param.signal));\n el.appendChild(div);\n let input = form;\n switch (param.input) {\n case 'checkbox':\n input = checkbox;\n break;\n case 'select':\n input = select;\n break;\n case 'radio':\n input = radio;\n break;\n case 'range':\n input = range;\n break;\n }\n input(bind, wrapper, param, value);\n}\n\n/**\n * Generates an arbitrary input form element.\n * The input type is controlled via user-provided parameters.\n */\nfunction form(bind, el, param, value) {\n const node = element('input');\n for (const key in param) {\n if (key !== 'signal' && key !== 'element') {\n node.setAttribute(key === 'input' ? 'type' : key, param[key]);\n }\n }\n node.setAttribute('name', param.signal);\n node.value = value;\n el.appendChild(node);\n node.addEventListener('input', () => bind.update(node.value));\n bind.elements = [node];\n bind.set = value => node.value = value;\n}\n\n/**\n * Generates a checkbox input element.\n */\nfunction checkbox(bind, el, param, value) {\n const attr = {\n type: 'checkbox',\n name: param.signal\n };\n if (value) attr.checked = true;\n const node = element('input', attr);\n el.appendChild(node);\n node.addEventListener('change', () => bind.update(node.checked));\n bind.elements = [node];\n bind.set = value => node.checked = !!value || null;\n}\n\n/**\n * Generates a selection list input element.\n */\nfunction select(bind, el, param, value) {\n const node = element('select', {\n name: param.signal\n }),\n labels = param.labels || [];\n param.options.forEach((option, i) => {\n const attr = {\n value: option\n };\n if (valuesEqual(option, value)) attr.selected = true;\n node.appendChild(element('option', attr, (labels[i] || option) + ''));\n });\n el.appendChild(node);\n node.addEventListener('change', () => {\n bind.update(param.options[node.selectedIndex]);\n });\n bind.elements = [node];\n bind.set = value => {\n for (let i = 0, n = param.options.length; i < n; ++i) {\n if (valuesEqual(param.options[i], value)) {\n node.selectedIndex = i;\n return;\n }\n }\n };\n}\n\n/**\n * Generates a radio button group.\n */\nfunction radio(bind, el, param, value) {\n const group = element('span', {\n 'class': RadioClass\n }),\n labels = param.labels || [];\n el.appendChild(group);\n bind.elements = param.options.map((option, i) => {\n const attr = {\n type: 'radio',\n name: param.signal,\n value: option\n };\n if (valuesEqual(option, value)) attr.checked = true;\n const input = element('input', attr);\n input.addEventListener('change', () => bind.update(option));\n const label = element('label', {}, (labels[i] || option) + '');\n label.prepend(input);\n group.appendChild(label);\n return input;\n });\n bind.set = value => {\n const nodes = bind.elements,\n n = nodes.length;\n for (let i = 0; i < n; ++i) {\n if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true;\n }\n };\n}\n\n/**\n * Generates a slider input element.\n */\nfunction range(bind, el, param, value) {\n value = value !== undefined ? value : (+param.max + +param.min) / 2;\n const max = param.max != null ? param.max : Math.max(100, +value) || 100,\n min = param.min || Math.min(0, max, +value) || 0,\n step = param.step || tickStep(min, max, 100);\n const node = element('input', {\n type: 'range',\n name: param.signal,\n min: min,\n max: max,\n step: step\n });\n node.value = value;\n const span = element('span', {}, +value);\n el.appendChild(node);\n el.appendChild(span);\n const update = () => {\n span.textContent = node.value;\n bind.update(+node.value);\n };\n\n // subscribe to both input and change\n node.addEventListener('input', update);\n node.addEventListener('change', update);\n bind.elements = [node];\n bind.set = value => {\n node.value = value;\n span.textContent = value;\n };\n}\nfunction valuesEqual(a, b) {\n return a === b || a + '' === b + '';\n}\n\nfunction initializeRenderer (view, r, el, constructor, scaleFactor, opt) {\n r = r || new constructor(view.loader());\n return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background());\n}\n\nfunction trap (view, fn) {\n return !fn ? null : function () {\n try {\n fn.apply(this, arguments);\n } catch (error) {\n view.error(error);\n }\n };\n}\n\nfunction initializeHandler (view, prevHandler, el, constructor) {\n // instantiate scenegraph handler\n const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view);\n\n // transfer event handlers\n if (prevHandler) {\n prevHandler.handlers().forEach(h => {\n handler.on(h.type, h.handler);\n });\n }\n return handler;\n}\n\nfunction initialize (el, elBind) {\n const view = this,\n type = view._renderType,\n config = view._eventConfig.bind,\n module = renderModule(type);\n\n // containing dom element\n el = view._el = el ? lookup(view, el, true) : null;\n\n // initialize aria attributes\n initializeAria(view);\n\n // select appropriate renderer & handler\n if (!module) view.error('Unrecognized renderer type: ' + type);\n const Handler = module.handler || CanvasHandler,\n Renderer = el ? module.renderer : module.headless;\n\n // initialize renderer and input handler\n view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer);\n view._handler = initializeHandler(view, view._handler, el, Handler);\n view._redraw = true;\n\n // initialize signal bindings\n if (el && config !== 'none') {\n elBind = elBind ? view._elBind = lookup(view, elBind, true) : el.appendChild(element('form', {\n 'class': 'vega-bindings'\n }));\n view._bind.forEach(_ => {\n if (_.param.element && config !== 'container') {\n _.element = lookup(view, _.param.element, !!_.param.input);\n }\n });\n view._bind.forEach(_ => {\n bind(view, _.element || elBind, _);\n });\n }\n return view;\n}\nfunction lookup(view, el, clear) {\n if (typeof el === 'string') {\n if (typeof document !== 'undefined') {\n el = document.querySelector(el);\n if (!el) {\n view.error('Signal bind element not found: ' + el);\n return null;\n }\n } else {\n view.error('DOM document instance not found.');\n return null;\n }\n }\n if (el && clear) {\n try {\n el.textContent = '';\n } catch (e) {\n el = null;\n view.error(e);\n }\n }\n return el;\n}\n\nconst number = _ => +_ || 0;\nconst paddingObject = _ => ({\n top: _,\n bottom: _,\n left: _,\n right: _\n});\nfunction padding (_) {\n return isObject(_) ? {\n top: number(_.top),\n bottom: number(_.bottom),\n left: number(_.left),\n right: number(_.right)\n } : paddingObject(number(_));\n}\n\n/**\n * Render the current scene in a headless fashion.\n * This method is asynchronous, returning a Promise instance.\n * @return {Promise} - A Promise that resolves to a renderer.\n */\nasync function renderHeadless (view, type, scaleFactor, opt) {\n const module = renderModule(type),\n ctr = module && module.headless;\n if (!ctr) error('Unrecognized renderer type: ' + type);\n await view.runAsync();\n return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root);\n}\n\n/**\n * Produce an image URL for the visualization. Depending on the type\n * parameter, the generated URL contains data for either a PNG or SVG image.\n * The URL can be used (for example) to download images of the visualization.\n * This method is asynchronous, returning a Promise instance.\n * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'.\n * The 'canvas' and 'png' types are synonyms for a PNG image.\n * @return {Promise} - A promise that resolves to an image URL.\n */\nasync function renderToImageURL (type, scaleFactor) {\n if (type !== RenderType.Canvas && type !== RenderType.SVG && type !== RenderType.PNG) {\n error('Unrecognized image type: ' + type);\n }\n const r = await renderHeadless(this, type, scaleFactor);\n return type === RenderType.SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png');\n}\nfunction toBlobURL(data, mime) {\n const blob = new Blob([data], {\n type: mime\n });\n return window.URL.createObjectURL(blob);\n}\n\n/**\n * Produce a Canvas instance containing a rendered visualization.\n * This method is asynchronous, returning a Promise instance.\n * @return {Promise} - A promise that resolves to a Canvas instance.\n */\nasync function renderToCanvas (scaleFactor, opt) {\n const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt);\n return r.canvas();\n}\n\n/**\n * Produce a rendered SVG string of the visualization.\n * This method is asynchronous, returning a Promise instance.\n * @return {Promise} - A promise that resolves to an SVG string.\n */\nasync function renderToSVG (scaleFactor) {\n const r = await renderHeadless(this, RenderType.SVG, scaleFactor);\n return r.svg();\n}\n\nfunction runtime (view, spec, expr) {\n return context(view, transforms, functionContext, expr).parse(spec);\n}\n\nfunction scale(name) {\n var scales = this._runtime.scales;\n if (!hasOwnProperty(scales, name)) {\n error('Unrecognized scale or projection: ' + name);\n }\n return scales[name].value;\n}\n\nvar Width = 'width',\n Height = 'height',\n Padding = 'padding',\n Skip = {\n skip: true\n };\nfunction viewWidth(view, width) {\n var a = view.autosize(),\n p = view.padding();\n return width - (a && a.contains === Padding ? p.left + p.right : 0);\n}\nfunction viewHeight(view, height) {\n var a = view.autosize(),\n p = view.padding();\n return height - (a && a.contains === Padding ? p.top + p.bottom : 0);\n}\nfunction initializeResize(view) {\n var s = view._signals,\n w = s[Width],\n h = s[Height],\n p = s[Padding];\n function resetSize() {\n view._autosize = view._resize = 1;\n }\n\n // respond to width signal\n view._resizeWidth = view.add(null, _ => {\n view._width = _.size;\n view._viewWidth = viewWidth(view, _.size);\n resetSize();\n }, {\n size: w\n });\n\n // respond to height signal\n view._resizeHeight = view.add(null, _ => {\n view._height = _.size;\n view._viewHeight = viewHeight(view, _.size);\n resetSize();\n }, {\n size: h\n });\n\n // respond to padding signal\n const resizePadding = view.add(null, resetSize, {\n pad: p\n });\n\n // set rank to run immediately after source signal\n view._resizeWidth.rank = w.rank + 1;\n view._resizeHeight.rank = h.rank + 1;\n resizePadding.rank = p.rank + 1;\n}\nfunction resizeView(viewWidth, viewHeight, width, height, origin, auto) {\n this.runAfter(view => {\n let rerun = 0;\n\n // reset autosize flag\n view._autosize = 0;\n\n // width value changed: update signal, skip resize op\n if (view.width() !== width) {\n rerun = 1;\n view.signal(Width, width, Skip); // set width, skip update calc\n view._resizeWidth.skip(true); // skip width resize handler\n }\n\n // height value changed: update signal, skip resize op\n if (view.height() !== height) {\n rerun = 1;\n view.signal(Height, height, Skip); // set height, skip update calc\n view._resizeHeight.skip(true); // skip height resize handler\n }\n\n // view width changed: update view property, set resize flag\n if (view._viewWidth !== viewWidth) {\n view._resize = 1;\n view._viewWidth = viewWidth;\n }\n\n // view height changed: update view property, set resize flag\n if (view._viewHeight !== viewHeight) {\n view._resize = 1;\n view._viewHeight = viewHeight;\n }\n\n // origin changed: update view property, set resize flag\n if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) {\n view._resize = 1;\n view._origin = origin;\n }\n\n // run dataflow on width/height signal change\n if (rerun) view.run('enter');\n if (auto) view.runAfter(v => v.resize());\n }, false, 1);\n}\n\n/**\n * Get the current view state, consisting of signal values and/or data sets.\n * @param {object} [options] - Options flags indicating which state to export.\n * If unspecified, all signals and data sets will be exported.\n * @param {function(string, Operator):boolean} [options.signals] - Optional\n * predicate function for testing if a signal should be included in the\n * exported state. If unspecified, all signals will be included, except for\n * those named 'parent' or those which refer to a Transform value.\n * @param {function(string, object):boolean} [options.data] - Optional\n * predicate function for testing if a data set's input should be included\n * in the exported state. If unspecified, all data sets that have been\n * explicitly modified will be included.\n * @param {boolean} [options.recurse=true] - Flag indicating if the exported\n * state should recursively include state from group mark sub-contexts.\n * @return {object} - An object containing the exported state values.\n */\nfunction getState(options) {\n return this._runtime.getState(options || {\n data: dataTest,\n signals: signalTest,\n recurse: true\n });\n}\nfunction dataTest(name, data) {\n return data.modified && isArray(data.input.value) && name.indexOf('_:vega:_');\n}\nfunction signalTest(name, op) {\n return !(name === 'parent' || op instanceof transforms.proxy);\n}\n\n/**\n * Sets the current view state and updates the view by invoking run.\n * @param {object} state - A state object containing signal and/or\n * data set values, following the format used by the getState method.\n * @return {View} - This view instance.\n */\nfunction setState(state) {\n this.runAsync(null, v => {\n v._trigger = false;\n v._runtime.setState(state);\n }, v => {\n v._trigger = true;\n });\n return this;\n}\n\nfunction timer (callback, delay) {\n function tick(elapsed) {\n callback({\n timestamp: Date.now(),\n elapsed: elapsed\n });\n }\n this._timers.push(interval(tick, delay));\n}\n\nfunction defaultTooltip (handler, event, item, value) {\n const el = handler.element();\n if (el) el.setAttribute('title', formatTooltip(value));\n}\nfunction formatTooltip(value) {\n return value == null ? '' : isArray(value) ? formatArray(value) : isObject(value) && !isDate(value) ? formatObject(value) : value + '';\n}\nfunction formatObject(obj) {\n return Object.keys(obj).map(key => {\n const v = obj[key];\n return key + ': ' + (isArray(v) ? formatArray(v) : formatValue(v));\n }).join('\\n');\n}\nfunction formatArray(value) {\n return '[' + value.map(formatValue).join(', ') + ']';\n}\nfunction formatValue(value) {\n return isArray(value) ? '[\\u2026]' : isObject(value) && !isDate(value) ? '{\\u2026}' : value;\n}\n\n/**\n * Create a new View instance from a Vega dataflow runtime specification.\n * The generated View will not immediately be ready for display. Callers\n * should also invoke the initialize method (e.g., to set the parent\n * DOM element in browser-based deployment) and then invoke the run\n * method to evaluate the dataflow graph. Rendering will automatically\n * be performed upon dataflow runs.\n * @constructor\n * @param {object} spec - The Vega dataflow runtime specification.\n */\nfunction View(spec, options) {\n const view = this;\n options = options || {};\n Dataflow.call(view);\n if (options.loader) view.loader(options.loader);\n if (options.logger) view.logger(options.logger);\n if (options.logLevel != null) view.logLevel(options.logLevel);\n if (options.locale || spec.locale) {\n const loc = extend({}, spec.locale, options.locale);\n view.locale(locale(loc.number, loc.time));\n }\n view._el = null;\n view._elBind = null;\n view._renderType = options.renderer || RenderType.Canvas;\n view._scenegraph = new Scenegraph();\n const root = view._scenegraph.root;\n\n // initialize renderer, handler and event management\n view._renderer = null;\n view._tooltip = options.tooltip || defaultTooltip, view._redraw = true;\n view._handler = new CanvasHandler().scene(root);\n view._globalCursor = false;\n view._preventDefault = false;\n view._timers = [];\n view._eventListeners = [];\n view._resizeListeners = [];\n\n // initialize event configuration\n view._eventConfig = initializeEventConfig(spec.eventConfig);\n view.globalCursor(view._eventConfig.globalCursor);\n\n // initialize dataflow graph\n const ctx = runtime(view, spec, options.expr);\n view._runtime = ctx;\n view._signals = ctx.signals;\n view._bind = (spec.bindings || []).map(_ => ({\n state: null,\n param: extend({}, _)\n }));\n\n // initialize scenegraph\n if (ctx.root) ctx.root.set(root);\n root.source = ctx.data.root.input;\n view.pulse(ctx.data.root.input, view.changeset().insert(root.items));\n\n // initialize view size\n view._width = view.width();\n view._height = view.height();\n view._viewWidth = viewWidth(view, view._width);\n view._viewHeight = viewHeight(view, view._height);\n view._origin = [0, 0];\n view._resize = 0;\n view._autosize = 1;\n initializeResize(view);\n\n // initialize background color\n background(view);\n\n // initialize cursor\n cursor(view);\n\n // initialize view description\n view.description(spec.description);\n\n // initialize hover proessing, if requested\n if (options.hover) view.hover();\n\n // initialize DOM container(s) and renderer\n if (options.container) view.initialize(options.container, options.bind);\n}\nfunction lookupSignal(view, name) {\n return hasOwnProperty(view._signals, name) ? view._signals[name] : error('Unrecognized signal name: ' + stringValue(name));\n}\nfunction findOperatorHandler(op, handler) {\n const h = (op._targets || []).filter(op => op._update && op._update.handler === handler);\n return h.length ? h[0] : null;\n}\nfunction addOperatorListener(view, name, op, handler) {\n let h = findOperatorHandler(op, handler);\n if (!h) {\n h = trap(view, () => handler(name, op.value));\n h.handler = handler;\n view.on(op, null, h);\n }\n return view;\n}\nfunction removeOperatorListener(view, op, handler) {\n const h = findOperatorHandler(op, handler);\n if (h) op._targets.remove(h);\n return view;\n}\ninherits(View, Dataflow, {\n // -- DATAFLOW / RENDERING ----\n\n async evaluate(encode, prerun, postrun) {\n // evaluate dataflow and prerun\n await Dataflow.prototype.evaluate.call(this, encode, prerun);\n\n // render as needed\n if (this._redraw || this._resize) {\n try {\n if (this._renderer) {\n if (this._resize) {\n this._resize = 0;\n resizeRenderer(this);\n }\n await this._renderer.renderAsync(this._scenegraph.root);\n }\n this._redraw = false;\n } catch (e) {\n this.error(e);\n }\n }\n\n // evaluate postrun\n if (postrun) asyncCallback(this, postrun);\n return this;\n },\n dirty(item) {\n this._redraw = true;\n this._renderer && this._renderer.dirty(item);\n },\n // -- GET / SET ----\n\n description(text) {\n if (arguments.length) {\n const desc = text != null ? text + '' : null;\n if (desc !== this._desc) ariaLabel(this._el, this._desc = desc);\n return this;\n }\n return this._desc;\n },\n container() {\n return this._el;\n },\n scenegraph() {\n return this._scenegraph;\n },\n origin() {\n return this._origin.slice();\n },\n signal(name, value, options) {\n const op = lookupSignal(this, name);\n return arguments.length === 1 ? op.value : this.update(op, value, options);\n },\n width(_) {\n return arguments.length ? this.signal('width', _) : this.signal('width');\n },\n height(_) {\n return arguments.length ? this.signal('height', _) : this.signal('height');\n },\n padding(_) {\n return arguments.length ? this.signal('padding', padding(_)) : padding(this.signal('padding'));\n },\n autosize(_) {\n return arguments.length ? this.signal('autosize', _) : this.signal('autosize');\n },\n background(_) {\n return arguments.length ? this.signal('background', _) : this.signal('background');\n },\n renderer(type) {\n if (!arguments.length) return this._renderType;\n if (!renderModule(type)) error('Unrecognized renderer type: ' + type);\n if (type !== this._renderType) {\n this._renderType = type;\n this._resetRenderer();\n }\n return this;\n },\n tooltip(handler) {\n if (!arguments.length) return this._tooltip;\n if (handler !== this._tooltip) {\n this._tooltip = handler;\n this._resetRenderer();\n }\n return this;\n },\n loader(loader) {\n if (!arguments.length) return this._loader;\n if (loader !== this._loader) {\n Dataflow.prototype.loader.call(this, loader);\n this._resetRenderer();\n }\n return this;\n },\n resize() {\n // set flag to perform autosize\n this._autosize = 1;\n // touch autosize signal to ensure top-level ViewLayout runs\n return this.touch(lookupSignal(this, 'autosize'));\n },\n _resetRenderer() {\n if (this._renderer) {\n this._renderer = null;\n this.initialize(this._el, this._elBind);\n }\n },\n // -- SIZING ----\n _resizeView: resizeView,\n // -- EVENT HANDLING ----\n\n addEventListener(type, handler, options) {\n let callback = handler;\n if (!(options && options.trap === false)) {\n // wrap callback in error handler\n callback = trap(this, handler);\n callback.raw = handler;\n }\n this._handler.on(type, callback);\n return this;\n },\n removeEventListener(type, handler) {\n var handlers = this._handler.handlers(type),\n i = handlers.length,\n h,\n t;\n\n // search registered handlers, remove if match found\n while (--i >= 0) {\n t = handlers[i].type;\n h = handlers[i].handler;\n if (type === t && (handler === h || handler === h.raw)) {\n this._handler.off(t, h);\n break;\n }\n }\n return this;\n },\n addResizeListener(handler) {\n const l = this._resizeListeners;\n if (l.indexOf(handler) < 0) {\n // add handler if it isn't already registered\n // note: error trapping handled elsewhere, so\n // no need to wrap handlers here\n l.push(handler);\n }\n return this;\n },\n removeResizeListener(handler) {\n var l = this._resizeListeners,\n i = l.indexOf(handler);\n if (i >= 0) {\n l.splice(i, 1);\n }\n return this;\n },\n addSignalListener(name, handler) {\n return addOperatorListener(this, name, lookupSignal(this, name), handler);\n },\n removeSignalListener(name, handler) {\n return removeOperatorListener(this, lookupSignal(this, name), handler);\n },\n addDataListener(name, handler) {\n return addOperatorListener(this, name, dataref(this, name).values, handler);\n },\n removeDataListener(name, handler) {\n return removeOperatorListener(this, dataref(this, name).values, handler);\n },\n globalCursor(_) {\n if (arguments.length) {\n if (this._globalCursor !== !!_) {\n const prev = setCursor(this, null); // clear previous cursor\n this._globalCursor = !!_;\n if (prev) setCursor(this, prev); // swap cursor\n }\n\n return this;\n } else {\n return this._globalCursor;\n }\n },\n preventDefault(_) {\n if (arguments.length) {\n this._preventDefault = _;\n return this;\n } else {\n return this._preventDefault;\n }\n },\n timer,\n events,\n finalize,\n hover,\n // -- DATA ----\n data,\n change,\n insert,\n remove,\n // -- SCALES --\n scale,\n // -- INITIALIZATION ----\n initialize,\n // -- HEADLESS RENDERING ----\n toImageURL: renderToImageURL,\n toCanvas: renderToCanvas,\n toSVG: renderToSVG,\n // -- SAVE / RESTORE STATE ----\n getState,\n setState\n});\n\nexport { View };\n","import {Timer, now} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer, total = delay;\n if (delay == null) return t.restart(callback, delay, time), t;\n t._restart = t.restart;\n t.restart = function(callback, delay, time) {\n delay = +delay, time = time == null ? now() : +time;\n t._restart(function tick(elapsed) {\n elapsed += total;\n t._restart(tick, total += delay, time);\n callback(elapsed);\n }, delay, time);\n }\n t.restart(callback, delay, time);\n return t;\n}\n","const VIEW = 'view',\n LBRACK = '[',\n RBRACK = ']',\n LBRACE = '{',\n RBRACE = '}',\n COLON = ':',\n COMMA = ',',\n NAME = '@',\n GT = '>',\n ILLEGAL = /[[\\]{}]/,\n DEFAULT_MARKS = {\n '*': 1,\n arc: 1,\n area: 1,\n group: 1,\n image: 1,\n line: 1,\n path: 1,\n rect: 1,\n rule: 1,\n shape: 1,\n symbol: 1,\n text: 1,\n trail: 1\n };\nlet DEFAULT_SOURCE, MARKS;\n\n/**\n * Parse an event selector string.\n * Returns an array of event stream definitions.\n */\nfunction eventSelector (selector, source, marks) {\n DEFAULT_SOURCE = source || VIEW;\n MARKS = marks || DEFAULT_MARKS;\n return parseMerge(selector.trim()).map(parseSelector);\n}\nfunction isMarkType(type) {\n return MARKS[type];\n}\nfunction find(s, i, endChar, pushChar, popChar) {\n const n = s.length;\n let count = 0,\n c;\n for (; i < n; ++i) {\n c = s[i];\n if (!count && c === endChar) return i;else if (popChar && popChar.indexOf(c) >= 0) --count;else if (pushChar && pushChar.indexOf(c) >= 0) ++count;\n }\n return i;\n}\nfunction parseMerge(s) {\n const output = [],\n n = s.length;\n let start = 0,\n i = 0;\n while (i < n) {\n i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE);\n output.push(s.substring(start, i).trim());\n start = ++i;\n }\n if (output.length === 0) {\n throw 'Empty event selector: ' + s;\n }\n return output;\n}\nfunction parseSelector(s) {\n return s[0] === '[' ? parseBetween(s) : parseStream(s);\n}\nfunction parseBetween(s) {\n const n = s.length;\n let i = 1,\n b;\n i = find(s, i, RBRACK, LBRACK, RBRACK);\n if (i === n) {\n throw 'Empty between selector: ' + s;\n }\n b = parseMerge(s.substring(1, i));\n if (b.length !== 2) {\n throw 'Between selector must have two elements: ' + s;\n }\n s = s.slice(i + 1).trim();\n if (s[0] !== GT) {\n throw 'Expected \\'>\\' after between selector: ' + s;\n }\n b = b.map(parseSelector);\n const stream = parseSelector(s.slice(1).trim());\n if (stream.between) {\n return {\n between: b,\n stream: stream\n };\n } else {\n stream.between = b;\n }\n return stream;\n}\nfunction parseStream(s) {\n const stream = {\n source: DEFAULT_SOURCE\n },\n source = [];\n let throttle = [0, 0],\n markname = 0,\n start = 0,\n n = s.length,\n i = 0,\n j,\n filter;\n\n // extract throttle from end\n if (s[n - 1] === RBRACE) {\n i = s.lastIndexOf(LBRACE);\n if (i >= 0) {\n try {\n throttle = parseThrottle(s.substring(i + 1, n - 1));\n } catch (e) {\n throw 'Invalid throttle specification: ' + s;\n }\n s = s.slice(0, i).trim();\n n = s.length;\n } else throw 'Unmatched right brace: ' + s;\n i = 0;\n }\n if (!n) throw s;\n\n // set name flag based on first char\n if (s[0] === NAME) markname = ++i;\n\n // extract first part of multi-part stream selector\n j = find(s, i, COLON);\n if (j < n) {\n source.push(s.substring(start, j).trim());\n start = i = ++j;\n }\n\n // extract remaining part of stream selector\n i = find(s, i, LBRACK);\n if (i === n) {\n source.push(s.substring(start, n).trim());\n } else {\n source.push(s.substring(start, i).trim());\n filter = [];\n start = ++i;\n if (start === n) throw 'Unmatched left bracket: ' + s;\n }\n\n // extract filters\n while (i < n) {\n i = find(s, i, RBRACK);\n if (i === n) throw 'Unmatched left bracket: ' + s;\n filter.push(s.substring(start, i).trim());\n if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s;\n start = ++i;\n }\n\n // marshall event stream specification\n if (!(n = source.length) || ILLEGAL.test(source[n - 1])) {\n throw 'Invalid event selector: ' + s;\n }\n if (n > 1) {\n stream.type = source[1];\n if (markname) {\n stream.markname = source[0].slice(1);\n } else if (isMarkType(source[0])) {\n stream.marktype = source[0];\n } else {\n stream.source = source[0];\n }\n } else {\n stream.type = source[0];\n }\n if (stream.type.slice(-1) === '!') {\n stream.consume = true;\n stream.type = stream.type.slice(0, -1);\n }\n if (filter != null) stream.filter = filter;\n if (throttle[0]) stream.throttle = throttle[0];\n if (throttle[1]) stream.debounce = throttle[1];\n return stream;\n}\nfunction parseThrottle(s) {\n const a = s.split(COMMA);\n if (!s.length || a.length > 2) throw s;\n return a.map(_ => {\n const x = +_;\n if (x !== x) throw s;\n return x;\n });\n}\n\nexport { eventSelector as parseSelector };\n","import { isObject, isArray, extend, hasOwnProperty, array, stringValue, peek, error, isString, splitAccessPath, mergeConfig } from 'vega-util';\nimport { parseExpression } from 'vega-functions';\nimport { parseSelector } from 'vega-event-selector';\nimport { isValidScaleType, isDiscrete, isQuantile, isContinuous, isDiscretizing } from 'vega-scale';\nimport { definition as definition$1 } from 'vega-dataflow';\n\nfunction parseAutosize (spec) {\n return isObject(spec) ? spec : {\n type: spec || 'pad'\n };\n}\n\nconst number = _ => +_ || 0;\nconst paddingObject = _ => ({\n top: _,\n bottom: _,\n left: _,\n right: _\n});\nfunction parsePadding (spec) {\n return !isObject(spec) ? paddingObject(number(spec)) : spec.signal ? spec : {\n top: number(spec.top),\n bottom: number(spec.bottom),\n left: number(spec.left),\n right: number(spec.right)\n };\n}\n\nconst encoder = _ => isObject(_) && !isArray(_) ? extend({}, _) : {\n value: _\n};\nfunction addEncode(object, name, value, set) {\n if (value != null) {\n const isEncoder = isObject(value) && !isArray(value) || isArray(value) && value.length && isObject(value[0]);\n\n // Always assign signal to update, even if the signal is from the enter block\n if (isEncoder) {\n object.update[name] = value;\n } else {\n object[set || 'enter'][name] = {\n value: value\n };\n }\n return 1;\n } else {\n return 0;\n }\n}\nfunction addEncoders(object, enter, update) {\n for (const name in enter) {\n addEncode(object, name, enter[name]);\n }\n for (const name in update) {\n addEncode(object, name, update[name], 'update');\n }\n}\nfunction extendEncode(encode, extra, skip) {\n for (const name in extra) {\n if (skip && hasOwnProperty(skip, name)) continue;\n encode[name] = extend(encode[name] || {}, extra[name]);\n }\n return encode;\n}\nfunction has(key, encode) {\n return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]);\n}\n\nconst MarkRole = 'mark';\nconst FrameRole = 'frame';\nconst ScopeRole = 'scope';\nconst AxisRole = 'axis';\nconst AxisDomainRole = 'axis-domain';\nconst AxisGridRole = 'axis-grid';\nconst AxisLabelRole = 'axis-label';\nconst AxisTickRole = 'axis-tick';\nconst AxisTitleRole = 'axis-title';\nconst LegendRole = 'legend';\nconst LegendBandRole = 'legend-band';\nconst LegendEntryRole = 'legend-entry';\nconst LegendGradientRole = 'legend-gradient';\nconst LegendLabelRole = 'legend-label';\nconst LegendSymbolRole = 'legend-symbol';\nconst LegendTitleRole = 'legend-title';\nconst TitleRole = 'title';\nconst TitleTextRole = 'title-text';\nconst TitleSubtitleRole = 'title-subtitle';\n\nfunction applyDefaults (encode, type, role, style, config) {\n const defaults = {},\n enter = {};\n let update, key, skip, props;\n\n // if text mark, apply global lineBreak settings (#2370)\n key = 'lineBreak';\n if (type === 'text' && config[key] != null && !has(key, encode)) {\n applyDefault(defaults, key, config[key]);\n }\n\n // ignore legend and axis roles\n if (role == 'legend' || String(role).startsWith('axis')) {\n role = null;\n }\n\n // resolve mark config\n props = role === FrameRole ? config.group : role === MarkRole ? extend({}, config.mark, config[type]) : null;\n for (key in props) {\n // do not apply defaults if relevant fields are defined\n skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode));\n if (!skip) applyDefault(defaults, key, props[key]);\n }\n\n // resolve styles, apply with increasing precedence\n array(style).forEach(name => {\n const props = config.style && config.style[name];\n for (const key in props) {\n if (!has(key, encode)) {\n applyDefault(defaults, key, props[key]);\n }\n }\n });\n encode = extend({}, encode); // defensive copy\n for (key in defaults) {\n props = defaults[key];\n if (props.signal) {\n (update = update || {})[key] = props;\n } else {\n enter[key] = props;\n }\n }\n encode.enter = extend(enter, encode.enter);\n if (update) encode.update = extend(update, encode.update);\n return encode;\n}\nfunction applyDefault(defaults, key, value) {\n defaults[key] = value && value.signal ? {\n signal: value.signal\n } : {\n value: value\n };\n}\n\nconst scaleRef = scale => isString(scale) ? stringValue(scale) : scale.signal ? `(${scale.signal})` : field(scale);\nfunction entry$1(enc) {\n if (enc.gradient != null) {\n return gradient(enc);\n }\n let value = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== undefined ? stringValue(enc.value) : undefined;\n if (enc.scale != null) {\n value = scale(enc, value);\n }\n if (value === undefined) {\n value = null;\n }\n if (enc.exponent != null) {\n value = `pow(${value},${property(enc.exponent)})`;\n }\n if (enc.mult != null) {\n value += `*${property(enc.mult)}`;\n }\n if (enc.offset != null) {\n value += `+${property(enc.offset)}`;\n }\n if (enc.round) {\n value = `round(${value})`;\n }\n return value;\n}\nconst _color = (type, x, y, z) => `(${type}(${[x, y, z].map(entry$1).join(',')})+'')`;\nfunction color(enc) {\n return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null;\n}\nfunction gradient(enc) {\n // map undefined to null; expression lang does not allow undefined\n const args = [enc.start, enc.stop, enc.count].map(_ => _ == null ? null : stringValue(_));\n\n // trim null inputs from the end\n while (args.length && peek(args) == null) args.pop();\n args.unshift(scaleRef(enc.gradient));\n return `gradient(${args.join(',')})`;\n}\nfunction property(property) {\n return isObject(property) ? '(' + entry$1(property) + ')' : property;\n}\nfunction field(ref) {\n return resolveField(isObject(ref) ? ref : {\n datum: ref\n });\n}\nfunction resolveField(ref) {\n let object, level, field;\n if (ref.signal) {\n object = 'datum';\n field = ref.signal;\n } else if (ref.group || ref.parent) {\n level = Math.max(1, ref.level || 1);\n object = 'item';\n while (level-- > 0) {\n object += '.mark.group';\n }\n if (ref.parent) {\n field = ref.parent;\n object += '.datum';\n } else {\n field = ref.group;\n }\n } else if (ref.datum) {\n object = 'datum';\n field = ref.datum;\n } else {\n error('Invalid field reference: ' + stringValue(ref));\n }\n if (!ref.signal) {\n field = isString(field) ? splitAccessPath(field).map(stringValue).join('][') : resolveField(field);\n }\n return object + '[' + field + ']';\n}\nfunction scale(enc, value) {\n const scale = scaleRef(enc.scale);\n if (enc.range != null) {\n // pull value from scale range\n value = `lerp(_range(${scale}), ${+enc.range})`;\n } else {\n // run value through scale and/or pull scale bandwidth\n if (value !== undefined) value = `_scale(${scale}, ${value})`;\n if (enc.band) {\n value = (value ? value + '+' : '') + `_bandwidth(${scale})` + (+enc.band === 1 ? '' : '*' + property(enc.band));\n if (enc.extra) {\n // include logic to handle extraneous elements\n value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`;\n }\n }\n if (value == null) value = '0';\n }\n return value;\n}\n\nfunction rule (enc) {\n let code = '';\n enc.forEach(rule => {\n const value = entry$1(rule);\n code += rule.test ? `(${rule.test})?${value}:` : value;\n });\n\n // if no else clause, terminate with null (#1366)\n if (peek(code) === ':') {\n code += 'null';\n }\n return code;\n}\n\nfunction parseEncode (encode, type, role, style, scope, params) {\n const enc = {};\n params = params || {};\n params.encoders = {\n $encode: enc\n };\n encode = applyDefaults(encode, type, role, style, scope.config);\n for (const key in encode) {\n enc[key] = parseBlock(encode[key], type, params, scope);\n }\n return params;\n}\nfunction parseBlock(block, marktype, params, scope) {\n const channels = {},\n fields = {};\n for (const name in block) {\n if (block[name] != null) {\n // skip any null entries\n channels[name] = parse$1(expr(block[name]), scope, params, fields);\n }\n }\n return {\n $expr: {\n marktype,\n channels\n },\n $fields: Object.keys(fields),\n $output: Object.keys(block)\n };\n}\nfunction expr(enc) {\n return isArray(enc) ? rule(enc) : entry$1(enc);\n}\nfunction parse$1(code, scope, params, fields) {\n const expr = parseExpression(code, scope);\n expr.$fields.forEach(name => fields[name] = 1);\n extend(params, expr.$params);\n return expr.$expr;\n}\n\nconst OUTER = 'outer',\n OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind'];\nfunction outerError(prefix, name) {\n error(prefix + ' for \"outer\" push: ' + stringValue(name));\n}\nfunction parseSignal (signal, scope) {\n const name = signal.name;\n if (signal.push === OUTER) {\n // signal must already be defined, raise error if not\n if (!scope.signals[name]) outerError('No prior signal definition', name);\n // signal push must not use properties reserved for standard definition\n OUTER_INVALID.forEach(prop => {\n if (signal[prop] !== undefined) outerError('Invalid property ', prop);\n });\n } else {\n // define a new signal in the current scope\n const op = scope.addSignal(name, signal.value);\n if (signal.react === false) op.react = false;\n if (signal.bind) scope.addBinding(name, signal.bind);\n }\n}\n\nfunction Entry(type, value, params, parent) {\n this.id = -1;\n this.type = type;\n this.value = value;\n this.params = params;\n if (parent) this.parent = parent;\n}\nfunction entry(type, value, params, parent) {\n return new Entry(type, value, params, parent);\n}\nfunction operator(value, params) {\n return entry('operator', value, params);\n}\n\n// -----\n\nfunction ref(op) {\n const ref = {\n $ref: op.id\n };\n // if operator not yet registered, cache ref to resolve later\n if (op.id < 0) (op.refs = op.refs || []).push(ref);\n return ref;\n}\nfunction fieldRef$1(field, name) {\n return name ? {\n $field: field,\n $name: name\n } : {\n $field: field\n };\n}\nconst keyFieldRef = fieldRef$1('key');\nfunction compareRef(fields, orders) {\n return {\n $compare: fields,\n $order: orders\n };\n}\nfunction keyRef(fields, flat) {\n const ref = {\n $key: fields\n };\n if (flat) ref.$flat = true;\n return ref;\n}\n\n// -----\n\nconst Ascending = 'ascending';\nconst Descending = 'descending';\nfunction sortKey(sort) {\n return !isObject(sort) ? '' : (sort.order === Descending ? '-' : '+') + aggrField(sort.op, sort.field);\n}\nfunction aggrField(op, field) {\n return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || '');\n}\n\n// -----\n\nconst Scope$1 = 'scope';\nconst View = 'view';\nfunction isSignal(_) {\n return _ && _.signal;\n}\nfunction isExpr$1(_) {\n return _ && _.expr;\n}\nfunction hasSignal(_) {\n if (isSignal(_)) return true;\n if (isObject(_)) for (const key in _) {\n if (hasSignal(_[key])) return true;\n }\n return false;\n}\nfunction value(specValue, defaultValue) {\n return specValue != null ? specValue : defaultValue;\n}\nfunction deref(v) {\n return v && v.signal || v;\n}\n\nconst Timer = 'timer';\nfunction parseStream(stream, scope) {\n const method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : error('Invalid stream specification: ' + stringValue(stream));\n return method(stream, scope);\n}\nfunction eventSource(source) {\n return source === Scope$1 ? View : source || View;\n}\nfunction mergeStream(stream, scope) {\n const list = stream.merge.map(s => parseStream(s, scope)),\n entry = streamParameters({\n merge: list\n }, stream, scope);\n return scope.addStream(entry).id;\n}\nfunction nestedStream(stream, scope) {\n const id = parseStream(stream.stream, scope),\n entry = streamParameters({\n stream: id\n }, stream, scope);\n return scope.addStream(entry).id;\n}\nfunction eventStream(stream, scope) {\n let id;\n if (stream.type === Timer) {\n id = scope.event(Timer, stream.throttle);\n stream = {\n between: stream.between,\n filter: stream.filter\n };\n } else {\n id = scope.event(eventSource(stream.source), stream.type);\n }\n const entry = streamParameters({\n stream: id\n }, stream, scope);\n return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id;\n}\nfunction streamParameters(entry, stream, scope) {\n let param = stream.between;\n if (param) {\n if (param.length !== 2) {\n error('Stream \"between\" parameter must have 2 entries: ' + stringValue(stream));\n }\n entry.between = [parseStream(param[0], scope), parseStream(param[1], scope)];\n }\n param = stream.filter ? [].concat(stream.filter) : [];\n if (stream.marktype || stream.markname || stream.markrole) {\n // add filter for mark type, name and/or role\n param.push(filterMark(stream.marktype, stream.markname, stream.markrole));\n }\n if (stream.source === Scope$1) {\n // add filter to limit events from sub-scope only\n param.push('inScope(event.item)');\n }\n if (param.length) {\n entry.filter = parseExpression('(' + param.join(')&&(') + ')', scope).$expr;\n }\n if ((param = stream.throttle) != null) {\n entry.throttle = +param;\n }\n if ((param = stream.debounce) != null) {\n entry.debounce = +param;\n }\n if (stream.consume) {\n entry.consume = true;\n }\n return entry;\n}\nfunction filterMark(type, name, role) {\n const item = 'event.item';\n return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\\'' + type + '\\'' : '') + (role ? '&&' + item + '.mark.role===\\'' + role + '\\'' : '') + (name ? '&&' + item + '.mark.name===\\'' + name + '\\'' : '');\n}\n\n// bypass expression parser for internal operator references\nconst OP_VALUE_EXPR = {\n code: '_.$value',\n ast: {\n type: 'Identifier',\n value: 'value'\n }\n};\nfunction parseUpdate (spec, scope, target) {\n const encode = spec.encode,\n entry = {\n target: target\n };\n let events = spec.events,\n update = spec.update,\n sources = [];\n if (!events) {\n error('Signal update missing events specification.');\n }\n\n // interpret as an event selector string\n if (isString(events)) {\n events = parseSelector(events, scope.isSubscope() ? Scope$1 : View);\n }\n\n // separate event streams from signal updates\n events = array(events).filter(s => s.signal || s.scale ? (sources.push(s), 0) : 1);\n\n // merge internal operator listeners\n if (sources.length > 1) {\n sources = [mergeSources(sources)];\n }\n\n // merge event streams, include as source\n if (events.length) {\n sources.push(events.length > 1 ? {\n merge: events\n } : events[0]);\n }\n if (encode != null) {\n if (update) error('Signal encode and update are mutually exclusive.');\n update = 'encode(item(),' + stringValue(encode) + ')';\n }\n\n // resolve update value\n entry.update = isString(update) ? parseExpression(update, scope) : update.expr != null ? parseExpression(update.expr, scope) : update.value != null ? update.value : update.signal != null ? {\n $expr: OP_VALUE_EXPR,\n $params: {\n $value: scope.signalRef(update.signal)\n }\n } : error('Invalid signal update specification.');\n if (spec.force) {\n entry.options = {\n force: true\n };\n }\n sources.forEach(source => scope.addUpdate(extend(streamSource(source, scope), entry)));\n}\nfunction streamSource(stream, scope) {\n return {\n source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream(stream, scope)\n };\n}\nfunction mergeSources(sources) {\n return {\n signal: '[' + sources.map(s => s.scale ? 'scale(\"' + s.scale + '\")' : s.signal) + ']'\n };\n}\n\nfunction parseSignalUpdates (signal, scope) {\n const op = scope.getSignal(signal.name);\n let expr = signal.update;\n if (signal.init) {\n if (expr) {\n error('Signals can not include both init and update expressions.');\n } else {\n expr = signal.init;\n op.initonly = true;\n }\n }\n if (expr) {\n expr = parseExpression(expr, scope);\n op.update = expr.$expr;\n op.params = expr.$params;\n }\n if (signal.on) {\n signal.on.forEach(_ => parseUpdate(_, scope, op.id));\n }\n}\n\nconst transform = name => (params, value, parent) => entry(name, value, params || undefined, parent);\nconst Aggregate = transform('aggregate');\nconst AxisTicks = transform('axisticks');\nconst Bound = transform('bound');\nconst Collect = transform('collect');\nconst Compare = transform('compare');\nconst DataJoin = transform('datajoin');\nconst Encode = transform('encode');\nconst Expression = transform('expression');\nconst Facet = transform('facet');\nconst Field = transform('field');\nconst Key = transform('key');\nconst LegendEntries = transform('legendentries');\nconst Load = transform('load');\nconst Mark = transform('mark');\nconst MultiExtent = transform('multiextent');\nconst MultiValues = transform('multivalues');\nconst Overlap = transform('overlap');\nconst Params = transform('params');\nconst PreFacet = transform('prefacet');\nconst Projection = transform('projection');\nconst Proxy = transform('proxy');\nconst Relay = transform('relay');\nconst Render = transform('render');\nconst Scale = transform('scale');\nconst Sieve = transform('sieve');\nconst SortItems = transform('sortitems');\nconst ViewLayout = transform('viewlayout');\nconst Values = transform('values');\n\nlet FIELD_REF_ID = 0;\nconst MULTIDOMAIN_SORT_OPS = {\n min: 'min',\n max: 'max',\n count: 'sum'\n};\nfunction initScale(spec, scope) {\n const type = spec.type || 'linear';\n if (!isValidScaleType(type)) {\n error('Unrecognized scale type: ' + stringValue(type));\n }\n scope.addScale(spec.name, {\n type,\n domain: undefined\n });\n}\nfunction parseScale(spec, scope) {\n const params = scope.getScale(spec.name).params;\n let key;\n params.domain = parseScaleDomain(spec.domain, spec, scope);\n if (spec.range != null) {\n params.range = parseScaleRange(spec, scope, params);\n }\n if (spec.interpolate != null) {\n parseScaleInterpolate(spec.interpolate, params);\n }\n if (spec.nice != null) {\n params.nice = parseScaleNice(spec.nice);\n }\n if (spec.bins != null) {\n params.bins = parseScaleBins(spec.bins, scope);\n }\n for (key in spec) {\n if (hasOwnProperty(params, key) || key === 'name') continue;\n params[key] = parseLiteral(spec[key], scope);\n }\n}\nfunction parseLiteral(v, scope) {\n return !isObject(v) ? v : v.signal ? scope.signalRef(v.signal) : error('Unsupported object: ' + stringValue(v));\n}\nfunction parseArray(v, scope) {\n return v.signal ? scope.signalRef(v.signal) : v.map(v => parseLiteral(v, scope));\n}\nfunction dataLookupError(name) {\n error('Can not find data set: ' + stringValue(name));\n}\n\n// -- SCALE DOMAIN ----\n\nfunction parseScaleDomain(domain, spec, scope) {\n if (!domain) {\n if (spec.domainMin != null || spec.domainMax != null) {\n error('No scale domain defined for domainMin/domainMax to override.');\n }\n return; // default domain\n }\n\n return domain.signal ? scope.signalRef(domain.signal) : (isArray(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope);\n}\nfunction explicitDomain(domain, spec, scope) {\n return domain.map(v => parseLiteral(v, scope));\n}\nfunction singularDomain(domain, spec, scope) {\n const data = scope.getData(domain.data);\n if (!data) dataLookupError(domain.data);\n return isDiscrete(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : isQuantile(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field);\n}\nfunction multipleDomain(domain, spec, scope) {\n const data = domain.data,\n fields = domain.fields.reduce((dom, d) => {\n d = isString(d) ? {\n data: data,\n field: d\n } : isArray(d) || d.signal ? fieldRef(d, scope) : d;\n dom.push(d);\n return dom;\n }, []);\n return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields);\n}\nfunction fieldRef(data, scope) {\n const name = '_:vega:_' + FIELD_REF_ID++,\n coll = Collect({});\n if (isArray(data)) {\n coll.value = {\n $ingest: data\n };\n } else if (data.signal) {\n const code = 'setdata(' + stringValue(name) + ',' + data.signal + ')';\n coll.params.input = scope.signalRef(code);\n }\n scope.addDataPipeline(name, [coll, Sieve({})]);\n return {\n data: name,\n field: 'data'\n };\n}\nfunction ordinalMultipleDomain(domain, scope, fields) {\n const sort = parseSort(domain.sort, true);\n let a, v;\n\n // get value counts for each domain field\n const counts = fields.map(f => {\n const data = scope.getData(f.data);\n if (!data) dataLookupError(f.data);\n return data.countsRef(scope, f.field, sort);\n });\n\n // aggregate the results from each domain field\n const p = {\n groupby: keyFieldRef,\n pulse: counts\n };\n if (sort) {\n a = sort.op || 'count';\n v = sort.field ? aggrField(a, sort.field) : 'count';\n p.ops = [MULTIDOMAIN_SORT_OPS[a]];\n p.fields = [scope.fieldRef(v)];\n p.as = [v];\n }\n a = scope.add(Aggregate(p));\n\n // collect aggregate output\n const c = scope.add(Collect({\n pulse: ref(a)\n }));\n\n // extract values for combined domain\n v = scope.add(Values({\n field: keyFieldRef,\n sort: scope.sortRef(sort),\n pulse: ref(c)\n }));\n return ref(v);\n}\nfunction parseSort(sort, multidomain) {\n if (sort) {\n if (!sort.field && !sort.op) {\n if (isObject(sort)) sort.field = 'key';else sort = {\n field: 'key'\n };\n } else if (!sort.field && sort.op !== 'count') {\n error('No field provided for sort aggregate op: ' + sort.op);\n } else if (multidomain && sort.field) {\n if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) {\n error('Multiple domain scales can not be sorted using ' + sort.op);\n }\n }\n }\n return sort;\n}\nfunction quantileMultipleDomain(domain, scope, fields) {\n // get value arrays for each domain field\n const values = fields.map(f => {\n const data = scope.getData(f.data);\n if (!data) dataLookupError(f.data);\n return data.domainRef(scope, f.field);\n });\n\n // combine value arrays\n return ref(scope.add(MultiValues({\n values: values\n })));\n}\nfunction numericMultipleDomain(domain, scope, fields) {\n // get extents for each domain field\n const extents = fields.map(f => {\n const data = scope.getData(f.data);\n if (!data) dataLookupError(f.data);\n return data.extentRef(scope, f.field);\n });\n\n // combine extents\n return ref(scope.add(MultiExtent({\n extents: extents\n })));\n}\n\n// -- SCALE BINS -----\n\nfunction parseScaleBins(v, scope) {\n return v.signal || isArray(v) ? parseArray(v, scope) : scope.objectProperty(v);\n}\n\n// -- SCALE NICE -----\n\nfunction parseScaleNice(nice) {\n return isObject(nice) ? {\n interval: parseLiteral(nice.interval),\n step: parseLiteral(nice.step)\n } : parseLiteral(nice);\n}\n\n// -- SCALE INTERPOLATION -----\n\nfunction parseScaleInterpolate(interpolate, params) {\n params.interpolate = parseLiteral(interpolate.type || interpolate);\n if (interpolate.gamma != null) {\n params.interpolateGamma = parseLiteral(interpolate.gamma);\n }\n}\n\n// -- SCALE RANGE -----\n\nfunction parseScaleRange(spec, scope, params) {\n const config = scope.config.range;\n let range = spec.range;\n if (range.signal) {\n return scope.signalRef(range.signal);\n } else if (isString(range)) {\n if (config && hasOwnProperty(config, range)) {\n spec = extend({}, spec, {\n range: config[range]\n });\n return parseScaleRange(spec, scope, params);\n } else if (range === 'width') {\n range = [0, {\n signal: 'width'\n }];\n } else if (range === 'height') {\n range = isDiscrete(spec.type) ? [0, {\n signal: 'height'\n }] : [{\n signal: 'height'\n }, 0];\n } else {\n error('Unrecognized scale range value: ' + stringValue(range));\n }\n } else if (range.scheme) {\n params.scheme = isArray(range.scheme) ? parseArray(range.scheme, scope) : parseLiteral(range.scheme, scope);\n if (range.extent) params.schemeExtent = parseArray(range.extent, scope);\n if (range.count) params.schemeCount = parseLiteral(range.count, scope);\n return;\n } else if (range.step) {\n params.rangeStep = parseLiteral(range.step, scope);\n return;\n } else if (isDiscrete(spec.type) && !isArray(range)) {\n return parseScaleDomain(range, spec, scope);\n } else if (!isArray(range)) {\n error('Unsupported range type: ' + stringValue(range));\n }\n return range.map(v => (isArray(v) ? parseArray : parseLiteral)(v, scope));\n}\n\nfunction parseProjection (proj, scope) {\n const config = scope.config.projection || {},\n params = {};\n for (const name in proj) {\n if (name === 'name') continue;\n params[name] = parseParameter$1(proj[name], name, scope);\n }\n\n // apply projection defaults from config\n for (const name in config) {\n if (params[name] == null) {\n params[name] = parseParameter$1(config[name], name, scope);\n }\n }\n scope.addProjection(proj.name, params);\n}\nfunction parseParameter$1(_, name, scope) {\n return isArray(_) ? _.map(_ => parseParameter$1(_, name, scope)) : !isObject(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : error('Unsupported parameter object: ' + stringValue(_));\n}\n\nconst Top = 'top';\nconst Left = 'left';\nconst Right = 'right';\nconst Bottom = 'bottom';\nconst Center = 'center';\nconst Vertical = 'vertical';\nconst Start = 'start';\nconst Middle = 'middle';\nconst End = 'end';\nconst Index = 'index';\nconst Label = 'label';\nconst Offset = 'offset';\nconst Perc = 'perc';\nconst Perc2 = 'perc2';\nconst Value = 'value';\nconst GuideLabelStyle = 'guide-label';\nconst GuideTitleStyle = 'guide-title';\nconst GroupTitleStyle = 'group-title';\nconst GroupSubtitleStyle = 'group-subtitle';\nconst Symbols = 'symbol';\nconst Gradient = 'gradient';\nconst Discrete = 'discrete';\nconst Size = 'size';\nconst Shape = 'shape';\nconst Fill = 'fill';\nconst Stroke = 'stroke';\nconst StrokeWidth = 'strokeWidth';\nconst StrokeDash = 'strokeDash';\nconst Opacity = 'opacity';\n\n// Encoding channels supported by legends\n// In priority order of 'canonical' scale\nconst LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity];\nconst Skip = {\n name: 1,\n style: 1,\n interactive: 1\n};\nconst zero = {\n value: 0\n};\nconst one = {\n value: 1\n};\n\nconst GroupMark = 'group';\nconst RectMark = 'rect';\nconst RuleMark = 'rule';\nconst SymbolMark = 'symbol';\nconst TextMark = 'text';\n\nfunction guideGroup (mark) {\n mark.type = GroupMark;\n mark.interactive = mark.interactive || false;\n return mark;\n}\n\nfunction lookup(spec, config) {\n const _ = (name, dflt) => value(spec[name], value(config[name], dflt));\n _.isVertical = s => Vertical === value(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection));\n _.gradientLength = () => value(spec.gradientLength, config.gradientLength || config.gradientWidth);\n _.gradientThickness = () => value(spec.gradientThickness, config.gradientThickness || config.gradientHeight);\n _.entryColumns = () => value(spec.columns, value(config.columns, +_.isVertical(true)));\n return _;\n}\nfunction getEncoding(name, encode) {\n const v = encode && (encode.update && encode.update[name] || encode.enter && encode.enter[name]);\n return v && v.signal ? v : v ? v.value : null;\n}\nfunction getStyle(name, scope, style) {\n const s = scope.config.style[style];\n return s && s[name];\n}\nfunction anchorExpr(s, e, m) {\n return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m}`;\n}\nconst alignExpr$1 = anchorExpr(stringValue(Left), stringValue(Right), stringValue(Center));\nfunction tickBand(_) {\n const v = _('tickBand');\n let offset = _('tickOffset'),\n band,\n extra;\n if (!v) {\n // if no tick band entry, fall back on other properties\n band = _('bandPosition');\n extra = _('tickExtra');\n } else if (v.signal) {\n // if signal, augment code to interpret values\n band = {\n signal: `(${v.signal}) === 'extent' ? 1 : 0.5`\n };\n extra = {\n signal: `(${v.signal}) === 'extent'`\n };\n if (!isObject(offset)) {\n offset = {\n signal: `(${v.signal}) === 'extent' ? 0 : ${offset}`\n };\n }\n } else if (v === 'extent') {\n // if constant, simply set values\n band = 1;\n extra = true;\n offset = 0;\n } else {\n band = 0.5;\n extra = false;\n }\n return {\n extra,\n band,\n offset\n };\n}\nfunction extendOffset(value, offset) {\n return !offset ? value : !value ? offset : !isObject(value) ? {\n value,\n offset\n } : Object.assign({}, value, {\n offset: extendOffset(value.offset, offset)\n });\n}\n\nfunction guideMark (mark, extras) {\n if (extras) {\n mark.name = extras.name;\n mark.style = extras.style || mark.style;\n mark.interactive = !!extras.interactive;\n mark.encode = extendEncode(mark.encode, extras, Skip);\n } else {\n mark.interactive = false;\n }\n return mark;\n}\n\nfunction legendGradient (spec, scale, config, userEncode) {\n const _ = lookup(spec, config),\n vertical = _.isVertical(),\n thickness = _.gradientThickness(),\n length = _.gradientLength();\n let enter, start, stop, width, height;\n if (vertical) {\n start = [0, 1];\n stop = [0, 0];\n width = thickness;\n height = length;\n } else {\n start = [0, 0];\n stop = [1, 0];\n width = length;\n height = thickness;\n }\n const encode = {\n enter: enter = {\n opacity: zero,\n x: zero,\n y: zero,\n width: encoder(width),\n height: encoder(height)\n },\n update: extend({}, enter, {\n opacity: one,\n fill: {\n gradient: scale,\n start: start,\n stop: stop\n }\n }),\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n stroke: _('gradientStrokeColor'),\n strokeWidth: _('gradientStrokeWidth')\n }, {\n // update\n opacity: _('gradientOpacity')\n });\n return guideMark({\n type: RectMark,\n role: LegendGradientRole,\n encode\n }, userEncode);\n}\n\nfunction legendGradientDiscrete (spec, scale, config, userEncode, dataRef) {\n const _ = lookup(spec, config),\n vertical = _.isVertical(),\n thickness = _.gradientThickness(),\n length = _.gradientLength();\n let u,\n v,\n uu,\n vv,\n adjust = '';\n vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height');\n const enter = {\n opacity: zero,\n fill: {\n scale: scale,\n field: Value\n }\n };\n enter[u] = {\n signal: adjust + 'datum.' + Perc,\n mult: length\n };\n enter[v] = zero;\n enter[uu] = {\n signal: adjust + 'datum.' + Perc2,\n mult: length\n };\n enter[vv] = encoder(thickness);\n const encode = {\n enter: enter,\n update: extend({}, enter, {\n opacity: one\n }),\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n stroke: _('gradientStrokeColor'),\n strokeWidth: _('gradientStrokeWidth')\n }, {\n // update\n opacity: _('gradientOpacity')\n });\n return guideMark({\n type: RectMark,\n role: LegendBandRole,\n key: Value,\n from: dataRef,\n encode\n }, userEncode);\n}\n\nconst alignExpr = `datum.${Perc}<=0?\"${Left}\":datum.${Perc}>=1?\"${Right}\":\"${Center}\"`,\n baselineExpr = `datum.${Perc}<=0?\"${Bottom}\":datum.${Perc}>=1?\"${Top}\":\"${Middle}\"`;\nfunction legendGradientLabels (spec, config, userEncode, dataRef) {\n const _ = lookup(spec, config),\n vertical = _.isVertical(),\n thickness = encoder(_.gradientThickness()),\n length = _.gradientLength();\n let overlap = _('labelOverlap'),\n enter,\n update,\n u,\n v,\n adjust = '';\n const encode = {\n enter: enter = {\n opacity: zero\n },\n update: update = {\n opacity: one,\n text: {\n field: Label\n }\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n fill: _('labelColor'),\n fillOpacity: _('labelOpacity'),\n font: _('labelFont'),\n fontSize: _('labelFontSize'),\n fontStyle: _('labelFontStyle'),\n fontWeight: _('labelFontWeight'),\n limit: value(spec.labelLimit, config.gradientLabelLimit)\n });\n if (vertical) {\n enter.align = {\n value: 'left'\n };\n enter.baseline = update.baseline = {\n signal: baselineExpr\n };\n u = 'y';\n v = 'x';\n adjust = '1-';\n } else {\n enter.align = update.align = {\n signal: alignExpr\n };\n enter.baseline = {\n value: 'top'\n };\n u = 'x';\n v = 'y';\n }\n enter[u] = update[u] = {\n signal: adjust + 'datum.' + Perc,\n mult: length\n };\n enter[v] = update[v] = thickness;\n thickness.offset = value(spec.labelOffset, config.gradientLabelOffset) || 0;\n overlap = overlap ? {\n separation: _('labelSeparation'),\n method: overlap,\n order: 'datum.' + Index\n } : undefined;\n\n // type, role, style, key, dataRef, encode, extras\n return guideMark({\n type: TextMark,\n role: LegendLabelRole,\n style: GuideLabelStyle,\n key: Value,\n from: dataRef,\n encode,\n overlap\n }, userEncode);\n}\n\n// userEncode is top-level, includes entries, symbols, labels\nfunction legendSymbolGroups (spec, config, userEncode, dataRef, columns) {\n const _ = lookup(spec, config),\n entries = userEncode.entries,\n interactive = !!(entries && entries.interactive),\n name = entries ? entries.name : undefined,\n height = _('clipHeight'),\n symbolOffset = _('symbolOffset'),\n valueRef = {\n data: 'value'\n },\n xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`,\n yEncode = height ? encoder(height) : {\n field: Size\n },\n index = `datum.${Index}`,\n ncols = `max(1, ${columns})`;\n let encode, enter, update, nrows, sort;\n yEncode.mult = 0.5;\n\n // -- LEGEND SYMBOLS --\n encode = {\n enter: enter = {\n opacity: zero,\n x: {\n signal: xSignal,\n mult: 0.5,\n offset: symbolOffset\n },\n y: yEncode\n },\n update: update = {\n opacity: one,\n x: enter.x,\n y: enter.y\n },\n exit: {\n opacity: zero\n }\n };\n let baseFill = null,\n baseStroke = null;\n if (!spec.fill) {\n baseFill = config.symbolBaseFillColor;\n baseStroke = config.symbolBaseStrokeColor;\n }\n addEncoders(encode, {\n fill: _('symbolFillColor', baseFill),\n shape: _('symbolType'),\n size: _('symbolSize'),\n stroke: _('symbolStrokeColor', baseStroke),\n strokeDash: _('symbolDash'),\n strokeDashOffset: _('symbolDashOffset'),\n strokeWidth: _('symbolStrokeWidth')\n }, {\n // update\n opacity: _('symbolOpacity')\n });\n LegendScales.forEach(scale => {\n if (spec[scale]) {\n update[scale] = enter[scale] = {\n scale: spec[scale],\n field: Value\n };\n }\n });\n const symbols = guideMark({\n type: SymbolMark,\n role: LegendSymbolRole,\n key: Value,\n from: valueRef,\n clip: height ? true : undefined,\n encode\n }, userEncode.symbols);\n\n // -- LEGEND LABELS --\n const labelOffset = encoder(symbolOffset);\n labelOffset.offset = _('labelOffset');\n encode = {\n enter: enter = {\n opacity: zero,\n x: {\n signal: xSignal,\n offset: labelOffset\n },\n y: yEncode\n },\n update: update = {\n opacity: one,\n text: {\n field: Label\n },\n x: enter.x,\n y: enter.y\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n align: _('labelAlign'),\n baseline: _('labelBaseline'),\n fill: _('labelColor'),\n fillOpacity: _('labelOpacity'),\n font: _('labelFont'),\n fontSize: _('labelFontSize'),\n fontStyle: _('labelFontStyle'),\n fontWeight: _('labelFontWeight'),\n limit: _('labelLimit')\n });\n const labels = guideMark({\n type: TextMark,\n role: LegendLabelRole,\n style: GuideLabelStyle,\n key: Value,\n from: valueRef,\n encode\n }, userEncode.labels);\n\n // -- LEGEND ENTRY GROUPS --\n encode = {\n enter: {\n noBound: {\n value: !height\n },\n // ignore width/height in bounds calc\n width: zero,\n height: height ? encoder(height) : zero,\n opacity: zero\n },\n exit: {\n opacity: zero\n },\n update: update = {\n opacity: one,\n row: {\n signal: null\n },\n column: {\n signal: null\n }\n }\n };\n\n // annotate and sort groups to ensure correct ordering\n if (_.isVertical(true)) {\n nrows = `ceil(item.mark.items.length / ${ncols})`;\n update.row.signal = `${index}%${nrows}`;\n update.column.signal = `floor(${index} / ${nrows})`;\n sort = {\n field: ['row', index]\n };\n } else {\n update.row.signal = `floor(${index} / ${ncols})`;\n update.column.signal = `${index} % ${ncols}`;\n sort = {\n field: index\n };\n }\n // handle zero column case (implies infinite columns)\n update.column.signal = `(${columns})?${update.column.signal}:${index}`;\n\n // facet legend entries into sub-groups\n dataRef = {\n facet: {\n data: dataRef,\n name: 'value',\n groupby: Index\n }\n };\n return guideGroup({\n role: ScopeRole,\n from: dataRef,\n encode: extendEncode(encode, entries, Skip),\n marks: [symbols, labels],\n name,\n interactive,\n sort\n });\n}\nfunction legendSymbolLayout(spec, config) {\n const _ = lookup(spec, config);\n\n // layout parameters for legend entries\n return {\n align: _('gridAlign'),\n columns: _.entryColumns(),\n center: {\n row: true,\n column: false\n },\n padding: {\n row: _('rowPadding'),\n column: _('columnPadding')\n }\n };\n}\n\n// expression logic for align, anchor, angle, and baseline calculation\nconst isL = 'item.orient === \"left\"',\n isR = 'item.orient === \"right\"',\n isLR = `(${isL} || ${isR})`,\n isVG = `datum.vgrad && ${isLR}`,\n baseline = anchorExpr('\"top\"', '\"bottom\"', '\"middle\"'),\n alignFlip = anchorExpr('\"right\"', '\"left\"', '\"center\"'),\n exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? \"left\" : ${alignExpr$1}`,\n exprAnchor = `item._anchor || (${isLR} ? \"middle\" : \"start\")`,\n exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`,\n exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? \"bottom\" : \"top\") : ${baseline}) : \"top\"`;\nfunction legendTitle (spec, config, userEncode, dataRef) {\n const _ = lookup(spec, config);\n const encode = {\n enter: {\n opacity: zero\n },\n update: {\n opacity: one,\n x: {\n field: {\n group: 'padding'\n }\n },\n y: {\n field: {\n group: 'padding'\n }\n }\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n orient: _('titleOrient'),\n _anchor: _('titleAnchor'),\n anchor: {\n signal: exprAnchor\n },\n angle: {\n signal: exprAngle\n },\n align: {\n signal: exprAlign\n },\n baseline: {\n signal: exprBaseline\n },\n text: spec.title,\n fill: _('titleColor'),\n fillOpacity: _('titleOpacity'),\n font: _('titleFont'),\n fontSize: _('titleFontSize'),\n fontStyle: _('titleFontStyle'),\n fontWeight: _('titleFontWeight'),\n limit: _('titleLimit'),\n lineHeight: _('titleLineHeight')\n }, {\n // require update\n align: _('titleAlign'),\n baseline: _('titleBaseline')\n });\n return guideMark({\n type: TextMark,\n role: LegendTitleRole,\n style: GuideTitleStyle,\n from: dataRef,\n encode\n }, userEncode);\n}\n\nfunction clip (clip, scope) {\n let expr;\n if (isObject(clip)) {\n if (clip.signal) {\n expr = clip.signal;\n } else if (clip.path) {\n expr = 'pathShape(' + param(clip.path) + ')';\n } else if (clip.sphere) {\n expr = 'geoShape(' + param(clip.sphere) + ', {type: \"Sphere\"})';\n }\n }\n return expr ? scope.signalRef(expr) : !!clip;\n}\nfunction param(value) {\n return isObject(value) && value.signal ? value.signal : stringValue(value);\n}\n\nfunction getRole (spec) {\n const role = spec.role || '';\n return !role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title') ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole;\n}\n\nfunction definition (spec) {\n return {\n marktype: spec.type,\n name: spec.name || undefined,\n role: spec.role || getRole(spec),\n zindex: +spec.zindex || undefined,\n aria: spec.aria,\n description: spec.description\n };\n}\n\nfunction interactive (spec, scope) {\n return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true;\n}\n\n/**\n * Parse a data transform specification.\n */\nfunction parseTransform (spec, scope) {\n const def = definition$1(spec.type);\n if (!def) error('Unrecognized transform type: ' + stringValue(spec.type));\n const t = entry(def.type.toLowerCase(), null, parseParameters(def, spec, scope));\n if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t));\n t.metadata = def.metadata || {};\n return t;\n}\n\n/**\n * Parse all parameters of a data transform.\n */\nfunction parseParameters(def, spec, scope) {\n const params = {},\n n = def.params.length;\n for (let i = 0; i < n; ++i) {\n const pdef = def.params[i];\n params[pdef.name] = parseParameter(pdef, spec, scope);\n }\n return params;\n}\n\n/**\n * Parse a data transform parameter.\n */\nfunction parseParameter(def, spec, scope) {\n const type = def.type,\n value = spec[def.name];\n if (type === 'index') {\n return parseIndexParameter(def, spec, scope);\n } else if (value === undefined) {\n if (def.required) {\n error('Missing required ' + stringValue(spec.type) + ' parameter: ' + stringValue(def.name));\n }\n return;\n } else if (type === 'param') {\n return parseSubParameters(def, spec, scope);\n } else if (type === 'projection') {\n return scope.projectionRef(spec[def.name]);\n }\n return def.array && !isSignal(value) ? value.map(v => parameterValue(def, v, scope)) : parameterValue(def, value, scope);\n}\n\n/**\n * Parse a single parameter value.\n */\nfunction parameterValue(def, value, scope) {\n const type = def.type;\n if (isSignal(value)) {\n return isExpr(type) ? error('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal);\n } else {\n const expr = def.expr || isField(type);\n return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef$1(value.field, value.as) : isExpr(type) ? parseExpression(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef$1(value) : isCompare(type) ? scope.compareRef(value) : value;\n }\n}\n\n/**\n * Parse parameter for accessing an index of another data set.\n */\nfunction parseIndexParameter(def, spec, scope) {\n if (!isString(spec.from)) {\n error('Lookup \"from\" parameter must be a string literal.');\n }\n return scope.getData(spec.from).lookupRef(scope, spec.key);\n}\n\n/**\n * Parse a parameter that contains one or more sub-parameter objects.\n */\nfunction parseSubParameters(def, spec, scope) {\n const value = spec[def.name];\n if (def.array) {\n if (!isArray(value)) {\n // signals not allowed!\n error('Expected an array of sub-parameters. Instead: ' + stringValue(value));\n }\n return value.map(v => parseSubParameter(def, v, scope));\n } else {\n return parseSubParameter(def, value, scope);\n }\n}\n\n/**\n * Parse a sub-parameter object.\n */\nfunction parseSubParameter(def, value, scope) {\n const n = def.params.length;\n let pdef;\n\n // loop over defs to find matching key\n for (let i = 0; i < n; ++i) {\n pdef = def.params[i];\n for (const k in pdef.key) {\n if (pdef.key[k] !== value[k]) {\n pdef = null;\n break;\n }\n }\n if (pdef) break;\n }\n // raise error if matching key not found\n if (!pdef) error('Unsupported parameter: ' + stringValue(value));\n\n // parse params, create Params transform, return ref\n const params = extend(parseParameters(pdef, value, scope), pdef.key);\n return ref(scope.add(Params(params)));\n}\n\n// -- Utilities -----\n\nconst outerExpr = _ => _ && _.expr;\nconst outerField = _ => _ && _.field;\nconst isData = _ => _ === 'data';\nconst isExpr = _ => _ === 'expr';\nconst isField = _ => _ === 'field';\nconst isCompare = _ => _ === 'compare';\n\nfunction parseData$1 (from, group, scope) {\n let facet, key, op, dataRef, parent;\n\n // if no source data, generate singleton datum\n if (!from) {\n dataRef = ref(scope.add(Collect(null, [{}])));\n }\n\n // if faceted, process facet specification\n else if (facet = from.facet) {\n if (!group) error('Only group marks can be faceted.');\n\n // use pre-faceted source data, if available\n if (facet.field != null) {\n dataRef = parent = getDataRef(facet, scope);\n } else {\n // generate facet aggregates if no direct data specification\n if (!from.data) {\n op = parseTransform(extend({\n type: 'aggregate',\n groupby: array(facet.groupby)\n }, facet.aggregate), scope);\n op.params.key = scope.keyRef(facet.groupby);\n op.params.pulse = getDataRef(facet, scope);\n dataRef = parent = ref(scope.add(op));\n } else {\n parent = ref(scope.getData(from.data).aggregate);\n }\n key = scope.keyRef(facet.groupby, true);\n }\n }\n\n // if not yet defined, get source data reference\n if (!dataRef) {\n dataRef = getDataRef(from, scope);\n }\n return {\n key: key,\n pulse: dataRef,\n parent: parent\n };\n}\nfunction getDataRef(from, scope) {\n return from.$ref ? from : from.data && from.data.$ref ? from.data : ref(scope.getData(from.data).output);\n}\n\nfunction DataScope(scope, input, output, values, aggr) {\n this.scope = scope; // parent scope object\n this.input = input; // first operator in pipeline (tuple input)\n this.output = output; // last operator in pipeline (tuple output)\n this.values = values; // operator for accessing tuples (but not tuple flow)\n\n // last aggregate in transform pipeline\n this.aggregate = aggr;\n\n // lookup table of field indices\n this.index = {};\n}\nDataScope.fromEntries = function (scope, entries) {\n const n = entries.length,\n values = entries[n - 1],\n output = entries[n - 2];\n let input = entries[0],\n aggr = null,\n i = 1;\n if (input && input.type === 'load') {\n input = entries[1];\n }\n\n // add operator entries to this scope, wire up pulse chain\n scope.add(entries[0]);\n for (; i < n; ++i) {\n entries[i].params.pulse = ref(entries[i - 1]);\n scope.add(entries[i]);\n if (entries[i].type === 'aggregate') aggr = entries[i];\n }\n return new DataScope(scope, input, output, values, aggr);\n};\nfunction fieldKey(field) {\n return isString(field) ? field : null;\n}\nfunction addSortField(scope, p, sort) {\n const as = aggrField(sort.op, sort.field);\n let s;\n if (p.ops) {\n for (let i = 0, n = p.as.length; i < n; ++i) {\n if (p.as[i] === as) return;\n }\n } else {\n p.ops = ['count'];\n p.fields = [null];\n p.as = ['count'];\n }\n if (sort.op) {\n p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op);\n p.fields.push(scope.fieldRef(sort.field));\n p.as.push(as);\n }\n}\nfunction cache(scope, ds, name, optype, field, counts, index) {\n const cache = ds[name] || (ds[name] = {}),\n sort = sortKey(counts);\n let k = fieldKey(field),\n v,\n op;\n if (k != null) {\n scope = ds.scope;\n k = k + (sort ? '|' + sort : '');\n v = cache[k];\n }\n if (!v) {\n const params = counts ? {\n field: keyFieldRef,\n pulse: ds.countsRef(scope, field, counts)\n } : {\n field: scope.fieldRef(field),\n pulse: ref(ds.output)\n };\n if (sort) params.sort = scope.sortRef(counts);\n op = scope.add(entry(optype, undefined, params));\n if (index) ds.index[field] = op;\n v = ref(op);\n if (k != null) cache[k] = v;\n }\n return v;\n}\nDataScope.prototype = {\n countsRef(scope, field, sort) {\n const ds = this,\n cache = ds.counts || (ds.counts = {}),\n k = fieldKey(field);\n let v, a, p;\n if (k != null) {\n scope = ds.scope;\n v = cache[k];\n }\n if (!v) {\n p = {\n groupby: scope.fieldRef(field, 'key'),\n pulse: ref(ds.output)\n };\n if (sort && sort.field) addSortField(scope, p, sort);\n a = scope.add(Aggregate(p));\n v = scope.add(Collect({\n pulse: ref(a)\n }));\n v = {\n agg: a,\n ref: ref(v)\n };\n if (k != null) cache[k] = v;\n } else if (sort && sort.field) {\n addSortField(scope, v.agg.params, sort);\n }\n return v.ref;\n },\n tuplesRef() {\n return ref(this.values);\n },\n extentRef(scope, field) {\n return cache(scope, this, 'extent', 'extent', field, false);\n },\n domainRef(scope, field) {\n return cache(scope, this, 'domain', 'values', field, false);\n },\n valuesRef(scope, field, sort) {\n return cache(scope, this, 'vals', 'values', field, sort || true);\n },\n lookupRef(scope, field) {\n return cache(scope, this, 'lookup', 'tupleindex', field, false);\n },\n indataRef(scope, field) {\n return cache(scope, this, 'indata', 'tupleindex', field, true, true);\n }\n};\n\nfunction parseFacet (spec, scope, group) {\n const facet = spec.from.facet,\n name = facet.name,\n data = getDataRef(facet, scope);\n let op;\n if (!facet.name) {\n error('Facet must have a name: ' + stringValue(facet));\n }\n if (!facet.data) {\n error('Facet must reference a data set: ' + stringValue(facet));\n }\n if (facet.field) {\n op = scope.add(PreFacet({\n field: scope.fieldRef(facet.field),\n pulse: data\n }));\n } else if (facet.groupby) {\n op = scope.add(Facet({\n key: scope.keyRef(facet.groupby),\n group: ref(scope.proxy(group.parent)),\n pulse: data\n }));\n } else {\n error('Facet must specify groupby or field: ' + stringValue(facet));\n }\n\n // initialize facet subscope\n const subscope = scope.fork(),\n source = subscope.add(Collect()),\n values = subscope.add(Sieve({\n pulse: ref(source)\n }));\n subscope.addData(name, new DataScope(subscope, source, source, values));\n subscope.addSignal('parent', null);\n\n // parse faceted subflow\n op.params.subflow = {\n $subflow: subscope.parse(spec).toRuntime()\n };\n}\n\nfunction parseSubflow (spec, scope, input) {\n const op = scope.add(PreFacet({\n pulse: input.pulse\n })),\n subscope = scope.fork();\n subscope.add(Sieve());\n subscope.addSignal('parent', null);\n\n // parse group mark subflow\n op.params.subflow = {\n $subflow: subscope.parse(spec).toRuntime()\n };\n}\n\nfunction parseTrigger (spec, scope, name) {\n const remove = spec.remove,\n insert = spec.insert,\n toggle = spec.toggle,\n modify = spec.modify,\n values = spec.values,\n op = scope.add(operator());\n const update = 'if(' + spec.trigger + ',modify(\"' + name + '\",' + [insert, remove, toggle, modify, values].map(_ => _ == null ? 'null' : _).join(',') + '),0)';\n const expr = parseExpression(update, scope);\n op.update = expr.$expr;\n op.params = expr.$params;\n}\n\nfunction parseMark (spec, scope) {\n const role = getRole(spec),\n group = spec.type === GroupMark,\n facet = spec.from && spec.from.facet,\n overlap = spec.overlap;\n let layout = spec.layout || role === ScopeRole || role === FrameRole,\n ops,\n op,\n store,\n enc,\n name,\n layoutRef,\n boundRef;\n const nested = role === MarkRole || layout || facet;\n\n // resolve input data\n const input = parseData$1(spec.from, group, scope);\n\n // data join to map tuples to visual items\n op = scope.add(DataJoin({\n key: input.key || (spec.key ? fieldRef$1(spec.key) : undefined),\n pulse: input.pulse,\n clean: !group\n }));\n const joinRef = ref(op);\n\n // collect visual items\n op = store = scope.add(Collect({\n pulse: joinRef\n }));\n\n // connect visual items to scenegraph\n op = scope.add(Mark({\n markdef: definition(spec),\n interactive: interactive(spec.interactive, scope),\n clip: clip(spec.clip, scope),\n context: {\n $context: true\n },\n groups: scope.lookup(),\n parent: scope.signals.parent ? scope.signalRef('parent') : null,\n index: scope.markpath(),\n pulse: ref(op)\n }));\n const markRef = ref(op);\n\n // add visual encoders\n op = enc = scope.add(Encode(parseEncode(spec.encode, spec.type, role, spec.style, scope, {\n mod: false,\n pulse: markRef\n })));\n\n // monitor parent marks to propagate changes\n op.params.parent = scope.encode();\n\n // add post-encoding transforms, if defined\n if (spec.transform) {\n spec.transform.forEach(_ => {\n const tx = parseTransform(_, scope),\n md = tx.metadata;\n if (md.generates || md.changes) {\n error('Mark transforms should not generate new data.');\n }\n if (!md.nomod) enc.params.mod = true; // update encode mod handling\n tx.params.pulse = ref(op);\n scope.add(op = tx);\n });\n }\n\n // if item sort specified, perform post-encoding\n if (spec.sort) {\n op = scope.add(SortItems({\n sort: scope.compareRef(spec.sort),\n pulse: ref(op)\n }));\n }\n const encodeRef = ref(op);\n\n // add view layout operator if needed\n if (facet || layout) {\n layout = scope.add(ViewLayout({\n layout: scope.objectProperty(spec.layout),\n legends: scope.legends,\n mark: markRef,\n pulse: encodeRef\n }));\n layoutRef = ref(layout);\n }\n\n // compute bounding boxes\n const bound = scope.add(Bound({\n mark: markRef,\n pulse: layoutRef || encodeRef\n }));\n boundRef = ref(bound);\n\n // if group mark, recurse to parse nested content\n if (group) {\n // juggle layout & bounds to ensure they run *after* any faceting transforms\n if (nested) {\n ops = scope.operators;\n ops.pop();\n if (layout) ops.pop();\n }\n scope.pushState(encodeRef, layoutRef || boundRef, joinRef);\n facet ? parseFacet(spec, scope, input) // explicit facet\n : nested ? parseSubflow(spec, scope, input) // standard mark group\n : scope.parse(spec); // guide group, we can avoid nested scopes\n scope.popState();\n if (nested) {\n if (layout) ops.push(layout);\n ops.push(bound);\n }\n }\n\n // if requested, add overlap removal transform\n if (overlap) {\n boundRef = parseOverlap(overlap, boundRef, scope);\n }\n\n // render / sieve items\n const render = scope.add(Render({\n pulse: boundRef\n })),\n sieve = scope.add(Sieve({\n pulse: ref(render)\n }, undefined, scope.parent()));\n\n // if mark is named, make accessible as reactive geometry\n // add trigger updates if defined\n if (spec.name != null) {\n name = spec.name;\n scope.addData(name, new DataScope(scope, store, render, sieve));\n if (spec.on) spec.on.forEach(on => {\n if (on.insert || on.remove || on.toggle) {\n error('Marks only support modify triggers.');\n }\n parseTrigger(on, scope, name);\n });\n }\n}\nfunction parseOverlap(overlap, source, scope) {\n const method = overlap.method,\n bound = overlap.bound,\n sep = overlap.separation;\n const params = {\n separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep,\n method: isSignal(method) ? scope.signalRef(method.signal) : method,\n pulse: source\n };\n if (overlap.order) {\n params.sort = scope.compareRef({\n field: overlap.order\n });\n }\n if (bound) {\n const tol = bound.tolerance;\n params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol;\n params.boundScale = scope.scaleRef(bound.scale);\n params.boundOrient = bound.orient;\n }\n return ref(scope.add(Overlap(params)));\n}\n\nfunction parseLegend (spec, scope) {\n const config = scope.config.legend,\n encode = spec.encode || {},\n _ = lookup(spec, config),\n legendEncode = encode.legend || {},\n name = legendEncode.name || undefined,\n interactive = legendEncode.interactive,\n style = legendEncode.style,\n scales = {};\n let scale = 0,\n entryLayout,\n params,\n children;\n\n // resolve scales and 'canonical' scale name\n LegendScales.forEach(s => spec[s] ? (scales[s] = spec[s], scale = scale || spec[s]) : 0);\n if (!scale) error('Missing valid scale for legend.');\n\n // resolve legend type (symbol, gradient, or discrete gradient)\n const type = legendType(spec, scope.scaleType(scale));\n\n // single-element data source for legend group\n const datum = {\n title: spec.title != null,\n scales: scales,\n type: type,\n vgrad: type !== 'symbol' && _.isVertical()\n };\n const dataRef = ref(scope.add(Collect(null, [datum])));\n\n // encoding properties for legend entry sub-group\n const entryEncode = {\n enter: {\n x: {\n value: 0\n },\n y: {\n value: 0\n }\n }\n };\n\n // data source for legend values\n const entryRef = ref(scope.add(LegendEntries(params = {\n type: type,\n scale: scope.scaleRef(scale),\n count: scope.objectProperty(_('tickCount')),\n limit: scope.property(_('symbolLimit')),\n values: scope.objectProperty(spec.values),\n minstep: scope.property(spec.tickMinStep),\n formatType: scope.property(spec.formatType),\n formatSpecifier: scope.property(spec.format)\n })));\n\n // continuous gradient legend\n if (type === Gradient) {\n children = [legendGradient(spec, scale, config, encode.gradient), legendGradientLabels(spec, config, encode.labels, entryRef)];\n // adjust default tick count based on the gradient length\n params.count = params.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`);\n }\n\n // discrete gradient legend\n else if (type === Discrete) {\n children = [legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), legendGradientLabels(spec, config, encode.labels, entryRef)];\n }\n\n // symbol legend\n else {\n // determine legend symbol group layout\n entryLayout = legendSymbolLayout(spec, config);\n children = [legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns))];\n // pass symbol size information to legend entry generator\n params.size = sizeExpression(spec, scope, children[0].marks);\n }\n\n // generate legend marks\n children = [guideGroup({\n role: LegendEntryRole,\n from: dataRef,\n encode: entryEncode,\n marks: children,\n layout: entryLayout,\n interactive\n })];\n\n // include legend title if defined\n if (datum.title) {\n children.push(legendTitle(spec, config, encode.title, dataRef));\n }\n\n // parse legend specification\n return parseMark(guideGroup({\n role: LegendRole,\n from: dataRef,\n encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip),\n marks: children,\n aria: _('aria'),\n description: _('description'),\n zindex: _('zindex'),\n name,\n interactive,\n style\n }), scope);\n}\nfunction legendType(spec, scaleType) {\n let type = spec.type || Symbols;\n if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) {\n type = isContinuous(scaleType) ? Gradient : isDiscretizing(scaleType) ? Discrete : Symbols;\n }\n return type !== Gradient ? type : isDiscretizing(scaleType) ? Discrete : Gradient;\n}\nfunction scaleCount(spec) {\n return LegendScales.reduce((count, type) => count + (spec[type] ? 1 : 0), 0);\n}\nfunction buildLegendEncode(_, spec, config) {\n const encode = {\n enter: {},\n update: {}\n };\n addEncoders(encode, {\n orient: _('orient'),\n offset: _('offset'),\n padding: _('padding'),\n titlePadding: _('titlePadding'),\n cornerRadius: _('cornerRadius'),\n fill: _('fillColor'),\n stroke: _('strokeColor'),\n strokeWidth: config.strokeWidth,\n strokeDash: config.strokeDash,\n x: _('legendX'),\n y: _('legendY'),\n // accessibility support\n format: spec.format,\n formatType: spec.formatType\n });\n return encode;\n}\nfunction sizeExpression(spec, scope, marks) {\n const size = deref(getChannel('size', spec, marks)),\n strokeWidth = deref(getChannel('strokeWidth', spec, marks)),\n fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle));\n return parseExpression(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, scope);\n}\nfunction getChannel(name, spec, marks) {\n return spec[name] ? `scale(\"${spec[name]}\",datum)` : getEncoding(name, marks[0].encode);\n}\nfunction getFontSize(encode, scope, style) {\n return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style);\n}\n\nconst angleExpr = `item.orient===\"${Left}\"?-90:item.orient===\"${Right}\"?90:0`;\nfunction parseTitle (spec, scope) {\n spec = isString(spec) ? {\n text: spec\n } : spec;\n const _ = lookup(spec, scope.config.title),\n encode = spec.encode || {},\n userEncode = encode.group || {},\n name = userEncode.name || undefined,\n interactive = userEncode.interactive,\n style = userEncode.style,\n children = [];\n\n // single-element data source for group title\n const datum = {},\n dataRef = ref(scope.add(Collect(null, [datum])));\n\n // include title text\n children.push(buildTitle(spec, _, titleEncode(spec), dataRef));\n\n // include subtitle text\n if (spec.subtitle) {\n children.push(buildSubTitle(spec, _, encode.subtitle, dataRef));\n }\n\n // parse title specification\n return parseMark(guideGroup({\n role: TitleRole,\n from: dataRef,\n encode: groupEncode(_, userEncode),\n marks: children,\n aria: _('aria'),\n description: _('description'),\n zindex: _('zindex'),\n name,\n interactive,\n style\n }), scope);\n}\n\n// provide backwards-compatibility for title custom encode;\n// the top-level encode block has been *deprecated*.\nfunction titleEncode(spec) {\n const encode = spec.encode;\n return encode && encode.title || extend({\n name: spec.name,\n interactive: spec.interactive,\n style: spec.style\n }, encode);\n}\nfunction groupEncode(_, userEncode) {\n const encode = {\n enter: {},\n update: {}\n };\n addEncoders(encode, {\n orient: _('orient'),\n anchor: _('anchor'),\n align: {\n signal: alignExpr$1\n },\n angle: {\n signal: angleExpr\n },\n limit: _('limit'),\n frame: _('frame'),\n offset: _('offset') || 0,\n padding: _('subtitlePadding')\n });\n return extendEncode(encode, userEncode, Skip);\n}\nfunction buildTitle(spec, _, userEncode, dataRef) {\n const zero = {\n value: 0\n },\n text = spec.text,\n encode = {\n enter: {\n opacity: zero\n },\n update: {\n opacity: {\n value: 1\n }\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n text: text,\n align: {\n signal: 'item.mark.group.align'\n },\n angle: {\n signal: 'item.mark.group.angle'\n },\n limit: {\n signal: 'item.mark.group.limit'\n },\n baseline: 'top',\n dx: _('dx'),\n dy: _('dy'),\n fill: _('color'),\n font: _('font'),\n fontSize: _('fontSize'),\n fontStyle: _('fontStyle'),\n fontWeight: _('fontWeight'),\n lineHeight: _('lineHeight')\n }, {\n // update\n align: _('align'),\n angle: _('angle'),\n baseline: _('baseline')\n });\n return guideMark({\n type: TextMark,\n role: TitleTextRole,\n style: GroupTitleStyle,\n from: dataRef,\n encode\n }, userEncode);\n}\nfunction buildSubTitle(spec, _, userEncode, dataRef) {\n const zero = {\n value: 0\n },\n text = spec.subtitle,\n encode = {\n enter: {\n opacity: zero\n },\n update: {\n opacity: {\n value: 1\n }\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n text: text,\n align: {\n signal: 'item.mark.group.align'\n },\n angle: {\n signal: 'item.mark.group.angle'\n },\n limit: {\n signal: 'item.mark.group.limit'\n },\n baseline: 'top',\n dx: _('dx'),\n dy: _('dy'),\n fill: _('subtitleColor'),\n font: _('subtitleFont'),\n fontSize: _('subtitleFontSize'),\n fontStyle: _('subtitleFontStyle'),\n fontWeight: _('subtitleFontWeight'),\n lineHeight: _('subtitleLineHeight')\n }, {\n // update\n align: _('align'),\n angle: _('angle'),\n baseline: _('baseline')\n });\n return guideMark({\n type: TextMark,\n role: TitleSubtitleRole,\n style: GroupSubtitleStyle,\n from: dataRef,\n encode\n }, userEncode);\n}\n\nfunction parseData(data, scope) {\n const transforms = [];\n if (data.transform) {\n data.transform.forEach(tx => {\n transforms.push(parseTransform(tx, scope));\n });\n }\n if (data.on) {\n data.on.forEach(on => {\n parseTrigger(on, scope, data.name);\n });\n }\n scope.addDataPipeline(data.name, analyze(data, scope, transforms));\n}\n\n/**\n * Analyze a data pipeline, add needed operators.\n */\nfunction analyze(data, scope, ops) {\n const output = [];\n let source = null,\n modify = false,\n generate = false,\n upstream,\n i,\n n,\n t,\n m;\n if (data.values) {\n // hard-wired input data set\n if (isSignal(data.values) || hasSignal(data.format)) {\n // if either values is signal or format has signal, use dynamic loader\n output.push(load(scope, data));\n output.push(source = collect());\n } else {\n // otherwise, ingest upon dataflow init\n output.push(source = collect({\n $ingest: data.values,\n $format: data.format\n }));\n }\n } else if (data.url) {\n // load data from external source\n if (hasSignal(data.url) || hasSignal(data.format)) {\n // if either url or format has signal, use dynamic loader\n output.push(load(scope, data));\n output.push(source = collect());\n } else {\n // otherwise, request load upon dataflow init\n output.push(source = collect({\n $request: data.url,\n $format: data.format\n }));\n }\n } else if (data.source) {\n // derives from one or more other data sets\n source = upstream = array(data.source).map(d => ref(scope.getData(d).output));\n output.push(null); // populate later\n }\n\n // scan data transforms, add collectors as needed\n for (i = 0, n = ops.length; i < n; ++i) {\n t = ops[i];\n m = t.metadata;\n if (!source && !m.source) {\n output.push(source = collect());\n }\n output.push(t);\n if (m.generates) generate = true;\n if (m.modifies && !generate) modify = true;\n if (m.source) source = t;else if (m.changes) source = null;\n }\n if (upstream) {\n n = upstream.length - 1;\n output[0] = Relay({\n derive: modify,\n pulse: n ? upstream : upstream[0]\n });\n if (modify || n) {\n // collect derived and multi-pulse tuples\n output.splice(1, 0, collect());\n }\n }\n if (!source) output.push(collect());\n output.push(Sieve({}));\n return output;\n}\nfunction collect(values) {\n const s = Collect({}, values);\n s.metadata = {\n source: true\n };\n return s;\n}\nfunction load(scope, data) {\n return Load({\n url: data.url ? scope.property(data.url) : undefined,\n async: data.async ? scope.property(data.async) : undefined,\n values: data.values ? scope.property(data.values) : undefined,\n format: scope.objectProperty(data.format)\n });\n}\n\nconst isX = orient => orient === Bottom || orient === Top;\n\n// get sign coefficient based on axis orient\nconst getSign = (orient, a, b) => isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left || orient === Top ? a : b;\n\n// condition on axis x-direction\nconst ifX = (orient, a, b) => isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b;\n\n// condition on axis y-direction\nconst ifY = (orient, a, b) => isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a;\nconst ifTop = (orient, a, b) => isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top ? {\n value: a\n} : {\n value: b\n};\nconst ifRight = (orient, a, b) => isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right ? {\n value: a\n} : {\n value: b\n};\nconst ifXEnc = ($orient, a, b) => ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a, b);\nconst ifYEnc = ($orient, a, b) => ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a, b);\nconst ifLeftTopExpr = ($orient, a, b) => ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a, b);\nconst ifTopExpr = ($orient, a, b) => ifExpr(`${$orient} === '${Top}'`, a, b);\nconst ifRightExpr = ($orient, a, b) => ifExpr(`${$orient} === '${Right}'`, a, b);\nconst ifEnc = (test, a, b) => {\n // ensure inputs are encoder objects (or null)\n a = a != null ? encoder(a) : a;\n b = b != null ? encoder(b) : b;\n if (isSimple(a) && isSimple(b)) {\n // if possible generate simple signal expression\n a = a ? a.signal || stringValue(a.value) : null;\n b = b ? b.signal || stringValue(b.value) : null;\n return {\n signal: `${test} ? (${a}) : (${b})`\n };\n } else {\n // otherwise generate rule set\n return [extend({\n test\n }, a)].concat(b || []);\n }\n};\nconst isSimple = enc => enc == null || Object.keys(enc).length === 1;\nconst ifExpr = (test, a, b) => ({\n signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})`\n});\nconst ifOrient = ($orient, t, b, l, r) => ({\n signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : '') + (b != null ? `${$orient} === '${Bottom}' ? (${toExpr(b)}) : ` : '') + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : '') + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : '') + '(null)'\n});\nconst toExpr = v => isSignal(v) ? v.signal : v == null ? null : stringValue(v);\nconst mult = (sign, value) => value === 0 ? 0 : isSignal(sign) ? {\n signal: `(${sign.signal}) * ${value}`\n} : {\n value: sign * value\n};\nconst patch = (value, base) => {\n const s = value.signal;\n return s && s.endsWith('(null)') ? {\n signal: s.slice(0, -6) + base.signal\n } : value;\n};\n\nfunction fallback(prop, config, axisConfig, style) {\n let styleProp;\n if (config && hasOwnProperty(config, prop)) {\n return config[prop];\n } else if (hasOwnProperty(axisConfig, prop)) {\n return axisConfig[prop];\n } else if (prop.startsWith('title')) {\n switch (prop) {\n case 'titleColor':\n styleProp = 'fill';\n break;\n case 'titleFont':\n case 'titleFontSize':\n case 'titleFontWeight':\n styleProp = prop[5].toLowerCase() + prop.slice(6);\n }\n return style[GuideTitleStyle][styleProp];\n } else if (prop.startsWith('label')) {\n switch (prop) {\n case 'labelColor':\n styleProp = 'fill';\n break;\n case 'labelFont':\n case 'labelFontSize':\n styleProp = prop[5].toLowerCase() + prop.slice(6);\n }\n return style[GuideLabelStyle][styleProp];\n }\n return null;\n}\nfunction keys(objects) {\n const map = {};\n for (const obj of objects) {\n if (!obj) continue;\n for (const key in obj) map[key] = 1;\n }\n return Object.keys(map);\n}\nfunction axisConfig (spec, scope) {\n var config = scope.config,\n style = config.style,\n axis = config.axis,\n band = scope.scaleType(spec.scale) === 'band' && config.axisBand,\n orient = spec.orient,\n xy,\n or,\n key;\n if (isSignal(orient)) {\n const xyKeys = keys([config.axisX, config.axisY]),\n orientKeys = keys([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]);\n xy = {};\n for (key of xyKeys) {\n xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style));\n }\n or = {};\n for (key of orientKeys) {\n or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style));\n }\n } else {\n xy = orient === Top || orient === Bottom ? config.axisX : config.axisY;\n or = config['axis' + orient[0].toUpperCase() + orient.slice(1)];\n }\n const result = xy || or || band ? extend({}, axis, xy, or, band) : axis;\n return result;\n}\n\nfunction axisDomain (spec, config, userEncode, dataRef) {\n const _ = lookup(spec, config),\n orient = spec.orient;\n let enter, update;\n const encode = {\n enter: enter = {\n opacity: zero\n },\n update: update = {\n opacity: one\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n stroke: _('domainColor'),\n strokeCap: _('domainCap'),\n strokeDash: _('domainDash'),\n strokeDashOffset: _('domainDashOffset'),\n strokeWidth: _('domainWidth'),\n strokeOpacity: _('domainOpacity')\n });\n const pos0 = position(spec, 0);\n const pos1 = position(spec, 1);\n enter.x = update.x = ifX(orient, pos0, zero);\n enter.x2 = update.x2 = ifX(orient, pos1);\n enter.y = update.y = ifY(orient, pos0, zero);\n enter.y2 = update.y2 = ifY(orient, pos1);\n return guideMark({\n type: RuleMark,\n role: AxisDomainRole,\n from: dataRef,\n encode\n }, userEncode);\n}\nfunction position(spec, pos) {\n return {\n scale: spec.scale,\n range: pos\n };\n}\n\nfunction axisGrid (spec, config, userEncode, dataRef, band) {\n const _ = lookup(spec, config),\n orient = spec.orient,\n vscale = spec.gridScale,\n sign = getSign(orient, 1, -1),\n offset = offsetValue(spec.offset, sign);\n let enter, exit, update;\n const encode = {\n enter: enter = {\n opacity: zero\n },\n update: update = {\n opacity: one\n },\n exit: exit = {\n opacity: zero\n }\n };\n addEncoders(encode, {\n stroke: _('gridColor'),\n strokeCap: _('gridCap'),\n strokeDash: _('gridDash'),\n strokeDashOffset: _('gridDashOffset'),\n strokeOpacity: _('gridOpacity'),\n strokeWidth: _('gridWidth')\n });\n const tickPos = {\n scale: spec.scale,\n field: Value,\n band: band.band,\n extra: band.extra,\n offset: band.offset,\n round: _('tickRound')\n };\n const sz = ifX(orient, {\n signal: 'height'\n }, {\n signal: 'width'\n });\n const gridStart = vscale ? {\n scale: vscale,\n range: 0,\n mult: sign,\n offset: offset\n } : {\n value: 0,\n offset: offset\n };\n const gridEnd = vscale ? {\n scale: vscale,\n range: 1,\n mult: sign,\n offset: offset\n } : extend(sz, {\n mult: sign,\n offset: offset\n });\n enter.x = update.x = ifX(orient, tickPos, gridStart);\n enter.y = update.y = ifY(orient, tickPos, gridStart);\n enter.x2 = update.x2 = ifY(orient, gridEnd);\n enter.y2 = update.y2 = ifX(orient, gridEnd);\n exit.x = ifX(orient, tickPos);\n exit.y = ifY(orient, tickPos);\n return guideMark({\n type: RuleMark,\n role: AxisGridRole,\n key: Value,\n from: dataRef,\n encode\n }, userEncode);\n}\nfunction offsetValue(offset, sign) {\n if (sign === 1) ; else if (!isObject(offset)) {\n offset = isSignal(sign) ? {\n signal: `(${sign.signal}) * (${offset || 0})`\n } : sign * (offset || 0);\n } else {\n let entry = offset = extend({}, offset);\n while (entry.mult != null) {\n if (!isObject(entry.mult)) {\n entry.mult = isSignal(sign) // no offset if sign === 1\n ? {\n signal: `(${entry.mult}) * (${sign.signal})`\n } : entry.mult * sign;\n return offset;\n } else {\n entry = entry.mult = extend({}, entry.mult);\n }\n }\n entry.mult = sign;\n }\n return offset;\n}\n\nfunction axisTicks (spec, config, userEncode, dataRef, size, band) {\n const _ = lookup(spec, config),\n orient = spec.orient,\n sign = getSign(orient, -1, 1);\n let enter, exit, update;\n const encode = {\n enter: enter = {\n opacity: zero\n },\n update: update = {\n opacity: one\n },\n exit: exit = {\n opacity: zero\n }\n };\n addEncoders(encode, {\n stroke: _('tickColor'),\n strokeCap: _('tickCap'),\n strokeDash: _('tickDash'),\n strokeDashOffset: _('tickDashOffset'),\n strokeOpacity: _('tickOpacity'),\n strokeWidth: _('tickWidth')\n });\n const tickSize = encoder(size);\n tickSize.mult = sign;\n const tickPos = {\n scale: spec.scale,\n field: Value,\n band: band.band,\n extra: band.extra,\n offset: band.offset,\n round: _('tickRound')\n };\n update.y = enter.y = ifX(orient, zero, tickPos);\n update.y2 = enter.y2 = ifX(orient, tickSize);\n exit.x = ifX(orient, tickPos);\n update.x = enter.x = ifY(orient, zero, tickPos);\n update.x2 = enter.x2 = ifY(orient, tickSize);\n exit.y = ifY(orient, tickPos);\n return guideMark({\n type: RuleMark,\n role: AxisTickRole,\n key: Value,\n from: dataRef,\n encode\n }, userEncode);\n}\n\nfunction flushExpr(scale, threshold, a, b, c) {\n return {\n signal: 'flush(range(\"' + scale + '\"), ' + 'scale(\"' + scale + '\", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')'\n };\n}\nfunction axisLabels (spec, config, userEncode, dataRef, size, band) {\n const _ = lookup(spec, config),\n orient = spec.orient,\n scale = spec.scale,\n sign = getSign(orient, -1, 1),\n flush = deref(_('labelFlush')),\n flushOffset = deref(_('labelFlushOffset')),\n labelAlign = _('labelAlign'),\n labelBaseline = _('labelBaseline');\n let flushOn = flush === 0 || !!flush,\n update;\n const tickSize = encoder(size);\n tickSize.mult = sign;\n tickSize.offset = encoder(_('labelPadding') || 0);\n tickSize.offset.mult = sign;\n const tickPos = {\n scale: scale,\n field: Value,\n band: 0.5,\n offset: extendOffset(band.offset, _('labelOffset'))\n };\n const align = ifX(orient, flushOn ? flushExpr(scale, flush, '\"left\"', '\"right\"', '\"center\"') : {\n value: 'center'\n }, ifRight(orient, 'left', 'right'));\n const baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '\"top\"', '\"bottom\"', '\"middle\"') : {\n value: 'middle'\n });\n const offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0);\n flushOn = flushOn && flushOffset;\n const enter = {\n opacity: zero,\n x: ifX(orient, tickPos, tickSize),\n y: ifY(orient, tickPos, tickSize)\n };\n const encode = {\n enter: enter,\n update: update = {\n opacity: one,\n text: {\n field: Label\n },\n x: enter.x,\n y: enter.y,\n align,\n baseline\n },\n exit: {\n opacity: zero,\n x: enter.x,\n y: enter.y\n }\n };\n addEncoders(encode, {\n dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null,\n dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null\n });\n addEncoders(encode, {\n angle: _('labelAngle'),\n fill: _('labelColor'),\n fillOpacity: _('labelOpacity'),\n font: _('labelFont'),\n fontSize: _('labelFontSize'),\n fontWeight: _('labelFontWeight'),\n fontStyle: _('labelFontStyle'),\n limit: _('labelLimit'),\n lineHeight: _('labelLineHeight')\n }, {\n align: labelAlign,\n baseline: labelBaseline\n });\n const bound = _('labelBound');\n let overlap = _('labelOverlap');\n\n // if overlap method or bound defined, request label overlap removal\n overlap = overlap || bound ? {\n separation: _('labelSeparation'),\n method: overlap,\n order: 'datum.index',\n bound: bound ? {\n scale,\n orient,\n tolerance: bound\n } : null\n } : undefined;\n if (update.align !== align) {\n update.align = patch(update.align, align);\n }\n if (update.baseline !== baseline) {\n update.baseline = patch(update.baseline, baseline);\n }\n return guideMark({\n type: TextMark,\n role: AxisLabelRole,\n style: GuideLabelStyle,\n key: Value,\n from: dataRef,\n encode,\n overlap\n }, userEncode);\n}\n\nfunction axisTitle (spec, config, userEncode, dataRef) {\n const _ = lookup(spec, config),\n orient = spec.orient,\n sign = getSign(orient, -1, 1);\n let enter, update;\n const encode = {\n enter: enter = {\n opacity: zero,\n anchor: encoder(_('titleAnchor', null)),\n align: {\n signal: alignExpr$1\n }\n },\n update: update = extend({}, enter, {\n opacity: one,\n text: encoder(spec.title)\n }),\n exit: {\n opacity: zero\n }\n };\n const titlePos = {\n signal: `lerp(range(\"${spec.scale}\"), ${anchorExpr(0, 1, 0.5)})`\n };\n update.x = ifX(orient, titlePos);\n update.y = ifY(orient, titlePos);\n enter.angle = ifX(orient, zero, mult(sign, 90));\n enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), {\n value: Bottom\n });\n update.angle = enter.angle;\n update.baseline = enter.baseline;\n addEncoders(encode, {\n fill: _('titleColor'),\n fillOpacity: _('titleOpacity'),\n font: _('titleFont'),\n fontSize: _('titleFontSize'),\n fontStyle: _('titleFontStyle'),\n fontWeight: _('titleFontWeight'),\n limit: _('titleLimit'),\n lineHeight: _('titleLineHeight')\n }, {\n // require update\n align: _('titleAlign'),\n angle: _('titleAngle'),\n baseline: _('titleBaseline')\n });\n autoLayout(_, orient, encode, userEncode);\n encode.update.align = patch(encode.update.align, enter.align);\n encode.update.angle = patch(encode.update.angle, enter.angle);\n encode.update.baseline = patch(encode.update.baseline, enter.baseline);\n return guideMark({\n type: TextMark,\n role: AxisTitleRole,\n style: GuideTitleStyle,\n from: dataRef,\n encode\n }, userEncode);\n}\nfunction autoLayout(_, orient, encode, userEncode) {\n const auto = (value, dim) => value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has(dim, userEncode) ? true : false;\n const autoY = auto(_('titleX'), 'x'),\n autoX = auto(_('titleY'), 'y');\n encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY));\n}\n\nfunction parseAxis (spec, scope) {\n const config = axisConfig(spec, scope),\n encode = spec.encode || {},\n axisEncode = encode.axis || {},\n name = axisEncode.name || undefined,\n interactive = axisEncode.interactive,\n style = axisEncode.style,\n _ = lookup(spec, config),\n band = tickBand(_);\n\n // single-element data source for axis group\n const datum = {\n scale: spec.scale,\n ticks: !!_('ticks'),\n labels: !!_('labels'),\n grid: !!_('grid'),\n domain: !!_('domain'),\n title: spec.title != null\n };\n const dataRef = ref(scope.add(Collect({}, [datum])));\n\n // data source for axis ticks\n const ticksRef = ref(scope.add(AxisTicks({\n scale: scope.scaleRef(spec.scale),\n extra: scope.property(band.extra),\n count: scope.objectProperty(spec.tickCount),\n values: scope.objectProperty(spec.values),\n minstep: scope.property(spec.tickMinStep),\n formatType: scope.property(spec.formatType),\n formatSpecifier: scope.property(spec.format)\n })));\n\n // generate axis marks\n const children = [];\n let size;\n\n // include axis gridlines if requested\n if (datum.grid) {\n children.push(axisGrid(spec, config, encode.grid, ticksRef, band));\n }\n\n // include axis ticks if requested\n if (datum.ticks) {\n size = _('tickSize');\n children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band));\n }\n\n // include axis labels if requested\n if (datum.labels) {\n size = datum.ticks ? size : 0;\n children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band));\n }\n\n // include axis domain path if requested\n if (datum.domain) {\n children.push(axisDomain(spec, config, encode.domain, dataRef));\n }\n\n // include axis title if defined\n if (datum.title) {\n children.push(axisTitle(spec, config, encode.title, dataRef));\n }\n\n // parse axis specification\n return parseMark(guideGroup({\n role: AxisRole,\n from: dataRef,\n encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip),\n marks: children,\n aria: _('aria'),\n description: _('description'),\n zindex: _('zindex'),\n name,\n interactive,\n style\n }), scope);\n}\nfunction buildAxisEncode(_, spec) {\n const encode = {\n enter: {},\n update: {}\n };\n addEncoders(encode, {\n orient: _('orient'),\n offset: _('offset') || 0,\n position: value(spec.position, 0),\n titlePadding: _('titlePadding'),\n minExtent: _('minExtent'),\n maxExtent: _('maxExtent'),\n range: {\n signal: `abs(span(range(\"${spec.scale}\")))`\n },\n translate: _('translate'),\n // accessibility support\n format: spec.format,\n formatType: spec.formatType\n });\n return encode;\n}\n\nfunction parseScope (spec, scope, preprocessed) {\n const signals = array(spec.signals),\n scales = array(spec.scales);\n\n // parse signal definitions, if not already preprocessed\n if (!preprocessed) signals.forEach(_ => parseSignal(_, scope));\n\n // parse cartographic projection definitions\n array(spec.projections).forEach(_ => parseProjection(_, scope));\n\n // initialize scale references\n scales.forEach(_ => initScale(_, scope));\n\n // parse data sources\n array(spec.data).forEach(_ => parseData(_, scope));\n\n // parse scale definitions\n scales.forEach(_ => parseScale(_, scope));\n\n // parse signal updates\n (preprocessed || signals).forEach(_ => parseSignalUpdates(_, scope));\n\n // parse axis definitions\n array(spec.axes).forEach(_ => parseAxis(_, scope));\n\n // parse mark definitions\n array(spec.marks).forEach(_ => parseMark(_, scope));\n\n // parse legend definitions\n array(spec.legends).forEach(_ => parseLegend(_, scope));\n\n // parse title, if defined\n if (spec.title) parseTitle(spec.title, scope);\n\n // parse collected lambda (anonymous) expressions\n scope.parseLambdas();\n return scope;\n}\n\nconst rootEncode = spec => extendEncode({\n enter: {\n x: {\n value: 0\n },\n y: {\n value: 0\n }\n },\n update: {\n width: {\n signal: 'width'\n },\n height: {\n signal: 'height'\n }\n }\n}, spec);\nfunction parseView(spec, scope) {\n const config = scope.config;\n\n // add scenegraph root\n const root = ref(scope.root = scope.add(operator()));\n\n // parse top-level signal definitions\n const signals = collectSignals(spec, config);\n signals.forEach(_ => parseSignal(_, scope));\n\n // assign description, event, legend, and locale configuration\n scope.description = spec.description || config.description;\n scope.eventConfig = config.events;\n scope.legends = scope.objectProperty(config.legend && config.legend.layout);\n scope.locale = config.locale;\n\n // store root group item\n const input = scope.add(Collect());\n\n // encode root group item\n const encode = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, {\n pulse: ref(input)\n })));\n\n // perform view layout\n const parent = scope.add(ViewLayout({\n layout: scope.objectProperty(spec.layout),\n legends: scope.legends,\n autosize: scope.signalRef('autosize'),\n mark: root,\n pulse: ref(encode)\n }));\n scope.operators.pop();\n\n // parse remainder of specification\n scope.pushState(ref(encode), ref(parent), null);\n parseScope(spec, scope, signals);\n scope.operators.push(parent);\n\n // bound / render / sieve root item\n let op = scope.add(Bound({\n mark: root,\n pulse: ref(parent)\n }));\n op = scope.add(Render({\n pulse: ref(op)\n }));\n op = scope.add(Sieve({\n pulse: ref(op)\n }));\n\n // track metadata for root item\n scope.addData('root', new DataScope(scope, input, input, op));\n return scope;\n}\nfunction signalObject(name, value) {\n return value && value.signal ? {\n name,\n update: value.signal\n } : {\n name,\n value\n };\n}\n\n/**\n * Collect top-level signals, merging values as needed. Signals\n * defined in the config signals arrays are added only if that\n * signal is not explicitly defined in the specification.\n * Built-in signals (autosize, background, padding, width, height)\n * receive special treatment. They are initialized using the\n * top-level spec property, or, if undefined in the spec, using\n * the corresponding top-level config property. If this property\n * is a signal reference object, the signal expression maps to the\n * signal 'update' property. If the spec's top-level signal array\n * contains an entry that matches a built-in signal, that entry\n * will be merged with the built-in specification, potentially\n * overwriting existing 'value' or 'update' properties.\n */\nfunction collectSignals(spec, config) {\n const _ = name => value(spec[name], config[name]),\n signals = [signalObject('background', _('background')), signalObject('autosize', parseAutosize(_('autosize'))), signalObject('padding', parsePadding(_('padding'))), signalObject('width', _('width') || 0), signalObject('height', _('height') || 0)],\n pre = signals.reduce((p, s) => (p[s.name] = s, p), {}),\n map = {};\n\n // add spec signal array\n array(spec.signals).forEach(s => {\n if (hasOwnProperty(pre, s.name)) {\n // merge if built-in signal\n s = extend(pre[s.name], s);\n } else {\n // otherwise add to signal list\n signals.push(s);\n }\n map[s.name] = s;\n });\n\n // add config signal array\n array(config.signals).forEach(s => {\n if (!hasOwnProperty(map, s.name) && !hasOwnProperty(pre, s.name)) {\n // add to signal list if not already defined\n signals.push(s);\n }\n });\n return signals;\n}\n\nfunction Scope(config, options) {\n this.config = config || {};\n this.options = options || {};\n this.bindings = [];\n this.field = {};\n this.signals = {};\n this.lambdas = {};\n this.scales = {};\n this.events = {};\n this.data = {};\n this.streams = [];\n this.updates = [];\n this.operators = [];\n this.eventConfig = null;\n this.locale = null;\n this._id = 0;\n this._subid = 0;\n this._nextsub = [0];\n this._parent = [];\n this._encode = [];\n this._lookup = [];\n this._markpath = [];\n}\nfunction Subscope(scope) {\n this.config = scope.config;\n this.options = scope.options;\n this.legends = scope.legends;\n this.field = Object.create(scope.field);\n this.signals = Object.create(scope.signals);\n this.lambdas = Object.create(scope.lambdas);\n this.scales = Object.create(scope.scales);\n this.events = Object.create(scope.events);\n this.data = Object.create(scope.data);\n this.streams = [];\n this.updates = [];\n this.operators = [];\n this._id = 0;\n this._subid = ++scope._nextsub[0];\n this._nextsub = scope._nextsub;\n this._parent = scope._parent.slice();\n this._encode = scope._encode.slice();\n this._lookup = scope._lookup.slice();\n this._markpath = scope._markpath;\n}\nScope.prototype = Subscope.prototype = {\n parse(spec) {\n return parseScope(spec, this);\n },\n fork() {\n return new Subscope(this);\n },\n isSubscope() {\n return this._subid > 0;\n },\n toRuntime() {\n this.finish();\n return {\n description: this.description,\n operators: this.operators,\n streams: this.streams,\n updates: this.updates,\n bindings: this.bindings,\n eventConfig: this.eventConfig,\n locale: this.locale\n };\n },\n id() {\n return (this._subid ? this._subid + ':' : 0) + this._id++;\n },\n add(op) {\n this.operators.push(op);\n op.id = this.id();\n // if pre-registration references exist, resolve them now\n if (op.refs) {\n op.refs.forEach(ref => {\n ref.$ref = op.id;\n });\n op.refs = null;\n }\n return op;\n },\n proxy(op) {\n const vref = op instanceof Entry ? ref(op) : op;\n return this.add(Proxy({\n value: vref\n }));\n },\n addStream(stream) {\n this.streams.push(stream);\n stream.id = this.id();\n return stream;\n },\n addUpdate(update) {\n this.updates.push(update);\n return update;\n },\n // Apply metadata\n finish() {\n let name, ds;\n\n // annotate root\n if (this.root) this.root.root = true;\n\n // annotate signals\n for (name in this.signals) {\n this.signals[name].signal = name;\n }\n\n // annotate scales\n for (name in this.scales) {\n this.scales[name].scale = name;\n }\n\n // annotate data sets\n function annotate(op, name, type) {\n let data, list;\n if (op) {\n data = op.data || (op.data = {});\n list = data[name] || (data[name] = []);\n list.push(type);\n }\n }\n for (name in this.data) {\n ds = this.data[name];\n annotate(ds.input, name, 'input');\n annotate(ds.output, name, 'output');\n annotate(ds.values, name, 'values');\n for (const field in ds.index) {\n annotate(ds.index[field], name, 'index:' + field);\n }\n }\n return this;\n },\n // ----\n\n pushState(encode, parent, lookup) {\n this._encode.push(ref(this.add(Sieve({\n pulse: encode\n }))));\n this._parent.push(parent);\n this._lookup.push(lookup ? ref(this.proxy(lookup)) : null);\n this._markpath.push(-1);\n },\n popState() {\n this._encode.pop();\n this._parent.pop();\n this._lookup.pop();\n this._markpath.pop();\n },\n parent() {\n return peek(this._parent);\n },\n encode() {\n return peek(this._encode);\n },\n lookup() {\n return peek(this._lookup);\n },\n markpath() {\n const p = this._markpath;\n return ++p[p.length - 1];\n },\n // ----\n\n fieldRef(field, name) {\n if (isString(field)) return fieldRef$1(field, name);\n if (!field.signal) {\n error('Unsupported field reference: ' + stringValue(field));\n }\n const s = field.signal;\n let f = this.field[s];\n if (!f) {\n const params = {\n name: this.signalRef(s)\n };\n if (name) params.as = name;\n this.field[s] = f = ref(this.add(Field(params)));\n }\n return f;\n },\n compareRef(cmp) {\n let signal = false;\n const check = _ => isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _;\n const fields = array(cmp.field).map(check),\n orders = array(cmp.order).map(check);\n return signal ? ref(this.add(Compare({\n fields: fields,\n orders: orders\n }))) : compareRef(fields, orders);\n },\n keyRef(fields, flat) {\n let signal = false;\n const check = _ => isSignal(_) ? (signal = true, ref(sig[_.signal])) : _;\n const sig = this.signals;\n fields = array(fields).map(check);\n return signal ? ref(this.add(Key({\n fields: fields,\n flat: flat\n }))) : keyRef(fields, flat);\n },\n sortRef(sort) {\n if (!sort) return sort;\n\n // including id ensures stable sorting\n const a = aggrField(sort.op, sort.field),\n o = sort.order || Ascending;\n return o.signal ? ref(this.add(Compare({\n fields: a,\n orders: this.signalRef(o.signal)\n }))) : compareRef(a, o);\n },\n // ----\n\n event(source, type) {\n const key = source + ':' + type;\n if (!this.events[key]) {\n const id = this.id();\n this.streams.push({\n id: id,\n source: source,\n type: type\n });\n this.events[key] = id;\n }\n return this.events[key];\n },\n // ----\n\n hasOwnSignal(name) {\n return hasOwnProperty(this.signals, name);\n },\n addSignal(name, value) {\n if (this.hasOwnSignal(name)) {\n error('Duplicate signal name: ' + stringValue(name));\n }\n const op = value instanceof Entry ? value : this.add(operator(value));\n return this.signals[name] = op;\n },\n getSignal(name) {\n if (!this.signals[name]) {\n error('Unrecognized signal name: ' + stringValue(name));\n }\n return this.signals[name];\n },\n signalRef(s) {\n if (this.signals[s]) {\n return ref(this.signals[s]);\n } else if (!hasOwnProperty(this.lambdas, s)) {\n this.lambdas[s] = this.add(operator(null));\n }\n return ref(this.lambdas[s]);\n },\n parseLambdas() {\n const code = Object.keys(this.lambdas);\n for (let i = 0, n = code.length; i < n; ++i) {\n const s = code[i],\n e = parseExpression(s, this),\n op = this.lambdas[s];\n op.params = e.$params;\n op.update = e.$expr;\n }\n },\n property(spec) {\n return spec && spec.signal ? this.signalRef(spec.signal) : spec;\n },\n objectProperty(spec) {\n return !spec || !isObject(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec));\n },\n exprRef(code, name) {\n const params = {\n expr: parseExpression(code, this)\n };\n if (name) params.expr.$name = name;\n return ref(this.add(Expression(params)));\n },\n addBinding(name, bind) {\n if (!this.bindings) {\n error('Nested signals do not support binding: ' + stringValue(name));\n }\n this.bindings.push(extend({\n signal: name\n }, bind));\n },\n // ----\n\n addScaleProj(name, transform) {\n if (hasOwnProperty(this.scales, name)) {\n error('Duplicate scale or projection name: ' + stringValue(name));\n }\n this.scales[name] = this.add(transform);\n },\n addScale(name, params) {\n this.addScaleProj(name, Scale(params));\n },\n addProjection(name, params) {\n this.addScaleProj(name, Projection(params));\n },\n getScale(name) {\n if (!this.scales[name]) {\n error('Unrecognized scale name: ' + stringValue(name));\n }\n return this.scales[name];\n },\n scaleRef(name) {\n return ref(this.getScale(name));\n },\n scaleType(name) {\n return this.getScale(name).params.type;\n },\n projectionRef(name) {\n return this.scaleRef(name);\n },\n projectionType(name) {\n return this.scaleType(name);\n },\n // ----\n\n addData(name, dataScope) {\n if (hasOwnProperty(this.data, name)) {\n error('Duplicate data set name: ' + stringValue(name));\n }\n return this.data[name] = dataScope;\n },\n getData(name) {\n if (!this.data[name]) {\n error('Undefined data set name: ' + stringValue(name));\n }\n return this.data[name];\n },\n addDataPipeline(name, entries) {\n if (hasOwnProperty(this.data, name)) {\n error('Duplicate data set name: ' + stringValue(name));\n }\n return this.addData(name, DataScope.fromEntries(this, entries));\n }\n};\nfunction propertyLambda(spec) {\n return (isArray(spec) ? arrayLambda : objectLambda)(spec);\n}\nfunction arrayLambda(array) {\n const n = array.length;\n let code = '[';\n for (let i = 0; i < n; ++i) {\n const value = array[i];\n code += (i > 0 ? ',' : '') + (isObject(value) ? value.signal || propertyLambda(value) : stringValue(value));\n }\n return code + ']';\n}\nfunction objectLambda(obj) {\n let code = '{',\n i = 0,\n key,\n value;\n for (key in obj) {\n value = obj[key];\n code += (++i > 1 ? ',' : '') + stringValue(key) + ':' + (isObject(value) ? value.signal || propertyLambda(value) : stringValue(value));\n }\n return code + '}';\n}\n\n/**\n * Standard configuration defaults for Vega specification parsing.\n * Users can provide their own (sub-)set of these default values\n * by passing in a config object to the top-level parse method.\n */\nfunction defaults () {\n const defaultFont = 'sans-serif',\n defaultSymbolSize = 30,\n defaultStrokeWidth = 2,\n defaultColor = '#4c78a8',\n black = '#000',\n gray = '#888',\n lightGray = '#ddd';\n return {\n // default visualization description\n description: 'Vega visualization',\n // default padding around visualization\n padding: 0,\n // default for automatic sizing; options: 'none', 'pad', 'fit'\n // or provide an object (e.g., {'type': 'pad', 'resize': true})\n autosize: 'pad',\n // default view background color\n // covers the entire view component\n background: null,\n // default event handling configuration\n // preventDefault for view-sourced event types except 'wheel'\n events: {\n defaults: {\n allow: ['wheel']\n }\n },\n // defaults for top-level group marks\n // accepts mark properties (fill, stroke, etc)\n // covers the data rectangle within group width/height\n group: null,\n // defaults for basic mark types\n // each subset accepts mark properties (fill, stroke, etc)\n mark: null,\n arc: {\n fill: defaultColor\n },\n area: {\n fill: defaultColor\n },\n image: null,\n line: {\n stroke: defaultColor,\n strokeWidth: defaultStrokeWidth\n },\n path: {\n stroke: defaultColor\n },\n rect: {\n fill: defaultColor\n },\n rule: {\n stroke: black\n },\n shape: {\n stroke: defaultColor\n },\n symbol: {\n fill: defaultColor,\n size: 64\n },\n text: {\n fill: black,\n font: defaultFont,\n fontSize: 11\n },\n trail: {\n fill: defaultColor,\n size: defaultStrokeWidth\n },\n // style definitions\n style: {\n // axis & legend labels\n 'guide-label': {\n fill: black,\n font: defaultFont,\n fontSize: 10\n },\n // axis & legend titles\n 'guide-title': {\n fill: black,\n font: defaultFont,\n fontSize: 11,\n fontWeight: 'bold'\n },\n // headers, including chart title\n 'group-title': {\n fill: black,\n font: defaultFont,\n fontSize: 13,\n fontWeight: 'bold'\n },\n // chart subtitle\n 'group-subtitle': {\n fill: black,\n font: defaultFont,\n fontSize: 12\n },\n // defaults for styled point marks in Vega-Lite\n point: {\n size: defaultSymbolSize,\n strokeWidth: defaultStrokeWidth,\n shape: 'circle'\n },\n circle: {\n size: defaultSymbolSize,\n strokeWidth: defaultStrokeWidth\n },\n square: {\n size: defaultSymbolSize,\n strokeWidth: defaultStrokeWidth,\n shape: 'square'\n },\n // defaults for styled group marks in Vega-Lite\n cell: {\n fill: 'transparent',\n stroke: lightGray\n },\n view: {\n fill: 'transparent'\n }\n },\n // defaults for title\n title: {\n orient: 'top',\n anchor: 'middle',\n offset: 4,\n subtitlePadding: 3\n },\n // defaults for axes\n axis: {\n minExtent: 0,\n maxExtent: 200,\n bandPosition: 0.5,\n domain: true,\n domainWidth: 1,\n domainColor: gray,\n grid: false,\n gridWidth: 1,\n gridColor: lightGray,\n labels: true,\n labelAngle: 0,\n labelLimit: 180,\n labelOffset: 0,\n labelPadding: 2,\n ticks: true,\n tickColor: gray,\n tickOffset: 0,\n tickRound: true,\n tickSize: 5,\n tickWidth: 1,\n titlePadding: 4\n },\n // correction for centering bias\n axisBand: {\n tickOffset: -0.5\n },\n // defaults for cartographic projection\n projection: {\n type: 'mercator'\n },\n // defaults for legends\n legend: {\n orient: 'right',\n padding: 0,\n gridAlign: 'each',\n columnPadding: 10,\n rowPadding: 2,\n symbolDirection: 'vertical',\n gradientDirection: 'vertical',\n gradientLength: 200,\n gradientThickness: 16,\n gradientStrokeColor: lightGray,\n gradientStrokeWidth: 0,\n gradientLabelOffset: 2,\n labelAlign: 'left',\n labelBaseline: 'middle',\n labelLimit: 160,\n labelOffset: 4,\n labelOverlap: true,\n symbolLimit: 30,\n symbolType: 'circle',\n symbolSize: 100,\n symbolOffset: 0,\n symbolStrokeWidth: 1.5,\n symbolBaseFillColor: 'transparent',\n symbolBaseStrokeColor: gray,\n titleLimit: 180,\n titleOrient: 'top',\n titlePadding: 5,\n layout: {\n offset: 18,\n direction: 'horizontal',\n left: {\n direction: 'vertical'\n },\n right: {\n direction: 'vertical'\n }\n }\n },\n // defaults for scale ranges\n range: {\n category: {\n scheme: 'tableau10'\n },\n ordinal: {\n scheme: 'blues'\n },\n heatmap: {\n scheme: 'yellowgreenblue'\n },\n ramp: {\n scheme: 'blues'\n },\n diverging: {\n scheme: 'blueorange',\n extent: [1, 0]\n },\n symbol: ['circle', 'square', 'triangle-up', 'cross', 'diamond', 'triangle-right', 'triangle-down', 'triangle-left']\n }\n };\n}\n\nfunction parse (spec, config, options) {\n if (!isObject(spec)) {\n error('Input Vega specification must be an object.');\n }\n config = mergeConfig(defaults(), config, spec.config);\n return parseView(spec, new Scope(config, options)).toRuntime();\n}\n\nexport { AxisDomainRole, AxisGridRole, AxisLabelRole, AxisRole, AxisTickRole, AxisTitleRole, DataScope, FrameRole, LegendEntryRole, LegendLabelRole, LegendRole, LegendSymbolRole, LegendTitleRole, MarkRole, Scope, ScopeRole, defaults as config, parse, parseSignal as signal, parseSignalUpdates as signalUpdates, parseStream as stream };\n","import { extend } from 'vega-util';\nexport * from 'vega-util';\nimport { transforms } from 'vega-dataflow';\nexport { Dataflow, EventStream, MultiPulse, Operator, Parameters, Pulse, Transform, changeset, definition, ingest, isTuple, transform, transforms, tupleid } from 'vega-dataflow';\nimport * as tx from 'vega-transforms';\nimport * as vtx from 'vega-view-transforms';\nimport * as encode from 'vega-encode';\nimport * as geo from 'vega-geo';\nimport * as force from 'vega-force';\nimport * as tree from 'vega-hierarchy';\nimport * as label from 'vega-label';\nimport * as reg from 'vega-regression';\nimport * as voronoi from 'vega-voronoi';\nimport * as wordcloud from 'vega-wordcloud';\nimport * as xf from 'vega-crossfilter';\nexport * from 'vega-statistics';\nexport * from 'vega-time';\nexport * from 'vega-loader';\nexport * from 'vega-scenegraph';\nexport { interpolate, interpolateColors, interpolateRange, quantizeInterpolator, scale, scheme } from 'vega-scale';\nexport { projection } from 'vega-projection';\nexport { View } from 'vega-view';\nexport { defaultLocale, numberFormatDefaultLocale as formatLocale, locale, resetDefaultLocale, timeFormatDefaultLocale as timeFormatLocale } from 'vega-format';\nexport { expressionFunction } from 'vega-functions';\nexport { parse } from 'vega-parser';\nexport { context as runtimeContext } from 'vega-runtime';\nexport { codegenExpression, parseExpression } from 'vega-expression';\nexport { parseSelector } from 'vega-event-selector';\n\nvar version = \"5.26.0\";\n\n// -- Transforms -----\n\nextend(transforms, tx, vtx, encode, geo, force, label, tree, reg, voronoi, wordcloud, xf);\n\nexport { version };\n","function adjustSpatial (item, encode, swap) {\n let t;\n if (encode.x2) {\n if (encode.x) {\n if (swap && item.x > item.x2) {\n t = item.x;\n item.x = item.x2;\n item.x2 = t;\n }\n item.width = item.x2 - item.x;\n } else {\n item.x = item.x2 - (item.width || 0);\n }\n }\n if (encode.xc) {\n item.x = item.xc - (item.width || 0) / 2;\n }\n if (encode.y2) {\n if (encode.y) {\n if (swap && item.y > item.y2) {\n t = item.y;\n item.y = item.y2;\n item.y2 = t;\n }\n item.height = item.y2 - item.y;\n } else {\n item.y = item.y2 - (item.height || 0);\n }\n }\n if (encode.yc) {\n item.y = item.yc - (item.height || 0) / 2;\n }\n}\n\nvar Constants = {\n NaN: NaN,\n E: Math.E,\n LN2: Math.LN2,\n LN10: Math.LN10,\n LOG2E: Math.LOG2E,\n LOG10E: Math.LOG10E,\n PI: Math.PI,\n SQRT1_2: Math.SQRT1_2,\n SQRT2: Math.SQRT2,\n MIN_VALUE: Number.MIN_VALUE,\n MAX_VALUE: Number.MAX_VALUE\n};\n\nvar Ops = {\n '*': (a, b) => a * b,\n '+': (a, b) => a + b,\n '-': (a, b) => a - b,\n '/': (a, b) => a / b,\n '%': (a, b) => a % b,\n '>': (a, b) => a > b,\n '<': (a, b) => a < b,\n '<=': (a, b) => a <= b,\n '>=': (a, b) => a >= b,\n '==': (a, b) => a == b,\n '!=': (a, b) => a != b,\n '===': (a, b) => a === b,\n '!==': (a, b) => a !== b,\n '&': (a, b) => a & b,\n '|': (a, b) => a | b,\n '^': (a, b) => a ^ b,\n '<<': (a, b) => a << b,\n '>>': (a, b) => a >> b,\n '>>>': (a, b) => a >>> b\n};\n\nvar Unary = {\n '+': a => +a,\n '-': a => -a,\n '~': a => ~a,\n '!': a => !a\n};\n\nconst slice = Array.prototype.slice;\nconst apply = (m, args, cast) => {\n const obj = cast ? cast(args[0]) : args[0];\n return obj[m].apply(obj, slice.call(args, 1));\n};\nconst datetime = (y, m, d, H, M, S, ms) => new Date(y, m || 0, d != null ? d : 1, H || 0, M || 0, S || 0, ms || 0);\nvar Functions = {\n // math functions\n isNaN: Number.isNaN,\n isFinite: Number.isFinite,\n abs: Math.abs,\n acos: Math.acos,\n asin: Math.asin,\n atan: Math.atan,\n atan2: Math.atan2,\n ceil: Math.ceil,\n cos: Math.cos,\n exp: Math.exp,\n floor: Math.floor,\n log: Math.log,\n max: Math.max,\n min: Math.min,\n pow: Math.pow,\n random: Math.random,\n round: Math.round,\n sin: Math.sin,\n sqrt: Math.sqrt,\n tan: Math.tan,\n clamp: (a, b, c) => Math.max(b, Math.min(c, a)),\n // date functions\n now: Date.now,\n utc: Date.UTC,\n datetime: datetime,\n date: d => new Date(d).getDate(),\n day: d => new Date(d).getDay(),\n year: d => new Date(d).getFullYear(),\n month: d => new Date(d).getMonth(),\n hours: d => new Date(d).getHours(),\n minutes: d => new Date(d).getMinutes(),\n seconds: d => new Date(d).getSeconds(),\n milliseconds: d => new Date(d).getMilliseconds(),\n time: d => new Date(d).getTime(),\n timezoneoffset: d => new Date(d).getTimezoneOffset(),\n utcdate: d => new Date(d).getUTCDate(),\n utcday: d => new Date(d).getUTCDay(),\n utcyear: d => new Date(d).getUTCFullYear(),\n utcmonth: d => new Date(d).getUTCMonth(),\n utchours: d => new Date(d).getUTCHours(),\n utcminutes: d => new Date(d).getUTCMinutes(),\n utcseconds: d => new Date(d).getUTCSeconds(),\n utcmilliseconds: d => new Date(d).getUTCMilliseconds(),\n // sequence functions\n length: x => x.length,\n join: function () {\n return apply('join', arguments);\n },\n indexof: function () {\n return apply('indexOf', arguments);\n },\n lastindexof: function () {\n return apply('lastIndexOf', arguments);\n },\n slice: function () {\n return apply('slice', arguments);\n },\n reverse: x => x.slice().reverse(),\n // string functions\n parseFloat: parseFloat,\n parseInt: parseInt,\n upper: x => String(x).toUpperCase(),\n lower: x => String(x).toLowerCase(),\n substring: function () {\n return apply('substring', arguments, String);\n },\n split: function () {\n return apply('split', arguments, String);\n },\n replace: function () {\n return apply('replace', arguments, String);\n },\n trim: x => String(x).trim(),\n // regexp functions\n regexp: RegExp,\n test: (r, t) => RegExp(r).test(t)\n};\n\nconst EventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'];\nconst DisallowedMethods = new Set([Function, eval, setTimeout, setInterval]);\nif (typeof setImmediate === 'function') DisallowedMethods.add(setImmediate);\nconst Visitors = {\n Literal: ($, n) => n.value,\n Identifier: ($, n) => {\n const id = n.name;\n return $.memberDepth > 0 ? id : id === 'datum' ? $.datum : id === 'event' ? $.event : id === 'item' ? $.item : Constants[id] || $.params['$' + id];\n },\n MemberExpression: ($, n) => {\n const d = !n.computed,\n o = $(n.object);\n if (d) $.memberDepth += 1;\n const p = $(n.property);\n if (d) $.memberDepth -= 1;\n if (DisallowedMethods.has(o[p])) {\n // eslint-disable-next-line no-console\n console.error(`Prevented interpretation of member \"${p}\" which could lead to insecure code execution`);\n return;\n }\n return o[p];\n },\n CallExpression: ($, n) => {\n const args = n.arguments;\n let name = n.callee.name;\n\n // handle special internal functions used by encoders\n // re-route to corresponding standard function\n if (name.startsWith('_')) {\n name = name.slice(1);\n }\n\n // special case \"if\" due to conditional evaluation of branches\n return name === 'if' ? $(args[0]) ? $(args[1]) : $(args[2]) : ($.fn[name] || Functions[name]).apply($.fn, args.map($));\n },\n ArrayExpression: ($, n) => n.elements.map($),\n BinaryExpression: ($, n) => Ops[n.operator]($(n.left), $(n.right)),\n UnaryExpression: ($, n) => Unary[n.operator]($(n.argument)),\n ConditionalExpression: ($, n) => $(n.test) ? $(n.consequent) : $(n.alternate),\n LogicalExpression: ($, n) => n.operator === '&&' ? $(n.left) && $(n.right) : $(n.left) || $(n.right),\n ObjectExpression: ($, n) => n.properties.reduce((o, p) => {\n $.memberDepth += 1;\n const k = $(p.key);\n $.memberDepth -= 1;\n if (DisallowedMethods.has($(p.value))) {\n // eslint-disable-next-line no-console\n console.error(`Prevented interpretation of property \"${k}\" which could lead to insecure code execution`);\n } else {\n o[k] = $(p.value);\n }\n return o;\n }, {})\n};\nfunction interpret (ast, fn, params, datum, event, item) {\n const $ = n => Visitors[n.type]($, n);\n $.memberDepth = 0;\n $.fn = Object.create(fn);\n $.params = params;\n $.datum = datum;\n $.event = event;\n $.item = item;\n\n // route event functions to annotated vega event context\n EventFunctions.forEach(f => $.fn[f] = function () {\n return event.vega[f](...arguments);\n });\n return $(ast);\n}\n\nvar expression = {\n /**\n * Parse an expression used to update an operator value.\n */\n operator(ctx, expr) {\n const ast = expr.ast,\n fn = ctx.functions;\n return _ => interpret(ast, fn, _);\n },\n /**\n * Parse an expression provided as an operator parameter value.\n */\n parameter(ctx, expr) {\n const ast = expr.ast,\n fn = ctx.functions;\n return (datum, _) => interpret(ast, fn, _, datum);\n },\n /**\n * Parse an expression applied to an event stream.\n */\n event(ctx, expr) {\n const ast = expr.ast,\n fn = ctx.functions;\n return event => interpret(ast, fn, undefined, undefined, event);\n },\n /**\n * Parse an expression used to handle an event-driven operator update.\n */\n handler(ctx, expr) {\n const ast = expr.ast,\n fn = ctx.functions;\n return (_, event) => {\n const datum = event.item && event.item.datum;\n return interpret(ast, fn, _, datum, event);\n };\n },\n /**\n * Parse an expression that performs visual encoding.\n */\n encode(ctx, encode) {\n const {\n marktype,\n channels\n } = encode,\n fn = ctx.functions,\n swap = marktype === 'group' || marktype === 'image' || marktype === 'rect';\n return (item, _) => {\n const datum = item.datum;\n let m = 0,\n v;\n for (const name in channels) {\n v = interpret(channels[name].ast, fn, _, datum, undefined, item);\n if (item[name] !== v) {\n item[name] = v;\n m = 1;\n }\n }\n if (marktype !== 'rule') {\n adjustSpatial(item, channels, swap);\n }\n return m;\n };\n }\n};\n\nexport { expression as expressionInterpreter };\n","export function isLogicalOr(op) {\n return !!op.or;\n}\nexport function isLogicalAnd(op) {\n return !!op.and;\n}\nexport function isLogicalNot(op) {\n return !!op.not;\n}\nexport function forEachLeaf(op, fn) {\n if (isLogicalNot(op)) {\n forEachLeaf(op.not, fn);\n }\n else if (isLogicalAnd(op)) {\n for (const subop of op.and) {\n forEachLeaf(subop, fn);\n }\n }\n else if (isLogicalOr(op)) {\n for (const subop of op.or) {\n forEachLeaf(subop, fn);\n }\n }\n else {\n fn(op);\n }\n}\nexport function normalizeLogicalComposition(op, normalizer) {\n if (isLogicalNot(op)) {\n return { not: normalizeLogicalComposition(op.not, normalizer) };\n }\n else if (isLogicalAnd(op)) {\n return { and: op.and.map(o => normalizeLogicalComposition(o, normalizer)) };\n }\n else if (isLogicalOr(op)) {\n return { or: op.or.map(o => normalizeLogicalComposition(o, normalizer)) };\n }\n else {\n return normalizer(op);\n }\n}\n//# sourceMappingURL=logical.js.map","import { hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig } from 'vega-util';\nimport { isLogicalAnd, isLogicalNot, isLogicalOr } from './logical';\nexport const duplicate = structuredClone;\nexport function never(message) {\n throw new Error(message);\n}\n/**\n * Creates an object composed of the picked object properties.\n *\n * var object = {'a': 1, 'b': '2', 'c': 3};\n * pick(object, ['a', 'c']);\n * // → {'a': 1, 'c': 3}\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function pick(obj, props) {\n const copy = {};\n for (const prop of props) {\n if (hasOwnProperty(obj, prop)) {\n copy[prop] = obj[prop];\n }\n }\n return copy;\n}\n/**\n * The opposite of _.pick; this method creates an object composed of the own\n * and inherited enumerable string keyed properties of object that are not omitted.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function omit(obj, props) {\n const copy = { ...obj };\n for (const prop of props) {\n delete copy[prop];\n }\n return copy;\n}\n/**\n * Monkey patch Set so that `stringify` produces a string representation of sets.\n */\nSet.prototype['toJSON'] = function () {\n return `Set(${[...this].map(x => stringify(x)).join(',')})`;\n};\n/**\n * Converts any object to a string of limited size, or a number.\n */\nexport function hash(a) {\n if (isNumber(a)) {\n return a;\n }\n const str = isString(a) ? a : stringify(a);\n // short strings can be used as hash directly, longer strings are hashed to reduce memory usage\n if (str.length < 250) {\n return str;\n }\n // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\n let h = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n h = (h << 5) - h + char;\n h = h & h; // Convert to 32bit integer\n }\n return h;\n}\nexport function isNullOrFalse(x) {\n return x === false || x === null;\n}\nexport function contains(array, item) {\n return array.includes(item);\n}\n/**\n * Returns true if any item returns true.\n */\nexport function some(arr, f) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (f(a, k, i++)) {\n return true;\n }\n }\n return false;\n}\n/**\n * Returns true if all items return true.\n */\nexport function every(arr, f) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (!f(a, k, i++)) {\n return false;\n }\n }\n return true;\n}\n/**\n * recursively merges src into dest\n */\nexport function mergeDeep(dest, ...src) {\n for (const s of src) {\n deepMerge_(dest, s ?? {});\n }\n return dest;\n}\nfunction deepMerge_(dest, src) {\n for (const property of keys(src)) {\n writeConfig(dest, property, src[property], true);\n }\n}\nexport function unique(values, f) {\n const results = [];\n const u = {};\n let v;\n for (const val of values) {\n v = f(val);\n if (v in u) {\n continue;\n }\n u[v] = 1;\n results.push(val);\n }\n return results;\n}\n/**\n * Returns true if the two dictionaries agree. Applies only to defined values.\n */\nexport function isEqual(dict, other) {\n const dictKeys = keys(dict);\n const otherKeys = keys(other);\n if (dictKeys.length !== otherKeys.length) {\n return false;\n }\n for (const key of dictKeys) {\n if (dict[key] !== other[key]) {\n return false;\n }\n }\n return true;\n}\nexport function setEqual(a, b) {\n if (a.size !== b.size) {\n return false;\n }\n for (const e of a) {\n if (!b.has(e)) {\n return false;\n }\n }\n return true;\n}\nexport function hasIntersection(a, b) {\n for (const key of a) {\n if (b.has(key)) {\n return true;\n }\n }\n return false;\n}\nexport function prefixGenerator(a) {\n const prefixes = new Set();\n for (const x of a) {\n const splitField = splitAccessPath(x);\n // Wrap every element other than the first in `[]`\n const wrappedWithAccessors = splitField.map((y, i) => (i === 0 ? y : `[${y}]`));\n const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join(''));\n for (const y of computedPrefixes) {\n prefixes.add(y);\n }\n }\n return prefixes;\n}\n/**\n * Returns true if a and b have an intersection. Also return true if a or b are undefined\n * since this means we don't know what fields a node produces or depends on.\n */\nexport function fieldIntersection(a, b) {\n if (a === undefined || b === undefined) {\n return true;\n }\n return hasIntersection(prefixGenerator(a), prefixGenerator(b));\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isEmpty(obj) {\n return keys(obj).length === 0;\n}\n// This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208\nexport const keys = Object.keys;\nexport const vals = Object.values;\nexport const entries = Object.entries;\nexport function isBoolean(b) {\n return b === true || b === false;\n}\n/**\n * Convert a string into a valid variable name\n */\nexport function varName(s) {\n // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _\n const alphanumericS = s.replace(/\\W/g, '_');\n // Add _ if the string has leading numbers.\n return (s.match(/^\\d+/) ? '_' : '') + alphanumericS;\n}\nexport function logicalExpr(op, cb) {\n if (isLogicalNot(op)) {\n return `!(${logicalExpr(op.not, cb)})`;\n }\n else if (isLogicalAnd(op)) {\n return `(${op.and.map((and) => logicalExpr(and, cb)).join(') && (')})`;\n }\n else if (isLogicalOr(op)) {\n return `(${op.or.map((or) => logicalExpr(or, cb)).join(') || (')})`;\n }\n else {\n return cb(op);\n }\n}\n/**\n * Delete nested property of an object, and delete the ancestors of the property if they become empty.\n */\nexport function deleteNestedProperty(obj, orderedProps) {\n if (orderedProps.length === 0) {\n return true;\n }\n const prop = orderedProps.shift(); // eslint-disable-line @typescript-eslint/no-non-null-assertion\n if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) {\n delete obj[prop];\n }\n return isEmpty(obj);\n}\nexport function titleCase(s) {\n return s.charAt(0).toUpperCase() + s.substr(1);\n}\n/**\n * Converts a path to an access path with datum.\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function accessPathWithDatum(path, datum = 'datum') {\n const pieces = splitAccessPath(path);\n const prefixes = [];\n for (let i = 1; i <= pieces.length; i++) {\n const prefix = `[${pieces.slice(0, i).map(stringValue).join('][')}]`;\n prefixes.push(`${datum}${prefix}`);\n }\n return prefixes.join(' && ');\n}\n/**\n * Return access with datum to the flattened field.\n *\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function flatAccessWithDatum(path, datum = 'datum') {\n return `${datum}[${stringValue(splitAccessPath(path).join('.'))}]`;\n}\nfunction escapePathAccess(string) {\n return string.replace(/(\\[|\\]|\\.|'|\")/g, '\\\\$1');\n}\n/**\n * Replaces path accesses with access to non-nested field.\n * For example, `foo[\"bar\"].baz` becomes `foo\\\\.bar\\\\.baz`.\n */\nexport function replacePathInField(path) {\n return `${splitAccessPath(path).map(escapePathAccess).join('\\\\.')}`;\n}\n/**\n * Replace all occurrences of a string with another string.\n *\n * @param string the string to replace in\n * @param find the string to replace\n * @param replacement the replacement\n */\nexport function replaceAll(string, find, replacement) {\n return string.replace(new RegExp(find.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'g'), replacement);\n}\n/**\n * Remove path accesses with access from field.\n * For example, `foo[\"bar\"].baz` becomes `foo.bar.baz`.\n */\nexport function removePathFromField(path) {\n return `${splitAccessPath(path).join('.')}`;\n}\n/**\n * Count the depth of the path. Returns 1 for fields that are not nested.\n */\nexport function accessPathDepth(path) {\n if (!path) {\n return 0;\n }\n return splitAccessPath(path).length;\n}\n/**\n * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included.\n */\nexport function getFirstDefined(...args) {\n for (const arg of args) {\n if (arg !== undefined) {\n return arg;\n }\n }\n return undefined;\n}\n// variable used to generate id\nlet idCounter = 42;\n/**\n * Returns a new random id every time it gets called.\n *\n * Has side effect!\n */\nexport function uniqueId(prefix) {\n const id = ++idCounter;\n return prefix ? String(prefix) + id : id;\n}\n/**\n * Resets the id counter used in uniqueId. This can be useful for testing.\n */\nexport function resetIdCounter() {\n idCounter = 42;\n}\nexport function internalField(name) {\n return isInternalField(name) ? name : `__${name}`;\n}\nexport function isInternalField(name) {\n return name.startsWith('__');\n}\n/**\n * Normalize angle to be within [0,360).\n */\nexport function normalizeAngle(angle) {\n if (angle === undefined) {\n return undefined;\n }\n return ((angle % 360) + 360) % 360;\n}\n/**\n * Returns whether the passed in value is a valid number.\n */\nexport function isNumeric(value) {\n if (isNumber(value)) {\n return true;\n }\n return !isNaN(value) && !isNaN(parseFloat(value));\n}\nconst clonedProto = Object.getPrototypeOf(structuredClone({}));\n/**\n * Compares two values for equality, including arrays and objects.\n *\n * Adapted from https://github.com/epoberezkin/fast-deep-equal.\n */\nexport function deepEqual(a, b) {\n if (a === b)\n return true;\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n // compare names to avoid issues with structured clone\n if (a.constructor.name !== b.constructor.name)\n return false;\n let length;\n let i;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (!deepEqual(a[i], b[i]))\n return false;\n return true;\n }\n if (a instanceof Map && b instanceof Map) {\n if (a.size !== b.size)\n return false;\n for (i of a.entries())\n if (!b.has(i[0]))\n return false;\n for (i of a.entries())\n if (!deepEqual(i[1], b.get(i[0])))\n return false;\n return true;\n }\n if (a instanceof Set && b instanceof Set) {\n if (a.size !== b.size)\n return false;\n for (i of a.entries())\n if (!b.has(i[0]))\n return false;\n return true;\n }\n if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i])\n return false;\n return true;\n }\n if (a.constructor === RegExp)\n return a.source === b.source && a.flags === b.flags;\n // also compare to structured clone prototype\n if (a.valueOf !== Object.prototype.valueOf && a.valueOf !== clonedProto.valueOf)\n return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString && a.toString !== clonedProto.toString)\n return a.toString() === b.toString();\n const ks = Object.keys(a);\n length = ks.length;\n if (length !== Object.keys(b).length)\n return false;\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, ks[i]))\n return false;\n for (i = length; i-- !== 0;) {\n const key = ks[i];\n if (!deepEqual(a[key], b[key]))\n return false;\n }\n return true;\n }\n // true if both NaN, false otherwise\n return a !== a && b !== b;\n}\n/**\n * Converts any object to a string representation that can be consumed by humans.\n *\n * Adapted from https://github.com/epoberezkin/fast-json-stable-stringify\n */\nexport function stringify(data) {\n const seen = [];\n return (function _stringify(node) {\n if (node && node.toJSON && typeof node.toJSON === 'function') {\n node = node.toJSON();\n }\n if (node === undefined)\n return undefined;\n if (typeof node == 'number')\n return isFinite(node) ? '' + node : 'null';\n if (typeof node !== 'object')\n return JSON.stringify(node);\n let i, out;\n if (Array.isArray(node)) {\n out = '[';\n for (i = 0; i < node.length; i++) {\n if (i)\n out += ',';\n out += _stringify(node[i]) || 'null';\n }\n return out + ']';\n }\n if (node === null)\n return 'null';\n if (seen.includes(node)) {\n throw new TypeError('Converting circular structure to JSON');\n }\n const seenIndex = seen.push(node) - 1;\n const ks = Object.keys(node).sort();\n out = '';\n for (i = 0; i < ks.length; i++) {\n const key = ks[i];\n const value = _stringify(node[key]);\n if (!value)\n continue;\n if (out)\n out += ',';\n out += JSON.stringify(key) + ':' + value;\n }\n seen.splice(seenIndex, 1);\n return `{${out}}`;\n })(data);\n}\n//# sourceMappingURL=util.js.map","/*\n * Constants and utilities for encoding channels (Visual variables)\n * such as 'x', 'y', 'color'.\n */\nimport { keys } from './util';\n// Facet\nexport const ROW = 'row';\nexport const COLUMN = 'column';\nexport const FACET = 'facet';\n// Position\nexport const X = 'x';\nexport const Y = 'y';\nexport const X2 = 'x2';\nexport const Y2 = 'y2';\n// Position Offset\nexport const XOFFSET = 'xOffset';\nexport const YOFFSET = 'yOffset';\n// Arc-Position\nexport const RADIUS = 'radius';\nexport const RADIUS2 = 'radius2';\nexport const THETA = 'theta';\nexport const THETA2 = 'theta2';\n// Geo Position\nexport const LATITUDE = 'latitude';\nexport const LONGITUDE = 'longitude';\nexport const LATITUDE2 = 'latitude2';\nexport const LONGITUDE2 = 'longitude2';\n// Mark property with scale\nexport const COLOR = 'color';\nexport const FILL = 'fill';\nexport const STROKE = 'stroke';\nexport const SHAPE = 'shape';\nexport const SIZE = 'size';\nexport const ANGLE = 'angle';\nexport const OPACITY = 'opacity';\nexport const FILLOPACITY = 'fillOpacity';\nexport const STROKEOPACITY = 'strokeOpacity';\nexport const STROKEWIDTH = 'strokeWidth';\nexport const STROKEDASH = 'strokeDash';\n// Non-scale channel\nexport const TEXT = 'text';\nexport const ORDER = 'order';\nexport const DETAIL = 'detail';\nexport const KEY = 'key';\nexport const TOOLTIP = 'tooltip';\nexport const HREF = 'href';\nexport const URL = 'url';\nexport const DESCRIPTION = 'description';\nconst POSITION_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n x2: 1,\n y2: 1\n};\nconst POLAR_POSITION_CHANNEL_INDEX = {\n theta: 1,\n theta2: 1,\n radius: 1,\n radius2: 1\n};\nexport function isPolarPositionChannel(c) {\n return c in POLAR_POSITION_CHANNEL_INDEX;\n}\nconst GEO_POSIITON_CHANNEL_INDEX = {\n longitude: 1,\n longitude2: 1,\n latitude: 1,\n latitude2: 1\n};\nexport function getPositionChannelFromLatLong(channel) {\n switch (channel) {\n case LATITUDE:\n return 'y';\n case LATITUDE2:\n return 'y2';\n case LONGITUDE:\n return 'x';\n case LONGITUDE2:\n return 'x2';\n }\n}\nexport function isGeoPositionChannel(c) {\n return c in GEO_POSIITON_CHANNEL_INDEX;\n}\nexport const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX);\nconst UNIT_CHANNEL_INDEX = {\n ...POSITION_CHANNEL_INDEX,\n ...POLAR_POSITION_CHANNEL_INDEX,\n ...GEO_POSIITON_CHANNEL_INDEX,\n xOffset: 1,\n yOffset: 1,\n // color\n color: 1,\n fill: 1,\n stroke: 1,\n // other non-position with scale\n opacity: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n strokeWidth: 1,\n strokeDash: 1,\n size: 1,\n angle: 1,\n shape: 1,\n // channels without scales\n order: 1,\n text: 1,\n detail: 1,\n key: 1,\n tooltip: 1,\n href: 1,\n url: 1,\n description: 1\n};\nexport function isColorChannel(channel) {\n return channel === COLOR || channel === FILL || channel === STROKE;\n}\nconst FACET_CHANNEL_INDEX = {\n row: 1,\n column: 1,\n facet: 1\n};\nexport const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX);\nconst CHANNEL_INDEX = {\n ...UNIT_CHANNEL_INDEX,\n ...FACET_CHANNEL_INDEX\n};\nexport const CHANNELS = keys(CHANNEL_INDEX);\nconst { order: _o, detail: _d, tooltip: _tt1, ...SINGLE_DEF_CHANNEL_INDEX } = CHANNEL_INDEX;\nconst { row: _r, column: _c, facet: _f, ...SINGLE_DEF_UNIT_CHANNEL_INDEX } = SINGLE_DEF_CHANNEL_INDEX;\n/**\n * Channels that cannot have an array of channelDef.\n * model.fieldDef, getFieldDef only work for these channels.\n *\n * (The only two channels that can have an array of channelDefs are \"detail\" and \"order\".\n * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef\n * are not applicable for them. Similarly, selection projection won't work with \"detail\" and \"order\".)\n */\nexport const SINGLE_DEF_CHANNELS = keys(SINGLE_DEF_CHANNEL_INDEX);\nexport const SINGLE_DEF_UNIT_CHANNELS = keys(SINGLE_DEF_UNIT_CHANNEL_INDEX);\nexport function isSingleDefUnitChannel(str) {\n return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str];\n}\nexport function isChannel(str) {\n return !!CHANNEL_INDEX[str];\n}\nexport const SECONDARY_RANGE_CHANNEL = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2];\nexport function isSecondaryRangeChannel(c) {\n const main = getMainRangeChannel(c);\n return main !== c;\n}\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getMainRangeChannel(channel) {\n switch (channel) {\n case X2:\n return X;\n case Y2:\n return Y;\n case LATITUDE2:\n return LATITUDE;\n case LONGITUDE2:\n return LONGITUDE;\n case THETA2:\n return THETA;\n case RADIUS2:\n return RADIUS;\n }\n return channel;\n}\nexport function getVgPositionChannel(channel) {\n if (isPolarPositionChannel(channel)) {\n switch (channel) {\n case THETA:\n return 'startAngle';\n case THETA2:\n return 'endAngle';\n case RADIUS:\n return 'outerRadius';\n case RADIUS2:\n return 'innerRadius';\n }\n }\n return channel;\n}\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getSecondaryRangeChannel(channel) {\n switch (channel) {\n case X:\n return X2;\n case Y:\n return Y2;\n case LATITUDE:\n return LATITUDE2;\n case LONGITUDE:\n return LONGITUDE2;\n case THETA:\n return THETA2;\n case RADIUS:\n return RADIUS2;\n }\n return undefined;\n}\nexport function getSizeChannel(channel) {\n switch (channel) {\n case X:\n case X2:\n return 'width';\n case Y:\n case Y2:\n return 'height';\n }\n return undefined;\n}\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getOffsetChannel(channel) {\n switch (channel) {\n case X:\n return 'xOffset';\n case Y:\n return 'yOffset';\n case X2:\n return 'x2Offset';\n case Y2:\n return 'y2Offset';\n case THETA:\n return 'thetaOffset';\n case RADIUS:\n return 'radiusOffset';\n case THETA2:\n return 'theta2Offset';\n case RADIUS2:\n return 'radius2Offset';\n }\n return undefined;\n}\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getOffsetScaleChannel(channel) {\n switch (channel) {\n case X:\n return 'xOffset';\n case Y:\n return 'yOffset';\n }\n return undefined;\n}\nexport function getMainChannelFromOffsetChannel(channel) {\n switch (channel) {\n case 'xOffset':\n return 'x';\n case 'yOffset':\n return 'y';\n }\n}\n// CHANNELS without COLUMN, ROW\nexport const UNIT_CHANNELS = keys(UNIT_CHANNEL_INDEX);\n// NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2;\nconst { x: _x, y: _y, \n// x2 and y2 share the same scale as x and y\nx2: _x2, y2: _y2, \n//\nxOffset: _xo, yOffset: _yo, latitude: _latitude, longitude: _longitude, latitude2: _latitude2, longitude2: _longitude2, theta: _theta, theta2: _theta2, radius: _radius, radius2: _radius2, \n// The rest of unit channels then have scale\n...NONPOSITION_CHANNEL_INDEX } = UNIT_CHANNEL_INDEX;\nexport const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX);\nconst POSITION_SCALE_CHANNEL_INDEX = {\n x: 1,\n y: 1\n};\nexport const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX);\nexport function isXorY(channel) {\n return channel in POSITION_SCALE_CHANNEL_INDEX;\n}\nexport const POLAR_POSITION_SCALE_CHANNEL_INDEX = {\n theta: 1,\n radius: 1\n};\nexport const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX);\nexport function getPositionScaleChannel(sizeType) {\n return sizeType === 'width' ? X : Y;\n}\nconst OFFSET_SCALE_CHANNEL_INDEX = { xOffset: 1, yOffset: 1 };\nexport const OFFSET_SCALE_CHANNELS = keys(OFFSET_SCALE_CHANNEL_INDEX);\nexport function isXorYOffset(channel) {\n return channel in OFFSET_SCALE_CHANNEL_INDEX;\n}\n// NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without position / offset\nconst { \n// x2 and y2 share the same scale as x and y\n// text and tooltip have format instead of scale,\n// href has neither format, nor scale\ntext: _t, tooltip: _tt, href: _hr, url: _u, description: _al, \n// detail and order have no scale\ndetail: _dd, key: _k, order: _oo, ...NONPOSITION_SCALE_CHANNEL_INDEX } = NONPOSITION_CHANNEL_INDEX;\nexport const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX);\nexport function isNonPositionScaleChannel(channel) {\n return !!NONPOSITION_CHANNEL_INDEX[channel];\n}\n/**\n * @returns whether Vega supports legends for a particular channel\n */\nexport function supportLegend(channel) {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n case SIZE:\n case SHAPE:\n case OPACITY:\n case STROKEWIDTH:\n case STROKEDASH:\n return true;\n case FILLOPACITY:\n case STROKEOPACITY:\n case ANGLE:\n return false;\n }\n}\n// Declare SCALE_CHANNEL_INDEX\nconst SCALE_CHANNEL_INDEX = {\n ...POSITION_SCALE_CHANNEL_INDEX,\n ...POLAR_POSITION_SCALE_CHANNEL_INDEX,\n ...OFFSET_SCALE_CHANNEL_INDEX,\n ...NONPOSITION_SCALE_CHANNEL_INDEX\n};\n/** List of channels with scales */\nexport const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX);\nexport function isScaleChannel(channel) {\n return !!SCALE_CHANNEL_INDEX[channel];\n}\n/**\n * Return whether a channel supports a particular mark type.\n * @param channel channel name\n * @param mark the mark type\n * @return whether the mark supports the channel\n */\nexport function supportMark(channel, mark) {\n return getSupportedMark(channel)[mark];\n}\nconst ALL_MARKS = {\n // all marks\n arc: 'always',\n area: 'always',\n bar: 'always',\n circle: 'always',\n geoshape: 'always',\n image: 'always',\n line: 'always',\n rule: 'always',\n point: 'always',\n rect: 'always',\n square: 'always',\n trail: 'always',\n text: 'always',\n tick: 'always'\n};\nconst { geoshape: _g, ...ALL_MARKS_EXCEPT_GEOSHAPE } = ALL_MARKS;\n/**\n * Return a dictionary showing whether a channel supports mark type.\n * @param channel\n * @return A dictionary mapping mark types to 'always', 'binned', or undefined\n */\nfunction getSupportedMark(channel) {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n // falls through\n case DESCRIPTION:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case ORDER: // TODO: revise (order might not support rect, which is not stackable?)\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n // falls through\n case FACET:\n case ROW: // falls through\n case COLUMN:\n return ALL_MARKS;\n case X:\n case Y:\n case XOFFSET:\n case YOFFSET:\n case LATITUDE:\n case LONGITUDE:\n // all marks except geoshape. geoshape does not use X, Y -- it uses a projection\n return ALL_MARKS_EXCEPT_GEOSHAPE;\n case X2:\n case Y2:\n case LATITUDE2:\n case LONGITUDE2:\n return {\n area: 'always',\n bar: 'always',\n image: 'always',\n rect: 'always',\n rule: 'always',\n circle: 'binned',\n point: 'binned',\n square: 'binned',\n tick: 'binned',\n line: 'binned',\n trail: 'binned'\n };\n case SIZE:\n return {\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n text: 'always',\n line: 'always',\n trail: 'always'\n };\n case STROKEDASH:\n return {\n line: 'always',\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n geoshape: 'always'\n };\n case SHAPE:\n return { point: 'always', geoshape: 'always' };\n case TEXT:\n return { text: 'always' };\n case ANGLE:\n return { point: 'always', square: 'always', text: 'always' };\n case URL:\n return { image: 'always' };\n case THETA:\n return { text: 'always', arc: 'always' };\n case RADIUS:\n return { text: 'always', arc: 'always' };\n case THETA2:\n case RADIUS2:\n return { arc: 'always' };\n }\n}\nexport function rangeType(channel) {\n switch (channel) {\n case X:\n case Y:\n case THETA:\n case RADIUS:\n case XOFFSET:\n case YOFFSET:\n case SIZE:\n case ANGLE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through]\n case X2:\n case Y2:\n case THETA2:\n case RADIUS2:\n return undefined;\n case FACET:\n case ROW:\n case COLUMN:\n case SHAPE:\n case STROKEDASH:\n // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through]\n case TEXT:\n case TOOLTIP:\n case HREF:\n case URL:\n case DESCRIPTION:\n return 'discrete';\n // Color can be either continuous or discrete, depending on scale type.\n case COLOR:\n case FILL:\n case STROKE:\n return 'flexible';\n // No scale, no range type.\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n case DETAIL:\n case KEY:\n case ORDER:\n return undefined;\n }\n}\n//# sourceMappingURL=channel.js.map","import { isString } from 'vega-util';\nimport { contains } from './util';\nconst AGGREGATE_OP_INDEX = {\n argmax: 1,\n argmin: 1,\n average: 1,\n count: 1,\n distinct: 1,\n product: 1,\n max: 1,\n mean: 1,\n median: 1,\n min: 1,\n missing: 1,\n q1: 1,\n q3: 1,\n ci0: 1,\n ci1: 1,\n stderr: 1,\n stdev: 1,\n stdevp: 1,\n sum: 1,\n valid: 1,\n values: 1,\n variance: 1,\n variancep: 1\n};\nexport const MULTIDOMAIN_SORT_OP_INDEX = {\n count: 1,\n min: 1,\n max: 1\n};\nexport function isArgminDef(a) {\n return !!a && !!a['argmin'];\n}\nexport function isArgmaxDef(a) {\n return !!a && !!a['argmax'];\n}\nexport function isAggregateOp(a) {\n return isString(a) && !!AGGREGATE_OP_INDEX[a];\n}\nexport const COUNTING_OPS = new Set([\n 'count',\n 'valid',\n 'missing',\n 'distinct'\n]);\nexport function isCountingAggregateOp(aggregate) {\n return isString(aggregate) && COUNTING_OPS.has(aggregate);\n}\nexport function isMinMaxOp(aggregate) {\n return isString(aggregate) && contains(['min', 'max'], aggregate);\n}\n/** Additive-based aggregation operations. These can be applied to stack. */\nexport const SUM_OPS = new Set([\n 'count',\n 'sum',\n 'distinct',\n 'valid',\n 'missing'\n]);\n/**\n * Aggregation operators that always produce values within the range [domainMin, domainMax].\n */\nexport const SHARED_DOMAIN_OPS = new Set([\n 'mean',\n 'average',\n 'median',\n 'q1',\n 'q3',\n 'min',\n 'max'\n]);\n//# sourceMappingURL=aggregate.js.map","import { isBoolean, isObject } from 'vega-util';\nimport { COLOR, COLUMN, FILL, FILLOPACITY, OPACITY, ROW, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH } from './channel';\nimport { normalizeBin } from './channeldef';\nimport { entries, keys, varName } from './util';\n/**\n * Create a key for the bin configuration. Not for prebinned bin.\n */\nexport function binToString(bin) {\n if (isBoolean(bin)) {\n bin = normalizeBin(bin, undefined);\n }\n return ('bin' +\n keys(bin)\n .map(p => (isParameterExtent(bin[p]) ? varName(`_${p}_${entries(bin[p])}`) : varName(`_${p}_${bin[p]}`)))\n .join(''));\n}\n/**\n * Vega-Lite should bin the data.\n */\nexport function isBinning(bin) {\n return bin === true || (isBinParams(bin) && !bin.binned);\n}\n/**\n * The data is already binned and so Vega-Lite should not bin it again.\n */\nexport function isBinned(bin) {\n return bin === 'binned' || (isBinParams(bin) && bin.binned === true);\n}\nexport function isBinParams(bin) {\n return isObject(bin);\n}\nexport function isParameterExtent(extent) {\n return extent?.['param'];\n}\nexport function autoMaxBins(channel) {\n switch (channel) {\n case ROW:\n case COLUMN:\n case SIZE:\n case COLOR:\n case FILL:\n case STROKE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // Facets and Size shouldn't have too many bins\n // We choose 6 like shape to simplify the rule [falls through]\n case SHAPE:\n return 6; // Vega's \"shape\" has 6 distinct values\n case STROKEDASH:\n return 4; // We only provide 5 different stroke dash values (but 4 is more effective)\n default:\n return 10;\n }\n}\n//# sourceMappingURL=bin.js.map","import { signalRefOrValue } from './compile/common';\nimport { keys } from './util';\nexport function isExprRef(o) {\n return !!o?.expr;\n}\nexport function replaceExprRef(index) {\n const props = keys(index || {});\n const newIndex = {};\n for (const prop of props) {\n newIndex[prop] = signalRefOrValue(index[prop]);\n }\n return newIndex;\n}\n//# sourceMappingURL=expr.js.map","import { isArray, isString } from 'vega-util';\nimport { pick } from './util';\nexport function extractTitleConfig(titleConfig) {\n const { \n // These are non-mark title config that need to be hardcoded\n anchor, frame, offset, orient, angle, limit, \n // color needs to be redirect to fill\n color, \n // subtitle properties\n subtitleColor, subtitleFont, subtitleFontSize, subtitleFontStyle, subtitleFontWeight, subtitleLineHeight, subtitlePadding, \n // The rest are mark config.\n ...rest } = titleConfig;\n const titleMarkConfig = {\n ...rest,\n ...(color ? { fill: color } : {})\n };\n // These are non-mark title config that need to be hardcoded\n const nonMarkTitleProperties = {\n ...(anchor ? { anchor } : {}),\n ...(frame ? { frame } : {}),\n ...(offset ? { offset } : {}),\n ...(orient ? { orient } : {}),\n ...(angle !== undefined ? { angle } : {}),\n ...(limit !== undefined ? { limit } : {})\n };\n // subtitle part can stay in config.title since header titles do not use subtitle\n const subtitle = {\n ...(subtitleColor ? { subtitleColor } : {}),\n ...(subtitleFont ? { subtitleFont } : {}),\n ...(subtitleFontSize ? { subtitleFontSize } : {}),\n ...(subtitleFontStyle ? { subtitleFontStyle } : {}),\n ...(subtitleFontWeight ? { subtitleFontWeight } : {}),\n ...(subtitleLineHeight ? { subtitleLineHeight } : {}),\n ...(subtitlePadding ? { subtitlePadding } : {})\n };\n const subtitleMarkConfig = pick(titleConfig, ['align', 'baseline', 'dx', 'dy', 'limit']);\n return { titleMarkConfig, subtitleMarkConfig, nonMarkTitleProperties, subtitle };\n}\nexport function isText(v) {\n return isString(v) || (isArray(v) && isString(v[0]));\n}\n//# sourceMappingURL=title.js.map","import { isArray } from 'vega-util';\nimport { keys } from './util';\nexport function isSignalRef(o) {\n return !!o?.signal;\n}\nexport function isVgRangeStep(range) {\n return !!range['step'];\n}\nexport function isDataRefUnionedDomain(domain) {\n if (!isArray(domain)) {\n return 'fields' in domain && !('data' in domain);\n }\n return false;\n}\nexport function isFieldRefUnionDomain(domain) {\n if (!isArray(domain)) {\n return 'fields' in domain && 'data' in domain;\n }\n return false;\n}\nexport function isDataRefDomain(domain) {\n if (!isArray(domain)) {\n return 'field' in domain && 'data' in domain;\n }\n return false;\n}\nconst VG_MARK_CONFIG_INDEX = {\n aria: 1,\n description: 1,\n ariaRole: 1,\n ariaRoleDescription: 1,\n blend: 1,\n opacity: 1,\n fill: 1,\n fillOpacity: 1,\n stroke: 1,\n strokeCap: 1,\n strokeWidth: 1,\n strokeOpacity: 1,\n strokeDash: 1,\n strokeDashOffset: 1,\n strokeJoin: 1,\n strokeOffset: 1,\n strokeMiterLimit: 1,\n startAngle: 1,\n endAngle: 1,\n padAngle: 1,\n innerRadius: 1,\n outerRadius: 1,\n size: 1,\n shape: 1,\n interpolate: 1,\n tension: 1,\n orient: 1,\n align: 1,\n baseline: 1,\n text: 1,\n dir: 1,\n dx: 1,\n dy: 1,\n ellipsis: 1,\n limit: 1,\n radius: 1,\n theta: 1,\n angle: 1,\n font: 1,\n fontSize: 1,\n fontWeight: 1,\n fontStyle: 1,\n lineBreak: 1,\n lineHeight: 1,\n cursor: 1,\n href: 1,\n tooltip: 1,\n cornerRadius: 1,\n cornerRadiusTopLeft: 1,\n cornerRadiusTopRight: 1,\n cornerRadiusBottomLeft: 1,\n cornerRadiusBottomRight: 1,\n aspect: 1,\n width: 1,\n height: 1,\n url: 1,\n smooth: 1\n // commented below are vg channel that do not have mark config.\n // x: 1,\n // y: 1,\n // x2: 1,\n // y2: 1,\n // xc'|'yc'\n // clip: 1,\n // path: 1,\n // url: 1,\n};\nexport const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX);\nexport const VG_MARK_INDEX = {\n arc: 1,\n area: 1,\n group: 1,\n image: 1,\n line: 1,\n path: 1,\n rect: 1,\n rule: 1,\n shape: 1,\n symbol: 1,\n text: 1,\n trail: 1\n};\n// Vega's cornerRadius channels.\nexport const VG_CORNERRADIUS_CHANNELS = [\n 'cornerRadius',\n 'cornerRadiusTopLeft',\n 'cornerRadiusTopRight',\n 'cornerRadiusBottomLeft',\n 'cornerRadiusBottomRight'\n];\n//# sourceMappingURL=vega.schema.js.map","import { array, isArray, stringValue } from 'vega-util';\nimport { vgField } from '../channeldef';\nimport { isExprRef } from '../expr';\nimport { isText } from '../title';\nimport { deepEqual, getFirstDefined } from '../util';\nimport { isSignalRef } from '../vega.schema';\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\nexport function signalOrValueRefWithCondition(val) {\n const condition = isArray(val.condition)\n ? val.condition.map(conditionalSignalRefOrValue)\n : conditionalSignalRefOrValue(val.condition);\n return {\n ...signalRefOrValue(val),\n condition\n };\n}\nexport function signalRefOrValue(value) {\n if (isExprRef(value)) {\n const { expr, ...rest } = value;\n return { signal: expr, ...rest };\n }\n return value;\n}\nexport function conditionalSignalRefOrValue(value) {\n if (isExprRef(value)) {\n const { expr, ...rest } = value;\n return { signal: expr, ...rest };\n }\n return value;\n}\nexport function signalOrValueRef(value) {\n if (isExprRef(value)) {\n const { expr, ...rest } = value;\n return { signal: expr, ...rest };\n }\n if (isSignalRef(value)) {\n return value;\n }\n return value !== undefined ? { value } : undefined;\n}\nexport function exprFromSignalRefOrValue(ref) {\n if (isSignalRef(ref)) {\n return ref.signal;\n }\n return stringValue(ref);\n}\nexport function exprFromValueRefOrSignalRef(ref) {\n if (isSignalRef(ref)) {\n return ref.signal;\n }\n return stringValue(ref.value);\n}\nexport function signalOrStringValue(v) {\n if (isSignalRef(v)) {\n return v.signal;\n }\n return v == null ? null : stringValue(v);\n}\nexport function applyMarkConfig(e, model, propsList) {\n for (const property of propsList) {\n const value = getMarkConfig(property, model.markDef, model.config);\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n return e;\n}\nexport function getStyles(mark) {\n return [].concat(mark.type, mark.style ?? []);\n}\nexport function getMarkPropOrConfig(channel, mark, config, opt = {}) {\n const { vgChannel, ignoreVgConfig } = opt;\n if (vgChannel && mark[vgChannel] !== undefined) {\n return mark[vgChannel];\n }\n else if (mark[channel] !== undefined) {\n return mark[channel];\n }\n else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) {\n return undefined;\n }\n return getMarkConfig(channel, mark, config, opt);\n}\n/**\n * Return property value from style or mark specific config property if exists.\n * Otherwise, return general mark specific config.\n */\nexport function getMarkConfig(channel, mark, config, { vgChannel } = {}) {\n return getFirstDefined(\n // style config has highest precedence\n vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined, getMarkStyleConfig(channel, mark, config.style), \n // then mark-specific config\n vgChannel ? config[mark.type][vgChannel] : undefined, config[mark.type][channel], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine\n // If there is vgChannel, skip vl channel.\n // For example, vl size for text is vg fontSize, but config.mark.size is only for point size.\n vgChannel ? config.mark[vgChannel] : config.mark[channel] // Need to cast for the same reason as above\n );\n}\nexport function getMarkStyleConfig(prop, mark, styleConfigIndex) {\n return getStyleConfig(prop, getStyles(mark), styleConfigIndex);\n}\nexport function getStyleConfig(p, styles, styleConfigIndex) {\n styles = array(styles);\n let value;\n for (const style of styles) {\n const styleConfig = styleConfigIndex[style];\n if (styleConfig && styleConfig[p] !== undefined) {\n value = styleConfig[p];\n }\n }\n return value;\n}\n/**\n * Return Vega sort parameters (tuple of field and order).\n */\nexport function sortParams(orderDef, fieldRefOption) {\n return array(orderDef).reduce((s, orderChannelDef) => {\n s.field.push(vgField(orderChannelDef, fieldRefOption));\n s.order.push(orderChannelDef.sort ?? 'ascending');\n return s;\n }, { field: [], order: [] });\n}\nexport function mergeTitleFieldDefs(f1, f2) {\n const merged = [...f1];\n f2.forEach(fdToMerge => {\n for (const fieldDef1 of merged) {\n // If already exists, no need to append to merged array\n if (deepEqual(fieldDef1, fdToMerge)) {\n return;\n }\n }\n merged.push(fdToMerge);\n });\n return merged;\n}\nexport function mergeTitle(title1, title2) {\n if (deepEqual(title1, title2) || !title2) {\n // if titles are the same or title2 is falsy\n return title1;\n }\n else if (!title1) {\n // if title1 is falsy\n return title2;\n }\n else {\n return [...array(title1), ...array(title2)].join(', ');\n }\n}\nexport function mergeTitleComponent(v1, v2) {\n const v1Val = v1.value;\n const v2Val = v2.value;\n if (v1Val == null || v2Val === null) {\n return {\n explicit: v1.explicit,\n value: null\n };\n }\n else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) {\n return {\n explicit: v1.explicit,\n value: mergeTitle(v1Val, v2Val)\n };\n }\n else if (isText(v1Val) || isSignalRef(v1Val)) {\n return {\n explicit: v1.explicit,\n value: v1Val\n };\n }\n else if (isText(v2Val) || isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: v2Val\n };\n }\n else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: mergeTitleFieldDefs(v1Val, v2Val)\n };\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('It should never reach here');\n}\n//# sourceMappingURL=common.js.map","import { getSizeChannel } from '../channel';\nimport { stringify } from '../util';\nexport function invalidSpec(spec) {\n return `Invalid specification ${stringify(spec)}. Make sure the specification includes at least one of the following properties: \"mark\", \"layer\", \"facet\", \"hconcat\", \"vconcat\", \"concat\", or \"repeat\".`;\n}\n// FIT\nexport const FIT_NON_SINGLE = 'Autosize \"fit\" only works for single views and layered views.';\nexport function containerSizeNonSingle(name) {\n const uName = name == 'width' ? 'Width' : 'Height';\n return `${uName} \"container\" only works for single views and layered views.`;\n}\nexport function containerSizeNotCompatibleWithAutosize(name) {\n const uName = name == 'width' ? 'Width' : 'Height';\n const fitDirection = name == 'width' ? 'x' : 'y';\n return `${uName} \"container\" only works well with autosize \"fit\" or \"fit-${fitDirection}\".`;\n}\nexport function droppingFit(channel) {\n return channel\n ? `Dropping \"fit-${channel}\" because spec has discrete ${getSizeChannel(channel)}.`\n : `Dropping \"fit\" because spec has discrete size.`;\n}\n// VIEW SIZE\nexport function unknownField(channel) {\n return `Unknown field for ${channel}. Cannot calculate view size.`;\n}\n// SELECTION\nexport function cannotProjectOnChannelWithoutField(channel) {\n return `Cannot project a selection on encoding channel \"${channel}\", which has no field.`;\n}\nexport function cannotProjectAggregate(channel, aggregate) {\n return `Cannot project a selection on encoding channel \"${channel}\" as it uses an aggregate function (\"${aggregate}\").`;\n}\nexport function nearestNotSupportForContinuous(mark) {\n return `The \"nearest\" transform is not supported for ${mark} marks.`;\n}\nexport function selectionNotSupported(mark) {\n return `Selection not supported for ${mark} yet.`;\n}\nexport function selectionNotFound(name) {\n return `Cannot find a selection named \"${name}\".`;\n}\nexport const SCALE_BINDINGS_CONTINUOUS = 'Scale bindings are currently only supported for scales with unbinned, continuous domains.';\nexport const LEGEND_BINDINGS_MUST_HAVE_PROJECTION = 'Legend bindings are only supported for selections over an individual field or encoding channel.';\nexport function cannotLookupVariableParameter(name) {\n return `Lookups can only be performed on selection parameters. \"${name}\" is a variable parameter.`;\n}\nexport function noSameUnitLookup(name) {\n return (`Cannot define and lookup the \"${name}\" selection in the same view. ` +\n `Try moving the lookup into a second, layered view?`);\n}\nexport const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.';\nexport const INTERVAL_INITIALIZED_WITH_POS = 'Interval selections should be initialized using \"x\", \"y\", \"longitude\", or \"latitude\" keys.';\n// REPEAT\nexport function noSuchRepeatedValue(field) {\n return `Unknown repeated value \"${field}\".`;\n}\nexport function columnsNotSupportByRowCol(type) {\n return `The \"columns\" property cannot be used when \"${type}\" has nested row/column.`;\n}\n// CONCAT / REPEAT\nexport const CONCAT_CANNOT_SHARE_AXIS = 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).';\n// DATA\nexport function unrecognizedParse(p) {\n return `Unrecognized parse \"${p}\".`;\n}\nexport function differentParse(field, local, ancestor) {\n return `An ancestor parsed field \"${field}\" as ${ancestor} but a child wants to parse the field as ${local}.`;\n}\nexport const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.';\n// TRANSFORMS\nexport function invalidTransformIgnored(transform) {\n return `Ignoring an invalid transform: ${stringify(transform)}.`;\n}\nexport const NO_FIELDS_NEEDS_AS = 'If \"from.fields\" is not specified, \"as\" has to be a string that specifies the key to be used for the data from the secondary source.';\n// ENCODING & FACET\nexport function customFormatTypeNotAllowed(channel) {\n return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`;\n}\nexport function projectionOverridden(opt) {\n const { parentProjection, projection } = opt;\n return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify(projection)}.`;\n}\nexport const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.';\nexport function offsetNestedInsideContinuousPositionScaleDropped(mainChannel) {\n return `${mainChannel}Offset dropped because ${mainChannel} is continuous`;\n}\nexport function primitiveChannelDef(channel, type, value) {\n return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`;\n}\nexport function invalidFieldType(type) {\n return `Invalid field type \"${type}\".`;\n}\nexport function invalidFieldTypeForCountAggregate(type, aggregate) {\n return `Invalid field type \"${type}\" for aggregate: \"${aggregate}\", using \"quantitative\" instead.`;\n}\nexport function invalidAggregate(aggregate) {\n return `Invalid aggregation operator \"${aggregate}\".`;\n}\nexport function missingFieldType(channel, newType) {\n return `Missing type for channel \"${channel}\", using \"${newType}\" instead.`;\n}\nexport function droppingColor(type, opt) {\n const { fill, stroke } = opt;\n return `Dropping color ${type} as the plot also has ${fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke'}.`;\n}\nexport function relativeBandSizeNotSupported(sizeChannel) {\n return `Position range does not support relative band size for ${sizeChannel}.`;\n}\nexport function emptyFieldDef(fieldDef, channel) {\n return `Dropping ${stringify(fieldDef)} from channel \"${channel}\" since it does not contain any data field, datum, value, or signal.`;\n}\nexport const LINE_WITH_VARYING_SIZE = 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.';\nexport function incompatibleChannel(channel, markOrFacet, when) {\n return `${channel} dropped as it is incompatible with \"${markOrFacet}\"${when ? ` when ${when}` : ''}.`;\n}\nexport function offsetEncodingScaleIgnored(channel) {\n return `${channel} encoding has no scale, so specified scale is ignored.`;\n}\nexport function invalidEncodingChannel(channel) {\n return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`;\n}\nexport function channelShouldBeDiscrete(channel) {\n return `${channel} encoding should be discrete (ordinal / nominal / binned).`;\n}\nexport function channelShouldBeDiscreteOrDiscretizing(channel) {\n return `${channel} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`;\n}\nexport function facetChannelDropped(channels) {\n return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`;\n}\nexport function discreteChannelCannotEncode(channel, type) {\n return `Using discrete channel \"${channel}\" to encode \"${type}\" field can be misleading as it does not encode ${type === 'ordinal' ? 'order' : 'magnitude'}.`;\n}\n// MARK\nexport function rangeMarkAlignmentCannotBeExpression(align) {\n return `The ${align} for range marks cannot be an expression`;\n}\nexport function lineWithRange(hasX2, hasY2) {\n const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2';\n return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`;\n}\nexport function orientOverridden(original, actual) {\n return `Specified orient \"${original}\" overridden with \"${actual}\".`;\n}\n// SCALE\nexport const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN = 'Custom domain scale cannot be unioned with default field-based domain.';\nexport function cannotUseScalePropertyWithNonColor(prop) {\n return `Cannot use the scale property \"${prop}\" with non-color channel.`;\n}\nexport function cannotUseRelativeBandSizeWithNonBandScale(scaleType) {\n return `Cannot use the relative band size with ${scaleType} scale.`;\n}\nexport function unaggregateDomainHasNoEffectForRawField(fieldDef) {\n return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`;\n}\nexport function unaggregateDomainWithNonSharedDomainOp(aggregate) {\n return `Unaggregated domain not applicable for \"${aggregate}\" since it produces values outside the origin domain of the source data.`;\n}\nexport function unaggregatedDomainWithLogScale(fieldDef) {\n return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`;\n}\nexport function cannotApplySizeToNonOrientedMark(mark) {\n return `Cannot apply size to non-oriented mark \"${mark}\".`;\n}\nexport function scaleTypeNotWorkWithChannel(channel, scaleType, defaultScaleType) {\n return `Channel \"${channel}\" does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\nexport function scaleTypeNotWorkWithFieldDef(scaleType, defaultScaleType) {\n return `FieldDef does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\nexport function scalePropertyNotWorkWithScaleType(scaleType, propName, channel) {\n return `${channel}-scale's \"${propName}\" is dropped as it does not work with ${scaleType} scale.`;\n}\nexport function scaleTypeNotWorkWithMark(mark, scaleType) {\n return `Scale type \"${scaleType}\" does not work with mark \"${mark}\".`;\n}\nexport function stepDropped(channel) {\n return `The step for \"${channel}\" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`;\n}\nexport function mergeConflictingProperty(property, propertyOf, v1, v2) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(v2)}). Using ${stringify(v1)}.`;\n}\nexport function mergeConflictingDomainProperty(property, propertyOf, v1, v2) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(v2)}). Using the union of the two domains.`;\n}\nexport function independentScaleMeansIndependentGuide(channel) {\n return `Setting the scale to be independent for \"${channel}\" means we also have to set the guide (axis or legend) to be independent.`;\n}\nexport function domainSortDropped(sort) {\n return `Dropping sort property ${stringify(sort)} as unioned domains only support boolean or op \"count\", \"min\", and \"max\".`;\n}\nexport const MORE_THAN_ONE_SORT = 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.';\nexport const FACETED_INDEPENDENT_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.';\nexport const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.';\nexport const FACETED_INDEPENDENT_SAME_SOURCE = 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.';\n// AXIS\nexport const INVALID_CHANNEL_FOR_AXIS = 'Invalid channel for axis.';\n// STACK\nexport function cannotStackRangedMark(channel) {\n return `Cannot stack \"${channel}\" if there is already \"${channel}2\".`;\n}\nexport function cannotStackNonLinearScale(scaleType) {\n return `Cannot stack non-linear scale (${scaleType}).`;\n}\nexport function stackNonSummativeAggregate(aggregate) {\n return `Stacking is applied even though the aggregate function is non-summative (\"${aggregate}\").`;\n}\n// TIMEUNIT\nexport function invalidTimeUnit(unitName, value) {\n return `Invalid ${unitName}: ${stringify(value)}.`;\n}\nexport function droppedDay(d) {\n return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`;\n}\nexport function errorBarCenterAndExtentAreNotNeeded(center, extent) {\n return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${extent && center ? 'are ' : 'is '}not needed when data are aggregated.`;\n}\nexport function errorBarCenterIsUsedWithWrongExtent(center, extent, mark) {\n return `${center} is not usually used with ${extent} for ${mark}.`;\n}\nexport function errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark) {\n return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`;\n}\nexport function errorBand1DNotSupport(property) {\n return `1D error band does not support ${property}.`;\n}\n// CHANNEL\nexport function channelRequiredForBinned(channel) {\n return `Channel ${channel} is required for \"binned\" bin.`;\n}\nexport function channelShouldNotBeUsedForBinned(channel) {\n return `Channel ${channel} should not be used with \"binned\" bin.`;\n}\nexport function domainRequiredForThresholdScale(channel) {\n return `Domain for ${channel} is required for threshold scale.`;\n}\n//# sourceMappingURL=message.js.map","/**\n * Vega-Lite's singleton logger utility.\n */\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _LocalLogger_level;\nimport { Debug, Error as ErrorLevel, Info, logger, Warn } from 'vega-util';\nexport * as message from './message';\n/**\n * Main (default) Vega Logger instance for Vega-Lite.\n */\nconst main = logger(Warn);\nlet current = main;\n/**\n * Logger tool for checking if the code throws correct warning.\n */\nexport class LocalLogger {\n constructor() {\n this.warns = [];\n this.infos = [];\n this.debugs = [];\n _LocalLogger_level.set(this, Warn);\n }\n level(_) {\n if (_) {\n __classPrivateFieldSet(this, _LocalLogger_level, _, \"f\");\n return this;\n }\n return __classPrivateFieldGet(this, _LocalLogger_level, \"f\");\n }\n warn(...args) {\n if (__classPrivateFieldGet(this, _LocalLogger_level, \"f\") >= Warn)\n this.warns.push(...args);\n return this;\n }\n info(...args) {\n if (__classPrivateFieldGet(this, _LocalLogger_level, \"f\") >= Info)\n this.infos.push(...args);\n return this;\n }\n debug(...args) {\n if (__classPrivateFieldGet(this, _LocalLogger_level, \"f\") >= Debug)\n this.debugs.push(...args);\n return this;\n }\n error(...args) {\n if (__classPrivateFieldGet(this, _LocalLogger_level, \"f\") >= ErrorLevel)\n throw Error(...args);\n return this;\n }\n}\n_LocalLogger_level = new WeakMap();\nexport function wrap(f) {\n return () => {\n current = new LocalLogger();\n f(current);\n reset();\n };\n}\n/**\n * Set the singleton logger to be a custom logger.\n */\nexport function set(newLogger) {\n current = newLogger;\n return current;\n}\n/**\n * Reset the main logger to use the default Vega Logger.\n */\nexport function reset() {\n current = main;\n return current;\n}\nexport function error(...args) {\n current.error(...args);\n}\nexport function warn(...args) {\n current.warn(...args);\n}\nexport function info(...args) {\n current.info(...args);\n}\nexport function debug(...args) {\n current.debug(...args);\n}\n//# sourceMappingURL=index.js.map","// DateTime definition object\nimport { isNumber, isObject } from 'vega-util';\nimport * as log from './log';\nimport { TIMEUNIT_PARTS } from './timeunit';\nimport { duplicate, isNumeric, keys } from './util';\nexport function isDateTime(o) {\n if (o && isObject(o)) {\n for (const part of TIMEUNIT_PARTS) {\n if (part in o) {\n return true;\n }\n }\n }\n return false;\n}\nexport const MONTHS = [\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december'\n];\nexport const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3));\nexport const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];\nexport const SHORT_DAYS = DAYS.map(d => d.substr(0, 3));\nfunction normalizeQuarter(q) {\n if (isNumeric(q)) {\n q = +q;\n }\n if (isNumber(q)) {\n if (q > 4) {\n log.warn(log.message.invalidTimeUnit('quarter', q));\n }\n // We accept 1-based quarter, so need to readjust to 0-based quarter\n return q - 1;\n }\n else {\n // Invalid quarter\n throw new Error(log.message.invalidTimeUnit('quarter', q));\n }\n}\nfunction normalizeMonth(m) {\n if (isNumeric(m)) {\n m = +m;\n }\n if (isNumber(m)) {\n // We accept 1-based month, so need to readjust to 0-based month\n return m - 1;\n }\n else {\n const lowerM = m.toLowerCase();\n const monthIndex = MONTHS.indexOf(lowerM);\n if (monthIndex !== -1) {\n return monthIndex; // 0 for january, ...\n }\n const shortM = lowerM.substr(0, 3);\n const shortMonthIndex = SHORT_MONTHS.indexOf(shortM);\n if (shortMonthIndex !== -1) {\n return shortMonthIndex;\n }\n // Invalid month\n throw new Error(log.message.invalidTimeUnit('month', m));\n }\n}\nfunction normalizeDay(d) {\n if (isNumeric(d)) {\n d = +d;\n }\n if (isNumber(d)) {\n // mod so that this can be both 0-based where 0 = sunday\n // and 1-based where 7=sunday\n return d % 7;\n }\n else {\n const lowerD = d.toLowerCase();\n const dayIndex = DAYS.indexOf(lowerD);\n if (dayIndex !== -1) {\n return dayIndex; // 0 for january, ...\n }\n const shortD = lowerD.substr(0, 3);\n const shortDayIndex = SHORT_DAYS.indexOf(shortD);\n if (shortDayIndex !== -1) {\n return shortDayIndex;\n }\n // Invalid day\n throw new Error(log.message.invalidTimeUnit('day', d));\n }\n}\n/**\n * @param d the date.\n * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime.\n * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds]\n */\nfunction dateTimeParts(d, normalize) {\n const parts = [];\n if (normalize && d.day !== undefined) {\n if (keys(d).length > 1) {\n log.warn(log.message.droppedDay(d));\n d = duplicate(d);\n delete d.day;\n }\n }\n if (d.year !== undefined) {\n parts.push(d.year);\n }\n else {\n // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega\n // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year).\n parts.push(2012);\n }\n if (d.month !== undefined) {\n const month = normalize ? normalizeMonth(d.month) : d.month;\n parts.push(month);\n }\n else if (d.quarter !== undefined) {\n const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter;\n parts.push(isNumber(quarter) ? quarter * 3 : `${quarter}*3`);\n }\n else {\n parts.push(0); // months start at zero in JS\n }\n if (d.date !== undefined) {\n parts.push(d.date);\n }\n else if (d.day !== undefined) {\n // HACK: Day only works as a standalone unit\n // This is only correct because we always set year to 2006 for day\n const day = normalize ? normalizeDay(d.day) : d.day;\n parts.push(isNumber(day) ? day + 1 : `${day}+1`);\n }\n else {\n parts.push(1); // Date starts at 1 in JS\n }\n // Note: can't use TimeUnit enum here as importing it will create\n // circular dependency problem!\n for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds']) {\n const unit = d[timeUnit];\n parts.push(typeof unit === 'undefined' ? 0 : unit);\n }\n return parts;\n}\n/**\n * Return Vega expression for a date time.\n *\n * @param d the date time.\n * @returns the Vega expression.\n */\nexport function dateTimeToExpr(d) {\n const parts = dateTimeParts(d, true);\n const string = parts.join(', ');\n if (d.utc) {\n return `utc(${string})`;\n }\n else {\n return `datetime(${string})`;\n }\n}\n/**\n * Return Vega expression for a date time expression.\n *\n * @param d the internal date time object with expression.\n * @returns the Vega expression.\n */\nexport function dateTimeExprToExpr(d) {\n const parts = dateTimeParts(d, false);\n const string = parts.join(', ');\n if (d.utc) {\n return `utc(${string})`;\n }\n else {\n return `datetime(${string})`;\n }\n}\n/**\n * @param d the date time.\n * @returns the timestamp.\n */\nexport function dateTimeToTimestamp(d) {\n const parts = dateTimeParts(d, true);\n if (d.utc) {\n return +new Date(Date.UTC(...parts));\n }\n else {\n return +new Date(...parts);\n }\n}\n//# sourceMappingURL=datetime.js.map","import { isObject, isString } from 'vega-util';\nimport { dateTimeExprToExpr, dateTimeToExpr } from './datetime';\nimport { accessPathWithDatum, keys, stringify, varName } from './util';\n/** Time Unit that only corresponds to only one part of Date objects. */\nexport const LOCAL_SINGLE_TIMEUNIT_INDEX = {\n year: 1,\n quarter: 1,\n month: 1,\n week: 1,\n day: 1,\n dayofyear: 1,\n date: 1,\n hours: 1,\n minutes: 1,\n seconds: 1,\n milliseconds: 1\n};\nexport const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX);\nexport function isLocalSingleTimeUnit(timeUnit) {\n return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit];\n}\nexport const UTC_SINGLE_TIMEUNIT_INDEX = {\n utcyear: 1,\n utcquarter: 1,\n utcmonth: 1,\n utcweek: 1,\n utcday: 1,\n utcdayofyear: 1,\n utcdate: 1,\n utchours: 1,\n utcminutes: 1,\n utcseconds: 1,\n utcmilliseconds: 1\n};\nexport const LOCAL_MULTI_TIMEUNIT_INDEX = {\n yearquarter: 1,\n yearquartermonth: 1,\n yearmonth: 1,\n yearmonthdate: 1,\n yearmonthdatehours: 1,\n yearmonthdatehoursminutes: 1,\n yearmonthdatehoursminutesseconds: 1,\n yearweek: 1,\n yearweekday: 1,\n yearweekdayhours: 1,\n yearweekdayhoursminutes: 1,\n yearweekdayhoursminutesseconds: 1,\n yeardayofyear: 1,\n quartermonth: 1,\n monthdate: 1,\n monthdatehours: 1,\n monthdatehoursminutes: 1,\n monthdatehoursminutesseconds: 1,\n weekday: 1,\n weeksdayhours: 1,\n weekdayhoursminutes: 1,\n weekdayhoursminutesseconds: 1,\n dayhours: 1,\n dayhoursminutes: 1,\n dayhoursminutesseconds: 1,\n hoursminutes: 1,\n hoursminutesseconds: 1,\n minutesseconds: 1,\n secondsmilliseconds: 1\n};\nconst BINNED_LOCAL_TIMEUNIT_INDEX = {\n binnedyear: 1,\n binnedyearquarter: 1,\n binnedyearquartermonth: 1,\n binnedyearmonth: 1,\n binnedyearmonthdate: 1,\n binnedyearmonthdatehours: 1,\n binnedyearmonthdatehoursminutes: 1,\n binnedyearmonthdatehoursminutesseconds: 1,\n binnedyearweek: 1,\n binnedyearweekday: 1,\n binnedyearweekdayhours: 1,\n binnedyearweekdayhoursminutes: 1,\n binnedyearweekdayhoursminutesseconds: 1,\n binnedyeardayofyear: 1\n};\nconst BINNED_UTC_TIMEUNIT_INDEX = {\n binnedutcyear: 1,\n binnedutcyearquarter: 1,\n binnedutcyearquartermonth: 1,\n binnedutcyearmonth: 1,\n binnedutcyearmonthdate: 1,\n binnedutcyearmonthdatehours: 1,\n binnedutcyearmonthdatehoursminutes: 1,\n binnedutcyearmonthdatehoursminutesseconds: 1,\n binnedutcyearweek: 1,\n binnedutcyearweekday: 1,\n binnedutcyearweekdayhours: 1,\n binnedutcyearweekdayhoursminutes: 1,\n binnedutcyearweekdayhoursminutesseconds: 1,\n binnedutcyeardayofyear: 1\n};\nexport const BINNED_TIMEUNIT_INDEX = {\n ...BINNED_LOCAL_TIMEUNIT_INDEX,\n ...BINNED_UTC_TIMEUNIT_INDEX\n};\nexport function isBinnedTimeUnit(timeUnit) {\n if (isObject(timeUnit)) {\n return timeUnit.binned;\n }\n return isBinnedTimeUnitString(timeUnit);\n}\nexport function isBinnedTimeUnitString(timeUnit) {\n return timeUnit && timeUnit.startsWith('binned');\n}\nexport const UTC_MULTI_TIMEUNIT_INDEX = {\n utcyearquarter: 1,\n utcyearquartermonth: 1,\n utcyearmonth: 1,\n utcyearmonthdate: 1,\n utcyearmonthdatehours: 1,\n utcyearmonthdatehoursminutes: 1,\n utcyearmonthdatehoursminutesseconds: 1,\n utcyearweek: 1,\n utcyearweekday: 1,\n utcyearweekdayhours: 1,\n utcyearweekdayhoursminutes: 1,\n utcyearweekdayhoursminutesseconds: 1,\n utcyeardayofyear: 1,\n utcquartermonth: 1,\n utcmonthdate: 1,\n utcmonthdatehours: 1,\n utcmonthdatehoursminutes: 1,\n utcmonthdatehoursminutesseconds: 1,\n utcweekday: 1,\n utcweeksdayhours: 1,\n utcweekdayhoursminutes: 1,\n utcweekdayhoursminutesseconds: 1,\n utcdayhours: 1,\n utcdayhoursminutes: 1,\n utcdayhoursminutesseconds: 1,\n utchoursminutes: 1,\n utchoursminutesseconds: 1,\n utcminutesseconds: 1,\n utcsecondsmilliseconds: 1\n};\nexport function isUTCTimeUnit(t) {\n return t.startsWith('utc');\n}\nexport function getLocalTimeUnitFromUTCTimeUnit(t) {\n return t.substring(3);\n}\n// In order of increasing specificity\nexport const VEGALITE_TIMEFORMAT = {\n 'year-month': '%b %Y ',\n 'year-month-date': '%b %d, %Y '\n};\nexport function getTimeUnitParts(timeUnit) {\n return TIMEUNIT_PARTS.filter(part => containsTimeUnit(timeUnit, part));\n}\nexport function getSmallestTimeUnitPart(timeUnit) {\n const parts = getTimeUnitParts(timeUnit);\n return parts[parts.length - 1];\n}\n/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */\nexport function containsTimeUnit(fullTimeUnit, timeUnit) {\n const index = fullTimeUnit.indexOf(timeUnit);\n if (index < 0) {\n return false;\n }\n // exclude milliseconds\n if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') {\n return false;\n }\n // exclude dayofyear\n if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') {\n return false;\n }\n if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') {\n return false;\n }\n return true;\n}\n/**\n * Returns Vega expression for a given timeUnit and fieldRef\n */\nexport function fieldExpr(fullTimeUnit, field, { end } = { end: false }) {\n const fieldRef = accessPathWithDatum(field);\n const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : '';\n function func(timeUnit) {\n if (timeUnit === 'quarter') {\n // quarter starting at 0 (0,3,6,9).\n return `(${utc}quarter(${fieldRef})-1)`;\n }\n else {\n return `${utc}${timeUnit}(${fieldRef})`;\n }\n }\n let lastTimeUnit;\n const dateExpr = {};\n for (const part of TIMEUNIT_PARTS) {\n if (containsTimeUnit(fullTimeUnit, part)) {\n dateExpr[part] = func(part);\n lastTimeUnit = part;\n }\n }\n if (end) {\n dateExpr[lastTimeUnit] += '+1';\n }\n return dateTimeExprToExpr(dateExpr);\n}\nexport function timeUnitSpecifierExpression(timeUnit) {\n if (!timeUnit) {\n return undefined;\n }\n const timeUnitParts = getTimeUnitParts(timeUnit);\n return `timeUnitSpecifier(${stringify(timeUnitParts)}, ${stringify(VEGALITE_TIMEFORMAT)})`;\n}\n/**\n * Returns the signal expression used for axis labels for a time unit.\n */\nexport function formatExpression(timeUnit, field, isUTCScale) {\n if (!timeUnit) {\n return undefined;\n }\n const expr = timeUnitSpecifierExpression(timeUnit);\n // We only use utcFormat for utc scale\n // For utc time units, the data is already converted as a part of timeUnit transform.\n // Thus, utc time units should use timeFormat to avoid shifting the time twice.\n const utc = isUTCScale || isUTCTimeUnit(timeUnit);\n return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`;\n}\nexport function normalizeTimeUnit(timeUnit) {\n if (!timeUnit) {\n return undefined;\n }\n let params;\n if (isString(timeUnit)) {\n if (isBinnedTimeUnitString(timeUnit)) {\n params = {\n unit: timeUnit.substring(6),\n binned: true\n };\n }\n else {\n params = {\n unit: timeUnit\n };\n }\n }\n else if (isObject(timeUnit)) {\n params = {\n ...timeUnit,\n ...(timeUnit.unit ? { unit: timeUnit.unit } : {})\n };\n }\n if (isUTCTimeUnit(params.unit)) {\n params.utc = true;\n params.unit = getLocalTimeUnitFromUTCTimeUnit(params.unit);\n }\n return params;\n}\nexport function timeUnitToString(tu) {\n const { utc, ...rest } = normalizeTimeUnit(tu);\n if (rest.unit) {\n return ((utc ? 'utc' : '') +\n keys(rest)\n .map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`))\n .join(''));\n }\n else {\n // when maxbins is specified instead of units\n return ((utc ? 'utc' : '') +\n 'timeunit' +\n keys(rest)\n .map(p => varName(`_${p}_${rest[p]}`))\n .join(''));\n }\n}\nexport function durationExpr(timeUnit, wrap = x => x) {\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit);\n const smallestUnitPart = getSmallestTimeUnitPart(normalizedTimeUnit.unit);\n if (smallestUnitPart && smallestUnitPart !== 'day') {\n const startDate = {\n year: 2001,\n month: 1,\n date: 1,\n hours: 0,\n minutes: 0,\n seconds: 0,\n milliseconds: 0\n };\n const { step, part } = getDateTimePartAndStep(smallestUnitPart, normalizedTimeUnit.step);\n const endDate = {\n ...startDate,\n [part]: +startDate[part] + step\n };\n // Calculate timestamp duration for the smallest unit listed\n return `${wrap(dateTimeToExpr(endDate))} - ${wrap(dateTimeToExpr(startDate))}`;\n }\n return undefined;\n}\nconst DATE_PARTS = {\n year: 1,\n month: 1,\n date: 1,\n hours: 1,\n minutes: 1,\n seconds: 1,\n milliseconds: 1\n};\nexport function isDatePart(timeUnit) {\n return !!DATE_PARTS[timeUnit];\n}\nexport function getDateTimePartAndStep(timeUnit, step = 1) {\n if (isDatePart(timeUnit)) {\n return { part: timeUnit, step };\n }\n switch (timeUnit) {\n case 'day':\n case 'dayofyear':\n return { part: 'date', step };\n case 'quarter':\n return { part: 'month', step: step * 3 };\n case 'week':\n return { part: 'date', step: step * 7 };\n }\n}\n//# sourceMappingURL=timeunit.js.map","import { isArray } from 'vega-util';\nimport { valueExpr, vgField } from './channeldef';\nimport { fieldExpr as timeUnitFieldExpr, normalizeTimeUnit } from './timeunit';\nimport { stringify } from './util';\nimport { isSignalRef } from './vega.schema';\nexport function isSelectionPredicate(predicate) {\n return predicate?.['param'];\n}\nexport function isFieldEqualPredicate(predicate) {\n return !!predicate?.field && predicate.equal !== undefined;\n}\nexport function isFieldLTPredicate(predicate) {\n return !!predicate?.field && predicate.lt !== undefined;\n}\nexport function isFieldLTEPredicate(predicate) {\n return !!predicate?.field && predicate.lte !== undefined;\n}\nexport function isFieldGTPredicate(predicate) {\n return !!predicate?.field && predicate.gt !== undefined;\n}\nexport function isFieldGTEPredicate(predicate) {\n return !!predicate?.field && predicate.gte !== undefined;\n}\nexport function isFieldRangePredicate(predicate) {\n if (predicate?.field) {\n if (isArray(predicate.range) && predicate.range.length === 2) {\n return true;\n }\n else if (isSignalRef(predicate.range)) {\n return true;\n }\n }\n return false;\n}\nexport function isFieldOneOfPredicate(predicate) {\n return (!!predicate?.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility\n );\n}\nexport function isFieldValidPredicate(predicate) {\n return !!predicate?.field && predicate.valid !== undefined;\n}\nexport function isFieldPredicate(predicate) {\n return (isFieldOneOfPredicate(predicate) ||\n isFieldEqualPredicate(predicate) ||\n isFieldRangePredicate(predicate) ||\n isFieldLTPredicate(predicate) ||\n isFieldGTPredicate(predicate) ||\n isFieldLTEPredicate(predicate) ||\n isFieldGTEPredicate(predicate));\n}\nfunction predicateValueExpr(v, timeUnit) {\n return valueExpr(v, { timeUnit, wrapTime: true });\n}\nfunction predicateValuesExpr(vals, timeUnit) {\n return vals.map(v => predicateValueExpr(v, timeUnit));\n}\n// This method is used by Voyager. Do not change its behavior without changing Voyager.\nexport function fieldFilterExpression(predicate, useInRange = true) {\n const { field } = predicate;\n const normalizedTimeUnit = normalizeTimeUnit(predicate.timeUnit);\n const { unit, binned } = normalizedTimeUnit || {};\n const rawFieldExpr = vgField(predicate, { expr: 'datum' });\n const fieldExpr = unit\n ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly.\n // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline\n // TODO: support utc\n `time(${!binned ? timeUnitFieldExpr(unit, field) : rawFieldExpr})`\n : rawFieldExpr;\n if (isFieldEqualPredicate(predicate)) {\n return `${fieldExpr}===${predicateValueExpr(predicate.equal, unit)}`;\n }\n else if (isFieldLTPredicate(predicate)) {\n const upper = predicate.lt;\n return `${fieldExpr}<${predicateValueExpr(upper, unit)}`;\n }\n else if (isFieldGTPredicate(predicate)) {\n const lower = predicate.gt;\n return `${fieldExpr}>${predicateValueExpr(lower, unit)}`;\n }\n else if (isFieldLTEPredicate(predicate)) {\n const upper = predicate.lte;\n return `${fieldExpr}<=${predicateValueExpr(upper, unit)}`;\n }\n else if (isFieldGTEPredicate(predicate)) {\n const lower = predicate.gte;\n return `${fieldExpr}>=${predicateValueExpr(lower, unit)}`;\n }\n else if (isFieldOneOfPredicate(predicate)) {\n return `indexof([${predicateValuesExpr(predicate.oneOf, unit).join(',')}], ${fieldExpr}) !== -1`;\n }\n else if (isFieldValidPredicate(predicate)) {\n return fieldValidPredicate(fieldExpr, predicate.valid);\n }\n else if (isFieldRangePredicate(predicate)) {\n const { range } = predicate;\n const lower = isSignalRef(range) ? { signal: `${range.signal}[0]` } : range[0];\n const upper = isSignalRef(range) ? { signal: `${range.signal}[1]` } : range[1];\n if (lower !== null && upper !== null && useInRange) {\n return ('inrange(' + fieldExpr + ', [' + predicateValueExpr(lower, unit) + ', ' + predicateValueExpr(upper, unit) + '])');\n }\n const exprs = [];\n if (lower !== null) {\n exprs.push(`${fieldExpr} >= ${predicateValueExpr(lower, unit)}`);\n }\n if (upper !== null) {\n exprs.push(`${fieldExpr} <= ${predicateValueExpr(upper, unit)}`);\n }\n return exprs.length > 0 ? exprs.join(' && ') : 'true';\n }\n /* istanbul ignore next: it should never reach here */\n throw new Error(`Invalid field predicate: ${stringify(predicate)}`);\n}\nexport function fieldValidPredicate(fieldExpr, valid = true) {\n if (valid) {\n return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`;\n }\n else {\n return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`;\n }\n}\nexport function normalizePredicate(f) {\n if (isFieldPredicate(f) && f.timeUnit) {\n return {\n ...f,\n timeUnit: normalizeTimeUnit(f.timeUnit)\n };\n }\n return f;\n}\n//# sourceMappingURL=predicate.js.map","import { keys } from './util';\n/**\n * Data type based on level of measurement\n */\nexport const Type = {\n quantitative: 'quantitative',\n ordinal: 'ordinal',\n temporal: 'temporal',\n nominal: 'nominal',\n geojson: 'geojson'\n};\nexport function isType(t) {\n return t in Type;\n}\nexport function isContinuous(type) {\n return type === 'quantitative' || type === 'temporal';\n}\nexport function isDiscrete(type) {\n return type === 'ordinal' || type === 'nominal';\n}\nexport const QUANTITATIVE = Type.quantitative;\nexport const ORDINAL = Type.ordinal;\nexport const TEMPORAL = Type.temporal;\nexport const NOMINAL = Type.nominal;\nexport const GEOJSON = Type.geojson;\nexport const TYPES = keys(Type);\n/**\n * Get full, lowercase type name for a given type.\n * @param type\n * @return Full type name.\n */\nexport function getFullName(type) {\n if (type) {\n type = type.toLowerCase();\n switch (type) {\n case 'q':\n case QUANTITATIVE:\n return 'quantitative';\n case 't':\n case TEMPORAL:\n return 'temporal';\n case 'o':\n case ORDINAL:\n return 'ordinal';\n case 'n':\n case NOMINAL:\n return 'nominal';\n case GEOJSON:\n return 'geojson';\n }\n }\n // If we get invalid input, return undefined type.\n return undefined;\n}\n//# sourceMappingURL=type.js.map","import { isObject } from 'vega';\nimport { isString } from 'vega-util';\nimport * as CHANNEL from './channel';\nimport { isColorChannel } from './channel';\nimport * as log from './log';\nimport { NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL } from './type';\nimport { contains, keys } from './util';\nexport const ScaleType = {\n // Continuous - Quantitative\n LINEAR: 'linear',\n LOG: 'log',\n POW: 'pow',\n SQRT: 'sqrt',\n SYMLOG: 'symlog',\n IDENTITY: 'identity',\n SEQUENTIAL: 'sequential',\n // Continuous - Time\n TIME: 'time',\n UTC: 'utc',\n // Discretizing scales\n QUANTILE: 'quantile',\n QUANTIZE: 'quantize',\n THRESHOLD: 'threshold',\n BIN_ORDINAL: 'bin-ordinal',\n // Discrete scales\n ORDINAL: 'ordinal',\n POINT: 'point',\n BAND: 'band'\n};\n/**\n * Index for scale categories -- only scale of the same categories can be merged together.\n * Current implementation is trying to be conservative and avoid merging scale type that might not work together\n */\nexport const SCALE_CATEGORY_INDEX = {\n linear: 'numeric',\n log: 'numeric',\n pow: 'numeric',\n sqrt: 'numeric',\n symlog: 'numeric',\n identity: 'numeric',\n sequential: 'numeric',\n time: 'time',\n utc: 'time',\n ordinal: 'ordinal',\n 'bin-ordinal': 'bin-ordinal',\n point: 'ordinal-position',\n band: 'ordinal-position',\n quantile: 'discretizing',\n quantize: 'discretizing',\n threshold: 'discretizing'\n};\nexport const SCALE_TYPES = keys(SCALE_CATEGORY_INDEX);\n/**\n * Whether the two given scale types can be merged together.\n */\nexport function scaleCompatible(scaleType1, scaleType2) {\n const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1];\n const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2];\n return (scaleCategory1 === scaleCategory2 ||\n (scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time') ||\n (scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time'));\n}\n/**\n * Index for scale precedence -- high score = higher priority for merging.\n */\nconst SCALE_PRECEDENCE_INDEX = {\n // numeric\n linear: 0,\n log: 1,\n pow: 1,\n sqrt: 1,\n symlog: 1,\n identity: 1,\n sequential: 1,\n // time\n time: 0,\n utc: 0,\n // ordinal-position -- these have higher precedence than continuous scales as they support more types of data\n point: 10,\n band: 11,\n // non grouped types\n ordinal: 0,\n 'bin-ordinal': 0,\n quantile: 0,\n quantize: 0,\n threshold: 0\n};\n/**\n * Return scale categories -- only scale of the same categories can be merged together.\n */\nexport function scaleTypePrecedence(scaleType) {\n return SCALE_PRECEDENCE_INDEX[scaleType];\n}\nexport const QUANTITATIVE_SCALES = new Set([\n 'linear',\n 'log',\n 'pow',\n 'sqrt',\n 'symlog'\n]);\nexport const CONTINUOUS_TO_CONTINUOUS_SCALES = new Set([\n ...QUANTITATIVE_SCALES,\n 'time',\n 'utc'\n]);\nexport function isQuantitative(type) {\n return QUANTITATIVE_SCALES.has(type);\n}\nexport const CONTINUOUS_TO_DISCRETE_SCALES = new Set([\n 'quantile',\n 'quantize',\n 'threshold'\n]);\nexport const CONTINUOUS_DOMAIN_SCALES = new Set([\n ...CONTINUOUS_TO_CONTINUOUS_SCALES,\n ...CONTINUOUS_TO_DISCRETE_SCALES,\n 'sequential',\n 'identity'\n]);\nexport const DISCRETE_DOMAIN_SCALES = new Set([\n 'ordinal',\n 'bin-ordinal',\n 'point',\n 'band'\n]);\nexport const TIME_SCALE_TYPES = new Set(['time', 'utc']);\nexport function hasDiscreteDomain(type) {\n return DISCRETE_DOMAIN_SCALES.has(type);\n}\nexport function hasContinuousDomain(type) {\n return CONTINUOUS_DOMAIN_SCALES.has(type);\n}\nexport function isContinuousToContinuous(type) {\n return CONTINUOUS_TO_CONTINUOUS_SCALES.has(type);\n}\nexport function isContinuousToDiscrete(type) {\n return CONTINUOUS_TO_DISCRETE_SCALES.has(type);\n}\nexport const defaultScaleConfig = {\n pointPadding: 0.5,\n barBandPaddingInner: 0.1,\n rectBandPaddingInner: 0,\n bandWithNestedOffsetPaddingInner: 0.2,\n bandWithNestedOffsetPaddingOuter: 0.2,\n minBandSize: 2,\n minFontSize: 8,\n maxFontSize: 40,\n minOpacity: 0.3,\n maxOpacity: 0.8,\n // FIXME: revise if these *can* become ratios of width/height step\n minSize: 9,\n minStrokeWidth: 1,\n maxStrokeWidth: 4,\n quantileCount: 4,\n quantizeCount: 4,\n zero: true\n};\nexport function isExtendedScheme(scheme) {\n return !isString(scheme) && !!scheme['name'];\n}\nexport function isParameterDomain(domain) {\n return domain?.['param'];\n}\nexport function isDomainUnionWith(domain) {\n return domain?.['unionWith'];\n}\nexport function isFieldRange(range) {\n return isObject(range) && 'field' in range;\n}\nconst SCALE_PROPERTY_INDEX = {\n type: 1,\n domain: 1,\n domainMax: 1,\n domainMin: 1,\n domainMid: 1,\n domainRaw: 1,\n align: 1,\n range: 1,\n rangeMax: 1,\n rangeMin: 1,\n scheme: 1,\n bins: 1,\n // Other properties\n reverse: 1,\n round: 1,\n // quantitative / time\n clamp: 1,\n nice: 1,\n // quantitative\n base: 1,\n exponent: 1,\n constant: 1,\n interpolate: 1,\n zero: 1,\n // band/point\n padding: 1,\n paddingInner: 1,\n paddingOuter: 1\n};\nexport const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX);\nconst { type, domain, range, rangeMax, rangeMin, scheme, ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX } = SCALE_PROPERTY_INDEX;\nexport const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX);\nexport function scaleTypeSupportProperty(scaleType, propName) {\n switch (propName) {\n case 'type':\n case 'domain':\n case 'reverse':\n case 'range':\n return true;\n case 'scheme':\n case 'interpolate':\n return !['point', 'band', 'identity'].includes(scaleType);\n case 'bins':\n return !['point', 'band', 'identity', 'ordinal'].includes(scaleType);\n case 'round':\n return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point';\n case 'padding':\n case 'rangeMin':\n case 'rangeMax':\n return isContinuousToContinuous(scaleType) || ['point', 'band'].includes(scaleType);\n case 'paddingOuter':\n case 'align':\n return ['point', 'band'].includes(scaleType);\n case 'paddingInner':\n return scaleType === 'band';\n case 'domainMax':\n case 'domainMid':\n case 'domainMin':\n case 'domainRaw':\n case 'clamp':\n return isContinuousToContinuous(scaleType);\n case 'nice':\n return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold';\n case 'exponent':\n return scaleType === 'pow';\n case 'base':\n return scaleType === 'log';\n case 'constant':\n return scaleType === 'symlog';\n case 'zero':\n return (hasContinuousDomain(scaleType) &&\n !contains([\n 'log',\n 'time',\n 'utc',\n 'threshold',\n 'quantile' // quantile depends on distribution so zero does not matter\n ], scaleType));\n }\n}\n/**\n * Returns undefined if the input channel supports the input scale property name\n */\nexport function channelScalePropertyIncompatability(channel, propName) {\n switch (propName) {\n case 'interpolate':\n case 'scheme':\n case 'domainMid':\n if (!isColorChannel(channel)) {\n return log.message.cannotUseScalePropertyWithNonColor(propName);\n }\n return undefined;\n case 'align':\n case 'type':\n case 'bins':\n case 'domain':\n case 'domainMax':\n case 'domainMin':\n case 'domainRaw':\n case 'range':\n case 'base':\n case 'exponent':\n case 'constant':\n case 'nice':\n case 'padding':\n case 'paddingInner':\n case 'paddingOuter':\n case 'rangeMax':\n case 'rangeMin':\n case 'reverse':\n case 'round':\n case 'clamp':\n case 'zero':\n return undefined; // GOOD!\n }\n}\nexport function scaleTypeSupportDataType(specifiedType, fieldDefType) {\n if (contains([ORDINAL, NOMINAL], fieldDefType)) {\n return specifiedType === undefined || hasDiscreteDomain(specifiedType);\n }\n else if (fieldDefType === TEMPORAL) {\n return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType);\n }\n else if (fieldDefType === QUANTITATIVE) {\n return isQuantitative(specifiedType) || isContinuousToDiscrete(specifiedType) || specifiedType === undefined;\n }\n return true;\n}\nexport function channelSupportScaleType(channel, scaleType, hasNestedOffsetScale = false) {\n if (!CHANNEL.isScaleChannel(channel)) {\n return false;\n }\n switch (channel) {\n case CHANNEL.X:\n case CHANNEL.Y:\n case CHANNEL.XOFFSET:\n case CHANNEL.YOFFSET:\n case CHANNEL.THETA:\n case CHANNEL.RADIUS:\n if (isContinuousToContinuous(scaleType)) {\n return true;\n }\n else if (scaleType === 'band') {\n return true;\n }\n else if (scaleType === 'point') {\n /*\n Point scale can't be use if the position has a nested offset scale\n because if there is a nested scale, then it's band.\n */\n return !hasNestedOffsetScale;\n }\n return false;\n case CHANNEL.SIZE: // TODO: size and opacity can support ordinal with more modification\n case CHANNEL.STROKEWIDTH:\n case CHANNEL.OPACITY:\n case CHANNEL.FILLOPACITY:\n case CHANNEL.STROKEOPACITY:\n case CHANNEL.ANGLE:\n // Although it generally doesn't make sense to use band with size and opacity,\n // it can also work since we use band: 0.5 to get midpoint.\n return (isContinuousToContinuous(scaleType) ||\n isContinuousToDiscrete(scaleType) ||\n contains(['band', 'point', 'ordinal'], scaleType));\n case CHANNEL.COLOR:\n case CHANNEL.FILL:\n case CHANNEL.STROKE:\n return scaleType !== 'band'; // band does not make sense with color\n case CHANNEL.STROKEDASH:\n case CHANNEL.SHAPE:\n return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType);\n }\n}\n//# sourceMappingURL=scale.js.map","import { keys } from './util';\n/**\n * All types of primitive marks.\n */\nexport const Mark = {\n arc: 'arc',\n area: 'area',\n bar: 'bar',\n image: 'image',\n line: 'line',\n point: 'point',\n rect: 'rect',\n rule: 'rule',\n text: 'text',\n tick: 'tick',\n trail: 'trail',\n circle: 'circle',\n square: 'square',\n geoshape: 'geoshape'\n};\nexport const ARC = Mark.arc;\nexport const AREA = Mark.area;\nexport const BAR = Mark.bar;\nexport const IMAGE = Mark.image;\nexport const LINE = Mark.line;\nexport const POINT = Mark.point;\nexport const RECT = Mark.rect;\nexport const RULE = Mark.rule;\nexport const TEXT = Mark.text;\nexport const TICK = Mark.tick;\nexport const TRAIL = Mark.trail;\nexport const CIRCLE = Mark.circle;\nexport const SQUARE = Mark.square;\nexport const GEOSHAPE = Mark.geoshape;\nexport function isMark(m) {\n return m in Mark;\n}\nexport function isPathMark(m) {\n return ['line', 'area', 'trail'].includes(m);\n}\nexport function isRectBasedMark(m) {\n return ['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */].includes(m);\n}\nexport const PRIMITIVE_MARKS = new Set(keys(Mark));\nexport function isMarkDef(mark) {\n return mark['type'];\n}\nexport function isPrimitiveMark(mark) {\n const markType = isMarkDef(mark) ? mark.type : mark;\n return PRIMITIVE_MARKS.has(markType);\n}\nexport const STROKE_CONFIG = [\n 'stroke',\n 'strokeWidth',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeOpacity',\n 'strokeJoin',\n 'strokeMiterLimit'\n];\nexport const FILL_CONFIG = ['fill', 'fillOpacity'];\nexport const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG];\nconst VL_ONLY_MARK_CONFIG_INDEX = {\n color: 1,\n filled: 1,\n invalid: 1,\n order: 1,\n radius2: 1,\n theta2: 1,\n timeUnitBandSize: 1,\n timeUnitBandPosition: 1\n};\nexport const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX);\nexport const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {\n area: ['line', 'point'],\n bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'],\n rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'],\n line: ['point'],\n tick: ['bandSize', 'thickness']\n};\nexport const defaultMarkConfig = {\n color: '#4c78a8',\n invalid: 'filter',\n timeUnitBandSize: 1\n};\nconst MARK_CONFIG_INDEX = {\n mark: 1,\n arc: 1,\n area: 1,\n bar: 1,\n circle: 1,\n image: 1,\n line: 1,\n point: 1,\n rect: 1,\n rule: 1,\n square: 1,\n text: 1,\n tick: 1,\n trail: 1,\n geoshape: 1\n};\nexport const MARK_CONFIGS = keys(MARK_CONFIG_INDEX);\nexport function isRelativeBandSize(o) {\n return o && o['band'] != undefined;\n}\nexport const BAR_CORNER_RADIUS_INDEX = {\n horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'],\n vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight']\n};\nconst DEFAULT_RECT_BAND_SIZE = 5;\nexport const defaultBarConfig = {\n binSpacing: 1,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n minBandSize: 0.25,\n timeUnitBandPosition: 0.5\n};\nexport const defaultRectConfig = {\n binSpacing: 0,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n minBandSize: 0.25,\n timeUnitBandPosition: 0.5\n};\nexport const defaultTickConfig = {\n thickness: 1\n};\nexport function getMarkType(m) {\n return isMarkDef(m) ? m.type : m;\n}\n//# sourceMappingURL=mark.js.map","import { isFunction, isString } from 'vega-util';\nimport { isCountingAggregateOp } from '../../../aggregate';\nimport { isBinned, isBinning } from '../../../bin';\nimport { getMainRangeChannel, X, X2, Y2 } from '../../../channel';\nimport { binRequiresRange, getBandPosition, isDatumDef, isFieldDef, isFieldOrDatumDef, isTypedFieldDef, isValueDef, vgField } from '../../../channeldef';\nimport { dateTimeToExpr, isDateTime } from '../../../datetime';\nimport { isExprRef } from '../../../expr';\nimport * as log from '../../../log';\nimport { isPathMark } from '../../../mark';\nimport { fieldValidPredicate } from '../../../predicate';\nimport { hasDiscreteDomain, isContinuousToContinuous } from '../../../scale';\nimport { TEMPORAL } from '../../../type';\nimport { contains, stringify } from '../../../util';\nimport { isSignalRef } from '../../../vega.schema';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nexport function midPointRefWithPositionInvalidTest(params) {\n const { channel, channelDef, markDef, scale, config } = params;\n const ref = midPoint(params);\n // Wrap to check if the positional value is invalid, if so, plot the point on the min value\n if (\n // Only this for field def without counting aggregate (as count wouldn't be null)\n isFieldDef(channelDef) &&\n !isCountingAggregateOp(channelDef.aggregate) &&\n // and only for continuous scale\n scale &&\n isContinuousToContinuous(scale.get('type'))) {\n return wrapPositionInvalidTest({\n fieldDef: channelDef,\n channel,\n markDef,\n ref,\n config\n });\n }\n return ref;\n}\nexport function wrapPositionInvalidTest({ fieldDef, channel, markDef, ref, config }) {\n if (isPathMark(markDef.type)) {\n // path mark already use defined to skip points, no need to do it here.\n return ref;\n }\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid === null) {\n // if there is no invalid filter, don't do the invalid test\n return [fieldInvalidTestValueRef(fieldDef, channel), ref];\n }\n return ref;\n}\nexport function fieldInvalidTestValueRef(fieldDef, channel) {\n const test = fieldInvalidPredicate(fieldDef, true);\n const mainChannel = getMainRangeChannel(channel); // we can cast here as the output can't be other things.\n const zeroValueRef = mainChannel === 'y'\n ? { field: { group: 'height' } }\n : // x / angle / radius can all use 0\n { value: 0 };\n return { test, ...zeroValueRef };\n}\nexport function fieldInvalidPredicate(field, invalid = true) {\n return fieldValidPredicate(isString(field) ? field : vgField(field, { expr: 'datum' }), !invalid);\n}\nexport function datumDefToExpr(datumDef) {\n const { datum } = datumDef;\n if (isDateTime(datum)) {\n return dateTimeToExpr(datum);\n }\n return `${stringify(datum)}`;\n}\nexport function valueRefForFieldOrDatumDef(fieldDef, scaleName, opt, encode) {\n const ref = {};\n if (scaleName) {\n ref.scale = scaleName;\n }\n if (isDatumDef(fieldDef)) {\n const { datum } = fieldDef;\n if (isDateTime(datum)) {\n ref.signal = dateTimeToExpr(datum);\n }\n else if (isSignalRef(datum)) {\n ref.signal = datum.signal;\n }\n else if (isExprRef(datum)) {\n ref.signal = datum.expr;\n }\n else {\n ref.value = datum;\n }\n }\n else {\n ref.field = vgField(fieldDef, opt);\n }\n if (encode) {\n const { offset, band } = encode;\n if (offset) {\n ref.offset = offset;\n }\n if (band) {\n ref.band = band;\n }\n }\n return ref;\n}\n/**\n * Signal that returns the middle of a bin from start and end field. Should only be used with x and y.\n */\nexport function interpolatedSignalRef({ scaleName, fieldOrDatumDef, fieldOrDatumDef2, offset, startSuffix, endSuffix = 'end', bandPosition = 0.5 }) {\n const expr = !isSignalRef(bandPosition) && 0 < bandPosition && bandPosition < 1 ? 'datum' : undefined;\n const start = vgField(fieldOrDatumDef, { expr, suffix: startSuffix });\n const end = fieldOrDatumDef2 !== undefined\n ? vgField(fieldOrDatumDef2, { expr })\n : vgField(fieldOrDatumDef, { suffix: endSuffix, expr });\n const ref = {};\n if (bandPosition === 0 || bandPosition === 1) {\n ref.scale = scaleName;\n const field = bandPosition === 0 ? start : end;\n ref.field = field;\n }\n else {\n const datum = isSignalRef(bandPosition)\n ? `(1-${bandPosition.signal}) * ${start} + ${bandPosition.signal} * ${end}`\n : `${1 - bandPosition} * ${start} + ${bandPosition} * ${end}`;\n ref.signal = `scale(\"${scaleName}\", ${datum})`;\n }\n if (offset) {\n ref.offset = offset;\n }\n return ref;\n}\nexport function binSizeExpr({ scaleName, fieldDef }) {\n const start = vgField(fieldDef, { expr: 'datum' });\n const end = vgField(fieldDef, { expr: 'datum', suffix: 'end' });\n return `abs(scale(\"${scaleName}\", ${end}) - scale(\"${scaleName}\", ${start}))`;\n}\n/**\n * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels.\n */\nexport function midPoint({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef, bandPosition }) {\n // TODO: datum support\n if (channelDef) {\n /* istanbul ignore else */\n if (isFieldOrDatumDef(channelDef)) {\n const scaleType = scale?.get('type');\n if (isTypedFieldDef(channelDef)) {\n bandPosition ?? (bandPosition = getBandPosition({\n fieldDef: channelDef,\n fieldDef2: channel2Def,\n markDef,\n config\n }));\n const { bin, timeUnit, type } = channelDef;\n if (isBinning(bin) || (bandPosition && timeUnit && type === TEMPORAL)) {\n // Use middle only for x an y to place marks in the center between start and end of the bin range.\n // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match.\n if (stack?.impute) {\n // For stack, we computed bin_mid so we can impute.\n return valueRefForFieldOrDatumDef(channelDef, scaleName, { binSuffix: 'mid' }, { offset });\n }\n if (bandPosition && !hasDiscreteDomain(scaleType)) {\n // if band = 0, no need to call interpolation\n // For non-stack, we can just calculate bin mid on the fly using signal.\n return interpolatedSignalRef({ scaleName, fieldOrDatumDef: channelDef, bandPosition, offset });\n }\n return valueRefForFieldOrDatumDef(channelDef, scaleName, binRequiresRange(channelDef, channel) ? { binSuffix: 'range' } : {}, {\n offset\n });\n }\n else if (isBinned(bin)) {\n if (isFieldDef(channel2Def)) {\n return interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef,\n fieldOrDatumDef2: channel2Def,\n bandPosition,\n offset\n });\n }\n else {\n const channel2 = channel === X ? X2 : Y2;\n log.warn(log.message.channelRequiredForBinned(channel2));\n }\n }\n }\n return valueRefForFieldOrDatumDef(channelDef, scaleName, hasDiscreteDomain(scaleType) ? { binSuffix: 'range' } : {}, // no need for bin suffix if there is no scale\n {\n offset,\n // For band, to get mid point, need to offset by half of the band\n band: scaleType === 'band' ? bandPosition ?? channelDef.bandPosition ?? 0.5 : undefined\n });\n }\n else if (isValueDef(channelDef)) {\n const value = channelDef.value;\n const offsetMixins = offset ? { offset } : {};\n return { ...widthHeightValueOrSignalRef(channel, value), ...offsetMixins };\n }\n // If channelDef is neither field def or value def, it's a condition-only def.\n // In such case, we will use default ref.\n }\n if (isFunction(defaultRef)) {\n defaultRef = defaultRef();\n }\n if (defaultRef) {\n // for non-position, ref could be undefined.\n return {\n ...defaultRef,\n // only include offset when it is non-zero (zero = no offset)\n ...(offset ? { offset } : {})\n };\n }\n return defaultRef;\n}\n/**\n * Convert special \"width\" and \"height\" values in Vega-Lite into Vega value ref.\n */\nexport function widthHeightValueOrSignalRef(channel, value) {\n if (contains(['x', 'x2'], channel) && value === 'width') {\n return { field: { group: 'width' } };\n }\n else if (contains(['y', 'y2'], channel) && value === 'height') {\n return { field: { group: 'height' } };\n }\n return signalOrValueRef(value);\n}\n//# sourceMappingURL=valueref.js.map","import { isString } from 'vega-util';\nimport { isBinning } from '../bin';\nimport { channelDefType, isFieldDef, isFieldOrDatumDefForTimeFormat, isPositionFieldOrDatumDef, isScaleFieldDef, vgField } from '../channeldef';\nimport { fieldValidPredicate } from '../predicate';\nimport { ScaleType } from '../scale';\nimport { formatExpression, normalizeTimeUnit, timeUnitSpecifierExpression } from '../timeunit';\nimport { QUANTITATIVE } from '../type';\nimport { stringify } from '../util';\nimport { isSignalRef } from '../vega.schema';\nimport { datumDefToExpr } from './mark/encode/valueref';\nexport function isCustomFormatType(formatType) {\n return formatType && formatType !== 'number' && formatType !== 'time';\n}\nfunction customFormatExpr(formatType, field, format) {\n return `${formatType}(${field}${format ? `, ${stringify(format)}` : ''})`;\n}\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\nexport function formatSignalRef({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config }) {\n if (isCustomFormatType(formatType)) {\n return formatCustomType({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n config\n });\n }\n const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack);\n const type = channelDefType(fieldOrDatumDef);\n if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (type === 'quantitative') {\n if (normalizeStack && config.normalizedNumberFormatType)\n return formatCustomType({\n fieldOrDatumDef,\n format: config.normalizedNumberFormat,\n formatType: config.normalizedNumberFormatType,\n expr,\n config\n });\n if (config.numberFormatType) {\n return formatCustomType({\n fieldOrDatumDef,\n format: config.numberFormat,\n formatType: config.numberFormatType,\n expr,\n config\n });\n }\n }\n if (type === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n fieldOrDatumDef.timeUnit === undefined) {\n return formatCustomType({\n fieldOrDatumDef,\n format: config.timeFormat,\n formatType: config.timeFormatType,\n expr,\n config\n });\n }\n }\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const signal = timeFormatExpression({\n field,\n timeUnit: isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined,\n format,\n formatType: config.timeFormatType,\n rawTimeFormat: config.timeFormat,\n isUTCScale: isScaleFieldDef(fieldOrDatumDef) && fieldOrDatumDef.scale?.type === ScaleType.UTC\n });\n return signal ? { signal } : undefined;\n }\n format = numberFormat({ type, specifiedFormat: format, config, normalizeStack });\n if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) {\n const endField = vgField(fieldOrDatumDef, { expr, binSuffix: 'end' });\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n }\n else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') {\n return {\n signal: `${formatExpr(field, format)}`\n };\n }\n else {\n return { signal: `isValid(${field}) ? ${field} : \"\"+${field}` };\n }\n}\nfunction fieldToFormat(fieldOrDatumDef, expr, normalizeStack) {\n if (isFieldDef(fieldOrDatumDef)) {\n if (normalizeStack) {\n return `${vgField(fieldOrDatumDef, { expr, suffix: 'end' })}-${vgField(fieldOrDatumDef, {\n expr,\n suffix: 'start'\n })}`;\n }\n else {\n return vgField(fieldOrDatumDef, { expr });\n }\n }\n else {\n return datumDefToExpr(fieldOrDatumDef);\n }\n}\nexport function formatCustomType({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config, field }) {\n field ?? (field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack));\n if (field !== 'datum.value' && // For axis/legend, we can't correctly know the end of the bin from `datum`\n isFieldDef(fieldOrDatumDef) &&\n isBinning(fieldOrDatumDef.bin)) {\n const endField = vgField(fieldOrDatumDef, { expr, binSuffix: 'end' });\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n }\n return { signal: customFormatExpr(formatType, field, format) };\n}\nexport function guideFormat(fieldOrDatumDef, type, format, formatType, config, omitTimeFormatConfig // axis doesn't use config.timeFormat\n) {\n if (isString(formatType) && isCustomFormatType(formatType)) {\n return undefined; // handled in encode block\n }\n else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (channelDefType(fieldOrDatumDef) === 'quantitative') {\n if (config.normalizedNumberFormatType &&\n isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize') {\n return undefined; // handled in encode block\n }\n if (config.numberFormatType) {\n return undefined; // handled in encode block\n }\n }\n }\n if (isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize' &&\n config.normalizedNumberFormat) {\n return numberFormat({\n type: 'quantitative',\n config,\n normalizeStack: true\n });\n }\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n if (timeUnit === undefined && config.customFormatTypes && config.timeFormatType) {\n return undefined; // hanlded in encode block\n }\n return timeFormat({ specifiedFormat: format, timeUnit, config, omitTimeFormatConfig });\n }\n return numberFormat({ type, specifiedFormat: format, config });\n}\nexport function guideFormatType(formatType, fieldOrDatumDef, scaleType) {\n if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) {\n return formatType;\n }\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') {\n return isFieldDef(fieldOrDatumDef) && normalizeTimeUnit(fieldOrDatumDef?.timeUnit)?.utc ? 'utc' : 'time';\n }\n return undefined;\n}\n/**\n * Returns number format for a fieldDef.\n */\nexport function numberFormat({ type, specifiedFormat, config, normalizeStack }) {\n // Specified format in axis/legend has higher precedence than fieldDef.format\n if (isString(specifiedFormat)) {\n return specifiedFormat;\n }\n if (type === QUANTITATIVE) {\n // we only apply the default if the field is quantitative\n return normalizeStack ? config.normalizedNumberFormat : config.numberFormat;\n }\n return undefined;\n}\n/**\n * Returns time format for a fieldDef for use in guides.\n */\nexport function timeFormat({ specifiedFormat, timeUnit, config, omitTimeFormatConfig }) {\n if (specifiedFormat) {\n return specifiedFormat;\n }\n if (timeUnit) {\n return {\n signal: timeUnitSpecifierExpression(timeUnit)\n };\n }\n return omitTimeFormatConfig ? undefined : config.timeFormat;\n}\nfunction formatExpr(field, format) {\n return `format(${field}, \"${format || ''}\")`;\n}\nfunction binNumberFormatExpr(field, format, formatType, config) {\n if (isCustomFormatType(formatType)) {\n return customFormatExpr(formatType, field, format);\n }\n return formatExpr(field, (isString(format) ? format : undefined) ?? config.numberFormat);\n}\nexport function binFormatExpression(startField, endField, format, formatType, config) {\n if (format === undefined && formatType === undefined && config.customFormatTypes && config.numberFormatType) {\n return binFormatExpression(startField, endField, config.numberFormat, config.numberFormatType, config);\n }\n const start = binNumberFormatExpr(startField, format, formatType, config);\n const end = binNumberFormatExpr(endField, format, formatType, config);\n return `${fieldValidPredicate(startField, false)} ? \"null\" : ${start} + \"${BIN_RANGE_DELIMITER}\" + ${end}`;\n}\n/**\n * Returns the time expression used for axis/legend labels or text mark for a temporal field\n */\nexport function timeFormatExpression({ field, timeUnit, format, formatType, rawTimeFormat, isUTCScale }) {\n if (!timeUnit || format) {\n // If there is no time unit, or if user explicitly specifies format for axis/legend/text.\n if (!timeUnit && formatType) {\n return `${formatType}(${field}, '${format}')`;\n }\n format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit.\n return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`;\n }\n else {\n return formatExpression(timeUnit, field, isUTCScale);\n }\n}\n//# sourceMappingURL=format.js.map","import { isArray } from 'vega-util';\nexport const DEFAULT_SORT_OP = 'min';\nconst SORT_BY_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n color: 1,\n fill: 1,\n stroke: 1,\n strokeWidth: 1,\n size: 1,\n shape: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n opacity: 1,\n text: 1\n};\nexport function isSortByChannel(c) {\n return c in SORT_BY_CHANNEL_INDEX;\n}\nexport function isSortByEncoding(sort) {\n return !!sort?.['encoding'];\n}\nexport function isSortField(sort) {\n return sort && (sort['op'] === 'count' || !!sort['field']);\n}\nexport function isSortArray(sort) {\n return sort && isArray(sort);\n}\n//# sourceMappingURL=sort.js.map","export function isFacetMapping(f) {\n return 'row' in f || 'column' in f;\n}\nexport function isFacetFieldDef(channelDef) {\n return !!channelDef && 'header' in channelDef;\n}\nexport function isFacetSpec(spec) {\n return 'facet' in spec;\n}\n//# sourceMappingURL=facet.js.map","import { isArray, isBoolean, isNumber, isString } from 'vega-util';\nimport { isAggregateOp, isArgmaxDef, isArgminDef, isCountingAggregateOp } from './aggregate';\nimport { autoMaxBins, binToString, isBinned, isBinning } from './bin';\nimport { ANGLE, COLOR, COLUMN, DESCRIPTION, DETAIL, FACET, FILL, FILLOPACITY, getSizeChannel, HREF, isScaleChannel, isSecondaryRangeChannel, isXorY, KEY, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, OPACITY, ORDER, RADIUS, RADIUS2, ROW, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, TEXT, THETA, THETA2, TOOLTIP, URL, X, X2, XOFFSET, Y, Y2, YOFFSET } from './channel';\nimport { getMarkConfig, getMarkPropOrConfig } from './compile/common';\nimport { isCustomFormatType } from './compile/format';\nimport { dateTimeToExpr, isDateTime } from './datetime';\nimport { isExprRef } from './expr';\nimport * as log from './log';\nimport { isRectBasedMark } from './mark';\nimport { hasDiscreteDomain, isContinuousToDiscrete, SCALE_CATEGORY_INDEX } from './scale';\nimport { isSortByChannel } from './sort';\nimport { isFacetFieldDef } from './spec/facet';\nimport { getTimeUnitParts, isBinnedTimeUnit, isLocalSingleTimeUnit, normalizeTimeUnit, timeUnitToString } from './timeunit';\nimport { getFullName, QUANTITATIVE } from './type';\nimport { flatAccessWithDatum, getFirstDefined, internalField, omit, removePathFromField, replacePathInField, stringify, titleCase } from './util';\nimport { isSignalRef } from './vega.schema';\nexport function isConditionalParameter(c) {\n return c['param'];\n}\nexport function isRepeatRef(field) {\n return field && !isString(field) && 'repeat' in field;\n}\nexport function toFieldDefBase(fieldDef) {\n const { field, timeUnit, bin, aggregate } = fieldDef;\n return {\n ...(timeUnit ? { timeUnit } : {}),\n ...(bin ? { bin } : {}),\n ...(aggregate ? { aggregate } : {}),\n field\n };\n}\nexport function isSortableFieldDef(fieldDef) {\n return 'sort' in fieldDef;\n}\nexport function getBandPosition({ fieldDef, fieldDef2, markDef: mark, config }) {\n if (isFieldOrDatumDef(fieldDef) && fieldDef.bandPosition !== undefined) {\n return fieldDef.bandPosition;\n }\n if (isFieldDef(fieldDef)) {\n const { timeUnit, bin } = fieldDef;\n if (timeUnit && !fieldDef2) {\n return getMarkConfig('timeUnitBandPosition', mark, config);\n }\n else if (isBinning(bin)) {\n return 0.5;\n }\n }\n return undefined;\n}\nexport function getBandSize({ channel, fieldDef, fieldDef2, markDef: mark, config, scaleType, useVlSizeChannel }) {\n const sizeChannel = getSizeChannel(channel);\n const size = getMarkPropOrConfig(useVlSizeChannel ? 'size' : sizeChannel, mark, config, {\n vgChannel: sizeChannel\n });\n if (size !== undefined) {\n return size;\n }\n if (isFieldDef(fieldDef)) {\n const { timeUnit, bin } = fieldDef;\n if (timeUnit && !fieldDef2) {\n return { band: getMarkConfig('timeUnitBandSize', mark, config) };\n }\n else if (isBinning(bin) && !hasDiscreteDomain(scaleType)) {\n return { band: 1 };\n }\n }\n if (isRectBasedMark(mark.type)) {\n if (scaleType) {\n if (hasDiscreteDomain(scaleType)) {\n return config[mark.type]?.discreteBandSize || { band: 1 };\n }\n else {\n return config[mark.type]?.continuousBandSize;\n }\n }\n return config[mark.type]?.discreteBandSize;\n }\n return undefined;\n}\nexport function hasBandEnd(fieldDef, fieldDef2, markDef, config) {\n if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) {\n // Need to check bandPosition because non-rect marks (e.g., point) with timeUnit\n // doesn't have to use bandEnd if there is no bandPosition.\n return getBandPosition({ fieldDef, fieldDef2, markDef, config }) !== undefined;\n }\n return false;\n}\nexport function isOrderOnlyDef(orderDef) {\n return orderDef && !!orderDef.sort && !orderDef['field'];\n}\nexport function isConditionalDef(channelDef) {\n return channelDef && 'condition' in channelDef;\n}\n/**\n * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef\n */\nexport function hasConditionalFieldDef(channelDef) {\n const condition = channelDef?.['condition'];\n return !!condition && !isArray(condition) && isFieldDef(condition);\n}\nexport function hasConditionalFieldOrDatumDef(channelDef) {\n const condition = channelDef?.['condition'];\n return !!condition && !isArray(condition) && isFieldOrDatumDef(condition);\n}\nexport function hasConditionalValueDef(channelDef) {\n const condition = channelDef?.['condition'];\n return !!condition && (isArray(condition) || isValueDef(condition));\n}\nexport function isFieldDef(channelDef) {\n // TODO: we can't use field in channelDef here as it's somehow failing runtime test\n return channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count');\n}\nexport function channelDefType(channelDef) {\n return channelDef?.['type'];\n}\nexport function isDatumDef(channelDef) {\n return channelDef && 'datum' in channelDef;\n}\nexport function isContinuousFieldOrDatumDef(cd) {\n // TODO: make datum support DateTime object\n return (isTypedFieldDef(cd) && !isDiscrete(cd)) || isNumericDataDef(cd);\n}\nexport function isUnbinnedQuantitativeFieldOrDatumDef(cd) {\n // TODO: make datum support DateTime object\n return (isTypedFieldDef(cd) && cd.type === 'quantitative' && !cd.bin) || isNumericDataDef(cd);\n}\nexport function isNumericDataDef(cd) {\n return isDatumDef(cd) && isNumber(cd.datum);\n}\nexport function isFieldOrDatumDef(channelDef) {\n return isFieldDef(channelDef) || isDatumDef(channelDef);\n}\nexport function isTypedFieldDef(channelDef) {\n return channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef;\n}\nexport function isValueDef(channelDef) {\n return channelDef && 'value' in channelDef && 'value' in channelDef;\n}\nexport function isScaleFieldDef(channelDef) {\n return channelDef && ('scale' in channelDef || 'sort' in channelDef);\n}\nexport function isPositionFieldOrDatumDef(channelDef) {\n return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef);\n}\nexport function isMarkPropFieldOrDatumDef(channelDef) {\n return channelDef && 'legend' in channelDef;\n}\nexport function isStringFieldOrDatumDef(channelDef) {\n return channelDef && ('format' in channelDef || 'formatType' in channelDef);\n}\nexport function toStringFieldDef(fieldDef) {\n // omit properties that don't exist in string field defs\n return omit(fieldDef, ['legend', 'axis', 'header', 'scale']);\n}\nfunction isOpFieldDef(fieldDef) {\n return 'op' in fieldDef;\n}\n/**\n * Get a Vega field reference from a Vega-Lite field def.\n */\nexport function vgField(fieldDef, opt = {}) {\n let field = fieldDef.field;\n const prefix = opt.prefix;\n let suffix = opt.suffix;\n let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped\n if (isCount(fieldDef)) {\n field = internalField('count');\n }\n else {\n let fn;\n if (!opt.nofn) {\n if (isOpFieldDef(fieldDef)) {\n fn = fieldDef.op;\n }\n else {\n const { bin, aggregate, timeUnit } = fieldDef;\n if (isBinning(bin)) {\n fn = binToString(bin);\n suffix = (opt.binSuffix ?? '') + (opt.suffix ?? '');\n }\n else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmax_${aggregate.argmax}`;\n }\n else if (isArgminDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmin_${aggregate.argmin}`;\n }\n else {\n fn = String(aggregate);\n }\n }\n else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n fn = timeUnitToString(timeUnit);\n suffix = ((!['range', 'mid'].includes(opt.binSuffix) && opt.binSuffix) || '') + (opt.suffix ?? '');\n }\n }\n }\n if (fn) {\n field = field ? `${fn}_${field}` : fn;\n }\n }\n if (suffix) {\n field = `${field}_${suffix}`;\n }\n if (prefix) {\n field = `${prefix}_${field}`;\n }\n if (opt.forAs) {\n return removePathFromField(field);\n }\n else if (opt.expr) {\n // Expression to access flattened field. No need to escape dots.\n return flatAccessWithDatum(field, opt.expr) + argAccessor;\n }\n else {\n // We flattened all fields so paths should have become dot.\n return replacePathInField(field) + argAccessor;\n }\n}\nexport function isDiscrete(def) {\n switch (def.type) {\n case 'nominal':\n case 'ordinal':\n case 'geojson':\n return true;\n case 'quantitative':\n return isFieldDef(def) && !!def.bin;\n case 'temporal':\n return false;\n }\n throw new Error(log.message.invalidFieldType(def.type));\n}\nexport function isDiscretizing(def) {\n return isScaleFieldDef(def) && isContinuousToDiscrete(def.scale?.type);\n}\nexport function isCount(fieldDef) {\n return fieldDef.aggregate === 'count';\n}\nexport function verbalTitleFormatter(fieldDef, config) {\n const { field, bin, timeUnit, aggregate } = fieldDef;\n if (aggregate === 'count') {\n return config.countTitle;\n }\n else if (isBinning(bin)) {\n return `${field} (binned)`;\n }\n else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n const unit = normalizeTimeUnit(timeUnit)?.unit;\n if (unit) {\n return `${field} (${getTimeUnitParts(unit).join('-')})`;\n }\n }\n else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n return `${field} for max ${aggregate.argmax}`;\n }\n else if (isArgminDef(aggregate)) {\n return `${field} for min ${aggregate.argmin}`;\n }\n else {\n return `${titleCase(aggregate)} of ${field}`;\n }\n }\n return field;\n}\nexport function functionalTitleFormatter(fieldDef) {\n const { aggregate, bin, timeUnit, field } = fieldDef;\n if (isArgmaxDef(aggregate)) {\n return `${field} for argmax(${aggregate.argmax})`;\n }\n else if (isArgminDef(aggregate)) {\n return `${field} for argmin(${aggregate.argmin})`;\n }\n const timeUnitParams = timeUnit && !isBinnedTimeUnit(timeUnit) ? normalizeTimeUnit(timeUnit) : undefined;\n const fn = aggregate || timeUnitParams?.unit || (timeUnitParams?.maxbins && 'timeunit') || (isBinning(bin) && 'bin');\n if (fn) {\n return `${fn.toUpperCase()}(${field})`;\n }\n else {\n return field;\n }\n}\nexport const defaultTitleFormatter = (fieldDef, config) => {\n switch (config.fieldTitle) {\n case 'plain':\n return fieldDef.field;\n case 'functional':\n return functionalTitleFormatter(fieldDef);\n default:\n return verbalTitleFormatter(fieldDef, config);\n }\n};\nlet titleFormatter = defaultTitleFormatter;\nexport function setTitleFormatter(formatter) {\n titleFormatter = formatter;\n}\nexport function resetTitleFormatter() {\n setTitleFormatter(defaultTitleFormatter);\n}\nexport function title(fieldOrDatumDef, config, { allowDisabling, includeDefault = true }) {\n const guideTitle = getGuide(fieldOrDatumDef)?.title;\n if (!isFieldDef(fieldOrDatumDef)) {\n return guideTitle ?? fieldOrDatumDef.title;\n }\n const fieldDef = fieldOrDatumDef;\n const def = includeDefault ? defaultTitle(fieldDef, config) : undefined;\n if (allowDisabling) {\n return getFirstDefined(guideTitle, fieldDef.title, def);\n }\n else {\n return guideTitle ?? fieldDef.title ?? def;\n }\n}\nexport function getGuide(fieldDef) {\n if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) {\n return fieldDef.axis;\n }\n else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) {\n return fieldDef.legend;\n }\n else if (isFacetFieldDef(fieldDef) && fieldDef.header) {\n return fieldDef.header;\n }\n return undefined;\n}\nexport function defaultTitle(fieldDef, config) {\n return titleFormatter(fieldDef, config);\n}\nexport function getFormatMixins(fieldDef) {\n if (isStringFieldOrDatumDef(fieldDef)) {\n const { format, formatType } = fieldDef;\n return { format, formatType };\n }\n else {\n const guide = getGuide(fieldDef) ?? {};\n const { format, formatType } = guide;\n return { format, formatType };\n }\n}\nexport function defaultType(fieldDef, channel) {\n switch (channel) {\n case 'latitude':\n case 'longitude':\n return 'quantitative';\n case 'row':\n case 'column':\n case 'facet':\n case 'shape':\n case 'strokeDash':\n return 'nominal';\n case 'order':\n return 'ordinal';\n }\n if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) {\n return 'ordinal';\n }\n const { aggregate, bin, timeUnit } = fieldDef;\n if (timeUnit) {\n return 'temporal';\n }\n if (bin || (aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate))) {\n return 'quantitative';\n }\n if (isScaleFieldDef(fieldDef) && fieldDef.scale?.type) {\n switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) {\n case 'numeric':\n case 'discretizing':\n return 'quantitative';\n case 'time':\n return 'temporal';\n }\n }\n return 'nominal';\n}\n/**\n * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef.\n * @param channelDef\n */\nexport function getFieldDef(channelDef) {\n if (isFieldDef(channelDef)) {\n return channelDef;\n }\n else if (hasConditionalFieldDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\nexport function getFieldOrDatumDef(channelDef) {\n if (isFieldOrDatumDef(channelDef)) {\n return channelDef;\n }\n else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\n/**\n * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing.\n */\nexport function initChannelDef(channelDef, channel, config, opt = {}) {\n if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) {\n const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean';\n log.warn(log.message.primitiveChannelDef(channel, primitiveType, channelDef));\n return { value: channelDef };\n }\n // If a fieldDef contains a field, we need type.\n if (isFieldOrDatumDef(channelDef)) {\n return initFieldOrDatumDef(channelDef, channel, config, opt);\n }\n else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return {\n ...channelDef,\n // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition\n condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt)\n };\n }\n return channelDef;\n}\nexport function initFieldOrDatumDef(fd, channel, config, opt) {\n if (isStringFieldOrDatumDef(fd)) {\n const { format, formatType, ...rest } = fd;\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef(rest, channel, config, opt);\n }\n }\n else {\n const guideType = isPositionFieldOrDatumDef(fd)\n ? 'axis'\n : isMarkPropFieldOrDatumDef(fd)\n ? 'legend'\n : isFacetFieldDef(fd)\n ? 'header'\n : null;\n if (guideType && fd[guideType]) {\n const { format, formatType, ...newGuide } = fd[guideType];\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef({ ...fd, [guideType]: newGuide }, channel, config, opt);\n }\n }\n }\n if (isFieldDef(fd)) {\n return initFieldDef(fd, channel, opt);\n }\n return initDatumDef(fd);\n}\nfunction initDatumDef(datumDef) {\n let type = datumDef['type'];\n if (type) {\n return datumDef;\n }\n const { datum } = datumDef;\n type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined;\n return { ...datumDef, type };\n}\nexport function initFieldDef(fd, channel, { compositeMark = false } = {}) {\n const { aggregate, timeUnit, bin, field } = fd;\n const fieldDef = { ...fd };\n // Drop invalid aggregate\n if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) {\n log.warn(log.message.invalidAggregate(aggregate));\n delete fieldDef.aggregate;\n }\n // Normalize Time Unit\n if (timeUnit) {\n fieldDef.timeUnit = normalizeTimeUnit(timeUnit);\n }\n if (field) {\n fieldDef.field = `${field}`;\n }\n // Normalize bin\n if (isBinning(bin)) {\n fieldDef.bin = normalizeBin(bin, channel);\n }\n if (isBinned(bin) && !isXorY(channel)) {\n log.warn(log.message.channelShouldNotBeUsedForBinned(channel));\n }\n // Normalize Type\n if (isTypedFieldDef(fieldDef)) {\n const { type } = fieldDef;\n const fullType = getFullName(type);\n if (type !== fullType) {\n // convert short type to full type\n fieldDef.type = fullType;\n }\n if (type !== 'quantitative') {\n if (isCountingAggregateOp(aggregate)) {\n log.warn(log.message.invalidFieldTypeForCountAggregate(type, aggregate));\n fieldDef.type = 'quantitative';\n }\n }\n }\n else if (!isSecondaryRangeChannel(channel)) {\n // If type is empty / invalid, then augment with default type\n const newType = defaultType(fieldDef, channel);\n fieldDef['type'] = newType;\n }\n if (isTypedFieldDef(fieldDef)) {\n const { compatible, warning } = channelCompatibility(fieldDef, channel) || {};\n if (compatible === false) {\n log.warn(warning);\n }\n }\n if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) {\n const { sort } = fieldDef;\n if (isSortByChannel(sort)) {\n return {\n ...fieldDef,\n sort: { encoding: sort }\n };\n }\n const sub = sort.substr(1);\n if (sort.charAt(0) === '-' && isSortByChannel(sub)) {\n return {\n ...fieldDef,\n sort: { encoding: sub, order: 'descending' }\n };\n }\n }\n if (isFacetFieldDef(fieldDef)) {\n const { header } = fieldDef;\n if (header) {\n const { orient, ...rest } = header;\n if (orient) {\n return {\n ...fieldDef,\n header: {\n ...rest,\n labelOrient: header.labelOrient || orient,\n titleOrient: header.titleOrient || orient\n }\n };\n }\n }\n }\n return fieldDef;\n}\nexport function normalizeBin(bin, channel) {\n if (isBoolean(bin)) {\n return { maxbins: autoMaxBins(channel) };\n }\n else if (bin === 'binned') {\n return {\n binned: true\n };\n }\n else if (!bin.maxbins && !bin.step) {\n return { ...bin, maxbins: autoMaxBins(channel) };\n }\n else {\n return bin;\n }\n}\nconst COMPATIBLE = { compatible: true };\nexport function channelCompatibility(fieldDef, channel) {\n const type = fieldDef.type;\n if (type === 'geojson' && channel !== 'shape') {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with a geojson data.`\n };\n }\n switch (channel) {\n case ROW:\n case COLUMN:\n case FACET:\n if (!isDiscrete(fieldDef)) {\n return {\n compatible: false,\n warning: log.message.channelShouldBeDiscrete(channel)\n };\n }\n return COMPATIBLE;\n case X:\n case Y:\n case XOFFSET:\n case YOFFSET:\n case COLOR:\n case FILL:\n case STROKE:\n case TEXT:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case URL:\n case ANGLE:\n case THETA:\n case RADIUS:\n case DESCRIPTION:\n return COMPATIBLE;\n case LONGITUDE:\n case LONGITUDE2:\n case LATITUDE:\n case LATITUDE2:\n if (type !== QUANTITATIVE) {\n return {\n compatible: false,\n warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.`\n };\n }\n return COMPATIBLE;\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n case SIZE:\n case THETA2:\n case RADIUS2:\n case X2:\n case Y2:\n if (type === 'nominal' && !fieldDef['sort']) {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with an unsorted discrete field.`\n };\n }\n return COMPATIBLE;\n case SHAPE:\n case STROKEDASH:\n if (!isDiscrete(fieldDef) && !isDiscretizing(fieldDef)) {\n return {\n compatible: false,\n warning: log.message.channelShouldBeDiscreteOrDiscretizing(channel)\n };\n }\n return COMPATIBLE;\n case ORDER:\n if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) {\n return {\n compatible: false,\n warning: `Channel order is inappropriate for nominal field, which has no inherent order.`\n };\n }\n return COMPATIBLE;\n }\n}\n/**\n * Check if the field def uses a time format or does not use any format but is temporal\n * (this does not cover field defs that are temporal but use a number format).\n */\nexport function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) {\n const { formatType } = getFormatMixins(fieldOrDatumDef);\n return formatType === 'time' || (!formatType && isTimeFieldDef(fieldOrDatumDef));\n}\n/**\n * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`.\n */\nexport function isTimeFieldDef(def) {\n return def && (def['type'] === 'temporal' || (isFieldDef(def) && !!def.timeUnit));\n}\n/**\n * Getting a value associated with a fielddef.\n * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit)\n */\nexport function valueExpr(v, { timeUnit, type, wrapTime, undefinedIfExprNotRequired }) {\n const unit = timeUnit && normalizeTimeUnit(timeUnit)?.unit;\n let isTime = unit || type === 'temporal';\n let expr;\n if (isExprRef(v)) {\n expr = v.expr;\n }\n else if (isSignalRef(v)) {\n expr = v.signal;\n }\n else if (isDateTime(v)) {\n isTime = true;\n expr = dateTimeToExpr(v);\n }\n else if (isString(v) || isNumber(v)) {\n if (isTime) {\n expr = `datetime(${stringify(v)})`;\n if (isLocalSingleTimeUnit(unit)) {\n // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit\n if ((isNumber(v) && v < 10000) || (isString(v) && isNaN(Date.parse(v)))) {\n expr = dateTimeToExpr({ [unit]: v });\n }\n }\n }\n }\n if (expr) {\n return wrapTime && isTime ? `time(${expr})` : expr;\n }\n // number or boolean or normal string\n return undefinedIfExprNotRequired ? undefined : stringify(v);\n}\n/**\n * Standardize value array -- convert each value to Vega expression if applicable\n */\nexport function valueArray(fieldOrDatumDef, values) {\n const { type } = fieldOrDatumDef;\n return values.map(v => {\n const timeUnit = isFieldDef(fieldOrDatumDef) && !isBinnedTimeUnit(fieldOrDatumDef.timeUnit) ? fieldOrDatumDef.timeUnit : undefined;\n const expr = valueExpr(v, {\n timeUnit,\n type,\n undefinedIfExprNotRequired: true\n });\n // return signal for the expression if we need an expression\n if (expr !== undefined) {\n return { signal: expr };\n }\n // otherwise just return the original value\n return v;\n });\n}\n/**\n * Checks whether a fieldDef for a particular channel requires a computed bin range.\n */\nexport function binRequiresRange(fieldDef, channel) {\n if (!isBinning(fieldDef.bin)) {\n console.warn('Only call this method for binned field defs.');\n return false;\n }\n // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels.\n // We could check whether the axis or legend exists (not disabled) but that seems overkill.\n return isScaleChannel(channel) && ['ordinal', 'nominal'].includes(fieldDef.type);\n}\n//# sourceMappingURL=channeldef.js.map","import { keys } from './util';\nexport const CONDITIONAL_AXIS_PROP_INDEX = {\n labelAlign: {\n part: 'labels',\n vgProp: 'align'\n },\n labelBaseline: {\n part: 'labels',\n vgProp: 'baseline'\n },\n labelColor: {\n part: 'labels',\n vgProp: 'fill'\n },\n labelFont: {\n part: 'labels',\n vgProp: 'font'\n },\n labelFontSize: {\n part: 'labels',\n vgProp: 'fontSize'\n },\n labelFontStyle: {\n part: 'labels',\n vgProp: 'fontStyle'\n },\n labelFontWeight: {\n part: 'labels',\n vgProp: 'fontWeight'\n },\n labelOpacity: {\n part: 'labels',\n vgProp: 'opacity'\n },\n labelOffset: null,\n labelPadding: null,\n gridColor: {\n part: 'grid',\n vgProp: 'stroke'\n },\n gridDash: {\n part: 'grid',\n vgProp: 'strokeDash'\n },\n gridDashOffset: {\n part: 'grid',\n vgProp: 'strokeDashOffset'\n },\n gridOpacity: {\n part: 'grid',\n vgProp: 'opacity'\n },\n gridWidth: {\n part: 'grid',\n vgProp: 'strokeWidth'\n },\n tickColor: {\n part: 'ticks',\n vgProp: 'stroke'\n },\n tickDash: {\n part: 'ticks',\n vgProp: 'strokeDash'\n },\n tickDashOffset: {\n part: 'ticks',\n vgProp: 'strokeDashOffset'\n },\n tickOpacity: {\n part: 'ticks',\n vgProp: 'opacity'\n },\n tickSize: null,\n tickWidth: {\n part: 'ticks',\n vgProp: 'strokeWidth'\n }\n};\nexport function isConditionalAxisValue(v) {\n return v?.condition;\n}\nexport const AXIS_PARTS = ['domain', 'grid', 'labels', 'ticks', 'title'];\n/**\n * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes.\n */\nexport const AXIS_PROPERTY_TYPE = {\n grid: 'grid',\n gridCap: 'grid',\n gridColor: 'grid',\n gridDash: 'grid',\n gridDashOffset: 'grid',\n gridOpacity: 'grid',\n gridScale: 'grid',\n gridWidth: 'grid',\n orient: 'main',\n bandPosition: 'both',\n aria: 'main',\n description: 'main',\n domain: 'main',\n domainCap: 'main',\n domainColor: 'main',\n domainDash: 'main',\n domainDashOffset: 'main',\n domainOpacity: 'main',\n domainWidth: 'main',\n format: 'main',\n formatType: 'main',\n labelAlign: 'main',\n labelAngle: 'main',\n labelBaseline: 'main',\n labelBound: 'main',\n labelColor: 'main',\n labelFlush: 'main',\n labelFlushOffset: 'main',\n labelFont: 'main',\n labelFontSize: 'main',\n labelFontStyle: 'main',\n labelFontWeight: 'main',\n labelLimit: 'main',\n labelLineHeight: 'main',\n labelOffset: 'main',\n labelOpacity: 'main',\n labelOverlap: 'main',\n labelPadding: 'main',\n labels: 'main',\n labelSeparation: 'main',\n maxExtent: 'main',\n minExtent: 'main',\n offset: 'both',\n position: 'main',\n tickCap: 'main',\n tickColor: 'main',\n tickDash: 'main',\n tickDashOffset: 'main',\n tickMinStep: 'both',\n tickOffset: 'both',\n tickOpacity: 'main',\n tickRound: 'both',\n ticks: 'main',\n tickSize: 'main',\n tickWidth: 'both',\n title: 'main',\n titleAlign: 'main',\n titleAnchor: 'main',\n titleAngle: 'main',\n titleBaseline: 'main',\n titleColor: 'main',\n titleFont: 'main',\n titleFontSize: 'main',\n titleFontStyle: 'main',\n titleFontWeight: 'main',\n titleLimit: 'main',\n titleLineHeight: 'main',\n titleOpacity: 'main',\n titlePadding: 'main',\n titleX: 'main',\n titleY: 'main',\n encode: 'both',\n scale: 'both',\n tickBand: 'both',\n tickCount: 'both',\n tickExtra: 'both',\n translate: 'both',\n values: 'both',\n zindex: 'both' // this is actually set afterward, so it doesn't matter\n};\nexport const COMMON_AXIS_PROPERTIES_INDEX = {\n orient: 1,\n aria: 1,\n bandPosition: 1,\n description: 1,\n domain: 1,\n domainCap: 1,\n domainColor: 1,\n domainDash: 1,\n domainDashOffset: 1,\n domainOpacity: 1,\n domainWidth: 1,\n format: 1,\n formatType: 1,\n grid: 1,\n gridCap: 1,\n gridColor: 1,\n gridDash: 1,\n gridDashOffset: 1,\n gridOpacity: 1,\n gridWidth: 1,\n labelAlign: 1,\n labelAngle: 1,\n labelBaseline: 1,\n labelBound: 1,\n labelColor: 1,\n labelFlush: 1,\n labelFlushOffset: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelLineHeight: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labels: 1,\n labelSeparation: 1,\n maxExtent: 1,\n minExtent: 1,\n offset: 1,\n position: 1,\n tickBand: 1,\n tickCap: 1,\n tickColor: 1,\n tickCount: 1,\n tickDash: 1,\n tickDashOffset: 1,\n tickExtra: 1,\n tickMinStep: 1,\n tickOffset: 1,\n tickOpacity: 1,\n tickRound: 1,\n ticks: 1,\n tickSize: 1,\n tickWidth: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleAngle: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titlePadding: 1,\n titleX: 1,\n titleY: 1,\n translate: 1,\n values: 1,\n zindex: 1\n};\nconst AXIS_PROPERTIES_INDEX = {\n ...COMMON_AXIS_PROPERTIES_INDEX,\n style: 1,\n labelExpr: 1,\n encoding: 1\n};\nexport function isAxisProperty(prop) {\n return !!AXIS_PROPERTIES_INDEX[prop];\n}\n// Export for dependent projects\nexport const AXIS_PROPERTIES = keys(AXIS_PROPERTIES_INDEX);\nconst AXIS_CONFIGS_INDEX = {\n axis: 1,\n axisBand: 1,\n axisBottom: 1,\n axisDiscrete: 1,\n axisLeft: 1,\n axisPoint: 1,\n axisQuantitative: 1,\n axisRight: 1,\n axisTemporal: 1,\n axisTop: 1,\n axisX: 1,\n axisXBand: 1,\n axisXDiscrete: 1,\n axisXPoint: 1,\n axisXQuantitative: 1,\n axisXTemporal: 1,\n axisY: 1,\n axisYBand: 1,\n axisYDiscrete: 1,\n axisYPoint: 1,\n axisYQuantitative: 1,\n axisYTemporal: 1\n};\nexport const AXIS_CONFIGS = keys(AXIS_CONFIGS_INDEX);\n//# sourceMappingURL=axis.js.map","export function isUnitSpec(spec) {\n return 'mark' in spec;\n}\n//# sourceMappingURL=unit.js.map","import { getMarkType } from '../mark';\nimport { isUnitSpec } from '../spec/unit';\nexport class CompositeMarkNormalizer {\n constructor(name, run) {\n this.name = name;\n this.run = run;\n }\n hasMatchingType(spec) {\n if (isUnitSpec(spec)) {\n return getMarkType(spec.mark) === this.name;\n }\n return false;\n }\n}\n//# sourceMappingURL=base.js.map","import { array, isArray } from 'vega-util';\nimport { isArgmaxDef, isArgminDef } from './aggregate';\nimport { isBinned, isBinning } from './bin';\nimport { ANGLE, CHANNELS, COLOR, DESCRIPTION, DETAIL, FILL, FILLOPACITY, getMainChannelFromOffsetChannel, getOffsetScaleChannel, HREF, isChannel, isNonPositionScaleChannel, isSecondaryRangeChannel, isXorY, isXorYOffset, KEY, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, OPACITY, ORDER, RADIUS, RADIUS2, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, supportMark, TEXT, THETA, THETA2, TOOLTIP, UNIT_CHANNELS, URL, X, X2, XOFFSET, Y, Y2, YOFFSET } from './channel';\nimport { binRequiresRange, getFieldDef, getGuide, hasConditionalFieldDef, hasConditionalFieldOrDatumDef, initChannelDef, initFieldDef, isConditionalDef, isDatumDef, isFieldDef, isOrderOnlyDef, isTypedFieldDef, isValueDef, title, vgField } from './channeldef';\nimport * as log from './log';\nimport { isContinuous, isDiscrete, QUANTITATIVE, TEMPORAL } from './type';\nimport { keys, some } from './util';\nimport { isSignalRef } from './vega.schema';\nimport { isBinnedTimeUnit } from './timeunit';\nexport function channelHasField(encoding, channel) {\n const channelDef = encoding && encoding[channel];\n if (channelDef) {\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.field);\n }\n else {\n return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef);\n }\n }\n return false;\n}\nexport function channelHasFieldOrDatum(encoding, channel) {\n const channelDef = encoding && encoding[channel];\n if (channelDef) {\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.field);\n }\n else {\n return isFieldDef(channelDef) || isDatumDef(channelDef) || hasConditionalFieldOrDatumDef(channelDef);\n }\n }\n return false;\n}\nexport function channelHasNestedOffsetScale(encoding, channel) {\n if (isXorY(channel)) {\n const fieldDef = encoding[channel];\n if ((isFieldDef(fieldDef) || isDatumDef(fieldDef)) &&\n (isDiscrete(fieldDef.type) || (isFieldDef(fieldDef) && fieldDef.timeUnit))) {\n const offsetChannel = getOffsetScaleChannel(channel);\n return channelHasFieldOrDatum(encoding, offsetChannel);\n }\n }\n return false;\n}\nexport function isAggregate(encoding) {\n return some(CHANNELS, channel => {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.aggregate);\n }\n else {\n const fieldDef = getFieldDef(channelDef);\n return fieldDef && !!fieldDef.aggregate;\n }\n }\n return false;\n });\n}\nexport function extractTransformsFromEncoding(oldEncoding, config) {\n const groupby = [];\n const bins = [];\n const timeUnits = [];\n const aggregate = [];\n const encoding = {};\n forEach(oldEncoding, (channelDef, channel) => {\n // Extract potential embedded transformations along with remaining properties\n if (isFieldDef(channelDef)) {\n const { field, aggregate: aggOp, bin, timeUnit, ...remaining } = channelDef;\n if (aggOp || timeUnit || bin) {\n const guide = getGuide(channelDef);\n const isTitleDefined = guide?.title;\n let newField = vgField(channelDef, { forAs: true });\n const newFieldDef = {\n // Only add title if it doesn't exist\n ...(isTitleDefined ? [] : { title: title(channelDef, config, { allowDisabling: true }) }),\n ...remaining,\n // Always overwrite field\n field: newField\n };\n if (aggOp) {\n let op;\n if (isArgmaxDef(aggOp)) {\n op = 'argmax';\n newField = vgField({ op: 'argmax', field: aggOp.argmax }, { forAs: true });\n newFieldDef.field = `${newField}.${field}`;\n }\n else if (isArgminDef(aggOp)) {\n op = 'argmin';\n newField = vgField({ op: 'argmin', field: aggOp.argmin }, { forAs: true });\n newFieldDef.field = `${newField}.${field}`;\n }\n else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') {\n op = aggOp;\n }\n if (op) {\n const aggregateEntry = {\n op,\n as: newField\n };\n if (field) {\n aggregateEntry.field = field;\n }\n aggregate.push(aggregateEntry);\n }\n }\n else {\n groupby.push(newField);\n if (isTypedFieldDef(channelDef) && isBinning(bin)) {\n bins.push({ bin, field, as: newField });\n // Add additional groupbys for range and end of bins\n groupby.push(vgField(channelDef, { binSuffix: 'end' }));\n if (binRequiresRange(channelDef, channel)) {\n groupby.push(vgField(channelDef, { binSuffix: 'range' }));\n }\n // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively\n if (isXorY(channel)) {\n const secondaryChannel = {\n field: `${newField}_end`\n };\n encoding[`${channel}2`] = secondaryChannel;\n }\n newFieldDef.bin = 'binned';\n if (!isSecondaryRangeChannel(channel)) {\n newFieldDef['type'] = QUANTITATIVE;\n }\n }\n else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n timeUnits.push({\n timeUnit,\n field,\n as: newField\n });\n // define the format type for later compilation\n const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time';\n if (formatType) {\n if (channel === TEXT || channel === TOOLTIP) {\n newFieldDef['formatType'] = formatType;\n }\n else if (isNonPositionScaleChannel(channel)) {\n newFieldDef['legend'] = {\n formatType,\n ...newFieldDef['legend']\n };\n }\n else if (isXorY(channel)) {\n newFieldDef['axis'] = {\n formatType,\n ...newFieldDef['axis']\n };\n }\n }\n }\n }\n // now the field should refer to post-transformed field instead\n encoding[channel] = newFieldDef;\n }\n else {\n groupby.push(field);\n encoding[channel] = oldEncoding[channel];\n }\n }\n else {\n // For value def / signal ref / datum def, just copy\n encoding[channel] = oldEncoding[channel];\n }\n });\n return {\n bins,\n timeUnits,\n aggregate,\n groupby,\n encoding\n };\n}\nexport function markChannelCompatible(encoding, channel, mark) {\n const markSupported = supportMark(channel, mark);\n if (!markSupported) {\n return false;\n }\n else if (markSupported === 'binned') {\n const primaryFieldDef = encoding[channel === X2 ? X : Y];\n // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef\n // has \"binned\" data and thus need x2/y2 to specify the bin-end field.\n if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) {\n return true;\n }\n else {\n return false;\n }\n }\n return true;\n}\nexport function initEncoding(encoding, mark, filled, config) {\n const normalizedEncoding = {};\n for (const key of keys(encoding)) {\n if (!isChannel(key)) {\n // Drop invalid channel\n log.warn(log.message.invalidEncodingChannel(key));\n }\n }\n for (let channel of UNIT_CHANNELS) {\n if (!encoding[channel]) {\n continue;\n }\n const channelDef = encoding[channel];\n if (isXorYOffset(channel)) {\n const mainChannel = getMainChannelFromOffsetChannel(channel);\n const positionDef = normalizedEncoding[mainChannel];\n if (isFieldDef(positionDef)) {\n if (isContinuous(positionDef.type)) {\n if (isFieldDef(channelDef) && !positionDef.timeUnit) {\n // TODO: nesting continuous field instead continuous field should\n // behave like offsetting the data in data domain\n log.warn(log.message.offsetNestedInsideContinuousPositionScaleDropped(mainChannel));\n continue;\n }\n }\n }\n }\n if (channel === 'angle' && mark === 'arc' && !encoding.theta) {\n log.warn(log.message.REPLACE_ANGLE_WITH_THETA);\n channel = THETA;\n }\n if (!markChannelCompatible(encoding, channel, mark)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, mark));\n continue;\n }\n // Drop line's size if the field is aggregated.\n if (channel === SIZE && mark === 'line') {\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef?.aggregate) {\n log.warn(log.message.LINE_WITH_VARYING_SIZE);\n continue;\n }\n }\n // Drop color if either fill or stroke is specified\n if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) {\n log.warn(log.message.droppingColor('encoding', { fill: 'fill' in encoding, stroke: 'stroke' in encoding }));\n continue;\n }\n if (channel === DETAIL ||\n (channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef)) ||\n (channel === TOOLTIP && isArray(channelDef))) {\n if (channelDef) {\n if (channel === ORDER) {\n const def = encoding[channel];\n if (isOrderOnlyDef(def)) {\n normalizedEncoding[channel] = def;\n continue;\n }\n }\n // Array of fieldDefs for detail channel (or production rule)\n normalizedEncoding[channel] = array(channelDef).reduce((defs, fieldDef) => {\n if (!isFieldDef(fieldDef)) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n }\n else {\n defs.push(initFieldDef(fieldDef, channel));\n }\n return defs;\n }, []);\n }\n }\n else {\n if (channel === TOOLTIP && channelDef === null) {\n // Preserve null so we can use it to disable tooltip\n normalizedEncoding[channel] = null;\n }\n else if (!isFieldDef(channelDef) &&\n !isDatumDef(channelDef) &&\n !isValueDef(channelDef) &&\n !isConditionalDef(channelDef) &&\n !isSignalRef(channelDef)) {\n log.warn(log.message.emptyFieldDef(channelDef, channel));\n continue;\n }\n normalizedEncoding[channel] = initChannelDef(channelDef, channel, config);\n }\n }\n return normalizedEncoding;\n}\n/**\n * For composite marks, we have to call initChannelDef during init so we can infer types earlier.\n */\nexport function normalizeEncoding(encoding, config) {\n const normalizedEncoding = {};\n for (const channel of keys(encoding)) {\n const newChannelDef = initChannelDef(encoding[channel], channel, config, { compositeMark: true });\n normalizedEncoding[channel] = newChannelDef;\n }\n return normalizedEncoding;\n}\nexport function fieldDefs(encoding) {\n const arr = [];\n for (const channel of keys(encoding)) {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n const channelDefArray = array(channelDef);\n for (const def of channelDefArray) {\n if (isFieldDef(def)) {\n arr.push(def);\n }\n else if (hasConditionalFieldDef(def)) {\n arr.push(def.condition);\n }\n }\n }\n }\n return arr;\n}\nexport function forEach(mapping, f, thisArg) {\n if (!mapping) {\n return;\n }\n for (const channel of keys(mapping)) {\n const el = mapping[channel];\n if (isArray(el)) {\n for (const channelDef of el) {\n f.call(thisArg, channelDef, channel);\n }\n }\n else {\n f.call(thisArg, el, channel);\n }\n }\n}\nexport function reduce(mapping, f, init, thisArg) {\n if (!mapping) {\n return init;\n }\n return keys(mapping).reduce((r, channel) => {\n const map = mapping[channel];\n if (isArray(map)) {\n return map.reduce((r1, channelDef) => {\n return f.call(thisArg, r1, channelDef, channel);\n }, r);\n }\n else {\n return f.call(thisArg, r, map, channel);\n }\n }, init);\n}\n/**\n * Returns list of path grouping fields for the given encoding\n */\nexport function pathGroupingFields(mark, encoding) {\n return keys(encoding).reduce((details, channel) => {\n switch (channel) {\n // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group\n case X:\n case Y:\n case HREF:\n case DESCRIPTION:\n case URL:\n case X2:\n case Y2:\n case XOFFSET:\n case YOFFSET:\n case THETA:\n case THETA2:\n case RADIUS:\n case RADIUS2:\n // falls through\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n // TODO: case 'cursor':\n // text, shape, shouldn't be a part of line/trail/area [falls through]\n case TEXT:\n case SHAPE:\n case ANGLE:\n // falls through\n // tooltip fields should not be added to group by [falls through]\n case TOOLTIP:\n return details;\n case ORDER:\n // order should not group line / trail\n if (mark === 'line' || mark === 'trail') {\n return details;\n }\n // but order should group area for stacking (falls through)\n case DETAIL:\n case KEY: {\n const channelDef = encoding[channel];\n if (isArray(channelDef) || isFieldDef(channelDef)) {\n for (const fieldDef of array(channelDef)) {\n if (!fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n }\n }\n return details;\n }\n case SIZE:\n if (mark === 'trail') {\n // For trail, size should not group trail lines.\n return details;\n }\n // For line, size should group lines.\n // falls through\n case COLOR:\n case FILL:\n case STROKE:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEDASH:\n case STROKEWIDTH: {\n // TODO strokeDashOffset:\n // falls through\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef && !fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n return details;\n }\n }\n }, []);\n}\n//# sourceMappingURL=encoding.js.map","import { isArray, isBoolean, isString } from 'vega-util';\nimport { isContinuousFieldOrDatumDef, isFieldDef, isFieldOrDatumDefForTimeFormat } from '../channeldef';\nimport { fieldDefs } from '../encoding';\nimport * as log from '../log';\nimport { isMarkDef } from '../mark';\nimport { getFirstDefined, hash, unique } from '../util';\nimport { isSignalRef } from '../vega.schema';\nimport { toStringFieldDef } from './../channeldef';\nexport function filterTooltipWithAggregatedField(oldEncoding) {\n const { tooltip, ...filteredEncoding } = oldEncoding;\n if (!tooltip) {\n return { filteredEncoding };\n }\n let customTooltipWithAggregatedField;\n let customTooltipWithoutAggregatedField;\n if (isArray(tooltip)) {\n for (const t of tooltip) {\n if (t.aggregate) {\n if (!customTooltipWithAggregatedField) {\n customTooltipWithAggregatedField = [];\n }\n customTooltipWithAggregatedField.push(t);\n }\n else {\n if (!customTooltipWithoutAggregatedField) {\n customTooltipWithoutAggregatedField = [];\n }\n customTooltipWithoutAggregatedField.push(t);\n }\n }\n if (customTooltipWithAggregatedField) {\n filteredEncoding.tooltip = customTooltipWithAggregatedField;\n }\n }\n else {\n if (tooltip['aggregate']) {\n filteredEncoding.tooltip = tooltip;\n }\n else {\n customTooltipWithoutAggregatedField = tooltip;\n }\n }\n if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) {\n customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0];\n }\n return { customTooltipWithoutAggregatedField, filteredEncoding };\n}\nexport function getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, withFieldName = true) {\n if ('tooltip' in encodingWithoutContinuousAxis) {\n return { tooltip: encodingWithoutContinuousAxis.tooltip };\n }\n const fiveSummaryTooltip = tooltipSummary.map(({ fieldPrefix, titlePrefix }) => {\n const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : '';\n return {\n field: fieldPrefix + continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n title: isSignalRef(titlePrefix) ? { signal: `${titlePrefix}\"${escape(mainTitle)}\"` } : titlePrefix + mainTitle\n };\n });\n const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef);\n return {\n tooltip: [\n ...fiveSummaryTooltip,\n // need to cast because TextFieldDef supports fewer types of bin\n ...unique(tooltipFieldDefs, hash)\n ]\n };\n}\nexport function getTitle(continuousAxisChannelDef) {\n const { title, field } = continuousAxisChannelDef;\n return getFirstDefined(title, field);\n}\nexport function makeCompositeAggregatePartFactory(compositeMarkDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, compositeMarkConfig) {\n const { scale, axis } = continuousAxisChannelDef;\n return ({ partName, mark, positionPrefix, endPositionPrefix = undefined, extraEncoding = {} }) => {\n const title = getTitle(continuousAxisChannelDef);\n return partLayerMixins(compositeMarkDef, partName, compositeMarkConfig, {\n mark,\n encoding: {\n [continuousAxis]: {\n field: `${positionPrefix}_${continuousAxisChannelDef.field}`,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? { title } : {}),\n ...(scale !== undefined ? { scale } : {}),\n ...(axis !== undefined ? { axis } : {})\n },\n ...(isString(endPositionPrefix)\n ? {\n [`${continuousAxis}2`]: {\n field: `${endPositionPrefix}_${continuousAxisChannelDef.field}`\n }\n }\n : {}),\n ...sharedEncoding,\n ...extraEncoding\n }\n });\n };\n}\nexport function partLayerMixins(markDef, part, compositeMarkConfig, partBaseSpec) {\n const { clip, color, opacity } = markDef;\n const mark = markDef.type;\n if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) {\n return [\n {\n ...partBaseSpec,\n mark: {\n ...compositeMarkConfig[part],\n ...(clip ? { clip } : {}),\n ...(color ? { color } : {}),\n ...(opacity ? { opacity } : {}),\n ...(isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : { type: partBaseSpec.mark }),\n style: `${mark}-${String(part)}`,\n ...(isBoolean(markDef[part]) ? {} : markDef[part])\n }\n }\n ];\n }\n return [];\n}\nexport function compositeMarkContinuousAxis(spec, orient, compositeMark) {\n const { encoding } = spec;\n const continuousAxis = orient === 'vertical' ? 'y' : 'x';\n const continuousAxisChannelDef = encoding[continuousAxis]; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal.\n const continuousAxisChannelDef2 = encoding[`${continuousAxis}2`];\n const continuousAxisChannelDefError = encoding[`${continuousAxis}Error`];\n const continuousAxisChannelDefError2 = encoding[`${continuousAxis}Error2`];\n return {\n continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark),\n continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark),\n continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark),\n continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark),\n continuousAxis\n };\n}\nfunction filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark) {\n if (continuousAxisChannelDef?.aggregate) {\n const { aggregate, ...continuousAxisWithoutAggregate } = continuousAxisChannelDef;\n if (aggregate !== compositeMark) {\n log.warn(log.message.errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark));\n }\n return continuousAxisWithoutAggregate;\n }\n else {\n return continuousAxisChannelDef;\n }\n}\nexport function compositeMarkOrient(spec, compositeMark) {\n const { mark, encoding } = spec;\n const { x, y } = encoding;\n if (isMarkDef(mark) && mark.orient) {\n return mark.orient;\n }\n if (isContinuousFieldOrDatumDef(x)) {\n // x is continuous\n if (isContinuousFieldOrDatumDef(y)) {\n // both x and y are continuous\n const xAggregate = isFieldDef(x) && x.aggregate;\n const yAggregate = isFieldDef(y) && y.aggregate;\n if (!xAggregate && yAggregate === compositeMark) {\n return 'vertical';\n }\n else if (!yAggregate && xAggregate === compositeMark) {\n return 'horizontal';\n }\n else if (xAggregate === compositeMark && yAggregate === compositeMark) {\n throw new Error('Both x and y cannot have aggregate');\n }\n else {\n if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) {\n // y is temporal but x is not\n return 'horizontal';\n }\n // default orientation for two continuous\n return 'vertical';\n }\n }\n return 'horizontal';\n }\n else if (isContinuousFieldOrDatumDef(y)) {\n // y is continuous but x is not\n return 'vertical';\n }\n else {\n // Neither x nor y is continuous.\n throw new Error(`Need a valid continuous axis for ${compositeMark}s`);\n }\n}\n//# sourceMappingURL=common.js.map","import { isNumber, isObject } from 'vega-util';\nimport { getMarkPropOrConfig } from '../compile/common';\nimport { extractTransformsFromEncoding, normalizeEncoding } from '../encoding';\nimport * as log from '../log';\nimport { isMarkDef } from '../mark';\nimport { isEmpty, omit } from '../util';\nimport { CompositeMarkNormalizer } from './base';\nimport { compositeMarkContinuousAxis, compositeMarkOrient, filterTooltipWithAggregatedField, getCompositeMarkTooltip, getTitle, makeCompositeAggregatePartFactory, partLayerMixins } from './common';\nexport const BOXPLOT = 'boxplot';\nexport const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks'];\nexport const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot);\nexport function getBoxPlotType(extent) {\n if (isNumber(extent)) {\n return 'tukey';\n }\n // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now.\n return extent;\n}\nexport function normalizeBoxPlot(spec, { config }) {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n const { mark, encoding: _encoding, params, projection: _p, ...outerSpec } = spec;\n const markDef = isMarkDef(mark) ? mark : { type: mark };\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (params) {\n log.warn(log.message.selectionNotSupported('boxplot'));\n }\n const extent = markDef.extent ?? config.boxplot.extent;\n const sizeValue = getMarkPropOrConfig('size', markDef, // TODO: https://github.com/vega/vega-lite/issues/6245\n config);\n const invalid = markDef.invalid;\n const boxPlotType = getBoxPlotType(extent);\n const { bins, timeUnits, transform, continuousAxisChannelDef, continuousAxis, groupby, aggregate, encodingWithoutContinuousAxis, ticksOrient, boxOrient, customTooltipWithoutAggregatedField } = boxParams(spec, extent, config);\n const { color, size, ...encodingWithoutSizeColorAndContinuousAxis } = encodingWithoutContinuousAxis;\n const makeBoxPlotPart = (sharedEncoding) => {\n return makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, config.boxplot);\n };\n const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis);\n const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis);\n const makeBoxPlotMidTick = makeBoxPlotPart({ ...encodingWithoutSizeColorAndContinuousAxis, ...(size ? { size } : {}) });\n const fiveSummaryTooltipEncoding = getCompositeMarkTooltip([\n { fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', titlePrefix: 'Max' },\n { fieldPrefix: 'upper_box_', titlePrefix: 'Q3' },\n { fieldPrefix: 'mid_box_', titlePrefix: 'Median' },\n { fieldPrefix: 'lower_box_', titlePrefix: 'Q1' },\n { fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', titlePrefix: 'Min' }\n ], continuousAxisChannelDef, encodingWithoutContinuousAxis);\n // ## Whisker Layers\n const endTick = { type: 'tick', color: 'black', opacity: 1, orient: ticksOrient, invalid, aria: false };\n const whiskerTooltipEncoding = boxPlotType === 'min-max'\n ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker\n : // for tukey / k-IQR, just show upper/lower-whisker\n getCompositeMarkTooltip([\n { fieldPrefix: 'upper_whisker_', titlePrefix: 'Upper Whisker' },\n { fieldPrefix: 'lower_whisker_', titlePrefix: 'Lower Whisker' }\n ], continuousAxisChannelDef, encodingWithoutContinuousAxis);\n const whiskerLayers = [\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: { type: 'rule', invalid, aria: false },\n positionPrefix: 'lower_whisker',\n endPositionPrefix: 'lower_box',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: { type: 'rule', invalid, aria: false },\n positionPrefix: 'upper_box',\n endPositionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'lower_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n })\n ];\n // ## Box Layers\n // TODO: support hiding certain mark parts\n const boxLayers = [\n ...(boxPlotType !== 'tukey' ? whiskerLayers : []),\n ...makeBoxPlotBox({\n partName: 'box',\n mark: {\n type: 'bar',\n ...(sizeValue ? { size: sizeValue } : {}),\n orient: boxOrient,\n invalid,\n ariaRoleDescription: 'box'\n },\n positionPrefix: 'lower_box',\n endPositionPrefix: 'upper_box',\n extraEncoding: fiveSummaryTooltipEncoding\n }),\n ...makeBoxPlotMidTick({\n partName: 'median',\n mark: {\n type: 'tick',\n invalid,\n ...(isObject(config.boxplot.median) && config.boxplot.median.color ? { color: config.boxplot.median.color } : {}),\n ...(sizeValue ? { size: sizeValue } : {}),\n orient: ticksOrient,\n aria: false\n },\n positionPrefix: 'mid_box',\n extraEncoding: fiveSummaryTooltipEncoding\n })\n ];\n if (boxPlotType === 'min-max') {\n return {\n ...outerSpec,\n transform: (outerSpec.transform ?? []).concat(transform),\n layer: boxLayers\n };\n }\n // Tukey Box Plot\n const lowerBoxExpr = `datum[\"lower_box_${continuousAxisChannelDef.field}\"]`;\n const upperBoxExpr = `datum[\"upper_box_${continuousAxisChannelDef.field}\"]`;\n const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`;\n const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`;\n const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`;\n const fieldExpr = `datum[\"${continuousAxisChannelDef.field}\"]`;\n const joinaggregateTransform = {\n joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field),\n groupby\n };\n const filteredWhiskerSpec = {\n transform: [\n {\n filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})`\n },\n {\n aggregate: [\n {\n op: 'min',\n field: continuousAxisChannelDef.field,\n as: `lower_whisker_${continuousAxisChannelDef.field}`\n },\n {\n op: 'max',\n field: continuousAxisChannelDef.field,\n as: `upper_whisker_${continuousAxisChannelDef.field}`\n },\n // preserve lower_box / upper_box\n {\n op: 'min',\n field: `lower_box_${continuousAxisChannelDef.field}`,\n as: `lower_box_${continuousAxisChannelDef.field}`\n },\n {\n op: 'max',\n field: `upper_box_${continuousAxisChannelDef.field}`,\n as: `upper_box_${continuousAxisChannelDef.field}`\n },\n ...aggregate\n ],\n groupby\n }\n ],\n layer: whiskerLayers\n };\n const { tooltip, ...encodingWithoutSizeColorContinuousAxisAndTooltip } = encodingWithoutSizeColorAndContinuousAxis;\n const { scale, axis } = continuousAxisChannelDef;\n const title = getTitle(continuousAxisChannelDef);\n const axisWithoutTitle = omit(axis, ['title']);\n const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, {\n transform: [{ filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})` }],\n mark: 'point',\n encoding: {\n [continuousAxis]: {\n field: continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? { title } : {}),\n ...(scale !== undefined ? { scale } : {}),\n // add axis without title since we already added the title above\n ...(isEmpty(axisWithoutTitle) ? {} : { axis: axisWithoutTitle })\n },\n ...encodingWithoutSizeColorContinuousAxisAndTooltip,\n ...(color ? { color } : {}),\n ...(customTooltipWithoutAggregatedField ? { tooltip: customTooltipWithoutAggregatedField } : {})\n }\n })[0];\n let filteredLayersMixins;\n const filteredLayersMixinsTransforms = [...bins, ...timeUnits, joinaggregateTransform];\n if (outlierLayersMixins) {\n filteredLayersMixins = {\n transform: filteredLayersMixinsTransforms,\n layer: [outlierLayersMixins, filteredWhiskerSpec]\n };\n }\n else {\n filteredLayersMixins = filteredWhiskerSpec;\n filteredLayersMixins.transform.unshift(...filteredLayersMixinsTransforms);\n }\n return {\n ...outerSpec,\n layer: [\n filteredLayersMixins,\n {\n // boxplot\n transform,\n layer: boxLayers\n }\n ]\n };\n}\nfunction boxParamsQuartiles(continousAxisField) {\n return [\n {\n op: 'q1',\n field: continousAxisField,\n as: `lower_box_${continousAxisField}`\n },\n {\n op: 'q3',\n field: continousAxisField,\n as: `upper_box_${continousAxisField}`\n }\n ];\n}\nfunction boxParams(spec, extent, config) {\n const orient = compositeMarkOrient(spec, BOXPLOT);\n const { continuousAxisChannelDef, continuousAxis } = compositeMarkContinuousAxis(spec, orient, BOXPLOT);\n const continuousFieldName = continuousAxisChannelDef.field;\n const boxPlotType = getBoxPlotType(extent);\n const boxplotSpecificAggregate = [\n ...boxParamsQuartiles(continuousFieldName),\n {\n op: 'median',\n field: continuousFieldName,\n as: `mid_box_${continuousFieldName}`\n },\n {\n op: 'min',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName\n },\n {\n op: 'max',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName\n }\n ];\n const postAggregateCalculates = boxPlotType === 'min-max' || boxPlotType === 'tukey'\n ? []\n : [\n // This is for the original k-IQR, which we do not expose\n {\n calculate: `datum[\"upper_box_${continuousFieldName}\"] - datum[\"lower_box_${continuousFieldName}\"]`,\n as: `iqr_${continuousFieldName}`\n },\n {\n calculate: `min(datum[\"upper_box_${continuousFieldName}\"] + datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"max_${continuousFieldName}\"])`,\n as: `upper_whisker_${continuousFieldName}`\n },\n {\n calculate: `max(datum[\"lower_box_${continuousFieldName}\"] - datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"min_${continuousFieldName}\"])`,\n as: `lower_whisker_${continuousFieldName}`\n }\n ];\n const { [continuousAxis]: oldContinuousAxisChannelDef, ...oldEncodingWithoutContinuousAxis } = spec.encoding;\n const { customTooltipWithoutAggregatedField, filteredEncoding } = filterTooltipWithAggregatedField(oldEncodingWithoutContinuousAxis);\n const { bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(filteredEncoding, config);\n const ticksOrient = orient === 'vertical' ? 'horizontal' : 'vertical';\n const boxOrient = orient;\n const transform = [\n ...bins,\n ...timeUnits,\n {\n aggregate: [...aggregate, ...boxplotSpecificAggregate],\n groupby\n },\n ...postAggregateCalculates\n ];\n return {\n bins,\n timeUnits,\n transform,\n groupby,\n aggregate,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient,\n boxOrient,\n customTooltipWithoutAggregatedField\n };\n}\n//# sourceMappingURL=boxplot.js.map","import { isContinuousFieldOrDatumDef, isFieldOrDatumDef, title } from '../channeldef';\nimport { extractTransformsFromEncoding, normalizeEncoding } from '../encoding';\nimport * as log from '../log';\nimport { isMarkDef } from '../mark';\nimport { replaceAll, titleCase } from '../util';\nimport { CompositeMarkNormalizer } from './base';\nimport { compositeMarkContinuousAxis, compositeMarkOrient, getCompositeMarkTooltip, makeCompositeAggregatePartFactory } from './common';\nexport const ERRORBAR = 'errorbar';\nexport const ERRORBAR_PARTS = ['ticks', 'rule'];\nexport const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar);\nexport function normalizeErrorBar(spec, { config }) {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n const { transform, continuousAxisChannelDef, continuousAxis, encodingWithoutContinuousAxis, ticksOrient, markDef, outerSpec, tooltipEncoding } = errorBarParams(spec, ERRORBAR, config);\n delete encodingWithoutContinuousAxis['size'];\n const makeErrorBarPart = makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorbar);\n const thickness = markDef.thickness;\n const size = markDef.size;\n const tick = {\n type: 'tick',\n orient: ticksOrient,\n aria: false,\n ...(thickness !== undefined ? { thickness } : {}),\n ...(size !== undefined ? { size } : {})\n };\n const layer = [\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'lower',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'rule',\n mark: {\n type: 'rule',\n ariaRoleDescription: 'errorbar',\n ...(thickness !== undefined ? { size: thickness } : {})\n },\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ];\n return {\n ...outerSpec,\n transform,\n ...(layer.length > 1 ? { layer } : { ...layer[0] })\n };\n}\nfunction errorBarOrientAndInputType(spec, compositeMark) {\n const { encoding } = spec;\n if (errorBarIsInputTypeRaw(encoding)) {\n return {\n orient: compositeMarkOrient(spec, compositeMark),\n inputType: 'raw'\n };\n }\n const isTypeAggregatedUpperLower = errorBarIsInputTypeAggregatedUpperLower(encoding);\n const isTypeAggregatedError = errorBarIsInputTypeAggregatedError(encoding);\n const x = encoding.x;\n const y = encoding.y;\n if (isTypeAggregatedUpperLower) {\n // type is aggregated-upper-lower\n if (isTypeAggregatedError) {\n throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`);\n }\n const x2 = encoding.x2;\n const y2 = encoding.y2;\n if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) {\n // having both x, x2 and y, y2\n throw new Error(`${compositeMark} cannot have both x2 and y2`);\n }\n else if (isFieldOrDatumDef(x2)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x, x2 quantitative and field y, y2 are not specified\n return { orient: 'horizontal', inputType: 'aggregated-upper-lower' };\n }\n else {\n // having x, x2 that are not both quantitative\n throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`);\n }\n }\n else if (isFieldOrDatumDef(y2)) {\n // y2 is a FieldDef\n if (isContinuousFieldOrDatumDef(y)) {\n // having y, y2 quantitative and field x, x2 are not specified\n return { orient: 'vertical', inputType: 'aggregated-upper-lower' };\n }\n else {\n // having y, y2 that are not both quantitative\n throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`);\n }\n }\n throw new Error('No ranged axis');\n }\n else {\n // type is aggregated-error\n const xError = encoding.xError;\n const xError2 = encoding.xError2;\n const yError = encoding.yError;\n const yError2 = encoding.yError2;\n if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) {\n // having xError2 without xError\n throw new Error(`${compositeMark} cannot have xError2 without xError`);\n }\n if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) {\n // having yError2 without yError\n throw new Error(`${compositeMark} cannot have yError2 without yError`);\n }\n if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) {\n // having both xError and yError\n throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`);\n }\n else if (isFieldOrDatumDef(xError)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x and xError that are all quantitative\n return { orient: 'horizontal', inputType: 'aggregated-error' };\n }\n else {\n // having x, xError, and xError2 that are not all quantitative\n throw new Error('All x, xError, and xError2 (if exist) have to be quantitative');\n }\n }\n else if (isFieldOrDatumDef(yError)) {\n if (isContinuousFieldOrDatumDef(y)) {\n // having y and yError that are all quantitative\n return { orient: 'vertical', inputType: 'aggregated-error' };\n }\n else {\n // having y, yError, and yError2 that are not all quantitative\n throw new Error('All y, yError, and yError2 (if exist) have to be quantitative');\n }\n }\n throw new Error('No ranged axis');\n }\n}\nfunction errorBarIsInputTypeRaw(encoding) {\n return ((isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) &&\n !isFieldOrDatumDef(encoding.x2) &&\n !isFieldOrDatumDef(encoding.y2) &&\n !isFieldOrDatumDef(encoding.xError) &&\n !isFieldOrDatumDef(encoding.xError2) &&\n !isFieldOrDatumDef(encoding.yError) &&\n !isFieldOrDatumDef(encoding.yError2));\n}\nfunction errorBarIsInputTypeAggregatedUpperLower(encoding) {\n return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2);\n}\nfunction errorBarIsInputTypeAggregatedError(encoding) {\n return (isFieldOrDatumDef(encoding.xError) ||\n isFieldOrDatumDef(encoding.xError2) ||\n isFieldOrDatumDef(encoding.yError) ||\n isFieldOrDatumDef(encoding.yError2));\n}\nexport function errorBarParams(spec, compositeMark, config) {\n // TODO: use selection\n const { mark, encoding, params, projection: _p, ...outerSpec } = spec;\n const markDef = isMarkDef(mark) ? mark : { type: mark };\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (params) {\n log.warn(log.message.selectionNotSupported(compositeMark));\n }\n const { orient, inputType } = errorBarOrientAndInputType(spec, compositeMark);\n const { continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, continuousAxis } = compositeMarkContinuousAxis(spec, orient, compositeMark);\n const { errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName } = errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config);\n const { [continuousAxis]: oldContinuousAxisChannelDef, [continuousAxis === 'x' ? 'x2' : 'y2']: oldContinuousAxisChannelDef2, [continuousAxis === 'x' ? 'xError' : 'yError']: oldContinuousAxisChannelDefError, [continuousAxis === 'x' ? 'xError2' : 'yError2']: oldContinuousAxisChannelDefError2, ...oldEncodingWithoutContinuousAxis } = encoding;\n const { bins, timeUnits, aggregate: oldAggregate, groupby: oldGroupBy, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config);\n const aggregate = [...oldAggregate, ...errorBarSpecificAggregate];\n const groupby = inputType !== 'raw' ? [] : oldGroupBy;\n const tooltipEncoding = getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, tooltipTitleWithFieldName);\n return {\n transform: [\n ...(outerSpec.transform ?? []),\n ...bins,\n ...timeUnits,\n ...(aggregate.length === 0 ? [] : [{ aggregate, groupby }]),\n ...postAggregateCalculates\n ],\n groupby,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical',\n markDef,\n outerSpec,\n tooltipEncoding\n };\n}\nfunction errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config) {\n let errorBarSpecificAggregate = [];\n let postAggregateCalculates = [];\n const continuousFieldName = continuousAxisChannelDef.field;\n let tooltipSummary;\n let tooltipTitleWithFieldName = false;\n if (inputType === 'raw') {\n const center = markDef.center\n ? markDef.center\n : markDef.extent\n ? markDef.extent === 'iqr'\n ? 'median'\n : 'mean'\n : config.errorbar.center;\n const extent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr';\n if ((center === 'median') !== (extent === 'iqr')) {\n log.warn(log.message.errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark));\n }\n if (extent === 'stderr' || extent === 'stdev') {\n errorBarSpecificAggregate = [\n { op: extent, field: continuousFieldName, as: `extent_${continuousFieldName}` },\n { op: center, field: continuousFieldName, as: `center_${continuousFieldName}` }\n ];\n postAggregateCalculates = [\n {\n calculate: `datum[\"center_${continuousFieldName}\"] + datum[\"extent_${continuousFieldName}\"]`,\n as: `upper_${continuousFieldName}`\n },\n {\n calculate: `datum[\"center_${continuousFieldName}\"] - datum[\"extent_${continuousFieldName}\"]`,\n as: `lower_${continuousFieldName}`\n }\n ];\n tooltipSummary = [\n { fieldPrefix: 'center_', titlePrefix: titleCase(center) },\n { fieldPrefix: 'upper_', titlePrefix: getTitlePrefix(center, extent, '+') },\n { fieldPrefix: 'lower_', titlePrefix: getTitlePrefix(center, extent, '-') }\n ];\n tooltipTitleWithFieldName = true;\n }\n else {\n let centerOp;\n let lowerExtentOp;\n let upperExtentOp;\n if (extent === 'ci') {\n centerOp = 'mean';\n lowerExtentOp = 'ci0';\n upperExtentOp = 'ci1';\n }\n else {\n centerOp = 'median';\n lowerExtentOp = 'q1';\n upperExtentOp = 'q3';\n }\n errorBarSpecificAggregate = [\n { op: lowerExtentOp, field: continuousFieldName, as: `lower_${continuousFieldName}` },\n { op: upperExtentOp, field: continuousFieldName, as: `upper_${continuousFieldName}` },\n { op: centerOp, field: continuousFieldName, as: `center_${continuousFieldName}` }\n ];\n tooltipSummary = [\n {\n fieldPrefix: 'upper_',\n titlePrefix: title({ field: continuousFieldName, aggregate: upperExtentOp, type: 'quantitative' }, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'lower_',\n titlePrefix: title({ field: continuousFieldName, aggregate: lowerExtentOp, type: 'quantitative' }, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'center_',\n titlePrefix: title({ field: continuousFieldName, aggregate: centerOp, type: 'quantitative' }, config, {\n allowDisabling: false\n })\n }\n ];\n }\n }\n else {\n if (markDef.center || markDef.extent) {\n log.warn(log.message.errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent));\n }\n if (inputType === 'aggregated-upper-lower') {\n tooltipSummary = [];\n postAggregateCalculates = [\n { calculate: `datum[\"${continuousAxisChannelDef2.field}\"]`, as: `upper_${continuousFieldName}` },\n { calculate: `datum[\"${continuousFieldName}\"]`, as: `lower_${continuousFieldName}` }\n ];\n }\n else if (inputType === 'aggregated-error') {\n tooltipSummary = [{ fieldPrefix: '', titlePrefix: continuousFieldName }];\n postAggregateCalculates = [\n {\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: `upper_${continuousFieldName}`\n }\n ];\n if (continuousAxisChannelDefError2) {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError2.field}\"]`,\n as: `lower_${continuousFieldName}`\n });\n }\n else {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] - datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: `lower_${continuousFieldName}`\n });\n }\n }\n for (const postAggregateCalculate of postAggregateCalculates) {\n tooltipSummary.push({\n fieldPrefix: postAggregateCalculate.as.substring(0, 6),\n titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum[\"', ''), '\"]', '')\n });\n }\n }\n return { postAggregateCalculates, errorBarSpecificAggregate, tooltipSummary, tooltipTitleWithFieldName };\n}\nfunction getTitlePrefix(center, extent, operation) {\n return `${titleCase(center)} ${operation} ${extent}`;\n}\n//# sourceMappingURL=errorbar.js.map","import { normalizeEncoding } from '../encoding';\nimport * as log from '../log';\nimport { CompositeMarkNormalizer } from './base';\nimport { makeCompositeAggregatePartFactory } from './common';\nimport { errorBarParams } from './errorbar';\nexport const ERRORBAND = 'errorband';\nexport const ERRORBAND_PARTS = ['band', 'borders'];\nexport const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand);\nexport function normalizeErrorBand(spec, { config }) {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n const { transform, continuousAxisChannelDef, continuousAxis, encodingWithoutContinuousAxis, markDef, outerSpec, tooltipEncoding } = errorBarParams(spec, ERRORBAND, config);\n const errorBandDef = markDef;\n const makeErrorBandPart = makeCompositeAggregatePartFactory(errorBandDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorband);\n const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined;\n let bandMark = { type: is2D ? 'area' : 'rect' };\n let bordersMark = { type: is2D ? 'line' : 'rule' };\n const interpolate = {\n ...(errorBandDef.interpolate ? { interpolate: errorBandDef.interpolate } : {}),\n ...(errorBandDef.tension && errorBandDef.interpolate ? { tension: errorBandDef.tension } : {})\n };\n if (is2D) {\n bandMark = {\n ...bandMark,\n ...interpolate,\n ariaRoleDescription: 'errorband'\n };\n bordersMark = {\n ...bordersMark,\n ...interpolate,\n aria: false\n };\n }\n else if (errorBandDef.interpolate) {\n log.warn(log.message.errorBand1DNotSupport('interpolate'));\n }\n else if (errorBandDef.tension) {\n log.warn(log.message.errorBand1DNotSupport('tension'));\n }\n return {\n ...outerSpec,\n transform,\n layer: [\n ...makeErrorBandPart({\n partName: 'band',\n mark: bandMark,\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'lower',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ]\n };\n}\n//# sourceMappingURL=errorband.js.map","import { keys } from '../util';\nimport { CompositeMarkNormalizer } from './base';\nimport { BOXPLOT, BOXPLOT_PARTS, normalizeBoxPlot } from './boxplot';\nimport { ERRORBAND, ERRORBAND_PARTS, normalizeErrorBand } from './errorband';\nimport { ERRORBAR, ERRORBAR_PARTS, normalizeErrorBar } from './errorbar';\n/**\n * Registry index for all composite mark's normalizer\n */\nconst compositeMarkRegistry = {};\nexport function add(mark, run, parts) {\n const normalizer = new CompositeMarkNormalizer(mark, run);\n compositeMarkRegistry[mark] = { normalizer, parts };\n}\nexport function remove(mark) {\n delete compositeMarkRegistry[mark];\n}\nexport function getAllCompositeMarks() {\n return keys(compositeMarkRegistry);\n}\nadd(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS);\nadd(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS);\nadd(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS);\n//# sourceMappingURL=index.js.map","export const VL_ONLY_LEGEND_CONFIG = [\n 'gradientHorizontalMaxLength',\n 'gradientHorizontalMinLength',\n 'gradientVerticalMaxLength',\n 'gradientVerticalMinLength',\n 'unselectedOpacity'\n];\n//# sourceMappingURL=guide.js.map","import { keys } from './util';\nexport const HEADER_TITLE_PROPERTIES_MAP = {\n titleAlign: 'align',\n titleAnchor: 'anchor',\n titleAngle: 'angle',\n titleBaseline: 'baseline',\n titleColor: 'color',\n titleFont: 'font',\n titleFontSize: 'fontSize',\n titleFontStyle: 'fontStyle',\n titleFontWeight: 'fontWeight',\n titleLimit: 'limit',\n titleLineHeight: 'lineHeight',\n titleOrient: 'orient',\n titlePadding: 'offset'\n};\nexport const HEADER_LABEL_PROPERTIES_MAP = {\n labelAlign: 'align',\n labelAnchor: 'anchor',\n labelAngle: 'angle',\n labelBaseline: 'baseline',\n labelColor: 'color',\n labelFont: 'font',\n labelFontSize: 'fontSize',\n labelFontStyle: 'fontStyle',\n labelFontWeight: 'fontWeight',\n labelLimit: 'limit',\n labelLineHeight: 'lineHeight',\n labelOrient: 'orient',\n labelPadding: 'offset'\n};\nexport const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP);\nexport const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP);\nconst HEADER_CONFIGS_INDEX = {\n header: 1,\n headerRow: 1,\n headerColumn: 1,\n headerFacet: 1\n};\nexport const HEADER_CONFIGS = keys(HEADER_CONFIGS_INDEX);\n//# sourceMappingURL=header.js.map","import { keys } from './util';\nexport const LEGEND_SCALE_CHANNELS = [\n 'size',\n 'shape',\n 'fill',\n 'stroke',\n 'strokeDash',\n 'strokeWidth',\n 'opacity'\n];\nexport const defaultLegendConfig = {\n gradientHorizontalMaxLength: 200,\n gradientHorizontalMinLength: 100,\n gradientVerticalMaxLength: 200,\n gradientVerticalMinLength: 64,\n unselectedOpacity: 0.35\n};\nexport const COMMON_LEGEND_PROPERTY_INDEX = {\n aria: 1,\n clipHeight: 1,\n columnPadding: 1,\n columns: 1,\n cornerRadius: 1,\n description: 1,\n direction: 1,\n fillColor: 1,\n format: 1,\n formatType: 1,\n gradientLength: 1,\n gradientOpacity: 1,\n gradientStrokeColor: 1,\n gradientStrokeWidth: 1,\n gradientThickness: 1,\n gridAlign: 1,\n labelAlign: 1,\n labelBaseline: 1,\n labelColor: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labelSeparation: 1,\n legendX: 1,\n legendY: 1,\n offset: 1,\n orient: 1,\n padding: 1,\n rowPadding: 1,\n strokeColor: 1,\n symbolDash: 1,\n symbolDashOffset: 1,\n symbolFillColor: 1,\n symbolLimit: 1,\n symbolOffset: 1,\n symbolOpacity: 1,\n symbolSize: 1,\n symbolStrokeColor: 1,\n symbolStrokeWidth: 1,\n symbolType: 1,\n tickCount: 1,\n tickMinStep: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titleOrient: 1,\n titlePadding: 1,\n type: 1,\n values: 1,\n zindex: 1\n};\nexport const LEGEND_PROPERTIES = keys(COMMON_LEGEND_PROPERTY_INDEX);\n//# sourceMappingURL=legend.js.map","import { isObject } from 'vega-util';\nexport const SELECTION_ID = '_vgsid_';\nexport const defaultConfig = {\n point: {\n on: 'click',\n fields: [SELECTION_ID],\n toggle: 'event.shiftKey',\n resolve: 'global',\n clear: 'dblclick'\n },\n interval: {\n on: '[pointerdown, window:pointerup] > window:pointermove!',\n encodings: ['x', 'y'],\n translate: '[pointerdown, window:pointerup] > window:pointermove!',\n zoom: 'wheel!',\n mark: { fill: '#333', fillOpacity: 0.125, stroke: 'white' },\n resolve: 'global',\n clear: 'dblclick'\n }\n};\nexport function isLegendBinding(bind) {\n return bind === 'legend' || !!bind?.legend;\n}\nexport function isLegendStreamBinding(bind) {\n return isLegendBinding(bind) && isObject(bind);\n}\nexport function isSelectionParameter(param) {\n return !!param?.['select'];\n}\n//# sourceMappingURL=selection.js.map","import { isSelectionParameter } from './selection';\nexport function assembleParameterSignals(params) {\n const signals = [];\n for (const param of params || []) {\n // Selection parameters are handled separately via assembleSelectionTopLevelSignals\n // and assembleSignals methods registered on the Model.\n if (isSelectionParameter(param))\n continue;\n const { expr, bind, ...rest } = param;\n if (bind && expr) {\n // Vega's InitSignal -- apply expr to \"init\"\n const signal = {\n ...rest,\n bind,\n init: expr\n };\n signals.push(signal);\n }\n else {\n const signal = {\n ...rest,\n ...(expr ? { update: expr } : {}),\n ...(bind ? { bind } : {})\n };\n signals.push(signal);\n }\n }\n return signals;\n}\n//# sourceMappingURL=parameter.js.map","export function isAnyConcatSpec(spec) {\n return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec);\n}\nexport function isConcatSpec(spec) {\n return 'concat' in spec;\n}\nexport function isVConcatSpec(spec) {\n return 'vconcat' in spec;\n}\nexport function isHConcatSpec(spec) {\n return 'hconcat' in spec;\n}\n//# sourceMappingURL=concat.js.map","import { isNumber, isObject } from 'vega-util';\nimport { keys } from '../util';\nimport { isConcatSpec, isVConcatSpec } from './concat';\nimport { isFacetMapping, isFacetSpec } from './facet';\nexport function getStepFor({ step, offsetIsDiscrete }) {\n if (offsetIsDiscrete) {\n return step.for ?? 'offset';\n }\n else {\n return 'position';\n }\n}\nexport function isStep(size) {\n return isObject(size) && size['step'] !== undefined;\n}\nexport function isFrameMixins(o) {\n return o['view'] || o['width'] || o['height'];\n}\nexport const DEFAULT_SPACING = 20;\nconst COMPOSITION_LAYOUT_INDEX = {\n align: 1,\n bounds: 1,\n center: 1,\n columns: 1,\n spacing: 1\n};\nconst COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX);\nexport function extractCompositionLayout(spec, specType, config) {\n const compositionConfig = config[specType];\n const layout = {};\n // Apply config first\n const { spacing: spacingConfig, columns } = compositionConfig;\n if (spacingConfig !== undefined) {\n layout.spacing = spacingConfig;\n }\n if (columns !== undefined) {\n if ((isFacetSpec(spec) && !isFacetMapping(spec.facet)) || isConcatSpec(spec)) {\n layout.columns = columns;\n }\n }\n if (isVConcatSpec(spec)) {\n layout.columns = 1;\n }\n // Then copy properties from the spec\n for (const prop of COMPOSITION_LAYOUT_PROPERTIES) {\n if (spec[prop] !== undefined) {\n if (prop === 'spacing') {\n const spacing = spec[prop];\n layout[prop] = isNumber(spacing)\n ? spacing\n : {\n row: spacing.row ?? spacingConfig,\n column: spacing.column ?? spacingConfig\n };\n }\n else {\n layout[prop] = spec[prop];\n }\n }\n }\n return layout;\n}\n//# sourceMappingURL=base.js.map","import { writeConfig } from 'vega';\nimport { isObject, mergeConfig } from 'vega-util';\nimport { AXIS_CONFIGS, isConditionalAxisValue } from './axis';\nimport { signalOrValueRefWithCondition, signalRefOrValue } from './compile/common';\nimport { getAllCompositeMarks } from './compositemark';\nimport { replaceExprRef } from './expr';\nimport { VL_ONLY_LEGEND_CONFIG } from './guide';\nimport { HEADER_CONFIGS } from './header';\nimport { defaultLegendConfig } from './legend';\nimport * as mark from './mark';\nimport { MARK_CONFIGS, PRIMITIVE_MARKS, VL_ONLY_MARK_CONFIG_PROPERTIES, VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX } from './mark';\nimport { assembleParameterSignals } from './parameter';\nimport { defaultScaleConfig } from './scale';\nimport { defaultConfig as defaultSelectionConfig } from './selection';\nimport { DEFAULT_SPACING, isStep } from './spec/base';\nimport { extractTitleConfig } from './title';\nimport { duplicate, getFirstDefined, isEmpty, keys, omit } from './util';\nexport function getViewConfigContinuousSize(viewConfig, channel) {\n return viewConfig[channel] ?? viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility\n}\nexport function getViewConfigDiscreteStep(viewConfig, channel) {\n const size = getViewConfigDiscreteSize(viewConfig, channel);\n return isStep(size) ? size.step : DEFAULT_STEP;\n}\nexport function getViewConfigDiscreteSize(viewConfig, channel) {\n const size = viewConfig[channel] ?? viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility\n return getFirstDefined(size, { step: viewConfig.step });\n}\nexport const DEFAULT_STEP = 20;\nexport const defaultViewConfig = {\n continuousWidth: 200,\n continuousHeight: 200,\n step: DEFAULT_STEP\n};\nexport function isVgScheme(rangeScheme) {\n return rangeScheme && !!rangeScheme['scheme'];\n}\nexport const defaultConfig = {\n background: 'white',\n padding: 5,\n timeFormat: '%b %d, %Y',\n countTitle: 'Count of Records',\n view: defaultViewConfig,\n mark: mark.defaultMarkConfig,\n arc: {},\n area: {},\n bar: mark.defaultBarConfig,\n circle: {},\n geoshape: {},\n image: {},\n line: {},\n point: {},\n rect: mark.defaultRectConfig,\n rule: { color: 'black' },\n square: {},\n text: { color: 'black' },\n tick: mark.defaultTickConfig,\n trail: {},\n boxplot: {\n size: 14,\n extent: 1.5,\n box: {},\n median: { color: 'white' },\n outliers: {},\n rule: {},\n ticks: null\n },\n errorbar: {\n center: 'mean',\n rule: true,\n ticks: false\n },\n errorband: {\n band: {\n opacity: 0.3\n },\n borders: false\n },\n scale: defaultScaleConfig,\n projection: {},\n legend: defaultLegendConfig,\n header: { titlePadding: 10, labelPadding: 10 },\n headerColumn: {},\n headerRow: {},\n headerFacet: {},\n selection: defaultSelectionConfig,\n style: {},\n title: {},\n facet: { spacing: DEFAULT_SPACING },\n concat: { spacing: DEFAULT_SPACING },\n normalizedNumberFormat: '.0%'\n};\n// Tableau10 color palette, copied from `vegaScale.scheme('tableau10')`\nconst tab10 = [\n '#4c78a8',\n '#f58518',\n '#e45756',\n '#72b7b2',\n '#54a24b',\n '#eeca3b',\n '#b279a2',\n '#ff9da6',\n '#9d755d',\n '#bab0ac'\n];\nexport const DEFAULT_FONT_SIZE = {\n text: 11,\n guideLabel: 10,\n guideTitle: 11,\n groupTitle: 13,\n groupSubtitle: 12\n};\nexport const DEFAULT_COLOR = {\n blue: tab10[0],\n orange: tab10[1],\n red: tab10[2],\n teal: tab10[3],\n green: tab10[4],\n yellow: tab10[5],\n purple: tab10[6],\n pink: tab10[7],\n brown: tab10[8],\n gray0: '#000',\n gray1: '#111',\n gray2: '#222',\n gray3: '#333',\n gray4: '#444',\n gray5: '#555',\n gray6: '#666',\n gray7: '#777',\n gray8: '#888',\n gray9: '#999',\n gray10: '#aaa',\n gray11: '#bbb',\n gray12: '#ccc',\n gray13: '#ddd',\n gray14: '#eee',\n gray15: '#fff'\n};\nexport function colorSignalConfig(color = {}) {\n return {\n signals: [\n {\n name: 'color',\n value: isObject(color) ? { ...DEFAULT_COLOR, ...color } : DEFAULT_COLOR\n }\n ],\n mark: { color: { signal: 'color.blue' } },\n rule: { color: { signal: 'color.gray0' } },\n text: {\n color: { signal: 'color.gray0' }\n },\n style: {\n 'guide-label': {\n fill: { signal: 'color.gray0' }\n },\n 'guide-title': {\n fill: { signal: 'color.gray0' }\n },\n 'group-title': {\n fill: { signal: 'color.gray0' }\n },\n 'group-subtitle': {\n fill: { signal: 'color.gray0' }\n },\n cell: {\n stroke: { signal: 'color.gray8' }\n }\n },\n axis: {\n domainColor: { signal: 'color.gray13' },\n gridColor: { signal: 'color.gray8' },\n tickColor: { signal: 'color.gray13' }\n },\n range: {\n category: [\n { signal: 'color.blue' },\n { signal: 'color.orange' },\n { signal: 'color.red' },\n { signal: 'color.teal' },\n { signal: 'color.green' },\n { signal: 'color.yellow' },\n { signal: 'color.purple' },\n { signal: 'color.pink' },\n { signal: 'color.brown' },\n { signal: 'color.grey8' }\n ]\n }\n };\n}\nexport function fontSizeSignalConfig(fontSize) {\n return {\n signals: [\n {\n name: 'fontSize',\n value: isObject(fontSize) ? { ...DEFAULT_FONT_SIZE, ...fontSize } : DEFAULT_FONT_SIZE\n }\n ],\n text: {\n fontSize: { signal: 'fontSize.text' }\n },\n style: {\n 'guide-label': {\n fontSize: { signal: 'fontSize.guideLabel' }\n },\n 'guide-title': {\n fontSize: { signal: 'fontSize.guideTitle' }\n },\n 'group-title': {\n fontSize: { signal: 'fontSize.groupTitle' }\n },\n 'group-subtitle': {\n fontSize: { signal: 'fontSize.groupSubtitle' }\n }\n }\n };\n}\nexport function fontConfig(font) {\n return {\n text: { font },\n style: {\n 'guide-label': { font },\n 'guide-title': { font },\n 'group-title': { font },\n 'group-subtitle': { font }\n }\n };\n}\nfunction getAxisConfigInternal(axisConfig) {\n const props = keys(axisConfig || {});\n const axisConfigInternal = {};\n for (const prop of props) {\n const val = axisConfig[prop];\n axisConfigInternal[prop] = isConditionalAxisValue(val)\n ? signalOrValueRefWithCondition(val)\n : signalRefOrValue(val);\n }\n return axisConfigInternal;\n}\nfunction getStyleConfigInternal(styleConfig) {\n const props = keys(styleConfig);\n const styleConfigInternal = {};\n for (const prop of props) {\n // We need to cast to cheat a bit here since styleConfig can be either mark config or axis config\n styleConfigInternal[prop] = getAxisConfigInternal(styleConfig[prop]);\n }\n return styleConfigInternal;\n}\nconst configPropsWithExpr = [\n ...MARK_CONFIGS,\n ...AXIS_CONFIGS,\n ...HEADER_CONFIGS,\n 'background',\n 'padding',\n 'legend',\n 'lineBreak',\n 'scale',\n 'style',\n 'title',\n 'view'\n];\n/**\n * Merge specified config with default config and config for the `color` flag,\n * then replace all expressions with signals\n */\nexport function initConfig(specifiedConfig = {}) {\n const { color, font, fontSize, selection, ...restConfig } = specifiedConfig;\n const mergedConfig = mergeConfig({}, duplicate(defaultConfig), font ? fontConfig(font) : {}, color ? colorSignalConfig(color) : {}, fontSize ? fontSizeSignalConfig(fontSize) : {}, restConfig || {});\n // mergeConfig doesn't recurse and overrides object values.\n if (selection) {\n writeConfig(mergedConfig, 'selection', selection, true);\n }\n const outputConfig = omit(mergedConfig, configPropsWithExpr);\n for (const prop of ['background', 'lineBreak', 'padding']) {\n if (mergedConfig[prop]) {\n outputConfig[prop] = signalRefOrValue(mergedConfig[prop]);\n }\n }\n for (const markConfigType of mark.MARK_CONFIGS) {\n if (mergedConfig[markConfigType]) {\n // FIXME: outputConfig[markConfigType] expects that types are replaced recursively but replaceExprRef only replaces one level deep\n outputConfig[markConfigType] = replaceExprRef(mergedConfig[markConfigType]);\n }\n }\n for (const axisConfigType of AXIS_CONFIGS) {\n if (mergedConfig[axisConfigType]) {\n outputConfig[axisConfigType] = getAxisConfigInternal(mergedConfig[axisConfigType]);\n }\n }\n for (const headerConfigType of HEADER_CONFIGS) {\n if (mergedConfig[headerConfigType]) {\n outputConfig[headerConfigType] = replaceExprRef(mergedConfig[headerConfigType]);\n }\n }\n if (mergedConfig.legend) {\n outputConfig.legend = replaceExprRef(mergedConfig.legend);\n }\n if (mergedConfig.scale) {\n outputConfig.scale = replaceExprRef(mergedConfig.scale);\n }\n if (mergedConfig.style) {\n outputConfig.style = getStyleConfigInternal(mergedConfig.style);\n }\n if (mergedConfig.title) {\n outputConfig.title = replaceExprRef(mergedConfig.title);\n }\n if (mergedConfig.view) {\n outputConfig.view = replaceExprRef(mergedConfig.view);\n }\n return outputConfig;\n}\nconst MARK_STYLES = new Set(['view', ...PRIMITIVE_MARKS]);\nconst VL_ONLY_CONFIG_PROPERTIES = [\n 'color',\n 'fontSize',\n 'background',\n 'padding',\n 'facet',\n 'concat',\n 'numberFormat',\n 'numberFormatType',\n 'normalizedNumberFormat',\n 'normalizedNumberFormatType',\n 'timeFormat',\n 'countTitle',\n 'header',\n 'axisQuantitative',\n 'axisTemporal',\n 'axisDiscrete',\n 'axisPoint',\n 'axisXBand',\n 'axisXPoint',\n 'axisXDiscrete',\n 'axisXQuantitative',\n 'axisXTemporal',\n 'axisYBand',\n 'axisYPoint',\n 'axisYDiscrete',\n 'axisYQuantitative',\n 'axisYTemporal',\n 'scale',\n 'selection',\n 'overlay' // FIXME: Redesign and unhide this\n];\nconst VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {\n view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'],\n ...VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX\n};\nexport function stripAndRedirectConfig(config) {\n config = duplicate(config);\n for (const prop of VL_ONLY_CONFIG_PROPERTIES) {\n delete config[prop];\n }\n if (config.axis) {\n // delete condition axis config\n for (const prop in config.axis) {\n if (isConditionalAxisValue(config.axis[prop])) {\n delete config.axis[prop];\n }\n }\n }\n if (config.legend) {\n for (const prop of VL_ONLY_LEGEND_CONFIG) {\n delete config.legend[prop];\n }\n }\n // Remove Vega-Lite only generic mark config\n if (config.mark) {\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config.mark[prop];\n }\n if (config.mark.tooltip && isObject(config.mark.tooltip)) {\n delete config.mark.tooltip;\n }\n }\n if (config.params) {\n config.signals = (config.signals || []).concat(assembleParameterSignals(config.params));\n delete config.params;\n }\n for (const markType of MARK_STYLES) {\n // Remove Vega-Lite-only mark config\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config[markType][prop];\n }\n // Remove Vega-Lite only mark-specific config\n const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType];\n if (vlOnlyMarkSpecificConfigs) {\n for (const prop of vlOnlyMarkSpecificConfigs) {\n delete config[markType][prop];\n }\n }\n // Redirect mark config to config.style so that mark config only affect its own mark type\n // without affecting other marks that share the same underlying Vega marks.\n // For example, config.rect should not affect bar marks.\n redirectConfigToStyleConfig(config, markType);\n }\n for (const m of getAllCompositeMarks()) {\n // Clean up the composite mark config as we don't need them in the output specs anymore\n delete config[m];\n }\n redirectTitleConfig(config);\n // Remove empty config objects.\n for (const prop in config) {\n if (isObject(config[prop]) && isEmpty(config[prop])) {\n delete config[prop];\n }\n }\n return isEmpty(config) ? undefined : config;\n}\n/**\n *\n * Redirect config.title -- so that title config do not affect header labels,\n * which also uses `title` directive to implement.\n *\n * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles.\n */\nfunction redirectTitleConfig(config) {\n const { titleMarkConfig, subtitleMarkConfig, subtitle } = extractTitleConfig(config.title);\n // set config.style if title/subtitleMarkConfig is not an empty object\n if (!isEmpty(titleMarkConfig)) {\n config.style['group-title'] = {\n ...config.style['group-title'],\n ...titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega\n };\n }\n if (!isEmpty(subtitleMarkConfig)) {\n config.style['group-subtitle'] = {\n ...config.style['group-subtitle'],\n ...subtitleMarkConfig\n };\n }\n // subtitle part can stay in config.title since header titles do not use subtitle\n if (!isEmpty(subtitle)) {\n config.title = subtitle;\n }\n else {\n delete config.title;\n }\n}\nfunction redirectConfigToStyleConfig(config, prop, // string = composite mark\ntoProp, compositeMarkPart) {\n const propConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop];\n if (prop === 'view') {\n toProp = 'cell'; // View's default style is \"cell\"\n }\n const style = {\n ...propConfig,\n ...config.style[toProp ?? prop]\n };\n // set config.style if it is not an empty object\n if (!isEmpty(style)) {\n config.style[toProp ?? prop] = style;\n }\n if (!compositeMarkPart) {\n // For composite mark, so don't delete the whole config yet as we have to do multiple redirections.\n delete config[prop];\n }\n}\n//# sourceMappingURL=config.js.map","export function isLayerSpec(spec) {\n return 'layer' in spec;\n}\n//# sourceMappingURL=layer.js.map","import * as log from '../log';\nimport { isConcatSpec, isHConcatSpec, isVConcatSpec } from './concat';\nimport { isFacetSpec } from './facet';\nimport { isLayerSpec } from './layer';\nimport { isRepeatSpec } from './repeat';\nimport { isUnitSpec } from './unit';\nexport class SpecMapper {\n map(spec, params) {\n if (isFacetSpec(spec)) {\n return this.mapFacet(spec, params);\n }\n else if (isRepeatSpec(spec)) {\n return this.mapRepeat(spec, params);\n }\n else if (isHConcatSpec(spec)) {\n return this.mapHConcat(spec, params);\n }\n else if (isVConcatSpec(spec)) {\n return this.mapVConcat(spec, params);\n }\n else if (isConcatSpec(spec)) {\n return this.mapConcat(spec, params);\n }\n else {\n return this.mapLayerOrUnit(spec, params);\n }\n }\n mapLayerOrUnit(spec, params) {\n if (isLayerSpec(spec)) {\n return this.mapLayer(spec, params);\n }\n else if (isUnitSpec(spec)) {\n return this.mapUnit(spec, params);\n }\n throw new Error(log.message.invalidSpec(spec));\n }\n mapLayer(spec, params) {\n return {\n ...spec,\n layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params))\n };\n }\n mapHConcat(spec, params) {\n return {\n ...spec,\n hconcat: spec.hconcat.map(subspec => this.map(subspec, params))\n };\n }\n mapVConcat(spec, params) {\n return {\n ...spec,\n vconcat: spec.vconcat.map(subspec => this.map(subspec, params))\n };\n }\n mapConcat(spec, params) {\n const { concat, ...rest } = spec;\n return {\n ...rest,\n concat: concat.map(subspec => this.map(subspec, params))\n };\n }\n mapFacet(spec, params) {\n return {\n // as any is required here since TS cannot infer that FO may only be FieldName or Field, but not RepeatRef\n ...spec,\n // TODO: remove \"any\" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760\n spec: this.map(spec.spec, params)\n };\n }\n mapRepeat(spec, params) {\n return {\n ...spec,\n // as any is required here since TS cannot infer that the output type satisfies the input type\n spec: this.map(spec.spec, params)\n };\n }\n}\n//# sourceMappingURL=map.js.map","import { isArray } from 'vega-util';\nexport function isRepeatSpec(spec) {\n return 'repeat' in spec;\n}\nexport function isLayerRepeatSpec(spec) {\n return !isArray(spec.repeat) && spec.repeat['layer'];\n}\n//# sourceMappingURL=repeat.js.map","import { array, isBoolean } from 'vega-util';\nimport { SUM_OPS } from './aggregate';\nimport { getSecondaryRangeChannel, NONPOSITION_CHANNELS } from './channel';\nimport { channelDefType, getFieldDef, isFieldDef, isFieldOrDatumDef, vgField } from './channeldef';\nimport { channelHasField, isAggregate } from './encoding';\nimport * as log from './log';\nimport { ARC, AREA, BAR, CIRCLE, isMarkDef, isPathMark, LINE, POINT, RULE, SQUARE, TEXT, TICK } from './mark';\nimport { ScaleType } from './scale';\nconst STACK_OFFSET_INDEX = {\n zero: 1,\n center: 1,\n normalize: 1\n};\nexport function isStackOffset(s) {\n return s in STACK_OFFSET_INDEX;\n}\nexport const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]);\nexport const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]);\nfunction isUnbinnedQuantitative(channelDef) {\n return isFieldDef(channelDef) && channelDefType(channelDef) === 'quantitative' && !channelDef.bin;\n}\nfunction potentialStackedChannel(encoding, x, { orient, type: mark }) {\n const y = x === 'x' ? 'y' : 'radius';\n const isCartesianBarOrArea = x === 'x' && ['bar', 'area'].includes(mark);\n const xDef = encoding[x];\n const yDef = encoding[y];\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n if (isUnbinnedQuantitative(xDef) && isUnbinnedQuantitative(yDef)) {\n if (xDef.stack) {\n return x;\n }\n else if (yDef.stack) {\n return y;\n }\n const xAggregate = isFieldDef(xDef) && !!xDef.aggregate;\n const yAggregate = isFieldDef(yDef) && !!yDef.aggregate;\n // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y\n if (xAggregate !== yAggregate) {\n return xAggregate ? x : y;\n }\n if (isCartesianBarOrArea) {\n if (orient === 'vertical') {\n return y;\n }\n else if (orient === 'horizontal') {\n return x;\n }\n }\n }\n else if (isUnbinnedQuantitative(xDef)) {\n return x;\n }\n else if (isUnbinnedQuantitative(yDef)) {\n return y;\n }\n }\n else if (isUnbinnedQuantitative(xDef)) {\n if (isCartesianBarOrArea && orient === 'vertical') {\n return undefined;\n }\n return x;\n }\n else if (isUnbinnedQuantitative(yDef)) {\n if (isCartesianBarOrArea && orient === 'horizontal') {\n return undefined;\n }\n return y;\n }\n return undefined;\n}\nfunction getDimensionChannel(channel) {\n switch (channel) {\n case 'x':\n return 'y';\n case 'y':\n return 'x';\n case 'theta':\n return 'radius';\n case 'radius':\n return 'theta';\n }\n}\nexport function stack(m, encoding) {\n const markDef = isMarkDef(m) ? m : { type: m };\n const mark = markDef.type;\n // Should have stackable mark\n if (!STACKABLE_MARKS.has(mark)) {\n return null;\n }\n // Run potential stacked twice, one for Cartesian and another for Polar,\n // so text marks can be stacked in any of the coordinates.\n // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking.\n // However, since we probably never want to do that, let's just note the limitation here.\n const fieldChannel = potentialStackedChannel(encoding, 'x', markDef) || potentialStackedChannel(encoding, 'theta', markDef);\n if (!fieldChannel) {\n return null;\n }\n const stackedFieldDef = encoding[fieldChannel];\n const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined;\n const dimensionChannel = getDimensionChannel(fieldChannel);\n const groupbyChannels = [];\n const groupbyFields = new Set();\n if (encoding[dimensionChannel]) {\n const dimensionDef = encoding[dimensionChannel];\n const dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined;\n if (dimensionField && dimensionField !== stackedField) {\n // avoid grouping by the stacked field\n groupbyChannels.push(dimensionChannel);\n groupbyFields.add(dimensionField);\n }\n }\n const dimensionOffsetChannel = dimensionChannel === 'x' ? 'xOffset' : 'yOffset';\n const dimensionOffsetDef = encoding[dimensionOffsetChannel];\n const dimensionOffsetField = isFieldDef(dimensionOffsetDef) ? vgField(dimensionOffsetDef, {}) : undefined;\n if (dimensionOffsetField && dimensionOffsetField !== stackedField) {\n // avoid grouping by the stacked field\n groupbyChannels.push(dimensionOffsetChannel);\n groupbyFields.add(dimensionOffsetField);\n }\n // If the dimension has offset, don't stack anymore\n // Should have grouping level of detail that is different from the dimension field\n const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => {\n // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001)\n if (channel !== 'tooltip' && channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n for (const cDef of array(channelDef)) {\n const fieldDef = getFieldDef(cDef);\n if (fieldDef.aggregate) {\n continue;\n }\n // Check whether the channel's field is identical to x/y's field or if the channel is a repeat\n const f = vgField(fieldDef, {});\n if (\n // if fielddef is a repeat, just include it in the stack by\n !f ||\n // otherwise, the field must be different from the groupBy fields.\n !groupbyFields.has(f)) {\n sc.push({ channel, fieldDef });\n }\n }\n }\n return sc;\n }, []);\n // Automatically determine offset\n let offset;\n if (stackedFieldDef.stack !== undefined) {\n if (isBoolean(stackedFieldDef.stack)) {\n offset = stackedFieldDef.stack ? 'zero' : null;\n }\n else {\n offset = stackedFieldDef.stack;\n }\n }\n else if (STACK_BY_DEFAULT_MARKS.has(mark)) {\n offset = 'zero';\n }\n if (!offset || !isStackOffset(offset)) {\n return null;\n }\n if (isAggregate(encoding) && stackBy.length === 0) {\n return null;\n }\n // warn when stacking non-linear\n if (stackedFieldDef?.scale?.type && stackedFieldDef?.scale?.type !== ScaleType.LINEAR) {\n if (stackedFieldDef?.stack) {\n log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type));\n }\n return null;\n }\n // Check if it is a ranged mark\n if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) {\n if (stackedFieldDef.stack !== undefined) {\n log.warn(log.message.cannotStackRangedMark(fieldChannel));\n }\n return null;\n }\n // Warn if stacking non-summative aggregate\n if (isFieldDef(stackedFieldDef) &&\n stackedFieldDef.aggregate &&\n !SUM_OPS.has(stackedFieldDef.aggregate)) {\n log.warn(log.message.stackNonSummativeAggregate(stackedFieldDef.aggregate));\n }\n return {\n groupbyChannels,\n groupbyFields,\n fieldChannel,\n impute: stackedFieldDef.impute === null ? false : isPathMark(mark),\n stackBy,\n offset\n };\n}\n//# sourceMappingURL=stack.js.map","import { isBinned, isBinning } from '../../bin';\nimport { isFieldDef, isNumericDataDef, isUnbinnedQuantitativeFieldOrDatumDef, isTypedFieldDef } from '../../channeldef';\nimport { isAggregate } from '../../encoding';\nimport { replaceExprRef } from '../../expr';\nimport * as log from '../../log';\nimport { AREA, BAR, BAR_CORNER_RADIUS_INDEX as BAR_CORNER_RADIUS_END_INDEX, CIRCLE, IMAGE, LINE, POINT, RECT, RULE, SQUARE, TEXT, TICK } from '../../mark';\nimport { QUANTITATIVE, TEMPORAL } from '../../type';\nimport { contains, getFirstDefined } from '../../util';\nimport { getMarkConfig, getMarkPropOrConfig } from '../common';\nexport function initMarkdef(originalMarkDef, encoding, config) {\n // FIXME: markDef expects that exprRefs are replaced recursively but replaceExprRef only replaces the top level\n const markDef = replaceExprRef(originalMarkDef);\n // set orient, which can be overridden by rules as sometimes the specified orient is invalid.\n const specifiedOrient = getMarkPropOrConfig('orient', markDef, config);\n markDef.orient = orient(markDef.type, encoding, specifiedOrient);\n if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) {\n log.warn(log.message.orientOverridden(markDef.orient, specifiedOrient));\n }\n if (markDef.type === 'bar' && markDef.orient) {\n const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config);\n if (cornerRadiusEnd !== undefined) {\n const newProps = (markDef.orient === 'horizontal' && encoding.x2) || (markDef.orient === 'vertical' && encoding.y2)\n ? ['cornerRadius']\n : BAR_CORNER_RADIUS_END_INDEX[markDef.orient];\n for (const newProp of newProps) {\n markDef[newProp] = cornerRadiusEnd;\n }\n if (markDef.cornerRadiusEnd !== undefined) {\n delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius\n }\n }\n }\n // set opacity and filled if not specified in mark config\n const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config);\n if (specifiedOpacity === undefined) {\n markDef.opacity = opacity(markDef.type, encoding);\n }\n // set cursor, which should be pointer if href channel is present unless otherwise specified\n const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config);\n if (specifiedCursor === undefined) {\n markDef.cursor = cursor(markDef, encoding, config);\n }\n return markDef;\n}\nfunction cursor(markDef, encoding, config) {\n if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) {\n return 'pointer';\n }\n return markDef.cursor;\n}\nfunction opacity(mark, encoding) {\n if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) {\n // point-based marks\n if (!isAggregate(encoding)) {\n return 0.7;\n }\n }\n return undefined;\n}\nexport function defaultFilled(markDef, config, { graticule }) {\n if (graticule) {\n return false;\n }\n const filledConfig = getMarkConfig('filled', markDef, config);\n const mark = markDef.type;\n return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE);\n}\nfunction orient(mark, encoding, specifiedOrient) {\n switch (mark) {\n case POINT:\n case CIRCLE:\n case SQUARE:\n case TEXT:\n case RECT:\n case IMAGE:\n // orient is meaningless for these marks.\n return undefined;\n }\n const { x, y, x2, y2 } = encoding;\n switch (mark) {\n case BAR:\n if (isFieldDef(x) && (isBinned(x.bin) || (isFieldDef(y) && y.aggregate && !x.aggregate))) {\n return 'vertical';\n }\n if (isFieldDef(y) && (isBinned(y.bin) || (isFieldDef(x) && x.aggregate && !y.aggregate))) {\n return 'horizontal';\n }\n if (y2 || x2) {\n // Ranged bar does not always have clear orientation, so we allow overriding\n if (specifiedOrient) {\n return specifiedOrient;\n }\n // If y is range and x is non-range, non-bin Q\n if (!x2) {\n if ((isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) || isNumericDataDef(x)) {\n if (isFieldDef(y) && isBinned(y.bin)) {\n return 'horizontal';\n }\n }\n return 'vertical';\n }\n // If x is range and y is non-range, non-bin Q\n if (!y2) {\n if ((isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) || isNumericDataDef(y)) {\n if (isFieldDef(x) && isBinned(x.bin)) {\n return 'vertical';\n }\n }\n return 'horizontal';\n }\n }\n // falls through\n case RULE:\n // return undefined for line segment rule and bar with both axis ranged\n // we have to ignore the case that the data are already binned\n if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) {\n return undefined;\n }\n // falls through\n case AREA:\n // If there are range for both x and y, y (vertical) has higher precedence.\n if (y2) {\n if (isFieldDef(y) && isBinned(y.bin)) {\n return 'horizontal';\n }\n else {\n return 'vertical';\n }\n }\n else if (x2) {\n if (isFieldDef(x) && isBinned(x.bin)) {\n return 'vertical';\n }\n else {\n return 'horizontal';\n }\n }\n else if (mark === RULE) {\n if (x && !y) {\n return 'vertical';\n }\n else if (y && !x) {\n return 'horizontal';\n }\n }\n // falls through\n case LINE:\n case TICK: {\n const xIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(x);\n const yIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(y);\n if (specifiedOrient) {\n return specifiedOrient;\n }\n else if (xIsMeasure && !yIsMeasure) {\n // Tick is opposite to bar, line, area\n return mark !== 'tick' ? 'horizontal' : 'vertical';\n }\n else if (!xIsMeasure && yIsMeasure) {\n // Tick is opposite to bar, line, area\n return mark !== 'tick' ? 'vertical' : 'horizontal';\n }\n else if (xIsMeasure && yIsMeasure) {\n return 'vertical';\n }\n else {\n const xIsTemporal = isTypedFieldDef(x) && x.type === TEMPORAL;\n const yIsTemporal = isTypedFieldDef(y) && y.type === TEMPORAL;\n // x: T, y: N --> vertical tick\n if (xIsTemporal && !yIsTemporal) {\n return 'vertical';\n }\n else if (!xIsTemporal && yIsTemporal) {\n return 'horizontal';\n }\n }\n return undefined;\n }\n }\n return 'vertical';\n}\n//# sourceMappingURL=init.js.map","import { isObject } from 'vega-util';\nimport { normalizeEncoding } from '../encoding';\nimport { isMarkDef } from '../mark';\nimport { isUnitSpec } from '../spec/unit';\nimport { stack } from '../stack';\nimport { keys, omit, pick } from '../util';\nimport { initMarkdef } from '../compile/mark/init';\nfunction dropLineAndPoint(markDef) {\n const { point: _point, line: _line, ...mark } = markDef;\n return keys(mark).length > 1 ? mark : mark.type;\n}\nfunction dropLineAndPointFromConfig(config) {\n for (const mark of ['line', 'area', 'rule', 'trail']) {\n if (config[mark]) {\n config = {\n ...config,\n // TODO: remove as any\n [mark]: omit(config[mark], ['point', 'line'])\n };\n }\n }\n return config;\n}\nfunction getPointOverlay(markDef, markConfig = {}, encoding) {\n if (markDef.point === 'transparent') {\n return { opacity: 0 };\n }\n else if (markDef.point) {\n // truthy : true or object\n return isObject(markDef.point) ? markDef.point : {};\n }\n else if (markDef.point !== undefined) {\n // false or null\n return null;\n }\n else {\n // undefined (not disabled)\n if (markConfig.point || encoding.shape) {\n // enable point overlay if config[mark].point is truthy or if encoding.shape is provided\n return isObject(markConfig.point) ? markConfig.point : {};\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\nfunction getLineOverlay(markDef, markConfig = {}) {\n if (markDef.line) {\n // true or object\n return markDef.line === true ? {} : markDef.line;\n }\n else if (markDef.line !== undefined) {\n // false or null\n return null;\n }\n else {\n // undefined (not disabled)\n if (markConfig.line) {\n // enable line overlay if config[mark].line is truthy\n return markConfig.line === true ? {} : markConfig.line;\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\nexport class PathOverlayNormalizer {\n constructor() {\n this.name = 'path-overlay';\n }\n hasMatchingType(spec, config) {\n if (isUnitSpec(spec)) {\n const { mark, encoding } = spec;\n const markDef = isMarkDef(mark) ? mark : { type: mark };\n switch (markDef.type) {\n case 'line':\n case 'rule':\n case 'trail':\n return !!getPointOverlay(markDef, config[markDef.type], encoding);\n case 'area':\n return (\n // false / null are also included as we want to remove the properties\n !!getPointOverlay(markDef, config[markDef.type], encoding) ||\n !!getLineOverlay(markDef, config[markDef.type]));\n }\n }\n return false;\n }\n run(spec, normParams, normalize) {\n const { config } = normParams;\n const { params, projection, mark, name, encoding: e, ...outerSpec } = spec;\n // Need to call normalizeEncoding because we need the inferred types to correctly determine stack\n const encoding = normalizeEncoding(e, config);\n const markDef = isMarkDef(mark) ? mark : { type: mark };\n const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding);\n const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]);\n const layer = [\n {\n name,\n ...(params ? { params } : {}),\n mark: dropLineAndPoint({\n // TODO: extract this 0.7 to be shared with default opacity for point/tick/...\n ...(markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined\n ? { opacity: 0.7 }\n : {}),\n ...markDef\n }),\n // drop shape from encoding as this might be used to trigger point overlay\n encoding: omit(encoding, ['shape'])\n }\n ];\n // FIXME: determine rules for applying selections.\n // Need to copy stack config to overlayed layer\n // FIXME: normalizer shouldn't call `initMarkdef`, a method from an init phase.\n const stackProps = stack(initMarkdef(markDef, encoding, config), encoding);\n let overlayEncoding = encoding;\n if (stackProps) {\n const { fieldChannel: stackFieldChannel, offset } = stackProps;\n overlayEncoding = {\n ...encoding,\n [stackFieldChannel]: {\n ...encoding[stackFieldChannel],\n ...(offset ? { stack: offset } : {})\n }\n };\n }\n // overlay line layer should be on the edge of area but passing y2/x2 makes\n // it as \"rule\" mark so that it draws unwanted vertical/horizontal lines.\n // point overlay also should not have y2/x2 as it does not support.\n overlayEncoding = omit(overlayEncoding, ['y2', 'x2']);\n if (lineOverlay) {\n layer.push({\n ...(projection ? { projection } : {}),\n mark: {\n type: 'line',\n ...pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip']),\n ...lineOverlay\n },\n encoding: overlayEncoding\n });\n }\n if (pointOverlay) {\n layer.push({\n ...(projection ? { projection } : {}),\n mark: {\n type: 'point',\n opacity: 1,\n filled: true,\n ...pick(markDef, ['clip', 'tooltip']),\n ...pointOverlay\n },\n encoding: overlayEncoding\n });\n }\n return normalize({\n ...outerSpec,\n layer\n }, {\n ...normParams,\n config: dropLineAndPointFromConfig(config)\n });\n }\n}\n//# sourceMappingURL=pathoverlay.js.map","import { hasOwnProperty, isArray } from 'vega-util';\nimport { hasConditionalFieldOrDatumDef, isConditionalDef, isFieldDef, isFieldOrDatumDef, isRepeatRef, isSortableFieldDef } from '../channeldef';\nimport * as log from '../log';\nimport { isSortField } from '../sort';\nimport { isFacetMapping } from '../spec/facet';\nexport function replaceRepeaterInFacet(facet, repeater) {\n if (!repeater) {\n return facet;\n }\n if (isFacetMapping(facet)) {\n return replaceRepeaterInMapping(facet, repeater);\n }\n return replaceRepeaterInFieldDef(facet, repeater);\n}\nexport function replaceRepeaterInEncoding(encoding, repeater) {\n if (!repeater) {\n return encoding;\n }\n return replaceRepeaterInMapping(encoding, repeater);\n}\n/**\n * Replaces repeated value and returns if the repeated value is valid.\n */\nfunction replaceRepeatInProp(prop, o, repeater) {\n const val = o[prop];\n if (isRepeatRef(val)) {\n if (val.repeat in repeater) {\n return { ...o, [prop]: repeater[val.repeat] };\n }\n else {\n log.warn(log.message.noSuchRepeatedValue(val.repeat));\n return undefined;\n }\n }\n return o;\n}\n/**\n * Replace repeater values in a field def with the concrete field name.\n */\nfunction replaceRepeaterInFieldDef(fieldDef, repeater) {\n fieldDef = replaceRepeatInProp('field', fieldDef, repeater);\n if (fieldDef === undefined) {\n // the field def should be ignored\n return undefined;\n }\n else if (fieldDef === null) {\n return null;\n }\n if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) {\n const sort = replaceRepeatInProp('field', fieldDef.sort, repeater);\n fieldDef = {\n ...fieldDef,\n ...(sort ? { sort } : {})\n };\n }\n return fieldDef;\n}\nfunction replaceRepeaterInFieldOrDatumDef(def, repeater) {\n if (isFieldDef(def)) {\n return replaceRepeaterInFieldDef(def, repeater);\n }\n else {\n const datumDef = replaceRepeatInProp('datum', def, repeater);\n if (datumDef !== def && !datumDef.type) {\n datumDef.type = 'nominal';\n }\n return datumDef;\n }\n}\nfunction replaceRepeaterInChannelDef(channelDef, repeater) {\n if (isFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater);\n if (fd) {\n return fd;\n }\n else if (isConditionalDef(channelDef)) {\n return { condition: channelDef.condition };\n }\n }\n else {\n if (hasConditionalFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater);\n if (fd) {\n return {\n ...channelDef,\n condition: fd\n };\n }\n else {\n const { condition, ...channelDefWithoutCondition } = channelDef;\n return channelDefWithoutCondition;\n }\n }\n return channelDef;\n }\n return undefined;\n}\nfunction replaceRepeaterInMapping(mapping, repeater) {\n const out = {};\n for (const channel in mapping) {\n if (hasOwnProperty(mapping, channel)) {\n const channelDef = mapping[channel];\n if (isArray(channelDef)) {\n // array cannot have condition\n out[channel] = channelDef // somehow we need to cast it here\n .map(cd => replaceRepeaterInChannelDef(cd, repeater))\n .filter(cd => cd);\n }\n else {\n const cd = replaceRepeaterInChannelDef(channelDef, repeater);\n if (cd !== undefined) {\n out[channel] = cd;\n }\n }\n }\n }\n return out;\n}\n//# sourceMappingURL=repeater.js.map","import { isObject } from 'vega-util';\nimport { isBinned } from '../bin';\nimport { getMainRangeChannel, SECONDARY_RANGE_CHANNEL } from '../channel';\nimport { isDatumDef, isFieldDef } from '../channeldef';\nimport * as log from '../log';\nimport { isMarkDef } from '../mark';\nimport { isUnitSpec } from '../spec/unit';\nexport class RuleForRangedLineNormalizer {\n constructor() {\n this.name = 'RuleForRangedLine';\n }\n hasMatchingType(spec) {\n if (isUnitSpec(spec)) {\n const { encoding, mark } = spec;\n if (mark === 'line' || (isMarkDef(mark) && mark.type === 'line')) {\n for (const channel of SECONDARY_RANGE_CHANNEL) {\n const mainChannel = getMainRangeChannel(channel);\n const mainChannelDef = encoding[mainChannel];\n if (encoding[channel]) {\n if ((isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) || isDatumDef(mainChannelDef)) {\n return true;\n }\n }\n }\n }\n }\n return false;\n }\n run(spec, params, normalize) {\n const { encoding, mark } = spec;\n log.warn(log.message.lineWithRange(!!encoding.x2, !!encoding.y2));\n return normalize({\n ...spec,\n mark: isObject(mark) ? { ...mark, type: 'rule' } : 'rule'\n }, params);\n }\n}\n//# sourceMappingURL=ruleforrangedline.js.map","import { isArray } from 'vega-util';\nimport { COLUMN, FACET, ROW } from '../channel';\nimport { hasConditionalFieldOrDatumDef, isFieldOrDatumDef, isValueDef } from '../channeldef';\nimport { boxPlotNormalizer } from '../compositemark/boxplot';\nimport { errorBandNormalizer } from '../compositemark/errorband';\nimport { errorBarNormalizer } from '../compositemark/errorbar';\nimport { channelHasField } from '../encoding';\nimport * as log from '../log';\nimport { isFacetMapping } from '../spec/facet';\nimport { SpecMapper } from '../spec/map';\nimport { isLayerRepeatSpec } from '../spec/repeat';\nimport { isUnitSpec } from '../spec/unit';\nimport { isEmpty, keys, omit, varName } from '../util';\nimport { isSignalRef } from '../vega.schema';\nimport { PathOverlayNormalizer } from './pathoverlay';\nimport { replaceRepeaterInEncoding, replaceRepeaterInFacet } from './repeater';\nimport { RuleForRangedLineNormalizer } from './ruleforrangedline';\nexport class CoreNormalizer extends SpecMapper {\n constructor() {\n super(...arguments);\n this.nonFacetUnitNormalizers = [\n boxPlotNormalizer,\n errorBarNormalizer,\n errorBandNormalizer,\n new PathOverlayNormalizer(),\n new RuleForRangedLineNormalizer()\n ];\n }\n map(spec, params) {\n // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec.\n if (isUnitSpec(spec)) {\n const hasRow = channelHasField(spec.encoding, ROW);\n const hasColumn = channelHasField(spec.encoding, COLUMN);\n const hasFacet = channelHasField(spec.encoding, FACET);\n if (hasRow || hasColumn || hasFacet) {\n return this.mapFacetedUnit(spec, params);\n }\n }\n return super.map(spec, params);\n }\n // This is for normalizing non-facet unit\n mapUnit(spec, params) {\n const { parentEncoding, parentProjection } = params;\n const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater);\n const specWithReplacedEncoding = {\n ...spec,\n ...(spec.name ? { name: [params.repeaterPrefix, spec.name].filter(n => n).join('_') } : {}),\n ...(encoding ? { encoding } : {})\n };\n if (parentEncoding || parentProjection) {\n return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params);\n }\n const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this);\n for (const unitNormalizer of this.nonFacetUnitNormalizers) {\n if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) {\n return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit);\n }\n }\n return specWithReplacedEncoding;\n }\n mapRepeat(spec, params) {\n if (isLayerRepeatSpec(spec)) {\n return this.mapLayerRepeat(spec, params);\n }\n else {\n return this.mapNonLayerRepeat(spec, params);\n }\n }\n mapLayerRepeat(spec, params) {\n const { repeat, spec: childSpec, ...rest } = spec;\n const { row, column, layer } = repeat;\n const { repeater = {}, repeaterPrefix = '' } = params;\n if (row || column) {\n return this.mapRepeat({\n ...spec,\n repeat: {\n ...(row ? { row } : {}),\n ...(column ? { column } : {})\n },\n spec: {\n repeat: { layer },\n spec: childSpec\n }\n }, params);\n }\n else {\n return {\n ...rest,\n layer: layer.map(layerValue => {\n const childRepeater = {\n ...repeater,\n layer: layerValue\n };\n const childName = `${(childSpec.name ? `${childSpec.name}_` : '') + repeaterPrefix}child__layer_${varName(layerValue)}`;\n const child = this.mapLayerOrUnit(childSpec, { ...params, repeater: childRepeater, repeaterPrefix: childName });\n child.name = childName;\n return child;\n })\n };\n }\n }\n mapNonLayerRepeat(spec, params) {\n const { repeat, spec: childSpec, data, ...remainingProperties } = spec;\n if (!isArray(repeat) && spec.columns) {\n // is repeat with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('repeat'));\n }\n const concat = [];\n const { repeater = {}, repeaterPrefix = '' } = params;\n const row = (!isArray(repeat) && repeat.row) || [repeater ? repeater.row : null];\n const column = (!isArray(repeat) && repeat.column) || [repeater ? repeater.column : null];\n const repeatValues = (isArray(repeat) && repeat) || [repeater ? repeater.repeat : null];\n // cross product\n for (const repeatValue of repeatValues) {\n for (const rowValue of row) {\n for (const columnValue of column) {\n const childRepeater = {\n repeat: repeatValue,\n row: rowValue,\n column: columnValue,\n layer: repeater.layer\n };\n const childName = (childSpec.name ? `${childSpec.name}_` : '') +\n repeaterPrefix +\n 'child__' +\n (isArray(repeat)\n ? `${varName(repeatValue)}`\n : (repeat.row ? `row_${varName(rowValue)}` : '') +\n (repeat.column ? `column_${varName(columnValue)}` : ''));\n const child = this.map(childSpec, { ...params, repeater: childRepeater, repeaterPrefix: childName });\n child.name = childName;\n // we move data up\n concat.push(omit(child, ['data']));\n }\n }\n }\n const columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1;\n return {\n data: childSpec.data ?? data,\n align: 'all',\n ...remainingProperties,\n columns,\n concat\n };\n }\n mapFacet(spec, params) {\n const { facet } = spec;\n if (isFacetMapping(facet) && spec.columns) {\n // is facet with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('facet'));\n }\n return super.mapFacet(spec, params);\n }\n mapUnitWithParentEncodingOrProjection(spec, params) {\n const { encoding, projection } = spec;\n const { parentEncoding, parentProjection, config } = params;\n const mergedProjection = mergeProjection({ parentProjection, projection });\n const mergedEncoding = mergeEncoding({\n parentEncoding,\n encoding: replaceRepeaterInEncoding(encoding, params.repeater)\n });\n return this.mapUnit({\n ...spec,\n ...(mergedProjection ? { projection: mergedProjection } : {}),\n ...(mergedEncoding ? { encoding: mergedEncoding } : {})\n }, { config });\n }\n mapFacetedUnit(spec, normParams) {\n // New encoding in the inside spec should not contain row / column\n // as row/column should be moved to facet\n const { row, column, facet, ...encoding } = spec.encoding;\n // Mark and encoding should be moved into the inner spec\n const { mark, width, projection, height, view, params, encoding: _, ...outerSpec } = spec;\n const { facetMapping, layout } = this.getFacetMappingAndLayout({ row, column, facet }, normParams);\n const newEncoding = replaceRepeaterInEncoding(encoding, normParams.repeater);\n return this.mapFacet({\n ...outerSpec,\n ...layout,\n // row / column has higher precedence than facet\n facet: facetMapping,\n spec: {\n ...(width ? { width } : {}),\n ...(height ? { height } : {}),\n ...(view ? { view } : {}),\n ...(projection ? { projection } : {}),\n mark,\n encoding: newEncoding,\n ...(params ? { params } : {})\n }\n }, normParams);\n }\n getFacetMappingAndLayout(facets, params) {\n const { row, column, facet } = facets;\n if (row || column) {\n if (facet) {\n log.warn(log.message.facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])]));\n }\n const facetMapping = {};\n const layout = {};\n for (const channel of [ROW, COLUMN]) {\n const def = facets[channel];\n if (def) {\n const { align, center, spacing, columns, ...defWithoutLayout } = def;\n facetMapping[channel] = defWithoutLayout;\n for (const prop of ['align', 'center', 'spacing']) {\n if (def[prop] !== undefined) {\n layout[prop] ?? (layout[prop] = {});\n layout[prop][channel] = def[prop];\n }\n }\n }\n }\n return { facetMapping, layout };\n }\n else {\n const { align, center, spacing, columns, ...facetMapping } = facet;\n return {\n facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater),\n layout: {\n ...(align ? { align } : {}),\n ...(center ? { center } : {}),\n ...(spacing ? { spacing } : {}),\n ...(columns ? { columns } : {})\n }\n };\n }\n }\n mapLayer(spec, { parentEncoding, parentProjection, ...otherParams }) {\n // Special handling for extended layer spec\n const { encoding, projection, ...rest } = spec;\n const params = {\n ...otherParams,\n parentEncoding: mergeEncoding({ parentEncoding, encoding, layer: true }),\n parentProjection: mergeProjection({ parentProjection, projection })\n };\n return super.mapLayer({\n ...rest,\n ...(spec.name ? { name: [params.repeaterPrefix, spec.name].filter(n => n).join('_') } : {})\n }, params);\n }\n}\nfunction mergeEncoding({ parentEncoding, encoding = {}, layer }) {\n let merged = {};\n if (parentEncoding) {\n const channels = new Set([...keys(parentEncoding), ...keys(encoding)]);\n for (const channel of channels) {\n const channelDef = encoding[channel];\n const parentChannelDef = parentEncoding[channel];\n if (isFieldOrDatumDef(channelDef)) {\n // Field/Datum Def can inherit properties from its parent\n // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one.\n const mergedChannelDef = {\n ...parentChannelDef,\n ...channelDef\n };\n merged[channel] = mergedChannelDef;\n }\n else if (hasConditionalFieldOrDatumDef(channelDef)) {\n merged[channel] = {\n ...channelDef,\n condition: {\n ...parentChannelDef,\n ...channelDef.condition\n }\n };\n }\n else if (channelDef || channelDef === null) {\n merged[channel] = channelDef;\n }\n else if (layer ||\n isValueDef(parentChannelDef) ||\n isSignalRef(parentChannelDef) ||\n isFieldOrDatumDef(parentChannelDef) ||\n isArray(parentChannelDef)) {\n merged[channel] = parentChannelDef;\n }\n }\n }\n else {\n merged = encoding;\n }\n return !merged || isEmpty(merged) ? undefined : merged;\n}\nfunction mergeProjection(opt) {\n const { parentProjection, projection } = opt;\n if (parentProjection && projection) {\n log.warn(log.message.projectionOverridden({ parentProjection, projection }));\n }\n return projection ?? parentProjection;\n}\n//# sourceMappingURL=core.js.map","import { normalizeLogicalComposition } from './logical';\nimport { normalizePredicate } from './predicate';\nexport function isFilter(t) {\n return 'filter' in t;\n}\nexport function isImputeSequence(t) {\n return t?.['stop'] !== undefined;\n}\nexport function isLookup(t) {\n return 'lookup' in t;\n}\nexport function isLookupData(from) {\n return 'data' in from;\n}\nexport function isLookupSelection(from) {\n return 'param' in from;\n}\nexport function isPivot(t) {\n return 'pivot' in t;\n}\nexport function isDensity(t) {\n return 'density' in t;\n}\nexport function isQuantile(t) {\n return 'quantile' in t;\n}\nexport function isRegression(t) {\n return 'regression' in t;\n}\nexport function isLoess(t) {\n return 'loess' in t;\n}\nexport function isSample(t) {\n return 'sample' in t;\n}\nexport function isWindow(t) {\n return 'window' in t;\n}\nexport function isJoinAggregate(t) {\n return 'joinaggregate' in t;\n}\nexport function isFlatten(t) {\n return 'flatten' in t;\n}\nexport function isCalculate(t) {\n return 'calculate' in t;\n}\nexport function isBin(t) {\n return 'bin' in t;\n}\nexport function isImpute(t) {\n return 'impute' in t;\n}\nexport function isTimeUnit(t) {\n return 'timeUnit' in t;\n}\nexport function isAggregate(t) {\n return 'aggregate' in t;\n}\nexport function isStack(t) {\n return 'stack' in t;\n}\nexport function isFold(t) {\n return 'fold' in t;\n}\nexport function isExtent(t) {\n return 'extent' in t && !('density' in t);\n}\nexport function normalizeTransform(transform) {\n return transform.map(t => {\n if (isFilter(t)) {\n return {\n filter: normalizeLogicalComposition(t.filter, normalizePredicate)\n };\n }\n return t;\n });\n}\n//# sourceMappingURL=transform.js.map","import { isArray } from 'vega';\nimport { isBinParams } from '../bin';\nimport { isConditionalDef, isFieldDef, isScaleFieldDef } from '../channeldef';\nimport { normalizeLogicalComposition } from '../logical';\nimport { SpecMapper } from '../spec/map';\nimport { isBin, isFilter, isLookup } from '../transform';\nimport { duplicate, entries, vals } from '../util';\nexport class SelectionCompatibilityNormalizer extends SpecMapper {\n map(spec, normParams) {\n normParams.emptySelections ?? (normParams.emptySelections = {});\n normParams.selectionPredicates ?? (normParams.selectionPredicates = {});\n spec = normalizeTransforms(spec, normParams);\n return super.map(spec, normParams);\n }\n mapLayerOrUnit(spec, normParams) {\n spec = normalizeTransforms(spec, normParams);\n if (spec.encoding) {\n const encoding = {};\n for (const [channel, enc] of entries(spec.encoding)) {\n encoding[channel] = normalizeChannelDef(enc, normParams);\n }\n spec = { ...spec, encoding };\n }\n return super.mapLayerOrUnit(spec, normParams);\n }\n mapUnit(spec, normParams) {\n const { selection, ...rest } = spec;\n if (selection) {\n return {\n ...rest,\n params: entries(selection).map(([name, selDef]) => {\n const { init: value, bind, empty, ...select } = selDef;\n if (select.type === 'single') {\n select.type = 'point';\n select.toggle = false;\n }\n else if (select.type === 'multi') {\n select.type = 'point';\n }\n // Propagate emptiness forwards and backwards\n normParams.emptySelections[name] = empty !== 'none';\n for (const pred of vals(normParams.selectionPredicates[name] ?? {})) {\n pred.empty = empty !== 'none';\n }\n return { name, value, select, bind };\n })\n };\n }\n return spec;\n }\n}\nfunction normalizeTransforms(spec, normParams) {\n const { transform: tx, ...rest } = spec;\n if (tx) {\n const transform = tx.map((t) => {\n if (isFilter(t)) {\n return { filter: normalizePredicate(t, normParams) };\n }\n else if (isBin(t) && isBinParams(t.bin)) {\n return {\n ...t,\n bin: normalizeBinExtent(t.bin)\n };\n }\n else if (isLookup(t)) {\n const { selection: param, ...from } = t.from;\n return param\n ? {\n ...t,\n from: { param, ...from }\n }\n : t;\n }\n return t;\n });\n return { ...rest, transform };\n }\n return spec;\n}\nfunction normalizeChannelDef(obj, normParams) {\n const enc = duplicate(obj);\n if (isFieldDef(enc) && isBinParams(enc.bin)) {\n enc.bin = normalizeBinExtent(enc.bin);\n }\n if (isScaleFieldDef(enc) && enc.scale?.domain?.selection) {\n const { selection: param, ...domain } = enc.scale.domain;\n enc.scale.domain = { ...domain, ...(param ? { param } : {}) };\n }\n if (isConditionalDef(enc)) {\n if (isArray(enc.condition)) {\n enc.condition = enc.condition.map((c) => {\n const { selection, param, test, ...cond } = c;\n return param ? c : { ...cond, test: normalizePredicate(c, normParams) };\n });\n }\n else {\n const { selection, param, test, ...cond } = normalizeChannelDef(enc.condition, normParams);\n enc.condition = param\n ? enc.condition\n : {\n ...cond,\n test: normalizePredicate(enc.condition, normParams)\n };\n }\n }\n return enc;\n}\nfunction normalizeBinExtent(bin) {\n const ext = bin.extent;\n if (ext?.selection) {\n const { selection: param, ...rest } = ext;\n return { ...bin, extent: { ...rest, param } };\n }\n return bin;\n}\nfunction normalizePredicate(op, normParams) {\n // Normalize old compositions of selection names (e.g., selection: {and: [\"one\", \"two\"]})\n const normalizeSelectionComposition = (o) => {\n return normalizeLogicalComposition(o, param => {\n var _a;\n const empty = normParams.emptySelections[param] ?? true;\n const pred = { param, empty };\n (_a = normParams.selectionPredicates)[param] ?? (_a[param] = []);\n normParams.selectionPredicates[param].push(pred);\n return pred;\n });\n };\n return op.selection\n ? normalizeSelectionComposition(op.selection)\n : normalizeLogicalComposition(op.test || op.filter, o => o.selection ? normalizeSelectionComposition(o.selection) : o);\n}\n//# sourceMappingURL=selectioncompat.js.map","import { isArray, isString } from 'vega';\nimport { isSelectionParameter } from '../selection';\nimport { isUnitSpec } from '../spec';\nimport { SpecMapper } from '../spec/map';\nexport class TopLevelSelectionsNormalizer extends SpecMapper {\n map(spec, normParams) {\n const selections = normParams.selections ?? [];\n if (spec.params && !isUnitSpec(spec)) {\n const params = [];\n for (const param of spec.params) {\n if (isSelectionParameter(param)) {\n selections.push(param);\n }\n else {\n params.push(param);\n }\n }\n spec.params = params;\n }\n normParams.selections = selections;\n return super.map(spec, normParams);\n }\n mapUnit(spec, normParams) {\n const selections = normParams.selections;\n if (!selections || !selections.length)\n return spec;\n const path = (normParams.path ?? []).concat(spec.name);\n const params = [];\n for (const selection of selections) {\n // By default, apply selections to all unit views.\n if (!selection.views || !selection.views.length) {\n params.push(selection);\n }\n else {\n for (const view of selection.views) {\n // view is either a specific unit name, or a partial path through the spec tree.\n if ((isString(view) && (view === spec.name || path.includes(view))) ||\n (isArray(view) &&\n // logic for backwards compatibility with view paths before we had unique names\n // @ts-ignore\n view.map(v => path.indexOf(v)).every((v, i, arr) => v !== -1 && (i === 0 || v > arr[i - 1])))) {\n params.push(selection);\n }\n }\n }\n }\n if (params.length)\n spec.params = params;\n return spec;\n }\n}\nfor (const method of ['mapFacet', 'mapRepeat', 'mapHConcat', 'mapVConcat', 'mapLayer']) {\n const proto = TopLevelSelectionsNormalizer.prototype[method];\n TopLevelSelectionsNormalizer.prototype[method] = function (spec, params) {\n return proto.call(this, spec, addSpecNameToParams(spec, params));\n };\n}\nfunction addSpecNameToParams(spec, params) {\n return spec.name\n ? {\n ...params,\n path: (params.path ?? []).concat(spec.name)\n }\n : params;\n}\n//# sourceMappingURL=toplevelselection.js.map","import { isString } from 'vega-util';\nimport { initConfig } from '../config';\nimport * as log from '../log';\nimport { isLayerSpec, isUnitSpec } from '../spec';\nimport { deepEqual } from '../util';\nimport { CoreNormalizer } from './core';\nimport { SelectionCompatibilityNormalizer } from './selectioncompat';\nimport { TopLevelSelectionsNormalizer } from './toplevelselection';\nexport function normalize(spec, config) {\n if (config === undefined) {\n config = initConfig(spec.config);\n }\n const normalizedSpec = normalizeGenericSpec(spec, config);\n const { width, height } = spec;\n const autosize = normalizeAutoSize(normalizedSpec, { width, height, autosize: spec.autosize }, config);\n return {\n ...normalizedSpec,\n ...(autosize ? { autosize } : {})\n };\n}\nconst coreNormalizer = new CoreNormalizer();\nconst selectionCompatNormalizer = new SelectionCompatibilityNormalizer();\nconst topLevelSelectionNormalizer = new TopLevelSelectionsNormalizer();\n/**\n * Decompose extended unit specs into composition of pure unit specs.\n * And push top-level selection definitions down to unit specs.\n */\nfunction normalizeGenericSpec(spec, config = {}) {\n const normParams = { config };\n return topLevelSelectionNormalizer.map(coreNormalizer.map(selectionCompatNormalizer.map(spec, normParams), normParams), normParams);\n}\nfunction _normalizeAutoSize(autosize) {\n return isString(autosize) ? { type: autosize } : autosize ?? {};\n}\n/**\n * Normalize autosize and deal with width or height == \"container\".\n */\nexport function normalizeAutoSize(spec, sizeInfo, config) {\n let { width, height } = sizeInfo;\n const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec);\n const autosizeDefault = {};\n if (!isFitCompatible) {\n // If spec is not compatible with autosize == \"fit\", discard width/height == container\n if (width == 'container') {\n log.warn(log.message.containerSizeNonSingle('width'));\n width = undefined;\n }\n if (height == 'container') {\n log.warn(log.message.containerSizeNonSingle('height'));\n height = undefined;\n }\n }\n else {\n // Default autosize parameters to fit when width/height is \"container\"\n if (width == 'container' && height == 'container') {\n autosizeDefault.type = 'fit';\n autosizeDefault.contains = 'padding';\n }\n else if (width == 'container') {\n autosizeDefault.type = 'fit-x';\n autosizeDefault.contains = 'padding';\n }\n else if (height == 'container') {\n autosizeDefault.type = 'fit-y';\n autosizeDefault.contains = 'padding';\n }\n }\n const autosize = {\n type: 'pad',\n ...autosizeDefault,\n ...(config ? _normalizeAutoSize(config.autosize) : {}),\n ..._normalizeAutoSize(spec.autosize)\n };\n if (autosize.type === 'fit' && !isFitCompatible) {\n log.warn(log.message.FIT_NON_SINGLE);\n autosize.type = 'pad';\n }\n if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('width'));\n }\n if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('height'));\n }\n // Delete autosize property if it's Vega's default\n if (deepEqual(autosize, { type: 'pad' })) {\n return undefined;\n }\n return autosize;\n}\n//# sourceMappingURL=index.js.map","import { getPositionScaleChannel } from '../channel';\nimport { signalRefOrValue } from '../compile/common';\nexport function isFitType(autoSizeType) {\n return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y';\n}\nexport function getFitType(sizeType) {\n return sizeType ? `fit-${getPositionScaleChannel(sizeType)}` : 'fit';\n}\nconst TOP_LEVEL_PROPERTIES = [\n 'background',\n 'padding'\n // We do not include \"autosize\" here as it is supported by only unit and layer specs and thus need to be normalized\n];\nexport function extractTopLevelProperties(t, includeParams) {\n const o = {};\n for (const p of TOP_LEVEL_PROPERTIES) {\n if (t && t[p] !== undefined) {\n o[p] = signalRefOrValue(t[p]);\n }\n }\n if (includeParams) {\n o.params = t.params;\n }\n return o;\n}\n//# sourceMappingURL=toplevel.js.map","import * as log from '../log';\nimport { deepEqual, duplicate, getFirstDefined, keys } from '../util';\n/**\n * Generic class for storing properties that are explicitly specified\n * and implicitly determined by the compiler.\n * This is important for scale/axis/legend merging as\n * we want to prioritize properties that users explicitly specified.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport class Split {\n constructor(explicit = {}, implicit = {}) {\n this.explicit = explicit;\n this.implicit = implicit;\n }\n clone() {\n return new Split(duplicate(this.explicit), duplicate(this.implicit));\n }\n combine() {\n return {\n ...this.explicit,\n ...this.implicit\n };\n }\n get(key) {\n // Explicit has higher precedence\n return getFirstDefined(this.explicit[key], this.implicit[key]);\n }\n getWithExplicit(key) {\n // Explicit has higher precedence\n if (this.explicit[key] !== undefined) {\n return { explicit: true, value: this.explicit[key] };\n }\n else if (this.implicit[key] !== undefined) {\n return { explicit: false, value: this.implicit[key] };\n }\n return { explicit: false, value: undefined };\n }\n setWithExplicit(key, { value, explicit }) {\n if (value !== undefined) {\n this.set(key, value, explicit);\n }\n }\n set(key, value, explicit) {\n delete this[explicit ? 'implicit' : 'explicit'][key];\n this[explicit ? 'explicit' : 'implicit'][key] = value;\n return this;\n }\n copyKeyFromSplit(key, { explicit, implicit }) {\n // Explicit has higher precedence\n if (explicit[key] !== undefined) {\n this.set(key, explicit[key], true);\n }\n else if (implicit[key] !== undefined) {\n this.set(key, implicit[key], false);\n }\n }\n copyKeyFromObject(key, s) {\n // Explicit has higher precedence\n if (s[key] !== undefined) {\n this.set(key, s[key], true);\n }\n }\n /**\n * Merge split object into this split object. Properties from the other split\n * overwrite properties from this split.\n */\n copyAll(other) {\n for (const key of keys(other.combine())) {\n const val = other.getWithExplicit(key);\n this.setWithExplicit(key, val);\n }\n }\n}\nexport function makeExplicit(value) {\n return {\n explicit: true,\n value\n };\n}\nexport function makeImplicit(value) {\n return {\n explicit: false,\n value\n };\n}\nexport function tieBreakByComparing(compare) {\n return (v1, v2, property, propertyOf) => {\n const diff = compare(v1.value, v2.value);\n if (diff > 0) {\n return v1;\n }\n else if (diff < 0) {\n return v2;\n }\n return defaultTieBreaker(v1, v2, property, propertyOf);\n };\n}\nexport function defaultTieBreaker(v1, v2, property, propertyOf) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, prefer v1.\n return v1;\n}\nexport function mergeValuesWithExplicit(v1, v2, property, propertyOf, tieBreaker = defaultTieBreaker) {\n if (v1 === undefined || v1.value === undefined) {\n // For first run\n return v2;\n }\n if (v1.explicit && !v2.explicit) {\n return v1;\n }\n else if (v2.explicit && !v1.explicit) {\n return v2;\n }\n else if (deepEqual(v1.value, v2.value)) {\n return v1;\n }\n else {\n return tieBreaker(v1, v2, property, propertyOf);\n }\n}\n//# sourceMappingURL=split.js.map","import { Split } from '../split';\n/**\n * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf)\n * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the\n * same field again (or differently).\n */\nexport class AncestorParse extends Split {\n constructor(explicit = {}, implicit = {}, parseNothing = false) {\n super(explicit, implicit);\n this.explicit = explicit;\n this.implicit = implicit;\n this.parseNothing = parseNothing;\n }\n clone() {\n const clone = super.clone();\n clone.parseNothing = this.parseNothing;\n return clone;\n }\n}\n//# sourceMappingURL=index.js.map","export function isUrlData(data) {\n return 'url' in data;\n}\nexport function isInlineData(data) {\n return 'values' in data;\n}\nexport function isNamedData(data) {\n return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data);\n}\nexport function isGenerator(data) {\n return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data));\n}\nexport function isSequenceGenerator(data) {\n return 'sequence' in data;\n}\nexport function isSphereGenerator(data) {\n return 'sphere' in data;\n}\nexport function isGraticuleGenerator(data) {\n return 'graticule' in data;\n}\nexport var DataSourceType;\n(function (DataSourceType) {\n DataSourceType[DataSourceType[\"Raw\"] = 0] = \"Raw\";\n DataSourceType[DataSourceType[\"Main\"] = 1] = \"Main\";\n DataSourceType[DataSourceType[\"Row\"] = 2] = \"Row\";\n DataSourceType[DataSourceType[\"Column\"] = 3] = \"Column\";\n DataSourceType[DataSourceType[\"Lookup\"] = 4] = \"Lookup\";\n})(DataSourceType || (DataSourceType = {}));\n//# sourceMappingURL=data.js.map","import { parseSelector } from 'vega-event-selector';\nimport { identity, isArray, stringValue } from 'vega-util';\nimport { MODIFY, STORE, unitName, VL_SELECTION_RESOLVE, TUPLE, selectionCompilers } from '.';\nimport { dateTimeToExpr, isDateTime, dateTimeToTimestamp } from '../../datetime';\nimport { hasContinuousDomain } from '../../scale';\nimport { SELECTION_ID } from '../../selection';\nimport { keys, replacePathInField, stringify, vals } from '../../util';\nimport { isUnitModel } from '../model';\nimport { parseSelectionExtent } from './parse';\nexport function assembleProjection(proj) {\n const { signals, hasLegend, index, ...rest } = proj;\n rest.field = replacePathInField(rest.field);\n return rest;\n}\nexport function assembleInit(init, isExpr = true, wrap = identity) {\n if (isArray(init)) {\n const assembled = init.map(v => assembleInit(v, isExpr, wrap));\n return isExpr ? `[${assembled.join(', ')}]` : assembled;\n }\n else if (isDateTime(init)) {\n if (isExpr) {\n return wrap(dateTimeToExpr(init));\n }\n else {\n return wrap(dateTimeToTimestamp(init));\n }\n }\n return isExpr ? wrap(stringify(init)) : init;\n}\nexport function assembleUnitSelectionSignals(model, signals) {\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const name = selCmpt.name;\n let modifyExpr = `${name}${TUPLE}, ${selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`}`;\n for (const c of selectionCompilers) {\n if (!c.defined(selCmpt))\n continue;\n if (c.signals)\n signals = c.signals(model, selCmpt, signals);\n if (c.modifyExpr)\n modifyExpr = c.modifyExpr(model, selCmpt, modifyExpr);\n }\n signals.push({\n name: name + MODIFY,\n on: [\n {\n events: { signal: selCmpt.name + TUPLE },\n update: `modify(${stringValue(selCmpt.name + STORE)}, ${modifyExpr})`\n }\n ]\n });\n }\n return cleanupEmptyOnArray(signals);\n}\nexport function assembleFacetSignals(model, signals) {\n if (model.component.selection && keys(model.component.selection).length) {\n const name = stringValue(model.getName('cell'));\n signals.unshift({\n name: 'facet',\n value: {},\n on: [\n {\n events: parseSelector('pointermove', 'scope'),\n update: `isTuple(facet) ? facet : group(${name}).datum`\n }\n ]\n });\n }\n return cleanupEmptyOnArray(signals);\n}\nexport function assembleTopLevelSignals(model, signals) {\n let hasSelections = false;\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const name = selCmpt.name;\n const store = stringValue(name + STORE);\n const hasSg = signals.filter(s => s.name === name);\n if (hasSg.length === 0) {\n const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve;\n const isPoint = selCmpt.type === 'point' ? ', true, true)' : ')';\n signals.push({\n name: selCmpt.name,\n update: `${VL_SELECTION_RESOLVE}(${store}, ${stringValue(resolve)}${isPoint}`\n });\n }\n hasSelections = true;\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.topLevelSignals) {\n signals = c.topLevelSignals(model, selCmpt, signals);\n }\n }\n }\n if (hasSelections) {\n const hasUnit = signals.filter(s => s.name === 'unit');\n if (hasUnit.length === 0) {\n signals.unshift({\n name: 'unit',\n value: {},\n on: [{ events: 'pointermove', update: 'isTuple(group()) ? group() : unit' }]\n });\n }\n }\n return cleanupEmptyOnArray(signals);\n}\nexport function assembleUnitSelectionData(model, data) {\n const dataCopy = [...data];\n const unit = unitName(model, { escape: false });\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const store = { name: selCmpt.name + STORE };\n if (selCmpt.project.hasSelectionId) {\n store.transform = [{ type: 'collect', sort: { field: SELECTION_ID } }];\n }\n if (selCmpt.init) {\n const fields = selCmpt.project.items.map(assembleProjection);\n store.values = selCmpt.project.hasSelectionId\n ? selCmpt.init.map(i => ({ unit, [SELECTION_ID]: assembleInit(i, false)[0] }))\n : selCmpt.init.map(i => ({ unit, fields, values: assembleInit(i, false) }));\n }\n const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE);\n if (!contains.length) {\n dataCopy.push(store);\n }\n }\n return dataCopy;\n}\nexport function assembleUnitSelectionMarks(model, marks) {\n for (const selCmpt of vals(model.component.selection ?? {})) {\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.marks) {\n marks = c.marks(model, selCmpt, marks);\n }\n }\n }\n return marks;\n}\nexport function assembleLayerSelectionMarks(model, marks) {\n for (const child of model.children) {\n if (isUnitModel(child)) {\n marks = assembleUnitSelectionMarks(child, marks);\n }\n }\n return marks;\n}\nexport function assembleSelectionScaleDomain(model, extent, scaleCmpt, domain) {\n const parsedExtent = parseSelectionExtent(model, extent.param, extent);\n return {\n signal: hasContinuousDomain(scaleCmpt.get('type')) && isArray(domain) && domain[0] > domain[1]\n ? `isValid(${parsedExtent}) && reverse(${parsedExtent})`\n : parsedExtent\n };\n}\nfunction cleanupEmptyOnArray(signals) {\n return signals.map(s => {\n if (s.on && !s.on.length)\n delete s.on;\n return s;\n });\n}\n//# sourceMappingURL=assemble.js.map","import * as log from '../../log';\nimport { uniqueId } from '../../util';\n/**\n * A node in the dataflow tree.\n */\nexport class DataFlowNode {\n constructor(parent, debugName) {\n this.debugName = debugName;\n this._children = [];\n this._parent = null;\n if (parent) {\n this.parent = parent;\n }\n }\n /**\n * Clone this node with a deep copy but don't clone links to children or parents.\n */\n clone() {\n throw new Error('Cannot clone node');\n }\n get parent() {\n return this._parent;\n }\n /**\n * Set the parent of the node and also add this node to the parent's children.\n */\n set parent(parent) {\n this._parent = parent;\n if (parent) {\n parent.addChild(this);\n }\n }\n get children() {\n return this._children;\n }\n numChildren() {\n return this._children.length;\n }\n addChild(child, loc) {\n // do not add the same child twice\n if (this._children.includes(child)) {\n log.warn(log.message.ADD_SAME_CHILD_TWICE);\n return;\n }\n if (loc !== undefined) {\n this._children.splice(loc, 0, child);\n }\n else {\n this._children.push(child);\n }\n }\n removeChild(oldChild) {\n const loc = this._children.indexOf(oldChild);\n this._children.splice(loc, 1);\n return loc;\n }\n /**\n * Remove node from the dataflow.\n */\n remove() {\n let loc = this._parent.removeChild(this);\n for (const child of this._children) {\n // do not use the set method because we want to insert at a particular location\n child._parent = this._parent;\n this._parent.addChild(child, loc++);\n }\n }\n /**\n * Insert another node as a parent of this node.\n */\n insertAsParentOf(other) {\n const parent = other.parent;\n parent.removeChild(this);\n this.parent = parent;\n other.parent = this;\n }\n swapWithParent() {\n const parent = this._parent;\n const newParent = parent.parent;\n // reconnect the children\n for (const child of this._children) {\n child.parent = parent;\n }\n // remove old links\n this._children = []; // equivalent to removing every child link one by one\n parent.removeChild(this);\n const loc = parent.parent.removeChild(parent);\n // swap two nodes but maintain order in children\n this._parent = newParent;\n newParent.addChild(this, loc);\n parent.parent = this;\n }\n}\nexport class OutputNode extends DataFlowNode {\n clone() {\n const cloneObj = new this.constructor();\n cloneObj.debugName = `clone_${this.debugName}`;\n cloneObj._source = this._source;\n cloneObj._name = `clone_${this._name}`;\n cloneObj.type = this.type;\n cloneObj.refCounts = this.refCounts;\n cloneObj.refCounts[cloneObj._name] = 0;\n return cloneObj;\n }\n /**\n * @param source The name of the source. Will change in assemble.\n * @param type The type of the output node.\n * @param refCounts A global ref counter map.\n */\n constructor(parent, source, type, refCounts) {\n super(parent, source);\n this.type = type;\n this.refCounts = refCounts;\n this._source = this._name = source;\n if (this.refCounts && !(this._name in this.refCounts)) {\n this.refCounts[this._name] = 0;\n }\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return new Set();\n }\n hash() {\n if (this._hash === undefined) {\n this._hash = `Output ${uniqueId()}`;\n }\n return this._hash;\n }\n /**\n * Request the datasource name and increase the ref counter.\n *\n * During the parsing phase, this will return the simple name such as 'main' or 'raw'.\n * It is crucial to request the name from an output node to mark it as a required node.\n * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase.\n *\n * In the assemble phase, this will return the correct name.\n */\n getSource() {\n this.refCounts[this._name]++;\n return this._source;\n }\n isRequired() {\n return !!this.refCounts[this._name];\n }\n setSource(source) {\n this._source = source;\n }\n}\n//# sourceMappingURL=dataflow.js.map","import { getBandPosition, vgField } from '../../channeldef';\nimport { getDateTimePartAndStep, getSmallestTimeUnitPart, getTimeUnitParts, isBinnedTimeUnit, normalizeTimeUnit } from '../../timeunit';\nimport { duplicate, entries, hash, isEmpty, replacePathInField, vals } from '../../util';\nimport { isUnitModel } from '../model';\nimport { DataFlowNode } from './dataflow';\nimport { isRectBasedMark } from '../../mark';\nimport { isXorY } from '../../channel';\nfunction isTimeUnitTransformComponent(timeUnitComponent) {\n return timeUnitComponent.as !== undefined;\n}\nfunction offsetAs(field) {\n return `${field}_end`;\n}\nexport class TimeUnitNode extends DataFlowNode {\n clone() {\n return new TimeUnitNode(null, duplicate(this.timeUnits));\n }\n constructor(parent, timeUnits) {\n super(parent);\n this.timeUnits = timeUnits;\n }\n static makeFromEncoding(parent, model) {\n const formula = model.reduceFieldDef((timeUnitComponent, fieldDef, channel) => {\n const { field, timeUnit } = fieldDef;\n if (timeUnit) {\n let component;\n if (isBinnedTimeUnit(timeUnit)) {\n // For binned time unit, only produce end if the mark is a rect-based mark (rect, bar, image, arc), which needs \"range\".\n if (isUnitModel(model)) {\n const { mark, markDef, config } = model;\n const bandPosition = getBandPosition({ fieldDef, markDef, config });\n if (isRectBasedMark(mark) || !!bandPosition) {\n component = {\n timeUnit: normalizeTimeUnit(timeUnit),\n field\n };\n }\n }\n }\n else {\n component = {\n as: vgField(fieldDef, { forAs: true }),\n field,\n timeUnit\n };\n }\n if (isUnitModel(model)) {\n const { mark, markDef, config } = model;\n const bandPosition = getBandPosition({ fieldDef, markDef, config });\n if (isRectBasedMark(mark) && isXorY(channel) && bandPosition !== 0.5) {\n component.rectBandPosition = bandPosition;\n }\n }\n if (component) {\n timeUnitComponent[hash(component)] = component;\n }\n }\n return timeUnitComponent;\n }, {});\n if (isEmpty(formula)) {\n return null;\n }\n return new TimeUnitNode(parent, formula);\n }\n static makeFromTransform(parent, t) {\n const { timeUnit, ...other } = { ...t };\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit);\n const component = {\n ...other,\n timeUnit: normalizedTimeUnit\n };\n return new TimeUnitNode(parent, {\n [hash(component)]: component\n });\n }\n /**\n * Merge together TimeUnitNodes assigning the children of `other` to `this`\n * and removing `other`.\n */\n merge(other) {\n this.timeUnits = { ...this.timeUnits };\n // if the same hash happen twice, merge\n for (const key in other.timeUnits) {\n if (!this.timeUnits[key]) {\n // copy if it's not a duplicate\n this.timeUnits[key] = other.timeUnits[key];\n }\n }\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n other.remove();\n }\n /**\n * Remove time units coming from the other node.\n */\n removeFormulas(fields) {\n const newFormula = {};\n for (const [key, timeUnitComponent] of entries(this.timeUnits)) {\n const fieldAs = isTimeUnitTransformComponent(timeUnitComponent)\n ? timeUnitComponent.as\n : `${timeUnitComponent.field}_end`;\n if (!fields.has(fieldAs)) {\n newFormula[key] = timeUnitComponent;\n }\n }\n this.timeUnits = newFormula;\n }\n producedFields() {\n return new Set(vals(this.timeUnits).map(f => {\n return isTimeUnitTransformComponent(f) ? f.as : offsetAs(f.field);\n }));\n }\n dependentFields() {\n return new Set(vals(this.timeUnits).map(f => f.field));\n }\n hash() {\n return `TimeUnit ${hash(this.timeUnits)}`;\n }\n assemble() {\n const transforms = [];\n for (const f of vals(this.timeUnits)) {\n const { rectBandPosition } = f;\n const normalizedTimeUnit = normalizeTimeUnit(f.timeUnit);\n if (isTimeUnitTransformComponent(f)) {\n const { field, as } = f;\n const { unit, utc, ...params } = normalizedTimeUnit;\n const startEnd = [as, `${as}_end`];\n transforms.push({\n field: replacePathInField(field),\n type: 'timeunit',\n ...(unit ? { units: getTimeUnitParts(unit) } : {}),\n ...(utc ? { timezone: 'utc' } : {}),\n ...params,\n as: startEnd\n });\n transforms.push(...offsetedRectFormulas(startEnd, rectBandPosition, normalizedTimeUnit));\n }\n else if (f) {\n const { field: escapedField } = f;\n // since this is a expression, we want the unescaped field name\n const field = escapedField.replaceAll('\\\\.', '.');\n const expr = offsetExpr({ timeUnit: normalizedTimeUnit, field });\n const endAs = offsetAs(field);\n transforms.push({\n type: 'formula',\n expr,\n as: endAs\n });\n transforms.push(...offsetedRectFormulas([field, endAs], rectBandPosition, normalizedTimeUnit));\n }\n }\n return transforms;\n }\n}\nexport const OFFSETTED_RECT_START_SUFFIX = 'offsetted_rect_start';\nexport const OFFSETTED_RECT_END_SUFFIX = 'offsetted_rect_end';\nfunction offsetExpr({ timeUnit, field, reverse }) {\n const { unit, utc } = timeUnit;\n const smallestUnit = getSmallestTimeUnitPart(unit);\n const { part, step } = getDateTimePartAndStep(smallestUnit, timeUnit.step);\n const offsetFn = utc ? 'utcOffset' : 'timeOffset';\n const expr = `${offsetFn}('${part}', datum['${field}'], ${reverse ? -step : step})`;\n return expr;\n}\nfunction offsetedRectFormulas([startField, endField], rectBandPosition, timeUnit) {\n if (rectBandPosition !== undefined && rectBandPosition !== 0.5) {\n const startExpr = `datum['${startField}']`;\n const endExpr = `datum['${endField}']`;\n return [\n {\n type: 'formula',\n expr: interpolateExpr([\n offsetExpr({\n timeUnit,\n field: startField,\n reverse: true\n }),\n startExpr\n ], rectBandPosition + 0.5),\n as: `${startField}_${OFFSETTED_RECT_START_SUFFIX}`\n },\n {\n type: 'formula',\n expr: interpolateExpr([startExpr, endExpr], rectBandPosition + 0.5),\n as: `${startField}_${OFFSETTED_RECT_END_SUFFIX}`\n }\n ];\n }\n return [];\n}\nfunction interpolateExpr([start, end], fraction) {\n return `${1 - fraction} * ${start} + ${fraction} * ${end}`;\n}\n//# sourceMappingURL=timeunit.js.map","import { array, isObject } from 'vega-util';\nimport { getPositionChannelFromLatLong, isGeoPositionChannel, isScaleChannel, isSingleDefUnitChannel } from '../../channel';\nimport * as log from '../../log';\nimport { hasContinuousDomain } from '../../scale';\nimport { SELECTION_ID } from '../../selection';\nimport { hash, keys, varName, isEmpty } from '../../util';\nimport { TimeUnitNode } from '../data/timeunit';\nimport { assembleProjection } from './assemble';\nimport { isBinnedTimeUnit } from '../../timeunit';\nexport const TUPLE_FIELDS = '_tuple_fields';\nexport class SelectionProjectionComponent {\n constructor(...items) {\n this.items = items;\n this.hasChannel = {};\n this.hasField = {};\n this.hasSelectionId = false;\n }\n}\nconst project = {\n defined: () => {\n return true; // This transform handles its own defaults, so always run parse.\n },\n parse: (model, selCmpt, selDef) => {\n const name = selCmpt.name;\n const proj = (selCmpt.project ?? (selCmpt.project = new SelectionProjectionComponent()));\n const parsed = {};\n const timeUnits = {};\n const signals = new Set();\n const signalName = (p, range) => {\n const suffix = range === 'visual' ? p.channel : p.field;\n let sg = varName(`${name}_${suffix}`);\n for (let counter = 1; signals.has(sg); counter++) {\n sg = varName(`${name}_${suffix}_${counter}`);\n }\n signals.add(sg);\n return { [range]: sg };\n };\n const type = selCmpt.type;\n const cfg = model.config.selection[type];\n const init = selDef.value !== undefined\n ? array(selDef.value)\n : null;\n // If no explicit projection (either fields or encodings) is specified, set some defaults.\n // If an initial value is set, try to infer projections.\n let { fields, encodings } = (isObject(selDef.select) ? selDef.select : {});\n if (!fields && !encodings && init) {\n for (const initVal of init) {\n // initVal may be a scalar value to smoothen varParam -> pointSelection gradient.\n if (!isObject(initVal)) {\n continue;\n }\n for (const key of keys(initVal)) {\n if (isSingleDefUnitChannel(key)) {\n (encodings || (encodings = [])).push(key);\n }\n else {\n if (type === 'interval') {\n log.warn(log.message.INTERVAL_INITIALIZED_WITH_POS);\n encodings = cfg.encodings;\n }\n else {\n (fields ?? (fields = [])).push(key);\n }\n }\n }\n }\n }\n // If no initial value is specified, use the default configuration.\n // We break this out as a separate if block (instead of an else condition)\n // to account for unprojected point selections that have scalar initial values\n if (!fields && !encodings) {\n encodings = cfg.encodings;\n if ('fields' in cfg) {\n fields = cfg.fields;\n }\n }\n for (const channel of encodings ?? []) {\n const fieldDef = model.fieldDef(channel);\n if (fieldDef) {\n let field = fieldDef.field;\n if (fieldDef.aggregate) {\n log.warn(log.message.cannotProjectAggregate(channel, fieldDef.aggregate));\n continue;\n }\n else if (!field) {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n continue;\n }\n if (fieldDef.timeUnit && !isBinnedTimeUnit(fieldDef.timeUnit)) {\n field = model.vgField(channel);\n // Construct TimeUnitComponents which will be combined into a\n // TimeUnitNode. This node may need to be inserted into the\n // dataflow if the selection is used across views that do not\n // have these time units defined.\n const component = {\n timeUnit: fieldDef.timeUnit,\n as: field,\n field: fieldDef.field\n };\n timeUnits[hash(component)] = component;\n }\n // Prevent duplicate projections on the same field.\n // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag).\n if (!parsed[field]) {\n // Determine whether the tuple will store enumerated or ranged values.\n // Interval selections store ranges for continuous scales, and enumerations otherwise.\n // Single/multi selections store ranges for binned fields, and enumerations otherwise.\n const tplType = type === 'interval' &&\n isScaleChannel(channel) &&\n hasContinuousDomain(model.getScaleComponent(channel).get('type'))\n ? 'R'\n : fieldDef.bin\n ? 'R-RE'\n : 'E';\n const p = { field, channel, type: tplType, index: proj.items.length };\n p.signals = { ...signalName(p, 'data'), ...signalName(p, 'visual') };\n proj.items.push((parsed[field] = p));\n proj.hasField[field] = parsed[field];\n proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID;\n if (isGeoPositionChannel(channel)) {\n p.geoChannel = channel;\n p.channel = getPositionChannelFromLatLong(channel);\n proj.hasChannel[p.channel] = parsed[field];\n }\n else {\n proj.hasChannel[channel] = parsed[field];\n }\n }\n }\n else {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n }\n }\n for (const field of fields ?? []) {\n if (proj.hasField[field])\n continue;\n const p = { type: 'E', field, index: proj.items.length };\n p.signals = { ...signalName(p, 'data') };\n proj.items.push(p);\n proj.hasField[field] = p;\n proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID;\n }\n if (init) {\n selCmpt.init = init.map((v) => {\n // Selections can be initialized either with a full object that maps projections to values\n // or scalar values to smoothen the abstraction gradient from variable params to point selections.\n return proj.items.map(p => isObject(v) ? (v[p.geoChannel || p.channel] !== undefined ? v[p.geoChannel || p.channel] : v[p.field]) : v);\n });\n }\n if (!isEmpty(timeUnits)) {\n proj.timeUnit = new TimeUnitNode(null, timeUnits);\n }\n },\n signals: (model, selCmpt, allSignals) => {\n const name = selCmpt.name + TUPLE_FIELDS;\n const hasSignal = allSignals.filter(s => s.name === name);\n return hasSignal.length > 0 || selCmpt.project.hasSelectionId\n ? allSignals\n : allSignals.concat({\n name,\n value: selCmpt.project.items.map(assembleProjection)\n });\n }\n};\nexport default project;\n//# sourceMappingURL=project.js.map","import { stringValue } from 'vega-util';\nimport { VL_SELECTION_RESOLVE } from '.';\nimport { isScaleChannel } from '../../channel';\nimport * as log from '../../log';\nimport { hasContinuousDomain } from '../../scale';\nimport { isLayerModel } from '../model';\nimport { replacePathInField } from '../../util';\nconst scaleBindings = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales';\n },\n parse: (model, selCmpt) => {\n const bound = (selCmpt.scales = []);\n for (const proj of selCmpt.project.items) {\n const channel = proj.channel;\n if (!isScaleChannel(channel)) {\n continue;\n }\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n if (!scale || !hasContinuousDomain(scaleType)) {\n log.warn(log.message.SCALE_BINDINGS_CONTINUOUS);\n continue;\n }\n scale.set('selectionExtent', { param: selCmpt.name, field: proj.field }, true);\n bound.push(proj);\n }\n },\n topLevelSignals: (model, selCmpt, signals) => {\n const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0);\n // Top-level signals are only needed for multiview displays and if this\n // view's top-level signals haven't already been generated.\n if (!model.parent || isTopLevelLayer(model) || bound.length === 0) {\n return signals;\n }\n // vlSelectionResolve does not account for the behavior of bound scales in\n // multiview displays. Each unit view adds a tuple to the store, but the\n // state of the selection is the unit selection most recently updated. This\n // state is captured by the top-level signals that we insert and \"push\n // outer\" to from within the units. We need to reassemble this state into\n // the top-level named signal, except no single selCmpt has a global view.\n const namedSg = signals.filter(s => s.name === selCmpt.name)[0];\n let update = namedSg.update;\n if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) {\n namedSg.update = `{${bound\n .map(proj => `${stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`)\n .join(', ')}}`;\n }\n else {\n for (const proj of bound) {\n const mapping = `${stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`;\n if (!update.includes(mapping)) {\n update = `${update.substring(0, update.length - 1)}, ${mapping}}`;\n }\n }\n namedSg.update = update;\n }\n return signals.concat(bound.map(proj => ({ name: proj.signals.data })));\n },\n signals: (model, selCmpt, signals) => {\n // Nested signals need only push to top-level signals with multiview displays.\n if (model.parent && !isTopLevelLayer(model)) {\n for (const proj of selCmpt.scales) {\n const signal = signals.filter(s => s.name === proj.signals.data)[0];\n signal.push = 'outer';\n delete signal.value;\n delete signal.update;\n }\n }\n return signals;\n }\n};\nexport default scaleBindings;\nexport function domain(model, channel) {\n const scale = stringValue(model.scaleName(channel));\n return `domain(${scale})`;\n}\nfunction isTopLevelLayer(model) {\n return model.parent && isLayerModel(model.parent) && (!model.parent.parent ?? isTopLevelLayer(model.parent.parent));\n}\n//# sourceMappingURL=scales.js.map","import { isObject } from 'vega';\nimport { array, stringValue } from 'vega-util';\nimport { STORE, TUPLE, unitName } from '.';\nimport { LATITUDE, LONGITUDE, X, Y } from '../../channel';\nimport { warn } from '../../log';\nimport { hasContinuousDomain } from '../../scale';\nimport { SELECTION_ID } from '../../selection';\nimport { keys, vals } from '../../util';\nimport { isUnitModel } from '../model';\nimport { assembleInit } from './assemble';\nimport { TUPLE_FIELDS } from './project';\nimport scales from './scales';\nexport const BRUSH = '_brush';\nexport const SCALE_TRIGGER = '_scale_trigger';\nexport const GEO_INIT_TICK = 'geo_interval_init_tick'; // Workaround for https://github.com/vega/vega/issues/3481\nconst INIT = '_init';\nconst CENTER = '_center';\nconst interval = {\n defined: selCmpt => selCmpt.type === 'interval',\n parse: (model, selCmpt, selDef) => {\n var _a;\n if (model.hasProjection) {\n const def = { ...(isObject(selDef.select) ? selDef.select : {}) };\n def.fields = [SELECTION_ID];\n if (!def.encodings) {\n // Remap default x/y projection\n def.encodings = selDef.value ? keys(selDef.value) : [LONGITUDE, LATITUDE];\n }\n selDef.select = { type: 'interval', ...def };\n }\n if (selCmpt.translate && !scales.defined(selCmpt)) {\n const filterExpr = `!event.item || event.item.mark.name !== ${stringValue(selCmpt.name + BRUSH)}`;\n for (const evt of selCmpt.events) {\n if (!evt.between) {\n warn(`${evt} is not an ordered event stream for interval selections.`);\n continue;\n }\n const filters = array(((_a = evt.between[0]).filter ?? (_a.filter = [])));\n if (filters.indexOf(filterExpr) < 0) {\n filters.push(filterExpr);\n }\n }\n }\n },\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const tupleSg = name + TUPLE;\n const channels = vals(selCmpt.project.hasChannel).filter(p => p.channel === X || p.channel === Y);\n const init = selCmpt.init ? selCmpt.init[0] : null;\n signals.push(...channels.reduce((arr, proj) => arr.concat(channelSignals(model, selCmpt, proj, init && init[proj.index])), []));\n if (!model.hasProjection) {\n // Proxy scale reactions to ensure that an infinite loop doesn't occur\n // when an interval selection filter touches the scale.\n if (!scales.defined(selCmpt)) {\n const triggerSg = name + SCALE_TRIGGER;\n const scaleTriggers = channels.map(proj => {\n const channel = proj.channel;\n const { data: dname, visual: vname } = proj.signals;\n const scaleName = stringValue(model.scaleName(channel));\n const scaleType = model.getScaleComponent(channel).get('type');\n const toNum = hasContinuousDomain(scaleType) ? '+' : '';\n return (`(!isArray(${dname}) || ` +\n `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` +\n `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))`);\n });\n if (scaleTriggers.length) {\n signals.push({\n name: triggerSg,\n value: {},\n on: [\n {\n events: channels.map(proj => ({ scale: model.scaleName(proj.channel) })),\n update: scaleTriggers.join(' && ') + ` ? ${triggerSg} : {}`\n }\n ]\n });\n }\n }\n // Only add an interval to the store if it has valid data extents. Data extents\n // are set to null if pixel extents are equal to account for intervals over\n // ordinal/nominal domains which, when inverted, will still produce a valid datum.\n const dataSignals = channels.map(proj => proj.signals.data);\n const update = `unit: ${unitName(model)}, fields: ${name + TUPLE_FIELDS}, values`;\n return signals.concat({\n name: tupleSg,\n ...(init ? { init: `{${update}: ${assembleInit(init)}}` } : {}),\n ...(dataSignals.length\n ? {\n on: [\n {\n events: [{ signal: dataSignals.join(' || ') }],\n update: `${dataSignals.join(' && ')} ? {${update}: [${dataSignals}]} : null`\n }\n ]\n }\n : {})\n });\n }\n else {\n const projection = stringValue(model.projectionName());\n const centerSg = model.projectionName() + CENTER;\n const { x, y } = selCmpt.project.hasChannel;\n const xvname = x && x.signals.visual;\n const yvname = y && y.signals.visual;\n const xinit = x ? init && init[x.index] : `${centerSg}[0]`;\n const yinit = y ? init && init[y.index] : `${centerSg}[1]`;\n const sizeSg = (layout) => model.getSizeSignalRef(layout).signal;\n const bbox = `[` +\n `[${xvname ? xvname + '[0]' : '0'}, ${yvname ? yvname + '[0]' : '0'}],` +\n `[${xvname ? xvname + '[1]' : sizeSg('width')}, ` +\n `${yvname ? yvname + '[1]' : sizeSg('height')}]` +\n `]`;\n if (init) {\n signals.unshift({\n name: name + INIT,\n init: `[scale(${projection}, [${x ? xinit[0] : xinit}, ${y ? yinit[0] : yinit}]), ` +\n `scale(${projection}, [${x ? xinit[1] : xinit}, ${y ? yinit[1] : yinit}])]`\n });\n if (!x || !y) {\n // If initializing a uni-dimensional brush, use the center of the view to determine the other coord\n const hasCenterSg = signals.find(s => s.name === centerSg);\n if (!hasCenterSg) {\n signals.unshift({\n name: centerSg,\n update: `invert(${projection}, [${sizeSg('width')}/2, ${sizeSg('height')}/2])`\n });\n }\n }\n }\n const intersect = `intersect(${bbox}, {markname: ${stringValue(model.getName('marks'))}}, unit.mark)`;\n const base = `{unit: ${unitName(model)}}`;\n const update = `vlSelectionTuples(${intersect}, ${base})`;\n const visualSignals = channels.map(proj => proj.signals.visual);\n return signals.concat({\n name: tupleSg,\n on: [\n {\n events: [\n ...(visualSignals.length ? [{ signal: visualSignals.join(' || ') }] : []),\n ...(init ? [{ signal: GEO_INIT_TICK }] : [])\n ],\n update\n }\n ]\n });\n }\n },\n topLevelSignals: (model, selCmpt, signals) => {\n if (isUnitModel(model) && model.hasProjection && selCmpt.init) {\n // Workaround for https://github.com/vega/vega/issues/3481\n // The scenegraph isn't populated on the first pulse. So we use a timer signal\n // to re-pulse the dataflow as soon as possible. We return an object to ensure\n // this only occurs once.\n const hasTick = signals.filter(s => s.name === GEO_INIT_TICK);\n if (!hasTick.length) {\n signals.unshift({\n name: GEO_INIT_TICK,\n value: null,\n on: [\n {\n events: 'timer{1}',\n update: `${GEO_INIT_TICK} === null ? {} : ${GEO_INIT_TICK}`\n }\n ]\n });\n }\n }\n return signals;\n },\n marks: (model, selCmpt, marks) => {\n const name = selCmpt.name;\n const { x, y } = selCmpt.project.hasChannel;\n const xvname = x?.signals.visual;\n const yvname = y?.signals.visual;\n const store = `data(${stringValue(selCmpt.name + STORE)})`;\n // Do not add a brush if we're binding to scales\n // or we don't have a valid interval projection\n if (scales.defined(selCmpt) || (!x && !y)) {\n return marks;\n }\n const update = {\n x: x !== undefined ? { signal: `${xvname}[0]` } : { value: 0 },\n y: y !== undefined ? { signal: `${yvname}[0]` } : { value: 0 },\n x2: x !== undefined ? { signal: `${xvname}[1]` } : { field: { group: 'width' } },\n y2: y !== undefined ? { signal: `${yvname}[1]` } : { field: { group: 'height' } }\n };\n // If the selection is resolved to global, only a single interval is in\n // the store. Wrap brush mark's encodings with a production rule to test\n // this based on the `unit` property. Hide the brush mark if it corresponds\n // to a unit different from the one in the store.\n if (selCmpt.resolve === 'global') {\n for (const key of keys(update)) {\n update[key] = [\n {\n test: `${store}.length && ${store}[0].unit === ${unitName(model)}`,\n ...update[key]\n },\n { value: 0 }\n ];\n }\n }\n // Two brush marks ensure that fill colors and other aesthetic choices do\n // not interefere with the core marks, but that the brushed region can still\n // be interacted with (e.g., dragging it around).\n const { fill, fillOpacity, cursor, ...stroke } = selCmpt.mark;\n const vgStroke = keys(stroke).reduce((def, k) => {\n def[k] = [\n {\n test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`]\n .filter(t => t)\n .join(' && '),\n value: stroke[k]\n },\n { value: null }\n ];\n return def;\n }, {});\n return [\n {\n name: `${name + BRUSH}_bg`,\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n fill: { value: fill },\n fillOpacity: { value: fillOpacity }\n },\n update\n }\n },\n ...marks,\n {\n name: name + BRUSH,\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n ...(cursor ? { cursor: { value: cursor } } : {}),\n fill: { value: 'transparent' }\n },\n update: { ...update, ...vgStroke }\n }\n }\n ];\n }\n};\nexport default interval;\n/**\n * Returns the visual and data signals for an interval selection.\n */\nfunction channelSignals(model, selCmpt, proj, init) {\n const scaledInterval = !model.hasProjection;\n const channel = proj.channel;\n const vname = proj.signals.visual;\n const scaleName = stringValue(scaledInterval ? model.scaleName(channel) : model.projectionName());\n const scaled = (str) => `scale(${scaleName}, ${str})`;\n const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal;\n const coord = `${channel}(unit)`;\n const von = selCmpt.events.reduce((def, evt) => {\n return [\n ...def,\n { events: evt.between[0], update: `[${coord}, ${coord}]` },\n { events: evt, update: `[${vname}[0], clamp(${coord}, 0, ${size})]` } // Brush End\n ];\n }, []);\n if (scaledInterval) {\n const dname = proj.signals.data;\n const hasScales = scales.defined(selCmpt);\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n const vinit = init ? { init: assembleInit(init, true, scaled) } : { value: [] };\n // React to pan/zooms of continuous scales. Non-continuous scales\n // (band, point) cannot be pan/zoomed and any other changes\n // to their domains (e.g., filtering) should clear the brushes.\n von.push({\n events: { signal: selCmpt.name + SCALE_TRIGGER },\n update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]`\n });\n return hasScales\n ? [{ name: dname, on: [] }]\n : [\n { name: vname, ...vinit, on: von },\n {\n name: dname,\n ...(init ? { init: assembleInit(init) } : {}),\n on: [\n {\n events: { signal: vname },\n update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})`\n }\n ]\n }\n ];\n }\n else {\n const initIdx = channel === X ? 0 : 1;\n const initSg = selCmpt.name + INIT;\n const vinit = init ? { init: `[${initSg}[0][${initIdx}], ${initSg}[1][${initIdx}]]` } : { value: [] };\n return [{ name: vname, ...vinit, on: von }];\n }\n}\n//# sourceMappingURL=interval.js.map","import { stringValue } from 'vega-util';\nimport { TUPLE, unitName } from '.';\nimport { SELECTION_ID } from '../../selection';\nimport { vals } from '../../util';\nimport { BRUSH } from './interval';\nimport { TUPLE_FIELDS } from './project';\nconst point = {\n defined: selCmpt => selCmpt.type === 'point',\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const fieldsSg = name + TUPLE_FIELDS;\n const project = selCmpt.project;\n const datum = '(item().isVoronoi ? datum.datum : datum)';\n // Only add a discrete selection to the store if a datum is present _and_\n // the interaction isn't occurring on a group mark. This guards against\n // polluting interactive state with invalid values in faceted displays\n // as the group marks are also data-driven. We force the update to account\n // for constant null states but varying toggles (e.g., shift-click in\n // whitespace followed by a click in whitespace; the store should only\n // be cleared on the second click).\n const brushes = vals(model.component.selection ?? {})\n .reduce((acc, cmpt) => {\n return cmpt.type === 'interval' ? acc.concat(cmpt.name + BRUSH) : acc;\n }, [])\n .map(b => `indexof(item().mark.name, '${b}') < 0`)\n .join(' && ');\n const test = `datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${brushes ? ` && ${brushes}` : ''}`;\n let update = `unit: ${unitName(model)}, `;\n if (selCmpt.project.hasSelectionId) {\n update += `${SELECTION_ID}: ${datum}[${stringValue(SELECTION_ID)}]`;\n }\n else {\n const values = project.items\n .map(p => {\n const fieldDef = model.fieldDef(p.channel);\n // Binned fields should capture extents, for a range test against the raw field.\n return fieldDef?.bin\n ? `[${datum}[${stringValue(model.vgField(p.channel, {}))}], ` +\n `${datum}[${stringValue(model.vgField(p.channel, { binSuffix: 'end' }))}]]`\n : `${datum}[${stringValue(p.field)}]`;\n })\n .join(', ');\n update += `fields: ${fieldsSg}, values: [${values}]`;\n }\n const events = selCmpt.events;\n return signals.concat([\n {\n name: name + TUPLE,\n on: events\n ? [\n {\n events,\n update: `${test} ? {${update}} : null`,\n force: true\n }\n ]\n : []\n }\n ]);\n }\n};\nexport default point;\n//# sourceMappingURL=point.js.map","import { array } from 'vega-util';\nimport { isConditionalDef, isConditionalParameter } from '../../../channeldef';\nimport { expression } from '../../predicate';\nimport { parseSelectionPredicate } from '../../selection/parse';\n/**\n * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition\n * or a simple mixin if channel def has no condition.\n */\nexport function wrapCondition(model, channelDef, vgChannel, refFn) {\n const condition = isConditionalDef(channelDef) && channelDef.condition;\n const valueRef = refFn(channelDef);\n if (condition) {\n const conditions = array(condition);\n const vgConditions = conditions.map(c => {\n const conditionValueRef = refFn(c);\n if (isConditionalParameter(c)) {\n const { param, empty } = c;\n const test = parseSelectionPredicate(model, { param, empty });\n return { test, ...conditionValueRef };\n }\n else {\n const test = expression(model, c.test); // FIXME: remove casting once TS is no longer dumb about it\n return { test, ...conditionValueRef };\n }\n });\n return {\n [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])]\n };\n }\n else {\n return valueRef !== undefined ? { [vgChannel]: valueRef } : {};\n }\n}\n//# sourceMappingURL=conditional.js.map","import { getFormatMixins, isFieldOrDatumDef, isValueDef } from '../../../channeldef';\nimport { signalOrValueRef } from '../../common';\nimport { formatSignalRef } from '../../format';\nimport { wrapCondition } from './conditional';\nexport function text(model, channel = 'text') {\n const channelDef = model.encoding[channel];\n return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config));\n}\nexport function textRef(channelDef, config, expr = 'datum') {\n // text\n if (channelDef) {\n if (isValueDef(channelDef)) {\n return signalOrValueRef(channelDef.value);\n }\n if (isFieldOrDatumDef(channelDef)) {\n const { format, formatType } = getFormatMixins(channelDef);\n return formatSignalRef({ fieldOrDatumDef: channelDef, format, formatType, expr, config });\n }\n }\n return undefined;\n}\n//# sourceMappingURL=text.js.map","import { array, isArray, isObject, isString } from 'vega-util';\nimport { isBinned } from '../../../bin';\nimport { getMainRangeChannel, isXorY, THETA, RADIUS } from '../../../channel';\nimport { defaultTitle, getFieldDef, getFormatMixins, hasConditionalFieldDef, isFieldDef, isTypedFieldDef, vgField } from '../../../channeldef';\nimport { forEach } from '../../../encoding';\nimport { entries } from '../../../util';\nimport { isSignalRef } from '../../../vega.schema';\nimport { getMarkPropOrConfig } from '../../common';\nimport { binFormatExpression, formatSignalRef } from '../../format';\nimport { wrapCondition } from './conditional';\nimport { textRef } from './text';\nexport function tooltip(model, opt = {}) {\n const { encoding, markDef, config, stack } = model;\n const channelDef = encoding.tooltip;\n if (isArray(channelDef)) {\n return { tooltip: tooltipRefForEncoding({ tooltip: channelDef }, stack, config, opt) };\n }\n else {\n const datum = opt.reactiveGeom ? 'datum.datum' : 'datum';\n return wrapCondition(model, channelDef, 'tooltip', cDef => {\n // use valueRef based on channelDef first\n const tooltipRefFromChannelDef = textRef(cDef, config, datum);\n if (tooltipRefFromChannelDef) {\n return tooltipRefFromChannelDef;\n }\n if (cDef === null) {\n // Allow using encoding.tooltip = null to disable tooltip\n return undefined;\n }\n let markTooltip = getMarkPropOrConfig('tooltip', markDef, config);\n if (markTooltip === true) {\n markTooltip = { content: 'encoding' };\n }\n if (isString(markTooltip)) {\n return { value: markTooltip };\n }\n else if (isObject(markTooltip)) {\n // `tooltip` is `{fields: 'encodings' | 'fields'}`\n if (isSignalRef(markTooltip)) {\n return markTooltip;\n }\n else if (markTooltip.content === 'encoding') {\n return tooltipRefForEncoding(encoding, stack, config, opt);\n }\n else {\n return { signal: datum };\n }\n }\n return undefined;\n });\n }\n}\nexport function tooltipData(encoding, stack, config, { reactiveGeom } = {}) {\n const formatConfig = { ...config, ...config.tooltipFormat };\n const toSkip = {};\n const expr = reactiveGeom ? 'datum.datum' : 'datum';\n const tuples = [];\n function add(fDef, channel) {\n const mainChannel = getMainRangeChannel(channel);\n const fieldDef = isTypedFieldDef(fDef)\n ? fDef\n : {\n ...fDef,\n type: encoding[mainChannel].type // for secondary field def, copy type from main channel\n };\n const title = fieldDef.title || defaultTitle(fieldDef, formatConfig);\n const key = array(title).join(', ').replaceAll(/\"/g, '\\\\\"');\n let value;\n if (isXorY(channel)) {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = getFieldDef(encoding[channel2]);\n if (isBinned(fieldDef.bin) && fieldDef2) {\n const startField = vgField(fieldDef, { expr });\n const endField = vgField(fieldDef2, { expr });\n const { format, formatType } = getFormatMixins(fieldDef);\n value = binFormatExpression(startField, endField, format, formatType, formatConfig);\n toSkip[channel2] = true;\n }\n }\n if ((isXorY(channel) || channel === THETA || channel === RADIUS) &&\n stack &&\n stack.fieldChannel === channel &&\n stack.offset === 'normalize') {\n const { format, formatType } = getFormatMixins(fieldDef);\n value = formatSignalRef({\n fieldOrDatumDef: fieldDef,\n format,\n formatType,\n expr,\n config: formatConfig,\n normalizeStack: true\n }).signal;\n }\n value ?? (value = textRef(fieldDef, formatConfig, expr).signal);\n tuples.push({ channel, key, value });\n }\n forEach(encoding, (channelDef, channel) => {\n if (isFieldDef(channelDef)) {\n add(channelDef, channel);\n }\n else if (hasConditionalFieldDef(channelDef)) {\n add(channelDef.condition, channel);\n }\n });\n const out = {};\n for (const { channel, key, value } of tuples) {\n if (!toSkip[channel] && !out[key]) {\n out[key] = value;\n }\n }\n return out;\n}\nexport function tooltipRefForEncoding(encoding, stack, config, { reactiveGeom } = {}) {\n const data = tooltipData(encoding, stack, config, { reactiveGeom });\n const keyValues = entries(data).map(([key, value]) => `\"${key}\": ${value}`);\n return keyValues.length > 0 ? { signal: `{${keyValues.join(', ')}}` } : undefined;\n}\n//# sourceMappingURL=tooltip.js.map","import { entries, isEmpty } from '../../../util';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nimport { VG_MARK_INDEX } from './../../../vega.schema';\nimport { wrapCondition } from './conditional';\nimport { textRef } from './text';\nimport { tooltipData } from './tooltip';\nexport function aria(model) {\n const { markDef, config } = model;\n const enableAria = getMarkPropOrConfig('aria', markDef, config);\n // We can ignore other aria properties if ariaHidden is true.\n if (enableAria === false) {\n // getMarkGroups sets aria to false already so we don't have to set it in the encode block\n return {};\n }\n return {\n ...(enableAria ? { aria: enableAria } : {}),\n ...ariaRoleDescription(model),\n ...description(model)\n };\n}\nfunction ariaRoleDescription(model) {\n const { mark, markDef, config } = model;\n if (config.aria === false) {\n return {};\n }\n const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config);\n if (ariaRoleDesc != null) {\n return { ariaRoleDescription: { value: ariaRoleDesc } };\n }\n return mark in VG_MARK_INDEX ? {} : { ariaRoleDescription: { value: mark } };\n}\nexport function description(model) {\n const { encoding, markDef, config, stack } = model;\n const channelDef = encoding.description;\n if (channelDef) {\n return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config));\n }\n // Use default from mark def or config if defined.\n // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here.\n const descriptionValue = getMarkPropOrConfig('description', markDef, config);\n if (descriptionValue != null) {\n return {\n description: signalOrValueRef(descriptionValue)\n };\n }\n if (config.aria === false) {\n return {};\n }\n const data = tooltipData(encoding, stack, config);\n if (isEmpty(data)) {\n return undefined;\n }\n return {\n description: {\n signal: entries(data)\n .map(([key, value], index) => `\"${index > 0 ? '; ' : ''}${key}: \" + (${value})`)\n .join(' + ')\n }\n };\n}\n//# sourceMappingURL=aria.js.map","import { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nimport { wrapCondition } from './conditional';\nimport * as ref from './valueref';\n/**\n * Return encode for non-positional channels with scales. (Text doesn't have scale.)\n */\nexport function nonPosition(channel, model, opt = {}) {\n const { markDef, encoding, config } = model;\n const { vgChannel } = opt;\n let { defaultRef, defaultValue } = opt;\n if (defaultRef === undefined) {\n // prettier-ignore\n defaultValue ?? (defaultValue = getMarkPropOrConfig(channel, markDef, config, { vgChannel, ignoreVgConfig: true }));\n if (defaultValue !== undefined) {\n defaultRef = signalOrValueRef(defaultValue);\n }\n }\n const channelDef = encoding[channel];\n return wrapCondition(model, channelDef, vgChannel ?? channel, cDef => {\n return ref.midPoint({\n channel,\n channelDef: cDef,\n markDef,\n config,\n scaleName: model.scaleName(channel),\n scale: model.getScaleComponent(channel),\n stack: null,\n defaultRef\n });\n });\n}\n//# sourceMappingURL=nonposition.js.map","import * as log from '../../../log';\nimport { contains } from '../../../util';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nimport { nonPosition } from './nonposition';\nexport function color(model, opt = { filled: undefined }) {\n const { markDef, encoding, config } = model;\n const { type: markType } = markDef;\n // Allow filled to be overridden (for trail's \"filled\")\n const filled = opt.filled ?? getMarkPropOrConfig('filled', markDef, config);\n const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType)\n ? 'transparent'\n : undefined;\n const defaultFill = getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, { vgChannel: 'fill' }) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === true && 'color'] ??\n // If there is no fill, always fill symbols, bar, geoshape\n // with transparent fills https://github.com/vega/vega-lite/issues/1316\n transparentIfNeeded;\n const defaultStroke = getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, { vgChannel: 'stroke' }) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === false && 'color'];\n const colorVgChannel = filled ? 'fill' : 'stroke';\n const fillStrokeMarkDefAndConfig = {\n ...(defaultFill ? { fill: signalOrValueRef(defaultFill) } : {}),\n ...(defaultStroke ? { stroke: signalOrValueRef(defaultStroke) } : {})\n };\n if (markDef.color && (filled ? markDef.fill : markDef.stroke)) {\n log.warn(log.message.droppingColor('property', { fill: 'fill' in markDef, stroke: 'stroke' in markDef }));\n }\n return {\n ...fillStrokeMarkDefAndConfig,\n ...nonPosition('color', model, {\n vgChannel: colorVgChannel,\n defaultValue: filled ? defaultFill : defaultStroke\n }),\n ...nonPosition('fill', model, {\n // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding\n defaultValue: encoding.fill ? defaultFill : undefined\n }),\n ...nonPosition('stroke', model, {\n // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding\n defaultValue: encoding.stroke ? defaultStroke : undefined\n })\n };\n}\n//# sourceMappingURL=color.js.map","import { isValueDef } from '../../../channeldef';\nimport { isPathMark } from '../../../mark';\nimport { signalOrValueRef } from '../../common';\nimport { wrapCondition } from './conditional';\nexport function zindex(model) {\n const { encoding, mark } = model;\n const order = encoding.order;\n if (!isPathMark(mark) && isValueDef(order)) {\n return wrapCondition(model, order, 'zindex', cd => signalOrValueRef(cd.value));\n }\n return {};\n}\n//# sourceMappingURL=zindex.js.map","import { signalOrValueRef } from '../../common';\nimport { midPoint } from './valueref';\nexport function positionOffset({ channel: baseChannel, markDef, encoding = {}, model, bandPosition }) {\n const channel = `${baseChannel}Offset`; // Need to cast as the type can't be inferred automatically\n const defaultValue = markDef[channel];\n const channelDef = encoding[channel];\n if ((channel === 'xOffset' || channel === 'yOffset') && channelDef) {\n const ref = midPoint({\n channel: channel,\n channelDef,\n markDef,\n config: model?.config,\n scaleName: model.scaleName(channel),\n scale: model.getScaleComponent(channel),\n stack: null,\n defaultRef: signalOrValueRef(defaultValue),\n bandPosition\n });\n return { offsetType: 'encoding', offset: ref };\n }\n const markDefOffsetValue = markDef[channel];\n if (markDefOffsetValue) {\n return { offsetType: 'visual', offset: markDefOffsetValue };\n }\n return {};\n}\n//# sourceMappingURL=offset.js.map","import { getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel, isXorY } from '../../../channel';\nimport { isFieldDef, isFieldOrDatumDef } from '../../../channeldef';\nimport { ScaleType } from '../../../scale';\nimport { contains } from '../../../util';\nimport { getMarkPropOrConfig } from '../../common';\nimport { positionOffset } from './offset';\nimport * as ref from './valueref';\n/**\n * Return encode for point (non-band) position channels.\n */\nexport function pointPosition(channel, model, { defaultPos, vgChannel }) {\n const { encoding, markDef, config, stack } = model;\n const channelDef = encoding[channel];\n const channel2Def = encoding[getSecondaryRangeChannel(channel)];\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n const { offset, offsetType } = positionOffset({\n channel,\n markDef,\n encoding,\n model,\n bandPosition: 0.5\n });\n // Get default position or position from mark def\n const defaultRef = pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n });\n const valueRef = !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude)\n ? // use geopoint output if there are lat/long and there is no point position overriding lat/long.\n { field: model.getName(channel) }\n : positionRef({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef,\n bandPosition: offsetType === 'encoding' ? 0 : undefined\n });\n return valueRef ? { [vgChannel || channel]: valueRef } : undefined;\n}\n// TODO: we need to find a way to refactor these so that scaleName is a part of scale\n// but that's complicated. For now, this is a huge step moving forward.\n/**\n * @return Vega ValueRef for normal x- or y-position without projection\n */\nexport function positionRef(params) {\n const { channel, channelDef, scaleName, stack, offset, markDef } = params;\n // This isn't a part of midPoint because we use midPoint for non-position too\n if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) {\n if (isFieldDef(channelDef)) {\n let bandPosition = channelDef.bandPosition;\n if (bandPosition === undefined && markDef.type === 'text' && (channel === 'radius' || channel === 'theta')) {\n // theta and radius of text mark should use bandPosition = 0.5 by default\n // so that labels for arc marks are centered automatically\n bandPosition = 0.5;\n }\n if (bandPosition !== undefined) {\n return ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef,\n startSuffix: 'start',\n bandPosition,\n offset\n });\n }\n }\n // x or y use stack_end so that stacked line's point mark use stack_end too.\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, { suffix: 'end' }, { offset });\n }\n return ref.midPointRefWithPositionInvalidTest(params);\n}\nexport function pointPositionDefaultRef({ model, defaultPos, channel, scaleName, scale }) {\n const { markDef, config } = model;\n return () => {\n const mainChannel = getMainRangeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, { vgChannel });\n if (definedValueOrConfig !== undefined) {\n return ref.widthHeightValueOrSignalRef(channel, definedValueOrConfig);\n }\n switch (defaultPos) {\n case 'zeroOrMin':\n case 'zeroOrMax':\n if (scaleName) {\n const scaleType = scale.get('type');\n if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) {\n // Log scales cannot have zero.\n // Zero in time scale is arbitrary, and does not affect ratio.\n // (Time is an interval level of measurement, not ratio).\n // See https://en.wikipedia.org/wiki/Level_of_measurement for more info.\n }\n else {\n if (scale.domainDefinitelyIncludesZero()) {\n return {\n scale: scaleName,\n value: 0\n };\n }\n }\n }\n if (defaultPos === 'zeroOrMin') {\n return mainChannel === 'y' ? { field: { group: 'height' } } : { value: 0 };\n }\n else {\n // zeroOrMax\n switch (mainChannel) {\n case 'radius':\n // max of radius is min(width, height) / 2\n return {\n signal: `min(${model.width.signal},${model.height.signal})/2`\n };\n case 'theta':\n return { signal: '2*PI' };\n case 'x':\n return { field: { group: 'width' } };\n case 'y':\n return { value: 0 };\n }\n }\n break;\n case 'mid': {\n const sizeRef = model[getSizeChannel(channel)];\n return { ...sizeRef, mult: 0.5 };\n }\n }\n // defaultPos === null\n return undefined;\n };\n}\n//# sourceMappingURL=position-point.js.map","import { getVgPositionChannel } from '../../../channel';\nimport * as log from '../../../log';\nimport { isSignalRef } from '../../../vega.schema';\nimport { getMarkPropOrConfig } from '../../common';\nconst ALIGNED_X_CHANNEL = {\n left: 'x',\n center: 'xc',\n right: 'x2'\n};\nconst BASELINED_Y_CHANNEL = {\n top: 'y',\n middle: 'yc',\n bottom: 'y2'\n};\nexport function vgAlignedPositionChannel(channel, markDef, config, defaultAlign = 'middle') {\n if (channel === 'radius' || channel === 'theta') {\n return getVgPositionChannel(channel);\n }\n const alignChannel = channel === 'x' ? 'align' : 'baseline';\n const align = getMarkPropOrConfig(alignChannel, markDef, config);\n let alignExcludingSignal;\n if (isSignalRef(align)) {\n log.warn(log.message.rangeMarkAlignmentCannotBeExpression(alignChannel));\n alignExcludingSignal = undefined;\n }\n else {\n alignExcludingSignal = align;\n }\n if (channel === 'x') {\n return ALIGNED_X_CHANNEL[alignExcludingSignal || (defaultAlign === 'top' ? 'left' : 'center')];\n }\n else {\n return BASELINED_Y_CHANNEL[alignExcludingSignal || defaultAlign];\n }\n}\n//# sourceMappingURL=position-align.js.map","import { getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel } from '../../../channel';\nimport { isFieldOrDatumDef } from '../../../channeldef';\nimport * as log from '../../../log';\nimport { isRelativeBandSize } from '../../../mark';\nimport { getMarkStyleConfig } from '../../common';\nimport { positionOffset } from './offset';\nimport { vgAlignedPositionChannel } from './position-align';\nimport { pointPosition, pointPositionDefaultRef } from './position-point';\nimport * as ref from './valueref';\n/**\n * Utility for area/rule position, which can be either point or range.\n * (One of the axes should be point and the other should be range.)\n */\nexport function pointOrRangePosition(channel, model, { defaultPos, defaultPos2, range }) {\n if (range) {\n return rangePosition(channel, model, { defaultPos, defaultPos2 });\n }\n return pointPosition(channel, model, { defaultPos });\n}\nexport function rangePosition(channel, model, { defaultPos, defaultPos2 }) {\n const { markDef, config } = model;\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2);\n const vgChannel = pos2Mixins[sizeChannel]\n ? // If there is width/height, we need to position the marks based on the alignment.\n vgAlignedPositionChannel(channel, markDef, config)\n : // Otherwise, make sure to apply to the right Vg Channel (for arc mark)\n getVgPositionChannel(channel);\n return {\n ...pointPosition(channel, model, { defaultPos, vgChannel }),\n ...pos2Mixins\n };\n}\n/**\n * Return encode for x2, y2.\n * If channel is not specified, return one channel based on orientation.\n */\nfunction pointPosition2OrSize(model, defaultPos, channel) {\n const { encoding, mark, markDef, stack, config } = model;\n const baseChannel = getMainRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n const channelDef = encoding[baseChannel];\n const scaleName = model.scaleName(baseChannel);\n const scale = model.getScaleComponent(baseChannel);\n const { offset } = channel in encoding || channel in markDef\n ? positionOffset({ channel, markDef, encoding, model })\n : positionOffset({ channel: baseChannel, markDef, encoding, model });\n if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) {\n const vgSizeChannel = getSizeChannel(channel);\n const size = model.markDef[vgSizeChannel];\n if (size != null) {\n return {\n [vgSizeChannel]: { value: size }\n };\n }\n else {\n return {\n [vgChannel]: { field: model.getName(channel) }\n };\n }\n }\n const valueRef = position2Ref({\n channel,\n channelDef,\n channel2Def: encoding[channel],\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: undefined\n });\n if (valueRef !== undefined) {\n return { [vgChannel]: valueRef };\n }\n // TODO: check width/height encoding here once we add them\n // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence:\n // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark)\n return (position2orSize(channel, markDef) ||\n position2orSize(channel, {\n [channel]: getMarkStyleConfig(channel, markDef, config.style),\n [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style)\n }) ||\n position2orSize(channel, config[mark]) ||\n position2orSize(channel, config.mark) || {\n [vgChannel]: pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n })()\n });\n}\nexport function position2Ref({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef }) {\n if (isFieldOrDatumDef(channelDef) &&\n stack &&\n // If fieldChannel is X and channel is X2 (or Y and Y2)\n channel.charAt(0) === stack.fieldChannel.charAt(0)) {\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, { suffix: 'start' }, { offset });\n }\n return ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: channel2Def,\n scaleName,\n scale,\n stack,\n markDef,\n config,\n offset,\n defaultRef\n });\n}\nfunction position2orSize(channel, markDef) {\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n if (markDef[vgChannel] !== undefined) {\n return { [vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[vgChannel]) };\n }\n else if (markDef[channel] !== undefined) {\n return { [vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[channel]) };\n }\n else if (markDef[sizeChannel]) {\n const dimensionSize = markDef[sizeChannel];\n if (isRelativeBandSize(dimensionSize)) {\n log.warn(log.message.relativeBandSizeNotSupported(sizeChannel));\n }\n else {\n return { [sizeChannel]: ref.widthHeightValueOrSignalRef(channel, dimensionSize) };\n }\n }\n return undefined;\n}\n//# sourceMappingURL=position-range.js.map","import { isArray, isNumber } from 'vega-util';\nimport { isBinned, isBinning, isBinParams } from '../../../bin';\nimport { getOffsetChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel, isPolarPositionChannel, isXorY } from '../../../channel';\nimport { getBandPosition, getBandSize, isFieldDef, isFieldOrDatumDef, vgField } from '../../../channeldef';\nimport { getViewConfigDiscreteStep } from '../../../config';\nimport * as log from '../../../log';\nimport { isRelativeBandSize } from '../../../mark';\nimport { hasDiscreteDomain } from '../../../scale';\nimport { isSignalRef, isVgRangeStep } from '../../../vega.schema';\nimport { getMarkConfig, getMarkPropOrConfig, signalOrStringValue, signalOrValueRef } from '../../common';\nimport { nonPosition } from './nonposition';\nimport { positionOffset } from './offset';\nimport { vgAlignedPositionChannel } from './position-align';\nimport { pointPositionDefaultRef } from './position-point';\nimport { rangePosition } from './position-range';\nimport * as ref from './valueref';\nimport { getOffsetScaleChannel } from '../../../channel';\nimport { getFirstDefined } from '../../../util';\nimport { OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX } from '../../data/timeunit';\nexport function rectPosition(model, channel) {\n const { config, encoding, markDef } = model;\n const mark = markDef.type;\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const channelDef = encoding[channel];\n const channelDef2 = encoding[channel2];\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n const orient = markDef.orient;\n const hasSizeDef = encoding[sizeChannel] ?? encoding.size ?? getMarkPropOrConfig('size', markDef, config, { vgChannel: sizeChannel });\n const offsetScaleChannel = getOffsetChannel(channel);\n const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal');\n // x, x2, and width -- we must specify two of these in all conditions\n if (isFieldDef(channelDef) &&\n (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) &&\n !(hasSizeDef && !isRelativeBandSize(hasSizeDef)) &&\n !encoding[offsetScaleChannel] &&\n !hasDiscreteDomain(scaleType)) {\n return rectBinPosition({\n fieldDef: channelDef,\n fieldDef2: channelDef2,\n channel,\n model\n });\n }\n else if (((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType)) || isBarBand) && !channelDef2) {\n return positionAndSize(channelDef, channel, model);\n }\n else {\n return rangePosition(channel, model, { defaultPos: 'zeroOrMax', defaultPos2: 'zeroOrMin' });\n }\n}\nfunction defaultSizeRef(sizeChannel, scaleName, scale, config, bandSize, hasFieldDef, mark) {\n if (isRelativeBandSize(bandSize)) {\n if (scale) {\n const scaleType = scale.get('type');\n if (scaleType === 'band') {\n let bandWidth = `bandwidth('${scaleName}')`;\n if (bandSize.band !== 1) {\n bandWidth = `${bandSize.band} * ${bandWidth}`;\n }\n const minBandSize = getMarkConfig('minBandSize', { type: mark }, config);\n return { signal: minBandSize ? `max(${signalOrStringValue(minBandSize)}, ${bandWidth})` : bandWidth };\n }\n else if (bandSize.band !== 1) {\n log.warn(log.message.cannotUseRelativeBandSizeWithNonBandScale(scaleType));\n bandSize = undefined;\n }\n }\n else {\n return {\n mult: bandSize.band,\n field: { group: sizeChannel }\n };\n }\n }\n else if (isSignalRef(bandSize)) {\n return bandSize;\n }\n else if (bandSize) {\n return { value: bandSize };\n }\n // no valid band size\n if (scale) {\n const scaleRange = scale.get('range');\n if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return { value: scaleRange.step - 2 };\n }\n }\n if (!hasFieldDef) {\n const { bandPaddingInner, barBandPaddingInner, rectBandPaddingInner } = config.scale;\n const padding = getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); // this part is like paddingInner in scale.ts\n if (isSignalRef(padding)) {\n return { signal: `(1 - (${padding.signal})) * ${sizeChannel}` };\n }\n else if (isNumber(padding)) {\n return { signal: `${1 - padding} * ${sizeChannel}` };\n }\n }\n const defaultStep = getViewConfigDiscreteStep(config.view, sizeChannel);\n return { value: defaultStep - 2 };\n}\n/**\n * Output position encoding and its size encoding for continuous, point, and band scales.\n */\nfunction positionAndSize(fieldDef, channel, model) {\n const { markDef, encoding, config, stack } = model;\n const orient = markDef.orient;\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n const vgSizeChannel = getSizeChannel(channel);\n const channel2 = getSecondaryRangeChannel(channel);\n const offsetScaleChannel = getOffsetChannel(channel);\n const offsetScaleName = model.scaleName(offsetScaleChannel);\n const offsetScale = model.getScaleComponent(getOffsetScaleChannel(channel));\n // use \"size\" channel for bars, if there is orient and the channel matches the right orientation\n const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x');\n // Use size encoding / mark property / config if it exists\n let sizeMixins;\n if (encoding.size || markDef.size) {\n if (useVlSizeChannel) {\n sizeMixins = nonPosition('size', model, {\n vgChannel: vgSizeChannel,\n defaultRef: signalOrValueRef(markDef.size)\n });\n }\n else {\n log.warn(log.message.cannotApplySizeToNonOrientedMark(markDef.type));\n }\n }\n const hasSizeFromMarkOrEncoding = !!sizeMixins;\n // Otherwise, apply default value\n const bandSize = getBandSize({\n channel,\n fieldDef,\n markDef,\n config,\n scaleType: (scale || offsetScale)?.get('type'),\n useVlSizeChannel\n });\n sizeMixins = sizeMixins || {\n [vgSizeChannel]: defaultSizeRef(vgSizeChannel, offsetScaleName || scaleName, offsetScale || scale, config, bandSize, !!fieldDef, markDef.type)\n };\n /*\n Band scales with size value and all point scales, use xc/yc + band=0.5\n \n Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2.\n In this case, size_band is the band specified in the x/y-encoding.\n By default band is 1, so `(1 - band) / 2` = 0.\n If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2\n */\n const defaultBandAlign = (scale || offsetScale)?.get('type') === 'band' && isRelativeBandSize(bandSize) && !hasSizeFromMarkOrEncoding\n ? 'top'\n : 'middle';\n const vgChannel = vgAlignedPositionChannel(channel, markDef, config, defaultBandAlign);\n const center = vgChannel === 'xc' || vgChannel === 'yc';\n const { offset, offsetType } = positionOffset({ channel, markDef, encoding, model, bandPosition: center ? 0.5 : 0 });\n const posRef = ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: fieldDef,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: pointPositionDefaultRef({ model, defaultPos: 'mid', channel, scaleName, scale }),\n bandPosition: center\n ? offsetType === 'encoding'\n ? 0\n : 0.5\n : isSignalRef(bandSize)\n ? { signal: `(1-${bandSize})/2` }\n : isRelativeBandSize(bandSize)\n ? (1 - bandSize.band) / 2\n : 0\n });\n if (vgSizeChannel) {\n return { [vgChannel]: posRef, ...sizeMixins };\n }\n else {\n // otherwise, we must simulate size by setting position2 = position + size\n // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth)\n const vgChannel2 = getVgPositionChannel(channel2);\n const sizeRef = sizeMixins[vgSizeChannel];\n const sizeOffset = offset ? { ...sizeRef, offset } : sizeRef;\n return {\n [vgChannel]: posRef,\n // posRef might be an array that wraps position invalid test\n [vgChannel2]: isArray(posRef)\n ? [posRef[0], { ...posRef[1], offset: sizeOffset }]\n : {\n ...posRef,\n offset: sizeOffset\n }\n };\n }\n}\nfunction getBinSpacing(channel, spacing, reverse, axisTranslate, offset, minBandSize, bandSizeExpr) {\n if (isPolarPositionChannel(channel)) {\n return 0;\n }\n const isEnd = channel === 'x' || channel === 'y2';\n const spacingOffset = isEnd ? -spacing / 2 : spacing / 2;\n if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(axisTranslate) || minBandSize) {\n const reverseExpr = signalOrStringValue(reverse);\n const offsetExpr = signalOrStringValue(offset);\n const axisTranslateExpr = signalOrStringValue(axisTranslate);\n const minBandSizeExpr = signalOrStringValue(minBandSize);\n const sign = isEnd ? '' : '-';\n const spacingAndSizeOffset = minBandSize\n ? `(${bandSizeExpr} < ${minBandSizeExpr} ? ${sign}0.5 * (${minBandSizeExpr} - (${bandSizeExpr})) : ${spacingOffset})`\n : spacingOffset;\n const t = axisTranslateExpr ? `${axisTranslateExpr} + ` : '';\n const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : '';\n const o = offsetExpr ? `(${offsetExpr} + ${spacingAndSizeOffset})` : spacingAndSizeOffset;\n return {\n signal: t + r + o\n };\n }\n else {\n offset = offset || 0;\n return axisTranslate + (reverse ? -offset - spacingOffset : +offset + spacingOffset);\n }\n}\nfunction rectBinPosition({ fieldDef, fieldDef2, channel, model }) {\n const { config, markDef, encoding } = model;\n const scale = model.getScaleComponent(channel);\n const scaleName = model.scaleName(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n const reverse = scale.get('reverse');\n const bandSize = getBandSize({ channel, fieldDef, markDef, config, scaleType });\n const axis = model.component.axes[channel]?.[0];\n const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5\n const spacing = isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) ?? 0 : 0;\n const channel2 = getSecondaryRangeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n const vgChannel2 = getVgPositionChannel(channel2);\n const minBandSize = getMarkConfig('minBandSize', markDef, config);\n const { offset } = positionOffset({ channel, markDef, encoding, model, bandPosition: 0 });\n const { offset: offset2 } = positionOffset({ channel: channel2, markDef, encoding, model, bandPosition: 0 });\n const bandSizeExpr = ref.binSizeExpr({ fieldDef, scaleName });\n const binSpacingOffset = getBinSpacing(channel, spacing, reverse, axisTranslate, offset, minBandSize, bandSizeExpr);\n const binSpacingOffset2 = getBinSpacing(channel2, spacing, reverse, axisTranslate, offset2 ?? offset, minBandSize, bandSizeExpr);\n const bandPositionForBandSize = isSignalRef(bandSize)\n ? { signal: `(1-${bandSize.signal})/2` }\n : isRelativeBandSize(bandSize)\n ? (1 - bandSize.band) / 2\n : 0.5;\n const bandPosition = getBandPosition({ fieldDef, fieldDef2, markDef, config });\n if (isBinning(fieldDef.bin) || fieldDef.timeUnit) {\n const useRectOffsetField = fieldDef.timeUnit && bandPosition !== 0.5;\n return {\n [vgChannel2]: rectBinRef({\n fieldDef,\n scaleName,\n bandPosition: bandPositionForBandSize,\n offset: binSpacingOffset2,\n useRectOffsetField\n }),\n [vgChannel]: rectBinRef({\n fieldDef,\n scaleName,\n bandPosition: isSignalRef(bandPositionForBandSize)\n ? { signal: `1-${bandPositionForBandSize.signal}` }\n : 1 - bandPositionForBandSize,\n offset: binSpacingOffset,\n useRectOffsetField\n })\n };\n }\n else if (isBinned(fieldDef.bin)) {\n const startRef = ref.valueRefForFieldOrDatumDef(fieldDef, scaleName, {}, { offset: binSpacingOffset2 });\n if (isFieldDef(fieldDef2)) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: ref.valueRefForFieldOrDatumDef(fieldDef2, scaleName, {}, { offset: binSpacingOffset })\n };\n }\n else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: {\n signal: `scale(\"${scaleName}\", ${vgField(fieldDef, { expr: 'datum' })} + ${fieldDef.bin.step})`,\n offset: binSpacingOffset\n }\n };\n }\n }\n log.warn(log.message.channelRequiredForBinned(channel2));\n return undefined;\n}\n/**\n * Value Ref for binned fields\n */\nfunction rectBinRef({ fieldDef, scaleName, bandPosition, offset, useRectOffsetField }) {\n return ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: fieldDef,\n bandPosition,\n offset,\n ...(useRectOffsetField\n ? {\n startSuffix: OFFSETTED_RECT_START_SUFFIX,\n endSuffix: OFFSETTED_RECT_END_SUFFIX\n }\n : {})\n });\n}\n//# sourceMappingURL=position-rect.js.map","import { array } from 'vega-util';\nimport { SCALE_CHANNELS } from '../../../channel';\nimport { isPathMark } from '../../../mark';\nimport { hasContinuousDomain } from '../../../scale';\nimport { keys } from '../../../util';\nimport { VG_MARK_CONFIGS } from '../../../vega.schema';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nimport { aria } from './aria';\nimport { color } from './color';\nimport { nonPosition } from './nonposition';\nimport { text } from './text';\nimport { tooltip } from './tooltip';\nimport { fieldInvalidPredicate } from './valueref';\nimport { zindex } from './zindex';\nexport { color } from './color';\nexport { wrapCondition } from './conditional';\nexport { nonPosition } from './nonposition';\nexport { pointPosition } from './position-point';\nexport { pointOrRangePosition, rangePosition } from './position-range';\nexport { rectPosition } from './position-rect';\nexport { text } from './text';\nexport { tooltip } from './tooltip';\nconst ALWAYS_IGNORE = new Set(['aria', 'width', 'height']);\nexport function baseEncodeEntry(model, ignore) {\n const { fill = undefined, stroke = undefined } = ignore.color === 'include' ? color(model) : {};\n return {\n ...markDefProperties(model.markDef, ignore),\n ...wrapAllFieldsInvalid(model, 'fill', fill),\n ...wrapAllFieldsInvalid(model, 'stroke', stroke),\n ...nonPosition('opacity', model),\n ...nonPosition('fillOpacity', model),\n ...nonPosition('strokeOpacity', model),\n ...nonPosition('strokeWidth', model),\n ...nonPosition('strokeDash', model),\n ...zindex(model),\n ...tooltip(model),\n ...text(model, 'href'),\n ...aria(model)\n };\n}\n// TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987\nfunction wrapAllFieldsInvalid(model, channel, valueRef) {\n const { config, mark, markDef } = model;\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid === 'hide' && valueRef && !isPathMark(mark)) {\n // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains.\n // For path marks, we will use \"defined\" property and skip these values instead.\n const test = allFieldsInvalidPredicate(model, { invalid: true, channels: SCALE_CHANNELS });\n if (test) {\n return {\n [channel]: [\n // prepend the invalid case\n // TODO: support custom value\n { test, value: null },\n ...array(valueRef)\n ]\n };\n }\n }\n return valueRef ? { [channel]: valueRef } : {};\n}\nfunction markDefProperties(mark, ignore) {\n return VG_MARK_CONFIGS.reduce((m, prop) => {\n if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') {\n m[prop] = signalOrValueRef(mark[prop]);\n }\n return m;\n }, {});\n}\nfunction allFieldsInvalidPredicate(model, { invalid = false, channels }) {\n const filterIndex = channels.reduce((aggregator, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, { expr: 'datum' });\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\n//# sourceMappingURL=base.js.map","import { POSITION_SCALE_CHANNELS } from '../../../channel';\nimport { hasContinuousDomain } from '../../../scale';\nimport { keys } from '../../../util';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nimport { fieldInvalidPredicate } from './valueref';\nexport function defined(model) {\n const { config, markDef } = model;\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid) {\n const signal = allFieldsInvalidPredicate(model, { channels: POSITION_SCALE_CHANNELS });\n if (signal) {\n return { defined: { signal } };\n }\n }\n return {};\n}\nfunction allFieldsInvalidPredicate(model, { invalid = false, channels }) {\n const filterIndex = channels.reduce((aggregator, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, { expr: 'datum', binSuffix: model.stack?.impute ? 'mid' : undefined });\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\nexport function valueIfDefined(prop, value) {\n if (value !== undefined) {\n return { [prop]: signalOrValueRef(value) };\n }\n return undefined;\n}\n//# sourceMappingURL=defined.js.map","import * as log from '../../log';\nimport { isPathMark } from '../../mark';\nimport { tooltip } from '../mark/encode';\nconst VORONOI = 'voronoi';\nconst nearest = {\n defined: selCmpt => {\n return selCmpt.type === 'point' && selCmpt.nearest;\n },\n parse: (model, selCmpt) => {\n // Scope selection events to the voronoi mark to prevent capturing\n // events that occur on the group mark (https://github.com/vega/vega/issues/2112).\n if (selCmpt.events) {\n for (const s of selCmpt.events) {\n s.markname = model.getName(VORONOI);\n }\n }\n },\n marks: (model, selCmpt, marks) => {\n const { x, y } = selCmpt.project.hasChannel;\n const markType = model.mark;\n if (isPathMark(markType)) {\n log.warn(log.message.nearestNotSupportForContinuous(markType));\n return marks;\n }\n const cellDef = {\n name: model.getName(VORONOI),\n type: 'path',\n interactive: true,\n from: { data: model.getName('marks') },\n encode: {\n update: {\n fill: { value: 'transparent' },\n strokeWidth: { value: 0.35 },\n stroke: { value: 'transparent' },\n isVoronoi: { value: true },\n ...tooltip(model, { reactiveGeom: true })\n }\n },\n transform: [\n {\n type: 'voronoi',\n x: { expr: x || !y ? 'datum.datum.x || 0' : '0' },\n y: { expr: y || !x ? 'datum.datum.y || 0' : '0' },\n size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')]\n }\n ]\n };\n let index = 0;\n let exists = false;\n marks.forEach((mark, i) => {\n const name = mark.name ?? '';\n if (name === model.component.mark[0].name) {\n index = i;\n }\n else if (name.indexOf(VORONOI) >= 0) {\n exists = true;\n }\n });\n if (!exists) {\n marks.splice(index + 1, 0, cellDef);\n }\n return marks;\n }\n};\nexport default nearest;\n//# sourceMappingURL=nearest.js.map","import { stringValue } from 'vega-util';\nimport { disableDirectManipulation, TUPLE } from '.';\nimport { varName } from '../../util';\nimport { assembleInit } from './assemble';\nimport nearest from './nearest';\nimport { TUPLE_FIELDS } from './project';\nimport { isLegendBinding } from '../../selection';\nconst inputBindings = {\n defined: selCmpt => {\n return (selCmpt.type === 'point' &&\n selCmpt.resolve === 'global' &&\n selCmpt.bind &&\n selCmpt.bind !== 'scales' &&\n !isLegendBinding(selCmpt.bind));\n },\n parse: (model, selCmpt, selDef) => disableDirectManipulation(selCmpt, selDef),\n topLevelSignals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const bind = selCmpt.bind;\n const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value).\n const datum = nearest.defined(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum';\n proj.items.forEach((p, i) => {\n const sgname = varName(`${name}_${p.field}`);\n const hasSignal = signals.filter(s => s.name === sgname);\n if (!hasSignal.length) {\n signals.unshift({\n name: sgname,\n ...(init ? { init: assembleInit(init[i]) } : { value: null }),\n on: selCmpt.events\n ? [\n {\n events: selCmpt.events,\n update: `datum && item().mark.marktype !== 'group' ? ${datum}[${stringValue(p.field)}] : null`\n }\n ]\n : [],\n bind: bind[p.field] ?? bind[p.channel] ?? bind\n });\n }\n });\n return signals;\n },\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const signal = signals.filter(s => s.name === name + TUPLE)[0];\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.map(p => varName(`${name}_${p.field}`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n if (values.length) {\n signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n }\n delete signal.value;\n delete signal.on;\n return signals;\n }\n};\nexport default inputBindings;\n//# sourceMappingURL=inputs.js.map","import { TUPLE, unitName } from '.';\nexport const TOGGLE = '_toggle';\nconst toggle = {\n defined: selCmpt => {\n return selCmpt.type === 'point' && !!selCmpt.toggle;\n },\n signals: (model, selCmpt, signals) => {\n return signals.concat({\n name: selCmpt.name + TOGGLE,\n value: false,\n on: [{ events: selCmpt.events, update: selCmpt.toggle }]\n });\n },\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n const signal = selCmpt.name + TOGGLE;\n return (`${signal} ? null : ${tpl}, ` +\n (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) +\n `${signal} ? ${tpl} : null`);\n }\n};\nexport default toggle;\n//# sourceMappingURL=toggle.js.map","import { parseSelector } from 'vega-event-selector';\nimport { isString } from 'vega-util';\nimport { TUPLE } from '.';\nimport { varName } from '../../util';\nimport inputBindings from './inputs';\nimport toggle, { TOGGLE } from './toggle';\nconst clear = {\n defined: selCmpt => {\n return selCmpt.clear !== undefined && selCmpt.clear !== false;\n },\n parse: (model, selCmpt) => {\n if (selCmpt.clear) {\n selCmpt.clear = isString(selCmpt.clear) ? parseSelector(selCmpt.clear, 'view') : selCmpt.clear;\n }\n },\n topLevelSignals: (model, selCmpt, signals) => {\n if (inputBindings.defined(selCmpt)) {\n for (const proj of selCmpt.project.items) {\n const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`));\n if (idx !== -1) {\n signals[idx].on.push({ events: selCmpt.clear, update: 'null' });\n }\n }\n }\n return signals;\n },\n signals: (model, selCmpt, signals) => {\n function addClear(idx, update) {\n if (idx !== -1 && signals[idx].on) {\n signals[idx].on.push({ events: selCmpt.clear, update });\n }\n }\n // Be as minimalist as possible when adding clear triggers to minimize dataflow execution.\n if (selCmpt.type === 'interval') {\n for (const proj of selCmpt.project.items) {\n const vIdx = signals.findIndex(n => n.name === proj.signals.visual);\n addClear(vIdx, '[0, 0]');\n if (vIdx === -1) {\n const dIdx = signals.findIndex(n => n.name === proj.signals.data);\n addClear(dIdx, 'null');\n }\n }\n }\n else {\n let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE);\n addClear(tIdx, 'null');\n if (toggle.defined(selCmpt)) {\n tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE);\n addClear(tIdx, 'false');\n }\n }\n return signals;\n }\n};\nexport default clear;\n//# sourceMappingURL=clear.js.map","import { isObject } from 'vega';\nimport { parseSelector } from 'vega-event-selector';\nimport { array, isString } from 'vega-util';\nimport { disableDirectManipulation, TUPLE } from '.';\nimport * as log from '../../log';\nimport { isLegendBinding, isLegendStreamBinding, SELECTION_ID } from '../../selection';\nimport { duplicate, vals, varName } from '../../util';\nimport { TUPLE_FIELDS } from './project';\nimport { TOGGLE } from './toggle';\nconst legendBindings = {\n defined: selCmpt => {\n const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind);\n const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID;\n if (spec && !projLen) {\n log.warn(log.message.LEGEND_BINDINGS_MUST_HAVE_PROJECTION);\n }\n return spec && projLen;\n },\n parse: (model, selCmpt, selDef) => {\n // Allow legend items to be toggleable by default even though direct manipulation is disabled.\n const selDef_ = duplicate(selDef);\n selDef_.select = isString(selDef_.select)\n ? { type: selDef_.select, toggle: selCmpt.toggle }\n : { ...selDef_.select, toggle: selCmpt.toggle };\n disableDirectManipulation(selCmpt, selDef_);\n if (isObject(selDef.select) && (selDef.select.on || selDef.select.clear)) {\n const legendFilter = 'event.item && indexof(event.item.mark.role, \"legend\") < 0';\n for (const evt of selCmpt.events) {\n evt.filter = array(evt.filter ?? []);\n if (!evt.filter.includes(legendFilter)) {\n evt.filter.push(legendFilter);\n }\n }\n }\n const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click';\n const stream = isString(evt) ? parseSelector(evt, 'view') : array(evt);\n selCmpt.bind = { legend: { merge: stream } };\n },\n topLevelSignals: (model, selCmpt, signals) => {\n const selName = selCmpt.name;\n const stream = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend;\n const markName = (name) => (s) => {\n const ds = duplicate(s);\n ds.markname = name;\n return ds;\n };\n for (const proj of selCmpt.project.items) {\n if (!proj.hasLegend)\n continue;\n const prefix = `${varName(proj.field)}_legend`;\n const sgName = `${selName}_${prefix}`;\n const hasSignal = signals.filter(s => s.name === sgName);\n if (hasSignal.length === 0) {\n const events = stream.merge\n .map(markName(`${prefix}_symbols`))\n .concat(stream.merge.map(markName(`${prefix}_labels`)))\n .concat(stream.merge.map(markName(`${prefix}_entries`)));\n signals.unshift({\n name: sgName,\n ...(!selCmpt.init ? { value: null } : {}),\n on: [\n // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum.\n {\n events,\n update: 'isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value',\n force: true\n },\n { events: stream.merge, update: `!event.item || !datum ? null : ${sgName}`, force: true }\n ]\n });\n }\n }\n return signals;\n },\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const tuple = signals.find(s => s.name === name + TUPLE);\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n if (selCmpt.events && values.length > 0) {\n tuple.on.push({\n events: values.map(signal => ({ signal })),\n update\n });\n }\n else if (values.length > 0) {\n tuple.update = update;\n delete tuple.value;\n delete tuple.on;\n }\n const toggle = signals.find(s => s.name === name + TOGGLE);\n const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend;\n if (toggle) {\n if (!selCmpt.events)\n toggle.on[0].events = events;\n else\n toggle.on.push({ ...toggle.on[0], events });\n }\n return signals;\n }\n};\nexport default legendBindings;\nexport function parseInteractiveLegend(model, channel, legendCmpt) {\n const field = model.fieldDef(channel)?.field;\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const proj = selCmpt.project.hasField[field] ?? selCmpt.project.hasChannel[channel];\n if (proj && legendBindings.defined(selCmpt)) {\n const legendSelections = legendCmpt.get('selections') ?? [];\n legendSelections.push(selCmpt.name);\n legendCmpt.set('selections', legendSelections, false);\n proj.hasLegend = true;\n }\n }\n}\n//# sourceMappingURL=legends.js.map","import { parseSelector } from 'vega-event-selector';\nimport { X, Y } from '../../channel';\nimport { BRUSH as INTERVAL_BRUSH } from './interval';\nimport scalesCompiler, { domain } from './scales';\nconst ANCHOR = '_translate_anchor';\nconst DELTA = '_translate_delta';\nconst translate = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.translate;\n },\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const boundScales = scalesCompiler.defined(selCmpt);\n const anchor = name + ANCHOR;\n const { x, y } = selCmpt.project.hasChannel;\n let events = parseSelector(selCmpt.translate, 'scope');\n if (!boundScales) {\n events = events.map(e => ((e.between[0].markname = name + INTERVAL_BRUSH), e));\n }\n signals.push({\n name: anchor,\n value: {},\n on: [\n {\n events: events.map(e => e.between[0]),\n update: '{x: x(unit), y: y(unit)' +\n (x !== undefined ? `, extent_x: ${boundScales ? domain(model, X) : `slice(${x.signals.visual})`}` : '') +\n (y !== undefined ? `, extent_y: ${boundScales ? domain(model, Y) : `slice(${y.signals.visual})`}` : '') +\n '}'\n }\n ]\n }, {\n name: name + DELTA,\n value: {},\n on: [\n {\n events,\n update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}`\n }\n ]\n });\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n return signals;\n }\n};\nexport default translate;\nfunction onDelta(model, selCmpt, proj, size, signals) {\n const name = selCmpt.name;\n const anchor = name + ANCHOR;\n const delta = name + DELTA;\n const channel = proj.channel;\n const boundScales = scalesCompiler.defined(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt && scaleCmpt.get('type');\n const reversed = scaleCmpt && scaleCmpt.get('reverse'); // scale parsing sets this flag for fieldDef.sort\n const sign = !boundScales ? '' : channel === X ? (reversed ? '' : '-') : reversed ? '-' : '';\n const extent = `${anchor}.extent_${channel}`;\n const offset = `${sign}${delta}.${channel} / ${boundScales ? `${sizeSg}` : `span(${extent})`}`;\n const panFn = !boundScales || !scaleCmpt\n ? 'panLinear'\n : scaleType === 'log'\n ? 'panLog'\n : scaleType === 'symlog'\n ? 'panSymlog'\n : scaleType === 'pow'\n ? 'panPow'\n : 'panLinear';\n const arg = !boundScales\n ? ''\n : scaleType === 'pow'\n ? `, ${scaleCmpt.get('exponent') ?? 1}`\n : scaleType === 'symlog'\n ? `, ${scaleCmpt.get('constant') ?? 1}`\n : '';\n const update = `${panFn}(${extent}, ${offset}${arg})`;\n signal.on.push({\n events: { signal: delta },\n update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n//# sourceMappingURL=translate.js.map","import { parseSelector } from 'vega-event-selector';\nimport { stringValue } from 'vega-util';\nimport { X, Y } from '../../channel';\nimport { BRUSH as INTERVAL_BRUSH } from './interval';\nimport { default as scalesCompiler, domain } from './scales';\nconst ANCHOR = '_zoom_anchor';\nconst DELTA = '_zoom_delta';\nconst zoom = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.zoom;\n },\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const boundScales = scalesCompiler.defined(selCmpt);\n const delta = name + DELTA;\n const { x, y } = selCmpt.project.hasChannel;\n const sx = stringValue(model.scaleName(X));\n const sy = stringValue(model.scaleName(Y));\n let events = parseSelector(selCmpt.zoom, 'scope');\n if (!boundScales) {\n events = events.map(e => ((e.markname = name + INTERVAL_BRUSH), e));\n }\n signals.push({\n name: name + ANCHOR,\n on: [\n {\n events,\n update: !boundScales\n ? `{x: x(unit), y: y(unit)}`\n : '{' +\n [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : '']\n .filter(expr => expr)\n .join(', ') +\n '}'\n }\n ]\n }, {\n name: delta,\n on: [\n {\n events,\n force: true,\n update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))'\n }\n ]\n });\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n return signals;\n }\n};\nexport default zoom;\nfunction onDelta(model, selCmpt, proj, size, signals) {\n const name = selCmpt.name;\n const channel = proj.channel;\n const boundScales = scalesCompiler.defined(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt && scaleCmpt.get('type');\n const base = boundScales ? domain(model, channel) : signal.name;\n const delta = name + DELTA;\n const anchor = `${name}${ANCHOR}.${channel}`;\n const zoomFn = !boundScales || !scaleCmpt\n ? 'zoomLinear'\n : scaleType === 'log'\n ? 'zoomLog'\n : scaleType === 'symlog'\n ? 'zoomSymlog'\n : scaleType === 'pow'\n ? 'zoomPow'\n : 'zoomLinear';\n const arg = !boundScales\n ? ''\n : scaleType === 'pow'\n ? `, ${scaleCmpt.get('exponent') ?? 1}`\n : scaleType === 'symlog'\n ? `, ${scaleCmpt.get('constant') ?? 1}`\n : '';\n const update = `${zoomFn}(${base}, ${anchor}, ${delta}${arg})`;\n signal.on.push({\n events: { signal: delta },\n update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n//# sourceMappingURL=zoom.js.map","import { isString } from 'vega';\nimport { stringValue } from 'vega-util';\nimport { FACET_CHANNELS } from '../../channel';\nimport { vals } from '../../util';\nimport { isFacetModel } from '../model';\nimport interval from './interval';\nimport point from './point';\nimport clear from './clear';\nimport inputs from './inputs';\nimport nearest from './nearest';\nimport project from './project';\nimport scales from './scales';\nimport legends from './legends';\nimport toggle from './toggle';\nimport translate from './translate';\nimport zoom from './zoom';\nexport const STORE = '_store';\nexport const TUPLE = '_tuple';\nexport const MODIFY = '_modify';\nexport const SELECTION_DOMAIN = '_selection_domain_';\nexport const VL_SELECTION_RESOLVE = 'vlSelectionResolve';\n// Order matters for parsing and assembly.\nexport const selectionCompilers = [\n point,\n interval,\n project,\n toggle,\n // Bindings may disable direct manipulation.\n inputs,\n scales,\n legends,\n clear,\n translate,\n zoom,\n nearest\n];\nfunction getFacetModel(model) {\n let parent = model.parent;\n while (parent) {\n if (isFacetModel(parent))\n break;\n parent = parent.parent;\n }\n return parent;\n}\nexport function unitName(model, { escape } = { escape: true }) {\n let name = escape ? stringValue(model.name) : model.name;\n const facetModel = getFacetModel(model);\n if (facetModel) {\n const { facet } = facetModel;\n for (const channel of FACET_CHANNELS) {\n if (facet[channel]) {\n name += ` + '__facet_${channel}_' + (facet[${stringValue(facetModel.vgField(channel))}])`;\n }\n }\n }\n return name;\n}\nexport function requiresSelectionId(model) {\n return vals(model.component.selection ?? {}).reduce((identifier, selCmpt) => {\n return identifier || selCmpt.project.hasSelectionId;\n }, false);\n}\n// Binding a point selection to query widgets or legends disables default direct manipulation interaction.\n// A user can choose to re-enable it by explicitly specifying triggering input events.\nexport function disableDirectManipulation(selCmpt, selDef) {\n if (isString(selDef.select) || !selDef.select.on)\n delete selCmpt.events;\n if (isString(selDef.select) || !selDef.select.clear)\n delete selCmpt.clear;\n if (isString(selDef.select) || !selDef.select.toggle)\n delete selCmpt.toggle;\n}\n//# sourceMappingURL=index.js.map","import { parseExpression } from 'vega-expression';\nfunction getName(node) {\n const name = [];\n if (node.type === 'Identifier') {\n return [node.name];\n }\n if (node.type === 'Literal') {\n return [node.value];\n }\n if (node.type === 'MemberExpression') {\n name.push(...getName(node.object));\n name.push(...getName(node.property));\n }\n return name;\n}\nfunction startsWithDatum(node) {\n if (node.object.type === 'MemberExpression') {\n return startsWithDatum(node.object);\n }\n return node.object.name === 'datum';\n}\nexport function getDependentFields(expression) {\n const ast = parseExpression(expression);\n const dependents = new Set();\n // visit is missing in types https://github.com/vega/vega/issues/3298\n ast.visit((node) => {\n if (node.type === 'MemberExpression' && startsWithDatum(node)) {\n dependents.add(getName(node).slice(1).join('.'));\n }\n });\n return dependents;\n}\n//# sourceMappingURL=expressions.js.map","import { duplicate } from '../../util';\nimport { expression } from '../predicate';\nimport { DataFlowNode } from './dataflow';\nimport { getDependentFields } from './expressions';\nexport class FilterNode extends DataFlowNode {\n clone() {\n return new FilterNode(null, this.model, duplicate(this.filter));\n }\n constructor(parent, model, filter) {\n super(parent);\n this.model = model;\n this.filter = filter;\n // TODO: refactor this to not take a node and\n // then add a static function makeFromOperand and make the constructor take only an expression\n this.expr = expression(this.model, this.filter, this);\n this._dependentFields = getDependentFields(this.expr);\n }\n dependentFields() {\n return this._dependentFields;\n }\n producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n assemble() {\n return {\n type: 'filter',\n expr: this.expr\n };\n }\n hash() {\n return `Filter ${this.expr}`;\n }\n}\n//# sourceMappingURL=filter.js.map","import { parseSelector } from 'vega-event-selector';\nimport { array, isObject, isString, stringValue } from 'vega-util';\nimport { selectionCompilers, STORE } from '.';\nimport { warn } from '../../log';\nimport { duplicate, entries, replacePathInField, varName } from '../../util';\nimport { OutputNode } from '../data/dataflow';\nimport { FilterNode } from '../data/filter';\nimport { DataSourceType } from '../../data';\nexport function parseUnitSelection(model, selDefs) {\n const selCmpts = {};\n const selectionConfig = model.config.selection;\n if (!selDefs || !selDefs.length)\n return selCmpts;\n for (const def of selDefs) {\n const name = varName(def.name);\n const selDef = def.select;\n const type = isString(selDef) ? selDef : selDef.type;\n const defaults = isObject(selDef) ? duplicate(selDef) : { type };\n // Set default values from config if a property hasn't been specified,\n // or if it is true. E.g., \"translate\": true should use the default\n // event handlers for translate. However, true may be a valid value for\n // a property (e.g., \"nearest\": true).\n const cfg = selectionConfig[type];\n for (const key in cfg) {\n // Project transform applies its defaults.\n if (key === 'fields' || key === 'encodings') {\n continue;\n }\n if (key === 'mark') {\n defaults[key] = { ...cfg[key], ...defaults[key] };\n }\n if (defaults[key] === undefined || defaults[key] === true) {\n defaults[key] = duplicate(cfg[key] ?? defaults[key]);\n }\n }\n const selCmpt = (selCmpts[name] = {\n ...defaults,\n name,\n type,\n init: def.value,\n bind: def.bind,\n events: isString(defaults.on) ? parseSelector(defaults.on, 'scope') : array(duplicate(defaults.on))\n });\n const def_ = duplicate(def); // defensive copy to prevent compilers from causing side effects\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.parse) {\n c.parse(model, selCmpt, def_);\n }\n }\n }\n return selCmpts;\n}\nexport function parseSelectionPredicate(model, pred, dfnode, datum = 'datum') {\n const name = isString(pred) ? pred : pred.param;\n const vname = varName(name);\n const store = stringValue(vname + STORE);\n let selCmpt;\n try {\n selCmpt = model.getSelectionComponent(vname, name);\n }\n catch (e) {\n // If a selection isn't found, treat as a variable parameter and coerce to boolean.\n return `!!${vname}`;\n }\n if (selCmpt.project.timeUnit) {\n const child = dfnode ?? model.component.data.raw;\n const tunode = selCmpt.project.timeUnit.clone();\n if (child.parent) {\n tunode.insertAsParentOf(child);\n }\n else {\n child.parent = tunode;\n }\n }\n const fn = selCmpt.project.hasSelectionId ? 'vlSelectionIdTest(' : 'vlSelectionTest(';\n const resolve = selCmpt.resolve === 'global' ? ')' : `, ${stringValue(selCmpt.resolve)})`;\n const test = `${fn}${store}, ${datum}${resolve}`;\n const length = `length(data(${store}))`;\n return pred.empty === false ? `${length} && ${test}` : `!${length} || ${test}`;\n}\nexport function parseSelectionExtent(model, name, extent) {\n const vname = varName(name);\n const encoding = extent['encoding'];\n let field = extent['field'];\n let selCmpt;\n try {\n selCmpt = model.getSelectionComponent(vname, name);\n }\n catch (e) {\n // If a selection isn't found, treat it as a variable parameter.\n return vname;\n }\n if (!encoding && !field) {\n field = selCmpt.project.items[0].field;\n if (selCmpt.project.items.length > 1) {\n warn('A \"field\" or \"encoding\" must be specified when using a selection as a scale domain. ' +\n `Using \"field\": ${stringValue(field)}.`);\n }\n }\n else if (encoding && !field) {\n const encodings = selCmpt.project.items.filter(p => p.channel === encoding);\n if (!encodings.length || encodings.length > 1) {\n field = selCmpt.project.items[0].field;\n warn((!encodings.length ? 'No ' : 'Multiple ') +\n `matching ${stringValue(encoding)} encoding found for selection ${stringValue(extent.param)}. ` +\n `Using \"field\": ${stringValue(field)}.`);\n }\n else {\n field = encodings[0].field;\n }\n }\n return `${selCmpt.name}[${stringValue(replacePathInField(field))}]`;\n}\nexport function materializeSelections(model, main) {\n for (const [selection, selCmpt] of entries(model.component.selection ?? {})) {\n const lookupName = model.getName(`lookup_${selection}`);\n model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(new FilterNode(main, model, { param: selection }), lookupName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts);\n }\n}\n//# sourceMappingURL=parse.js.map","import { isString } from 'vega-util';\nimport { fieldFilterExpression, isSelectionPredicate } from '../predicate';\nimport { logicalExpr } from '../util';\nimport { parseSelectionPredicate } from './selection/parse';\n/**\n * Converts a predicate into an expression.\n */\n// model is only used for selection filters.\nexport function expression(model, filterOp, node) {\n return logicalExpr(filterOp, (predicate) => {\n if (isString(predicate)) {\n return predicate;\n }\n else if (isSelectionPredicate(predicate)) {\n return parseSelectionPredicate(model, predicate, node);\n }\n else {\n // Filter Object\n return fieldFilterExpression(predicate);\n }\n });\n}\n//# sourceMappingURL=predicate.js.map","import { array, isArray } from 'vega-util';\nimport { AXIS_PARTS, AXIS_PROPERTY_TYPE, CONDITIONAL_AXIS_PROP_INDEX, isConditionalAxisValue } from '../../axis';\nimport { POSITION_SCALE_CHANNELS } from '../../channel';\nimport { defaultTitle } from '../../channeldef';\nimport { isText } from '../../title';\nimport { contains, getFirstDefined, isEmpty, replaceAll } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { exprFromValueRefOrSignalRef } from '../common';\nimport { expression } from '../predicate';\nfunction assembleTitle(title, config) {\n if (!title) {\n return undefined;\n }\n if (isArray(title) && !isText(title)) {\n return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', ');\n }\n return title;\n}\nfunction setAxisEncode(axis, part, vgProp, vgRef) {\n var _a, _b;\n axis.encode ?? (axis.encode = {});\n (_a = axis.encode)[part] ?? (_a[part] = {});\n (_b = axis.encode[part]).update ?? (_b.update = {});\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n axis.encode[part].update[vgProp] = vgRef;\n}\nexport function assembleAxis(axisCmpt, kind, config, opt = { header: false }) {\n const { disable, orient, scale, labelExpr, title, zindex, ...axis } = axisCmpt.combine();\n if (disable) {\n return undefined;\n }\n for (const prop in axis) {\n const propType = AXIS_PROPERTY_TYPE[prop];\n const propValue = axis[prop];\n if (propType && propType !== kind && propType !== 'both') {\n // Remove properties that are not valid for this kind of axis\n delete axis[prop];\n }\n else if (isConditionalAxisValue(propValue)) {\n // deal with conditional axis value\n const { condition, ...valueOrSignalRef } = propValue;\n const conditions = array(condition);\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const { vgProp, part } = propIndex;\n // If there is a corresponding Vega property for the channel,\n // use Vega's custom axis encoding and delete the original axis property to avoid conflicts\n const vgRef = [\n ...conditions.map(c => {\n const { test, ...valueOrSignalCRef } = c;\n return {\n test: expression(null, test),\n ...valueOrSignalCRef\n };\n }),\n valueOrSignalRef\n ];\n setAxisEncode(axis, part, vgProp, vgRef);\n delete axis[prop];\n }\n else if (propIndex === null) {\n // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead.\n const signalRef = {\n signal: conditions\n .map(c => {\n const { test, ...valueOrSignalCRef } = c;\n return `${expression(null, test)} ? ${exprFromValueRefOrSignalRef(valueOrSignalCRef)} : `;\n })\n .join('') + exprFromValueRefOrSignalRef(valueOrSignalRef)\n };\n axis[prop] = signalRef;\n }\n }\n else if (isSignalRef(propValue)) {\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const { vgProp, part } = propIndex;\n setAxisEncode(axis, part, vgProp, propValue);\n delete axis[prop];\n } // else do nothing since the property already supports signal\n }\n // Do not pass labelAlign/Baseline = null to Vega since it won't pass the schema\n // Note that we need to use null so the default labelAlign is preserved.\n if (contains(['labelAlign', 'labelBaseline'], prop) && axis[prop] === null) {\n delete axis[prop];\n }\n }\n if (kind === 'grid') {\n if (!axis.grid) {\n return undefined;\n }\n // Remove unnecessary encode block\n if (axis.encode) {\n // Only need to keep encode block for grid\n const { grid } = axis.encode;\n axis.encode = {\n ...(grid ? { grid } : {})\n };\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n return {\n scale,\n orient,\n ...axis,\n domain: false,\n labels: false,\n aria: false,\n // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent`\n // would not affect gridAxis\n maxExtent: 0,\n minExtent: 0,\n ticks: false,\n zindex: getFirstDefined(zindex, 0) // put grid behind marks by default\n };\n }\n else {\n // kind === 'main'\n if (!opt.header && axisCmpt.mainExtracted) {\n // if mainExtracted has been extracted to a separate facet\n return undefined;\n }\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (axis.encode?.labels?.update && isSignalRef(axis.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal);\n }\n setAxisEncode(axis, 'labels', 'text', { signal: expr });\n }\n if (axis.labelAlign === null) {\n delete axis.labelAlign;\n }\n // Remove unnecessary encode block\n if (axis.encode) {\n for (const part of AXIS_PARTS) {\n if (!axisCmpt.hasAxisPart(part)) {\n delete axis.encode[part];\n }\n }\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n const titleString = assembleTitle(title, config);\n return {\n scale,\n orient,\n grid: false,\n ...(titleString ? { title: titleString } : {}),\n ...axis,\n ...(config.aria === false ? { aria: false } : {}),\n zindex: getFirstDefined(zindex, 0) // put axis line above marks by default\n };\n }\n}\n/**\n * Add axis signals so grid line works correctly\n * (Fix https://github.com/vega/vega-lite/issues/4226)\n */\nexport function assembleAxisSignals(model) {\n const { axes } = model.component;\n const signals = [];\n for (const channel of POSITION_SCALE_CHANNELS) {\n if (axes[channel]) {\n for (const axis of axes[channel]) {\n if (!axis.get('disable') && !axis.get('gridScale')) {\n // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width.\n const sizeType = channel === 'x' ? 'height' : 'width';\n const update = model.getSizeSignalRef(sizeType).signal;\n if (sizeType !== update) {\n signals.push({\n name: sizeType,\n update\n });\n }\n }\n }\n }\n }\n return signals;\n}\nexport function assembleAxes(axisComponents, config) {\n const { x = [], y = [] } = axisComponents;\n return [\n ...x.map(a => assembleAxis(a, 'grid', config)),\n ...y.map(a => assembleAxis(a, 'grid', config)),\n ...x.map(a => assembleAxis(a, 'main', config)),\n ...y.map(a => assembleAxis(a, 'main', config))\n ].filter(a => a); // filter undefined\n}\n//# sourceMappingURL=assemble.js.map","import { array } from 'vega-util';\nimport { isQuantitative } from '../../scale';\nimport { keys, titleCase } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { getStyleConfig, signalOrStringValue } from '../common';\nfunction getAxisConfigFromConfigTypes(configTypes, config, channel, orient) {\n // TODO: add special casing to add conditional value based on orient signal\n return Object.assign.apply(null, [\n {},\n ...configTypes.map(configType => {\n if (configType === 'axisOrient') {\n const orient1 = channel === 'x' ? 'bottom' : 'left';\n const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {};\n const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {};\n const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]);\n const conditionalOrientAxisConfig = {};\n for (const prop of props.values()) {\n conditionalOrientAxisConfig[prop] = {\n // orient is surely signal in this case\n signal: `${orient['signal']} === \"${orient1}\" ? ${signalOrStringValue(orientConfig1[prop])} : ${signalOrStringValue(orientConfig2[prop])}`\n };\n }\n return conditionalOrientAxisConfig;\n }\n return config[configType];\n })\n ]);\n}\nexport function getAxisConfigs(channel, scaleType, orient, config) {\n const typeBasedConfigTypes = scaleType === 'band'\n ? ['axisDiscrete', 'axisBand']\n : scaleType === 'point'\n ? ['axisDiscrete', 'axisPoint']\n : isQuantitative(scaleType)\n ? ['axisQuantitative']\n : scaleType === 'time' || scaleType === 'utc'\n ? ['axisTemporal']\n : [];\n const axisChannel = channel === 'x' ? 'axisX' : 'axisY';\n const axisOrient = isSignalRef(orient) ? 'axisOrient' : `axis${titleCase(orient)}`; // axisTop, axisBottom, ...\n const vlOnlyConfigTypes = [\n // technically Vega does have axisBand, but if we make another separation here,\n // it will further introduce complexity in the code\n ...typeBasedConfigTypes,\n ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4))\n ];\n const vgConfigTypes = ['axis', axisOrient, axisChannel];\n return {\n vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient),\n vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient),\n axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config)\n };\n}\nexport function getAxisConfigStyle(axisConfigTypes, config) {\n const toMerge = [{}];\n for (const configType of axisConfigTypes) {\n // TODO: add special casing to add conditional value based on orient signal\n let style = config[configType]?.style;\n if (style) {\n style = array(style);\n for (const s of style) {\n toMerge.push(config.style[s]);\n }\n }\n }\n return Object.assign.apply(null, toMerge);\n}\nexport function getAxisConfig(property, styleConfigIndex, style, axisConfigs = {}) {\n const styleConfig = getStyleConfig(property, style, styleConfigIndex);\n if (styleConfig !== undefined) {\n return {\n configFrom: 'style',\n configValue: styleConfig\n };\n }\n for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) {\n if (axisConfigs[configFrom]?.[property] !== undefined) {\n return { configFrom, configValue: axisConfigs[configFrom][property] };\n }\n }\n return {};\n}\n//# sourceMappingURL=config.js.map","import { isArray, isObject } from 'vega-util';\nimport { isBinned, isBinning } from '../../bin';\nimport { X } from '../../channel';\nimport { isDiscrete, isFieldDef, toFieldDefBase, valueArray } from '../../channeldef';\nimport { hasDiscreteDomain } from '../../scale';\nimport { durationExpr, normalizeTimeUnit } from '../../timeunit';\nimport { NOMINAL, ORDINAL } from '../../type';\nimport { contains, normalizeAngle } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { mergeTitle, mergeTitleFieldDefs } from '../common';\nimport { getAxisConfig } from './config';\nexport const axisRules = {\n scale: ({ model, channel }) => model.scaleName(channel),\n format: ({ format }) => format,\n formatType: ({ formatType }) => formatType,\n grid: ({ fieldOrDatumDef, axis, scaleType }) => axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef),\n gridScale: ({ model, channel }) => gridScale(model, channel),\n labelAlign: ({ axis, labelAngle, orient, channel }) => axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel),\n labelAngle: ({ labelAngle }) => labelAngle,\n labelBaseline: ({ axis, labelAngle, orient, channel }) => axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel),\n labelFlush: ({ axis, fieldOrDatumDef, channel }) => axis.labelFlush ?? defaultLabelFlush(fieldOrDatumDef.type, channel),\n labelOverlap: ({ axis, fieldOrDatumDef, scaleType }) => axis.labelOverlap ??\n defaultLabelOverlap(fieldOrDatumDef.type, scaleType, isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit, isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined),\n // we already calculate orient in parse\n orient: ({ orient }) => orient,\n tickCount: ({ channel, model, axis, fieldOrDatumDef, scaleType }) => {\n const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined;\n const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined;\n return axis.tickCount ?? defaultTickCount({ fieldOrDatumDef, scaleType, size, values: axis.values });\n },\n tickMinStep: defaultTickMinStep,\n title: ({ axis, model, channel }) => {\n if (axis.title !== undefined) {\n return axis.title;\n }\n const fieldDefTitle = getFieldDefTitle(model, channel);\n if (fieldDefTitle !== undefined) {\n return fieldDefTitle;\n }\n const fieldDef = model.typedFieldDef(channel);\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = model.fieldDef(channel2);\n // If title not specified, store base parts of fieldDef (and fieldDef2 if exists)\n return mergeTitleFieldDefs(fieldDef ? [toFieldDefBase(fieldDef)] : [], isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []);\n },\n values: ({ axis, fieldOrDatumDef }) => values(axis, fieldOrDatumDef),\n zindex: ({ axis, fieldOrDatumDef, mark }) => axis.zindex ?? defaultZindex(mark, fieldOrDatumDef)\n};\n// TODO: we need to refactor this method after we take care of config refactoring\n/**\n * Default rules for whether to show a grid should be shown for a channel.\n * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned\n */\nexport function defaultGrid(scaleType, fieldDef) {\n return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin) && !isBinned(fieldDef?.bin);\n}\nexport function gridScale(model, channel) {\n const gridChannel = channel === 'x' ? 'y' : 'x';\n if (model.getScaleComponent(gridChannel)) {\n return model.scaleName(gridChannel);\n }\n return undefined;\n}\nexport function getLabelAngle(fieldOrDatumDef, axis, channel, styleConfig, axisConfigs) {\n const labelAngle = axis?.labelAngle;\n // try axis value\n if (labelAngle !== undefined) {\n return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle);\n }\n else {\n // try axis config value\n const { configValue: angle } = getAxisConfig('labelAngle', styleConfig, axis?.style, axisConfigs);\n if (angle !== undefined) {\n return normalizeAngle(angle);\n }\n else {\n // get default value\n if (channel === X &&\n contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) &&\n !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)) {\n return 270;\n }\n // no default\n return undefined;\n }\n }\n}\nexport function normalizeAngleExpr(angle) {\n return `(((${angle.signal} % 360) + 360) % 360)`;\n}\nexport function defaultLabelBaseline(angle, orient, channel, alwaysIncludeMiddle) {\n if (angle !== undefined) {\n if (channel === 'x') {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === \"top\")` : orient === 'top';\n return {\n signal: `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? \"middle\" :` +\n `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? \"bottom\" : \"top\"`\n };\n }\n if ((45 < angle && angle < 135) || (225 < angle && angle < 315)) {\n return 'middle';\n }\n if (isSignalRef(orient)) {\n const op = angle <= 45 || 315 <= angle ? '===' : '!==';\n return { signal: `${orient.signal} ${op} \"top\" ? \"bottom\" : \"top\"` };\n }\n return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top';\n }\n else {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === \"left\")` : orient === 'left';\n const middle = alwaysIncludeMiddle ? '\"middle\"' : 'null';\n return {\n signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? \"top\" : \"bottom\"`\n };\n }\n if (angle <= 45 || 315 <= angle || (135 <= angle && angle <= 225)) {\n return alwaysIncludeMiddle ? 'middle' : null;\n }\n if (isSignalRef(orient)) {\n const op = 45 <= angle && angle <= 135 ? '===' : '!==';\n return { signal: `${orient.signal} ${op} \"left\" ? \"top\" : \"bottom\"` };\n }\n return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom';\n }\n }\n return undefined;\n}\nexport function defaultLabelAlign(angle, orient, channel) {\n if (angle === undefined) {\n return undefined;\n }\n const isX = channel === 'x';\n const startAngle = isX ? 0 : 90;\n const mainOrient = isX ? 'bottom' : 'left';\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === \"${mainOrient}\")` : orient === mainOrient;\n return {\n signal: `(${startAngle ? `(${a} + 90)` : a} % 180 === 0) ? ${isX ? null : '\"center\"'} :` +\n `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n if ((angle + startAngle) % 180 === 0) {\n // For bottom, use default label align so label flush still works\n return isX ? null : 'center';\n }\n if (isSignalRef(orient)) {\n const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!==';\n const orientIsMain = `${orient.signal} ${op} \"${mainOrient}\"`;\n return {\n signal: `${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) {\n return 'left';\n }\n return 'right';\n}\nexport function defaultLabelFlush(type, channel) {\n if (channel === 'x' && contains(['quantitative', 'temporal'], type)) {\n return true;\n }\n return undefined;\n}\nexport function defaultLabelOverlap(type, scaleType, hasTimeUnit, sort) {\n // do not prevent overlap for nominal data because there is no way to infer what the missing labels are\n if ((hasTimeUnit && !isObject(sort)) || (type !== 'nominal' && type !== 'ordinal')) {\n if (scaleType === 'log' || scaleType === 'symlog') {\n return 'greedy';\n }\n return true;\n }\n return undefined;\n}\nexport function defaultOrient(channel) {\n return channel === 'x' ? 'bottom' : 'left';\n}\nexport function defaultTickCount({ fieldOrDatumDef, scaleType, size, values: vals }) {\n if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') {\n if (isFieldDef(fieldOrDatumDef)) {\n if (isBinning(fieldOrDatumDef.bin)) {\n // for binned data, we don't want more ticks than maxbins\n return { signal: `ceil(${size.signal}/10)` };\n }\n if (fieldOrDatumDef.timeUnit &&\n contains(['month', 'hours', 'day', 'quarter'], normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit)) {\n return undefined;\n }\n }\n return { signal: `ceil(${size.signal}/40)` };\n }\n return undefined;\n}\nexport function defaultTickMinStep({ format, fieldOrDatumDef }) {\n if (format === 'd') {\n return 1;\n }\n if (isFieldDef(fieldOrDatumDef)) {\n const { timeUnit } = fieldOrDatumDef;\n if (timeUnit) {\n const signal = durationExpr(timeUnit);\n if (signal) {\n return { signal };\n }\n }\n }\n return undefined;\n}\nexport function getFieldDefTitle(model, channel) {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef = model.fieldDef(channel);\n const fieldDef2 = model.fieldDef(channel2);\n const title1 = fieldDef ? fieldDef.title : undefined;\n const title2 = fieldDef2 ? fieldDef2.title : undefined;\n if (title1 && title2) {\n return mergeTitle(title1, title2);\n }\n else if (title1) {\n return title1;\n }\n else if (title2) {\n return title2;\n }\n else if (title1 !== undefined) {\n // falsy value to disable config\n return title1;\n }\n else if (title2 !== undefined) {\n // falsy value to disable config\n return title2;\n }\n return undefined;\n}\nexport function values(axis, fieldOrDatumDef) {\n const vals = axis.values;\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n }\n else if (isSignalRef(vals)) {\n return vals;\n }\n return undefined;\n}\nexport function defaultZindex(mark, fieldDef) {\n if (mark === 'rect' && isDiscrete(fieldDef)) {\n return 1;\n }\n return 0;\n}\n//# sourceMappingURL=properties.js.map","import { isScaleFieldDef, vgField } from '../../channeldef';\nimport { fieldFilterExpression } from '../../predicate';\nimport { isSortArray } from '../../sort';\nimport { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nimport { getDependentFields } from './expressions';\nexport class CalculateNode extends DataFlowNode {\n clone() {\n return new CalculateNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this._dependentFields = getDependentFields(this.transform.calculate);\n }\n static parseAllForSortIndex(parent, model) {\n // get all the encoding with sort fields from model\n model.forEachFieldDef((fieldDef, channel) => {\n if (!isScaleFieldDef(fieldDef)) {\n return;\n }\n if (isSortArray(fieldDef.sort)) {\n const { field, timeUnit } = fieldDef;\n const sort = fieldDef.sort;\n // generate `datum[\"a\"] === val0 ? 0 : datum[\"a\"] === val1 ? 1 : ... : n` via FieldEqualPredicate\n const calculate = sort\n .map((sortValue, i) => {\n return `${fieldFilterExpression({ field, timeUnit, equal: sortValue })} ? ${i} : `;\n })\n .join('') + sort.length;\n parent = new CalculateNode(parent, {\n calculate,\n as: sortArrayIndexField(fieldDef, channel, { forAs: true })\n });\n }\n });\n return parent;\n }\n producedFields() {\n return new Set([this.transform.as]);\n }\n dependentFields() {\n return this._dependentFields;\n }\n assemble() {\n return {\n type: 'formula',\n expr: this.transform.calculate,\n as: this.transform.as\n };\n }\n hash() {\n return `Calculate ${hash(this.transform)}`;\n }\n}\nexport function sortArrayIndexField(fieldDef, channel, opt) {\n return vgField(fieldDef, { prefix: channel, suffix: 'sort_index', ...(opt ?? {}) });\n}\n//# sourceMappingURL=calculate.js.map","import { contains, getFirstDefined } from '../../util';\n/**\n * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet.\n */\nexport function getHeaderChannel(channel, orient) {\n if (contains(['top', 'bottom'], orient)) {\n return 'column';\n }\n else if (contains(['left', 'right'], orient)) {\n return 'row';\n }\n return channel === 'row' ? 'row' : 'column';\n}\nexport function getHeaderProperty(prop, header, config, channel) {\n const headerSpecificConfig = channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet;\n return getFirstDefined((header || {})[prop], headerSpecificConfig[prop], config.header[prop]);\n}\nexport function getHeaderProperties(properties, header, config, channel) {\n const props = {};\n for (const prop of properties) {\n const value = getHeaderProperty(prop, header || {}, config, channel);\n if (value !== undefined) {\n props[prop] = value;\n }\n }\n return props;\n}\n//# sourceMappingURL=common.js.map","export const HEADER_CHANNELS = ['row', 'column'];\nexport const HEADER_TYPES = ['header', 'footer'];\n//# sourceMappingURL=component.js.map","/**\n * Utility for generating row / column headers\n */\nimport { isArray } from 'vega-util';\nimport { FACET_CHANNELS } from '../../channel';\nimport { vgField } from '../../channeldef';\nimport { HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP } from '../../header';\nimport { isSortField } from '../../sort';\nimport { isFacetMapping } from '../../spec/facet';\nimport { contains, isEmpty, normalizeAngle, replaceAll } from '../../util';\nimport { defaultLabelAlign, defaultLabelBaseline } from '../axis/properties';\nimport { sortArrayIndexField } from '../data/calculate';\nimport { formatSignalRef } from '../format';\nimport { isFacetModel } from '../model';\nimport { getHeaderChannel, getHeaderProperties, getHeaderProperty } from './common';\nimport { HEADER_TYPES } from './component';\n// TODO: rename to assembleHeaderTitleGroup\nexport function assembleTitleGroup(model, channel) {\n const title = model.component.layoutHeaders[channel].title;\n const config = model.config ? model.config : undefined;\n const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef\n ? model.component.layoutHeaders[channel].facetFieldDef\n : undefined;\n const { titleAnchor, titleAngle: ta, titleOrient } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef.header, config, channel);\n const headerChannel = getHeaderChannel(channel, titleOrient);\n const titleAngle = normalizeAngle(ta);\n return {\n name: `${channel}-title`,\n type: 'group',\n role: `${headerChannel}-title`,\n title: {\n text: title,\n ...(channel === 'row' ? { orient: 'left' } : {}),\n style: 'guide-title',\n ...defaultHeaderGuideBaseline(titleAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP)\n }\n };\n}\nexport function defaultHeaderGuideAlign(headerChannel, angle, anchor = 'middle') {\n switch (anchor) {\n case 'start':\n return { align: 'left' };\n case 'end':\n return { align: 'right' };\n }\n const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x');\n return align ? { align } : {};\n}\nexport function defaultHeaderGuideBaseline(angle, channel) {\n const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true);\n return baseline ? { baseline } : {};\n}\nexport function assembleHeaderGroups(model, channel) {\n const layoutHeader = model.component.layoutHeaders[channel];\n const groups = [];\n for (const headerType of HEADER_TYPES) {\n if (layoutHeader[headerType]) {\n for (const headerComponent of layoutHeader[headerType]) {\n const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent);\n if (group != null) {\n groups.push(group);\n }\n }\n }\n }\n return groups;\n}\nfunction getSort(facetFieldDef, channel) {\n const { sort } = facetFieldDef;\n if (isSortField(sort)) {\n return {\n field: vgField(sort, { expr: 'datum' }),\n order: sort.order ?? 'ascending'\n };\n }\n else if (isArray(sort)) {\n return {\n field: sortArrayIndexField(facetFieldDef, channel, { expr: 'datum' }),\n order: 'ascending'\n };\n }\n else {\n return {\n field: vgField(facetFieldDef, { expr: 'datum' }),\n order: sort ?? 'ascending'\n };\n }\n}\nexport function assembleLabelTitle(facetFieldDef, channel, config) {\n const { format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr } = getHeaderProperties(['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'], facetFieldDef.header, config, channel);\n const titleTextExpr = formatSignalRef({\n fieldOrDatumDef: facetFieldDef,\n format,\n formatType,\n expr: 'parent',\n config\n }).signal;\n const headerChannel = getHeaderChannel(channel, labelOrient);\n return {\n text: {\n signal: labelExpr\n ? replaceAll(replaceAll(labelExpr, 'datum.label', titleTextExpr), 'datum.value', vgField(facetFieldDef, { expr: 'parent' }))\n : titleTextExpr\n },\n ...(channel === 'row' ? { orient: 'left' } : {}),\n style: 'guide-label',\n frame: 'group',\n ...defaultHeaderGuideBaseline(labelAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP)\n };\n}\nexport function assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent) {\n if (headerComponent) {\n let title = null;\n const { facetFieldDef } = layoutHeader;\n const config = model.config ? model.config : undefined;\n if (facetFieldDef && headerComponent.labels) {\n const { labelOrient } = getHeaderProperties(['labelOrient'], facetFieldDef.header, config, channel);\n // Include label title in the header if orient aligns with the channel\n if ((channel === 'row' && !contains(['top', 'bottom'], labelOrient)) ||\n (channel === 'column' && !contains(['left', 'right'], labelOrient))) {\n title = assembleLabelTitle(facetFieldDef, channel, config);\n }\n }\n const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet);\n const axes = headerComponent.axes;\n const hasAxes = axes?.length > 0;\n if (title || hasAxes) {\n const sizeChannel = channel === 'row' ? 'height' : 'width';\n return {\n name: model.getName(`${channel}_${headerType}`),\n type: 'group',\n role: `${channel}-${headerType}`,\n ...(layoutHeader.facetFieldDef\n ? {\n from: { data: model.getName(`${channel}_domain`) },\n sort: getSort(facetFieldDef, channel)\n }\n : {}),\n ...(hasAxes && isFacetWithoutRowCol\n ? {\n from: { data: model.getName(`facet_domain_${channel}`) }\n }\n : {}),\n ...(title ? { title } : {}),\n ...(headerComponent.sizeSignal\n ? {\n encode: {\n update: {\n [sizeChannel]: headerComponent.sizeSignal\n }\n }\n }\n : {}),\n ...(hasAxes ? { axes } : {})\n };\n }\n }\n return null;\n}\nconst LAYOUT_TITLE_BAND = {\n column: {\n start: 0,\n end: 1\n },\n row: {\n start: 1,\n end: 0\n }\n};\nexport function getLayoutTitleBand(titleAnchor, headerChannel) {\n return LAYOUT_TITLE_BAND[headerChannel][titleAnchor];\n}\nexport function assembleLayoutTitleBand(headerComponentIndex, config) {\n const titleBand = {};\n for (const channel of FACET_CHANNELS) {\n const headerComponent = headerComponentIndex[channel];\n if (headerComponent?.facetFieldDef) {\n const { titleAnchor, titleOrient } = getHeaderProperties(['titleAnchor', 'titleOrient'], headerComponent.facetFieldDef.header, config, channel);\n const headerChannel = getHeaderChannel(channel, titleOrient);\n const band = getLayoutTitleBand(titleAnchor, headerChannel);\n if (band !== undefined) {\n titleBand[headerChannel] = band;\n }\n }\n }\n return isEmpty(titleBand) ? undefined : titleBand;\n}\nexport function assembleHeaderProperties(config, facetFieldDef, channel, properties, propertiesMap) {\n const props = {};\n for (const prop of properties) {\n if (!propertiesMap[prop]) {\n continue;\n }\n const value = getHeaderProperty(prop, facetFieldDef?.header, config, channel);\n if (value !== undefined) {\n props[propertiesMap[prop]] = value;\n }\n }\n return props;\n}\n//# sourceMappingURL=assemble.js.map","import { getViewConfigContinuousSize } from '../../config';\nimport { hasDiscreteDomain } from '../../scale';\nimport { getFirstDefined } from '../../util';\nimport { isSignalRef, isVgRangeStep } from '../../vega.schema';\nimport { signalOrStringValue } from '../common';\nimport { isFacetModel } from '../model';\nexport function assembleLayoutSignals(model) {\n return [\n ...sizeSignals(model, 'width'),\n ...sizeSignals(model, 'height'),\n ...sizeSignals(model, 'childWidth'),\n ...sizeSignals(model, 'childHeight')\n ];\n}\nexport function sizeSignals(model, sizeType) {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const size = model.component.layoutSize.get(sizeType);\n if (!size || size === 'merged') {\n return [];\n }\n // Read size signal name from name map, just in case it is the top-level size signal that got renamed.\n const name = model.getSizeSignalRef(sizeType).signal;\n if (size === 'step') {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = model.scaleName(channel);\n if (isFacetModel(model.parent)) {\n // If parent is facet and this is an independent scale, return only signal signal\n // as the width/height will be calculated using the cardinality from\n // facet's aggregate rather than reading from scale domain\n const parentResolve = model.parent.component.resolve;\n if (parentResolve.scale[channel] === 'independent') {\n return [stepSignal(scaleName, range)];\n }\n }\n return [\n stepSignal(scaleName, range),\n {\n name,\n update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`)\n }\n ];\n }\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('layout size is step although width/height is not step.');\n }\n else if (size == 'container') {\n const isWidth = name.endsWith('width');\n const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]';\n const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height');\n const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`;\n return [{ name, init: safeExpr, on: [{ update: safeExpr, events: 'window:resize' }] }];\n }\n else {\n return [\n {\n name,\n value: size\n }\n ];\n }\n}\nfunction stepSignal(scaleName, range) {\n const name = `${scaleName}_step`;\n if (isSignalRef(range.step)) {\n return { name, update: range.step.signal };\n }\n else {\n return { name, value: range.step };\n }\n}\nexport function sizeExpr(scaleName, scaleComponent, cardinality) {\n const type = scaleComponent.get('type');\n const padding = scaleComponent.get('padding');\n const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding);\n let paddingInner = scaleComponent.get('paddingInner');\n paddingInner =\n type === 'band'\n ? // only band has real paddingInner\n paddingInner !== undefined\n ? paddingInner\n : padding\n : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128,\n // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points.\n 1;\n return `bandspace(${cardinality}, ${signalOrStringValue(paddingInner)}, ${signalOrStringValue(paddingOuter)}) * ${scaleName}_step`;\n}\n//# sourceMappingURL=assemble.js.map","export function getSizeTypeFromLayoutSizeType(layoutSizeType) {\n return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType;\n}\n//# sourceMappingURL=component.js.map","import { keys } from '../util';\nimport { signalOrValueRef } from './common';\nimport { wrapCondition } from './mark/encode';\nexport function guideEncodeEntry(encoding, model) {\n return keys(encoding).reduce((encode, channel) => {\n const valueDef = encoding[channel];\n return {\n ...encode,\n ...wrapCondition(model, valueDef, channel, def => signalOrValueRef(def.value))\n };\n }, {});\n}\n//# sourceMappingURL=guide.js.map","import { isXorY } from '../channel';\nimport * as log from '../log';\nimport { isConcatModel, isFacetModel, isLayerModel } from './model';\nexport function defaultScaleResolve(channel, model) {\n if (isFacetModel(model)) {\n return channel === 'theta' ? 'independent' : 'shared';\n }\n else if (isLayerModel(model)) {\n return 'shared';\n }\n else if (isConcatModel(model)) {\n return isXorY(channel) || channel === 'theta' || channel === 'radius' ? 'independent' : 'shared';\n }\n /* istanbul ignore next: should never reach here. */\n throw new Error('invalid model type for resolve');\n}\nexport function parseGuideResolve(resolve, channel) {\n const channelScaleResolve = resolve.scale[channel];\n const guide = isXorY(channel) ? 'axis' : 'legend';\n if (channelScaleResolve === 'independent') {\n if (resolve[guide][channel] === 'shared') {\n log.warn(log.message.independentScaleMeansIndependentGuide(channel));\n }\n return 'independent';\n }\n return resolve[guide][channel] || 'shared';\n}\n//# sourceMappingURL=resolve.js.map","import { COMMON_LEGEND_PROPERTY_INDEX } from '../../legend';\nimport { keys } from '../../util';\nimport { Split } from '../split';\nconst LEGEND_COMPONENT_PROPERTY_INDEX = {\n ...COMMON_LEGEND_PROPERTY_INDEX,\n disable: 1,\n labelExpr: 1,\n selections: 1,\n // channel scales\n opacity: 1,\n shape: 1,\n stroke: 1,\n fill: 1,\n size: 1,\n strokeWidth: 1,\n strokeDash: 1,\n // encode\n encode: 1\n};\nexport const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX);\nexport class LegendComponent extends Split {\n}\n//# sourceMappingURL=component.js.map","import { array, isArray, stringValue } from 'vega-util';\nimport { COLOR, OPACITY } from '../../channel';\nimport { hasConditionalValueDef, isFieldDef, isValueDef } from '../../channeldef';\nimport { FILL_STROKE_CONFIG } from '../../mark';\nimport { getFirstDefined, isEmpty, varName } from '../../util';\nimport { applyMarkConfig, signalOrValueRef } from '../common';\nimport { formatCustomType, isCustomFormatType } from '../format';\nimport * as mixins from '../mark/encode';\nimport { STORE } from '../selection';\nexport const legendEncodeRules = {\n symbols,\n gradient,\n labels,\n entries\n};\nexport function symbols(symbolsSpec, { fieldOrDatumDef, model, channel, legendCmpt, legendType }) {\n if (legendType !== 'symbol') {\n return undefined;\n }\n const { markDef, encoding, config, mark } = model;\n const filled = markDef.filled && mark !== 'trail';\n let out = {\n ...applyMarkConfig({}, model, FILL_STROKE_CONFIG),\n ...mixins.color(model, { filled })\n }; // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry\n const symbolOpacity = legendCmpt.get('symbolOpacity') ?? config.legend.symbolOpacity;\n const symbolFillColor = legendCmpt.get('symbolFillColor') ?? config.legend.symbolFillColor;\n const symbolStrokeColor = legendCmpt.get('symbolStrokeColor') ?? config.legend.symbolStrokeColor;\n const opacity = symbolOpacity === undefined ? getMaxValue(encoding.opacity) ?? markDef.opacity : undefined;\n if (out.fill) {\n // for fill legend, we don't want any fill in symbol\n if (channel === 'fill' || (filled && channel === COLOR)) {\n delete out.fill;\n }\n else {\n if (out.fill['field']) {\n // For others, set fill to some opaque value (or nothing if a color is already set)\n if (symbolFillColor) {\n delete out.fill;\n }\n else {\n out.fill = signalOrValueRef(config.legend.symbolBaseFillColor ?? 'black');\n out.fillOpacity = signalOrValueRef(opacity ?? 1);\n }\n }\n else if (isArray(out.fill)) {\n const fill = getFirstConditionValue(encoding.fill ?? encoding.color) ?? markDef.fill ?? (filled && markDef.color);\n if (fill) {\n out.fill = signalOrValueRef(fill);\n }\n }\n }\n }\n if (out.stroke) {\n if (channel === 'stroke' || (!filled && channel === COLOR)) {\n delete out.stroke;\n }\n else {\n if (out.stroke['field'] || symbolStrokeColor) {\n // For others, remove stroke field\n delete out.stroke;\n }\n else if (isArray(out.stroke)) {\n const stroke = getFirstDefined(getFirstConditionValue(encoding.stroke || encoding.color), markDef.stroke, filled ? markDef.color : undefined);\n if (stroke) {\n out.stroke = { value: stroke };\n }\n }\n }\n }\n if (channel !== OPACITY) {\n const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef);\n if (condition) {\n out.opacity = [\n { test: condition, ...signalOrValueRef(opacity ?? 1) },\n signalOrValueRef(config.legend.unselectedOpacity)\n ];\n }\n else if (opacity) {\n out.opacity = signalOrValueRef(opacity);\n }\n }\n out = { ...out, ...symbolsSpec };\n return isEmpty(out) ? undefined : out;\n}\nexport function gradient(gradientSpec, { model, legendType, legendCmpt }) {\n if (legendType !== 'gradient') {\n return undefined;\n }\n const { config, markDef, encoding } = model;\n let out = {};\n const gradientOpacity = legendCmpt.get('gradientOpacity') ?? config.legend.gradientOpacity;\n const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined;\n if (opacity) {\n // only apply opacity if it is neither zero or undefined\n out.opacity = signalOrValueRef(opacity);\n }\n out = { ...out, ...gradientSpec };\n return isEmpty(out) ? undefined : out;\n}\nexport function labels(specifiedlabelsSpec, { fieldOrDatumDef, model, channel, legendCmpt }) {\n const legend = model.legend(channel) || {};\n const config = model.config;\n const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined;\n const opacity = condition ? [{ test: condition, value: 1 }, { value: config.legend.unselectedOpacity }] : undefined;\n const { format, formatType } = legend;\n let text = undefined;\n if (isCustomFormatType(formatType)) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n });\n }\n else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (fieldOrDatumDef.type === 'quantitative' && config.numberFormatType) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.numberFormat,\n formatType: config.numberFormatType,\n config\n });\n }\n else if (fieldOrDatumDef.type === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n fieldOrDatumDef.timeUnit === undefined) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.timeFormat,\n formatType: config.timeFormatType,\n config\n });\n }\n }\n const labelsSpec = {\n ...(opacity ? { opacity } : {}),\n ...(text ? { text } : {}),\n ...specifiedlabelsSpec\n };\n return isEmpty(labelsSpec) ? undefined : labelsSpec;\n}\nexport function entries(entriesSpec, { legendCmpt }) {\n const selections = legendCmpt.get('selections');\n return selections?.length ? { ...entriesSpec, fill: { value: 'transparent' } } : entriesSpec;\n}\nfunction getMaxValue(channelDef) {\n return getConditionValue(channelDef, (v, conditionalDef) => Math.max(v, conditionalDef.value));\n}\nexport function getFirstConditionValue(channelDef) {\n return getConditionValue(channelDef, (v, conditionalDef) => {\n return getFirstDefined(v, conditionalDef.value);\n });\n}\nfunction getConditionValue(channelDef, reducer) {\n if (hasConditionalValueDef(channelDef)) {\n return array(channelDef.condition).reduce(reducer, channelDef.value);\n }\n else if (isValueDef(channelDef)) {\n return channelDef.value;\n }\n return undefined;\n}\nfunction selectedCondition(model, legendCmpt, fieldDef) {\n const selections = legendCmpt.get('selections');\n if (!selections?.length)\n return undefined;\n const field = stringValue(fieldDef.field);\n return selections\n .map(name => {\n const store = stringValue(varName(name) + STORE);\n return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`;\n })\n .join(' || ');\n}\n//# sourceMappingURL=encode.js.map","import { isArray } from 'vega-util';\nimport { isColorChannel } from '../../channel';\nimport { title as fieldDefTitle, valueArray } from '../../channeldef';\nimport { isContinuousToContinuous } from '../../scale';\nimport { contains, getFirstDefined } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { guideFormat, guideFormatType } from '../format';\nimport { getFirstConditionValue } from './encode';\nexport const legendRules = {\n direction: ({ direction }) => direction,\n format: ({ fieldOrDatumDef, legend, config }) => {\n const { format, formatType } = legend;\n return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false);\n },\n formatType: ({ legend, fieldOrDatumDef, scaleType }) => {\n const { formatType } = legend;\n return guideFormatType(formatType, fieldOrDatumDef, scaleType);\n },\n gradientLength: params => {\n const { legend, legendConfig } = params;\n return legend.gradientLength ?? legendConfig.gradientLength ?? defaultGradientLength(params);\n },\n labelOverlap: ({ legend, legendConfig, scaleType }) => legend.labelOverlap ?? legendConfig.labelOverlap ?? defaultLabelOverlap(scaleType),\n symbolType: ({ legend, markDef, channel, encoding }) => legend.symbolType ?? defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape),\n title: ({ fieldOrDatumDef, config }) => fieldDefTitle(fieldOrDatumDef, config, { allowDisabling: true }),\n type: ({ legendType, scaleType, channel }) => {\n if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) {\n if (legendType === 'gradient') {\n return undefined;\n }\n }\n else if (legendType === 'symbol') {\n return undefined;\n }\n return legendType;\n },\n values: ({ fieldOrDatumDef, legend }) => values(legend, fieldOrDatumDef)\n};\nexport function values(legend, fieldOrDatumDef) {\n const vals = legend.values;\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n }\n else if (isSignalRef(vals)) {\n return vals;\n }\n return undefined;\n}\nexport function defaultSymbolType(mark, channel, shapeChannelDef, markShape) {\n if (channel !== 'shape') {\n // use the value from the shape encoding or the mark config if they exist\n const shape = getFirstConditionValue(shapeChannelDef) ?? markShape;\n if (shape) {\n return shape;\n }\n }\n switch (mark) {\n case 'bar':\n case 'rect':\n case 'image':\n case 'square':\n return 'square';\n case 'line':\n case 'trail':\n case 'rule':\n return 'stroke';\n case 'arc':\n case 'point':\n case 'circle':\n case 'tick':\n case 'geoshape':\n case 'area':\n case 'text':\n return 'circle';\n }\n}\nexport function clipHeight(legendType) {\n if (legendType === 'gradient') {\n return 20;\n }\n return undefined;\n}\nexport function getLegendType(params) {\n const { legend } = params;\n return getFirstDefined(legend.type, defaultType(params));\n}\nexport function defaultType({ channel, timeUnit, scaleType }) {\n // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js\n if (isColorChannel(channel)) {\n if (contains(['quarter', 'month', 'day'], timeUnit)) {\n return 'symbol';\n }\n if (isContinuousToContinuous(scaleType)) {\n return 'gradient';\n }\n }\n return 'symbol';\n}\nexport function getDirection({ legendConfig, legendType, orient, legend }) {\n return (legend.direction ??\n legendConfig[legendType ? 'gradientDirection' : 'symbolDirection'] ??\n defaultDirection(orient, legendType));\n}\nexport function defaultDirection(orient, legendType) {\n switch (orient) {\n case 'top':\n case 'bottom':\n return 'horizontal';\n case 'left':\n case 'right':\n case 'none':\n case undefined: // undefined = \"right\" in Vega\n return undefined; // vertical is Vega's default\n default:\n // top-left / ...\n // For inner legend, uses compact layout like Tableau\n return legendType === 'gradient' ? 'horizontal' : undefined;\n }\n}\nexport function defaultGradientLength({ legendConfig, model, direction, orient, scaleType }) {\n const { gradientHorizontalMaxLength, gradientHorizontalMinLength, gradientVerticalMaxLength, gradientVerticalMinLength } = legendConfig;\n if (isContinuousToContinuous(scaleType)) {\n if (direction === 'horizontal') {\n if (orient === 'top' || orient === 'bottom') {\n return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength);\n }\n else {\n return gradientHorizontalMinLength;\n }\n }\n else {\n // vertical / undefined (Vega uses vertical by default)\n return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength);\n }\n }\n return undefined;\n}\nfunction gradientLengthSignal(model, sizeType, min, max) {\n const sizeSignal = model.getSizeSignalRef(sizeType).signal;\n return { signal: `clamp(${sizeSignal}, ${min}, ${max})` };\n}\nexport function defaultLabelOverlap(scaleType) {\n if (contains(['quantile', 'threshold', 'log', 'symlog'], scaleType)) {\n return 'greedy';\n }\n return undefined;\n}\n//# sourceMappingURL=properties.js.map","import { COLOR, SHAPE } from '../../channel';\nimport { getFieldOrDatumDef, isFieldDef } from '../../channeldef';\nimport { LEGEND_SCALE_CHANNELS } from '../../legend';\nimport { normalizeTimeUnit } from '../../timeunit';\nimport { GEOJSON } from '../../type';\nimport { deleteNestedProperty, isEmpty, keys, varName } from '../../util';\nimport { mergeTitleComponent } from '../common';\nimport { guideEncodeEntry } from '../guide';\nimport { isUnitModel } from '../model';\nimport { parseGuideResolve } from '../resolve';\nimport { parseInteractiveLegend } from '../selection/legends';\nimport { defaultTieBreaker, makeImplicit, mergeValuesWithExplicit } from '../split';\nimport { LegendComponent, LEGEND_COMPONENT_PROPERTIES } from './component';\nimport { legendEncodeRules } from './encode';\nimport { getDirection, getLegendType, legendRules } from './properties';\nexport function parseLegend(model) {\n const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model);\n model.component.legends = legendComponent;\n return legendComponent;\n}\nfunction parseUnitLegend(model) {\n const { encoding } = model;\n const legendComponent = {};\n for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) {\n const def = getFieldOrDatumDef(encoding[channel]);\n if (!def || !model.getScaleComponent(channel)) {\n continue;\n }\n if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) {\n continue;\n }\n legendComponent[channel] = parseLegendForChannel(model, channel);\n }\n return legendComponent;\n}\nfunction getLegendDefWithScale(model, channel) {\n const scale = model.scaleName(channel);\n if (model.mark === 'trail') {\n if (channel === 'color') {\n // trail is a filled mark, but its default symbolType (\"stroke\") should use \"stroke\"\n return { stroke: scale };\n }\n else if (channel === 'size') {\n return { strokeWidth: scale };\n }\n }\n if (channel === 'color') {\n return model.markDef.filled ? { fill: scale } : { stroke: scale };\n }\n return { [channel]: scale };\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isExplicit(value, property, legend, fieldDef) {\n switch (property) {\n case 'disable':\n return legend !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit\n case 'values':\n // specified legend.values is already respected, but may get transformed.\n return !!legend?.values;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (property === 'title' && value === fieldDef?.title) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === (legend || {})[property];\n}\nexport function parseLegendForChannel(model, channel) {\n let legend = model.legend(channel);\n const { markDef, encoding, config } = model;\n const legendConfig = config.legend;\n const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel));\n parseInteractiveLegend(model, channel, legendCmpt);\n const disable = legend !== undefined ? !legend : legendConfig.disable;\n legendCmpt.set('disable', disable, legend !== undefined);\n if (disable) {\n return legendCmpt;\n }\n legend = legend || {};\n const scaleType = model.getScaleComponent(channel).get('type');\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]);\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n const orient = legend.orient || config.legend.orient || 'right';\n const legendType = getLegendType({ legend, channel, timeUnit, scaleType });\n const direction = getDirection({ legend, legendType, orient, legendConfig });\n const ruleParams = {\n legend,\n channel,\n model,\n markDef,\n encoding,\n fieldOrDatumDef,\n legendConfig,\n config,\n scaleType,\n orient,\n legendType,\n direction\n };\n for (const property of LEGEND_COMPONENT_PROPERTIES) {\n if ((legendType === 'gradient' && property.startsWith('symbol')) ||\n (legendType === 'symbol' && property.startsWith('gradient'))) {\n continue;\n }\n const value = property in legendRules ? legendRules[property](ruleParams) : legend[property];\n if (value !== undefined) {\n const explicit = isExplicit(value, property, legend, model.fieldDef(channel));\n if (explicit || config.legend[property] === undefined) {\n legendCmpt.set(property, value, explicit);\n }\n }\n }\n const legendEncoding = legend?.encoding ?? {};\n const selections = legendCmpt.get('selections');\n const legendEncode = {};\n const legendEncodeParams = { fieldOrDatumDef, model, channel, legendCmpt, legendType };\n for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) {\n const legendEncodingPart = guideEncodeEntry(legendEncoding[part] ?? {}, model);\n const value = part in legendEncodeRules\n ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule\n : legendEncodingPart; // no rule -- just default values\n if (value !== undefined && !isEmpty(value)) {\n legendEncode[part] = {\n ...(selections?.length && isFieldDef(fieldOrDatumDef)\n ? { name: `${varName(fieldOrDatumDef.field)}_legend_${part}` }\n : {}),\n ...(selections?.length ? { interactive: !!selections } : {}),\n update: value\n };\n }\n }\n if (!isEmpty(legendEncode)) {\n legendCmpt.set('encode', legendEncode, !!legend?.encoding);\n }\n return legendCmpt;\n}\nfunction parseNonUnitLegend(model) {\n const { legends, resolve } = model.component;\n for (const child of model.children) {\n parseLegend(child);\n for (const channel of keys(child.component.legends)) {\n resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel);\n if (resolve.legend[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]);\n if (!legends[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the legend shared.\n // Thus, mark legend as independent and remove the legend component.\n resolve.legend[channel] = 'independent';\n delete legends[channel];\n }\n }\n }\n }\n for (const channel of keys(legends)) {\n for (const child of model.children) {\n if (!child.component.legends[channel]) {\n // skip if the child does not have a particular legend\n continue;\n }\n if (resolve.legend[channel] === 'shared') {\n // After merging shared legend, make sure to remove legend from child\n delete child.component.legends[channel];\n }\n }\n }\n return legends;\n}\nexport function mergeLegendComponent(mergedLegend, childLegend) {\n if (!mergedLegend) {\n return childLegend.clone();\n }\n const mergedOrient = mergedLegend.getWithExplicit('orient');\n const childOrient = childLegend.getWithExplicit('orient');\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n // Cannot merge due to inconsistent orient\n return undefined;\n }\n let typeMerged = false;\n // Otherwise, let's merge\n for (const prop of LEGEND_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(mergedLegend.getWithExplicit(prop), childLegend.getWithExplicit(prop), prop, 'legend', \n // Tie breaker function\n (v1, v2) => {\n switch (prop) {\n case 'symbolType':\n return mergeSymbolType(v1, v2);\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'type':\n // There are only two types. If we have different types, then prefer symbol over gradient.\n typeMerged = true;\n return makeImplicit('symbol');\n }\n return defaultTieBreaker(v1, v2, prop, 'legend');\n });\n mergedLegend.setWithExplicit(prop, mergedValueWithExplicit);\n }\n if (typeMerged) {\n if (mergedLegend.implicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']);\n }\n if (mergedLegend.explicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']);\n }\n }\n return mergedLegend;\n}\nfunction mergeSymbolType(st1, st2) {\n if (st2.value === 'circle') {\n // prefer \"circle\" over \"stroke\"\n return st2;\n }\n return st1;\n}\n//# sourceMappingURL=parse.js.map","import { LEGEND_SCALE_CHANNELS } from '../../legend';\nimport { keys, replaceAll, stringify, vals } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { mergeLegendComponent } from './parse';\nfunction setLegendEncode(legend, part, vgProp, vgRef) {\n var _a, _b;\n legend.encode ?? (legend.encode = {});\n (_a = legend.encode)[part] ?? (_a[part] = {});\n (_b = legend.encode[part]).update ?? (_b.update = {});\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n legend.encode[part].update[vgProp] = vgRef;\n}\nexport function assembleLegends(model) {\n const legendComponentIndex = model.component.legends;\n const legendByDomain = {};\n for (const channel of keys(legendComponentIndex)) {\n const scaleComponent = model.getScaleComponent(channel);\n const domainHash = stringify(scaleComponent.get('domains'));\n if (legendByDomain[domainHash]) {\n for (const mergedLegendComponent of legendByDomain[domainHash]) {\n const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]);\n if (!merged) {\n // If cannot merge, need to add this legend separately\n legendByDomain[domainHash].push(legendComponentIndex[channel]);\n }\n }\n }\n else {\n legendByDomain[domainHash] = [legendComponentIndex[channel].clone()];\n }\n }\n const legends = vals(legendByDomain)\n .flat()\n .map(l => assembleLegend(l, model.config))\n .filter(l => l !== undefined);\n return legends;\n}\nexport function assembleLegend(legendCmpt, config) {\n const { disable, labelExpr, selections, ...legend } = legendCmpt.combine();\n if (disable) {\n return undefined;\n }\n if (config.aria === false && legend.aria == undefined) {\n legend.aria = false;\n }\n if (legend.encode?.symbols) {\n const out = legend.encode.symbols.update;\n if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) {\n // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used.\n out.stroke = { value: 'transparent' };\n }\n // Remove properties that the legend is encoding.\n for (const property of LEGEND_SCALE_CHANNELS) {\n if (legend[property]) {\n delete out[property];\n }\n }\n }\n if (!legend.title) {\n // title schema doesn't include null, ''\n delete legend.title;\n }\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (legend.encode?.labels?.update && isSignalRef(legend.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal);\n }\n setLegendEncode(legend, 'labels', 'text', { signal: expr });\n }\n return legend;\n}\n//# sourceMappingURL=assemble.js.map","import { contains } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { isConcatModel, isLayerModel } from '../model';\nexport function assembleProjections(model) {\n if (isLayerModel(model) || isConcatModel(model)) {\n return assembleProjectionsForModelAndChildren(model);\n }\n else {\n return assembleProjectionForModel(model);\n }\n}\nexport function assembleProjectionsForModelAndChildren(model) {\n return model.children.reduce((projections, child) => {\n return projections.concat(child.assembleProjections());\n }, assembleProjectionForModel(model));\n}\nexport function assembleProjectionForModel(model) {\n const component = model.component.projection;\n if (!component || component.merged) {\n return [];\n }\n const projection = component.combine();\n const { name } = projection; // we need to extract name so that it is always present in the output and pass TS type validation\n if (!component.data) {\n // generate custom projection, no automatic fitting\n return [\n {\n name,\n // translate to center by default\n ...{ translate: { signal: '[width / 2, height / 2]' } },\n // parameters, overwrite default translate if specified\n ...projection\n }\n ];\n }\n else {\n // generate projection that uses extent fitting\n const size = {\n signal: `[${component.size.map(ref => ref.signal).join(', ')}]`\n };\n const fits = component.data.reduce((sources, data) => {\n const source = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`;\n if (!contains(sources, source)) {\n // build a unique list of sources\n sources.push(source);\n }\n return sources;\n }, []);\n if (fits.length <= 0) {\n throw new Error(\"Projection's fit didn't find any data sources\");\n }\n return [\n {\n name,\n size,\n fit: {\n signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0]\n },\n ...projection\n }\n ];\n }\n}\n//# sourceMappingURL=assemble.js.map","export const PROJECTION_PROPERTIES = [\n 'type',\n 'clipAngle',\n 'clipExtent',\n 'center',\n 'rotate',\n 'precision',\n 'reflectX',\n 'reflectY',\n 'coefficient',\n 'distance',\n 'fraction',\n 'lobes',\n 'parallel',\n 'radius',\n 'ratio',\n 'spacing',\n 'tilt'\n];\n//# sourceMappingURL=projection.js.map","import { Split } from '../split';\nexport class ProjectionComponent extends Split {\n constructor(name, specifiedProjection, size, data) {\n super({ ...specifiedProjection }, // all explicit properties of projection\n { name } // name as initial implicit property\n );\n this.specifiedProjection = specifiedProjection;\n this.size = size;\n this.data = data;\n this.merged = false;\n }\n /**\n * Whether the projection parameters should fit provided data.\n */\n get isFit() {\n return !!this.data;\n }\n}\n//# sourceMappingURL=component.js.map","import { hasOwnProperty } from 'vega-util';\nimport { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE } from '../../channel';\nimport { getFieldOrDatumDef } from '../../channeldef';\nimport { DataSourceType } from '../../data';\nimport { replaceExprRef } from '../../expr';\nimport { PROJECTION_PROPERTIES } from '../../projection';\nimport { GEOJSON } from '../../type';\nimport { deepEqual, duplicate, every } from '../../util';\nimport { isUnitModel } from '../model';\nimport { ProjectionComponent } from './component';\nexport function parseProjection(model) {\n model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model);\n}\nfunction parseUnitProjection(model) {\n if (model.hasProjection) {\n const proj = replaceExprRef(model.specifiedProjection);\n const fit = !(proj && (proj.scale != null || proj.translate != null));\n const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined;\n const data = fit ? gatherFitData(model) : undefined;\n const projComp = new ProjectionComponent(model.projectionName(true), {\n ...(replaceExprRef(model.config.projection) ?? {}),\n ...(proj ?? {})\n }, size, data);\n if (!projComp.get('type')) {\n projComp.set('type', 'equalEarth', false);\n }\n return projComp;\n }\n return undefined;\n}\nfunction gatherFitData(model) {\n const data = [];\n const { encoding } = model;\n for (const posssiblePair of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ]) {\n if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n }\n if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n if (data.length === 0) {\n // main source is geojson, so we can just use that\n data.push(model.requestDataName(DataSourceType.Main));\n }\n return data;\n}\nfunction mergeIfNoConflict(first, second) {\n const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => {\n // neither has the property\n if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) {\n return true;\n }\n // both have property and an equal value for property\n if (hasOwnProperty(first.explicit, prop) &&\n hasOwnProperty(second.explicit, prop) &&\n // some properties might be signals or objects and require hashing for comparison\n deepEqual(first.get(prop), second.get(prop))) {\n return true;\n }\n return false;\n });\n const size = deepEqual(first.size, second.size);\n if (size) {\n if (allPropertiesShared) {\n return first;\n }\n else if (deepEqual(first.explicit, {})) {\n return second;\n }\n else if (deepEqual(second.explicit, {})) {\n return first;\n }\n }\n // if all properties don't match, let each unit spec have its own projection\n return null;\n}\nfunction parseNonUnitProjections(model) {\n if (model.children.length === 0) {\n return undefined;\n }\n let nonUnitProjection;\n // parse all children first\n for (const child of model.children) {\n parseProjection(child);\n }\n // analyze parsed projections, attempt to merge\n const mergable = every(model.children, child => {\n const projection = child.component.projection;\n if (!projection) {\n // child layer does not use a projection\n return true;\n }\n else if (!nonUnitProjection) {\n // cached 'projection' is null, cache this one\n nonUnitProjection = projection;\n return true;\n }\n else {\n const merge = mergeIfNoConflict(nonUnitProjection, projection);\n if (merge) {\n nonUnitProjection = merge;\n }\n return !!merge;\n }\n });\n // if cached one and all other children share the same projection,\n if (nonUnitProjection && mergable) {\n // so we can elevate it to the layer level\n const name = model.projectionName(true);\n const modelProjection = new ProjectionComponent(name, nonUnitProjection.specifiedProjection, nonUnitProjection.size, duplicate(nonUnitProjection.data));\n // rename and assign all others as merged\n for (const child of model.children) {\n const projection = child.component.projection;\n if (projection) {\n if (projection.isFit) {\n modelProjection.data.push(...child.component.projection.data);\n }\n child.renameProjection(projection.get('name'), name);\n projection.merged = true;\n }\n }\n return modelProjection;\n }\n return undefined;\n}\n//# sourceMappingURL=parse.js.map","import { isString } from 'vega-util';\nimport { binToString, isBinning, isParameterExtent } from '../../bin';\nimport { binRequiresRange, isTypedFieldDef, normalizeBin, vgField } from '../../channeldef';\nimport { duplicate, hash, isEmpty, keys, replacePathInField, unique, vals } from '../../util';\nimport { binFormatExpression } from '../format';\nimport { isUnitModel } from '../model';\nimport { parseSelectionExtent } from '../selection/parse';\nimport { DataFlowNode } from './dataflow';\nfunction rangeFormula(model, fieldDef, channel, config) {\n if (binRequiresRange(fieldDef, channel)) {\n // read format from axis or legend, if there is no format then use config.numberFormat\n const guide = isUnitModel(model)\n ? model.axis(channel) ?? model.legend(channel) ?? {}\n : {};\n const startField = vgField(fieldDef, { expr: 'datum' });\n const endField = vgField(fieldDef, { expr: 'datum', binSuffix: 'end' });\n return {\n formulaAs: vgField(fieldDef, { binSuffix: 'range', forAs: true }),\n formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config)\n };\n }\n return {};\n}\nfunction binKey(bin, field) {\n return `${binToString(bin)}_${field}`;\n}\nfunction getSignalsFromModel(model, key) {\n return {\n signal: model.getName(`${key}_bins`),\n extentSignal: model.getName(`${key}_extent`)\n };\n}\nexport function getBinSignalName(model, field, bin) {\n const normalizedBin = normalizeBin(bin, undefined) ?? {};\n const key = binKey(normalizedBin, field);\n return model.getName(`${key}_bins`);\n}\nfunction isBinTransform(t) {\n return 'as' in t;\n}\nfunction createBinComponent(t, bin, model) {\n let as;\n let span;\n if (isBinTransform(t)) {\n as = isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]];\n }\n else {\n as = [vgField(t, { forAs: true }), vgField(t, { binSuffix: 'end', forAs: true })];\n }\n const normalizedBin = { ...normalizeBin(bin, undefined) };\n const key = binKey(normalizedBin, t.field);\n const { signal, extentSignal } = getSignalsFromModel(model, key);\n if (isParameterExtent(normalizedBin.extent)) {\n const ext = normalizedBin.extent;\n span = parseSelectionExtent(model, ext.param, ext);\n delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property.\n }\n const binComponent = {\n bin: normalizedBin,\n field: t.field,\n as: [as],\n ...(signal ? { signal } : {}),\n ...(extentSignal ? { extentSignal } : {}),\n ...(span ? { span } : {})\n };\n return { key, binComponent };\n}\nexport class BinNode extends DataFlowNode {\n clone() {\n return new BinNode(null, duplicate(this.bins));\n }\n constructor(parent, bins) {\n super(parent);\n this.bins = bins;\n }\n static makeFromEncoding(parent, model) {\n const bins = model.reduceFieldDef((binComponentIndex, fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n const { key, binComponent } = createBinComponent(fieldDef, fieldDef.bin, model);\n binComponentIndex[key] = {\n ...binComponent,\n ...binComponentIndex[key],\n ...rangeFormula(model, fieldDef, channel, model.config)\n };\n }\n return binComponentIndex;\n }, {});\n if (isEmpty(bins)) {\n return null;\n }\n return new BinNode(parent, bins);\n }\n /**\n * Creates a bin node from BinTransform.\n * The optional parameter should provide\n */\n static makeFromTransform(parent, t, model) {\n const { key, binComponent } = createBinComponent(t, t.bin, model);\n return new BinNode(parent, {\n [key]: binComponent\n });\n }\n /**\n * Merge bin nodes. This method either integrates the bin config from the other node\n * or if this node already has a bin config, renames the corresponding signal in the model.\n */\n merge(other, renameSignal) {\n for (const key of keys(other.bins)) {\n if (key in this.bins) {\n renameSignal(other.bins[key].signal, this.bins[key].signal);\n // Ensure that we don't have duplicate names for signal pairs\n this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash);\n }\n else {\n this.bins[key] = other.bins[key];\n }\n }\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n other.remove();\n }\n producedFields() {\n return new Set(vals(this.bins)\n .map(c => c.as)\n .flat(2));\n }\n dependentFields() {\n return new Set(vals(this.bins).map(c => c.field));\n }\n hash() {\n return `Bin ${hash(this.bins)}`;\n }\n assemble() {\n return vals(this.bins).flatMap(bin => {\n const transform = [];\n const [binAs, ...remainingAs] = bin.as;\n const { extent, ...params } = bin.bin;\n const binTrans = {\n type: 'bin',\n field: replacePathInField(bin.field),\n as: binAs,\n signal: bin.signal,\n ...(!isParameterExtent(extent) ? { extent } : { extent: null }),\n ...(bin.span ? { span: { signal: `span(${bin.span})` } } : {}),\n ...params\n };\n if (!extent && bin.extentSignal) {\n transform.push({\n type: 'extent',\n field: replacePathInField(bin.field),\n signal: bin.extentSignal\n });\n binTrans.extent = { signal: bin.extentSignal };\n }\n transform.push(binTrans);\n for (const as of remainingAs) {\n for (let i = 0; i < 2; i++) {\n transform.push({\n type: 'formula',\n expr: vgField({ field: binAs[i] }, { expr: 'datum' }),\n as: as[i]\n });\n }\n }\n if (bin.formula) {\n transform.push({\n type: 'formula',\n expr: bin.formula,\n as: bin.formulaAs\n });\n }\n return transform;\n });\n }\n}\n//# sourceMappingURL=bin.js.map","import { isArgmaxDef, isArgminDef } from '../../aggregate';\nimport { getPositionChannelFromLatLong, getSecondaryRangeChannel, isGeoPositionChannel, isScaleChannel, isXorY } from '../../channel';\nimport { binRequiresRange, getBandPosition, hasBandEnd, isScaleFieldDef, isTypedFieldDef, vgField } from '../../channeldef';\nimport * as log from '../../log';\nimport { isFieldRange } from '../../scale';\nimport { duplicate, hash, keys, replacePathInField, setEqual } from '../../util';\nimport { isUnitModel } from '../model';\nimport { DataFlowNode } from './dataflow';\nimport { isRectBasedMark } from '../../mark';\nimport { OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX } from './timeunit';\nfunction addDimension(dims, channel, fieldDef, model) {\n const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined;\n if (isTypedFieldDef(fieldDef) &&\n isUnitModel(model) &&\n hasBandEnd(fieldDef, channelDef2, model.markDef, model.config)) {\n dims.add(vgField(fieldDef, {}));\n dims.add(vgField(fieldDef, { suffix: 'end' }));\n const { mark, markDef, config } = model;\n const bandPosition = getBandPosition({ fieldDef, markDef, config });\n if (isRectBasedMark(mark) && bandPosition !== 0.5 && isXorY(channel)) {\n dims.add(vgField(fieldDef, { suffix: OFFSETTED_RECT_START_SUFFIX }));\n dims.add(vgField(fieldDef, { suffix: OFFSETTED_RECT_END_SUFFIX }));\n }\n if (fieldDef.bin && binRequiresRange(fieldDef, channel)) {\n dims.add(vgField(fieldDef, { binSuffix: 'range' }));\n }\n }\n else if (isGeoPositionChannel(channel)) {\n const posChannel = getPositionChannelFromLatLong(channel);\n dims.add(model.getName(posChannel));\n }\n else {\n dims.add(vgField(fieldDef));\n }\n if (isScaleFieldDef(fieldDef) && isFieldRange(fieldDef.scale?.range)) {\n dims.add(fieldDef.scale.range.field);\n }\n return dims;\n}\nfunction mergeMeasures(parentMeasures, childMeasures) {\n for (const field of keys(childMeasures)) {\n // when we merge a measure, we either have to add an aggregation operator or even a new field\n const ops = childMeasures[field];\n for (const op of keys(ops)) {\n if (field in parentMeasures) {\n // add operator to existing measure field\n parentMeasures[field][op] = new Set([...(parentMeasures[field][op] ?? []), ...ops[op]]);\n }\n else {\n parentMeasures[field] = { [op]: ops[op] };\n }\n }\n }\n}\nexport class AggregateNode extends DataFlowNode {\n clone() {\n return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures));\n }\n /**\n * @param dimensions string set for dimensions\n * @param measures dictionary mapping field name => dict of aggregation functions and names to use\n */\n constructor(parent, dimensions, measures) {\n super(parent);\n this.dimensions = dimensions;\n this.measures = measures;\n }\n get groupBy() {\n return this.dimensions;\n }\n static makeFromEncoding(parent, model) {\n let isAggregate = false;\n model.forEachFieldDef(fd => {\n if (fd.aggregate) {\n isAggregate = true;\n }\n });\n const meas = {};\n const dims = new Set();\n if (!isAggregate) {\n // no need to create this node if the model has no aggregation\n return null;\n }\n model.forEachFieldDef((fieldDef, channel) => {\n const { aggregate, field } = fieldDef;\n if (aggregate) {\n if (aggregate === 'count') {\n meas['*'] ?? (meas['*'] = {});\n meas['*']['count'] = new Set([vgField(fieldDef, { forAs: true })]);\n }\n else {\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n const op = isArgminDef(aggregate) ? 'argmin' : 'argmax';\n const argField = aggregate[op];\n meas[argField] ?? (meas[argField] = {});\n meas[argField][op] = new Set([vgField({ op, field: argField }, { forAs: true })]);\n }\n else {\n meas[field] ?? (meas[field] = {});\n meas[field][aggregate] = new Set([vgField(fieldDef, { forAs: true })]);\n }\n // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain\n if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') {\n meas[field] ?? (meas[field] = {});\n meas[field]['min'] = new Set([vgField({ field, aggregate: 'min' }, { forAs: true })]);\n meas[field]['max'] = new Set([vgField({ field, aggregate: 'max' }, { forAs: true })]);\n }\n }\n }\n else {\n addDimension(dims, channel, fieldDef, model);\n }\n });\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n return new AggregateNode(parent, dims, meas);\n }\n static makeFromTransform(parent, t) {\n const dims = new Set();\n const meas = {};\n for (const s of t.aggregate) {\n const { op, field, as } = s;\n if (op) {\n if (op === 'count') {\n meas['*'] ?? (meas['*'] = {});\n meas['*']['count'] = new Set([as ? as : vgField(s, { forAs: true })]);\n }\n else {\n meas[field] ?? (meas[field] = {});\n meas[field][op] = new Set([as ? as : vgField(s, { forAs: true })]);\n }\n }\n }\n for (const s of t.groupby ?? []) {\n dims.add(s);\n }\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n return new AggregateNode(parent, dims, meas);\n }\n merge(other) {\n if (setEqual(this.dimensions, other.dimensions)) {\n mergeMeasures(this.measures, other.measures);\n return true;\n }\n log.debug('different dimensions, cannot merge');\n return false;\n }\n addDimensions(fields) {\n fields.forEach(this.dimensions.add, this.dimensions);\n }\n dependentFields() {\n return new Set([...this.dimensions, ...keys(this.measures)]);\n }\n producedFields() {\n const out = new Set();\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n const m = this.measures[field][op];\n if (m.size === 0) {\n out.add(`${op}_${field}`);\n }\n else {\n m.forEach(out.add, out);\n }\n }\n }\n return out;\n }\n hash() {\n return `Aggregate ${hash({ dimensions: this.dimensions, measures: this.measures })}`;\n }\n assemble() {\n const ops = [];\n const fields = [];\n const as = [];\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n for (const alias of this.measures[field][op]) {\n as.push(alias);\n ops.push(op);\n fields.push(field === '*' ? null : replacePathInField(field));\n }\n }\n }\n const result = {\n type: 'aggregate',\n groupby: [...this.dimensions].map(replacePathInField),\n ops,\n fields,\n as\n };\n return result;\n }\n}\n//# sourceMappingURL=aggregate.js.map","import { isArray } from 'vega-util';\nimport { isBinning } from '../../bin';\nimport { COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW } from '../../channel';\nimport { vgField } from '../../channeldef';\nimport * as log from '../../log';\nimport { hasDiscreteDomain } from '../../scale';\nimport { DEFAULT_SORT_OP, isSortField } from '../../sort';\nimport { hash } from '../../util';\nimport { isVgRangeStep } from '../../vega.schema';\nimport { HEADER_CHANNELS, HEADER_TYPES } from '../header/component';\nimport { assembleDomain, getFieldFromDomain } from '../scale/domain';\nimport { sortArrayIndexField } from './calculate';\nimport { DataFlowNode } from './dataflow';\n/**\n * A node that helps us track what fields we are faceting by.\n */\nexport class FacetNode extends DataFlowNode {\n /**\n * @param model The facet model.\n * @param name The name that this facet source will have.\n * @param data The source data for this facet data.\n */\n constructor(parent, model, name, data) {\n super(parent);\n this.model = model;\n this.name = name;\n this.data = data;\n for (const channel of FACET_CHANNELS) {\n const fieldDef = model.facet[channel];\n if (fieldDef) {\n const { bin, sort } = fieldDef;\n this[channel] = {\n name: model.getName(`${channel}_domain`),\n fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, { binSuffix: 'end' })] : [])],\n ...(isSortField(sort)\n ? { sortField: sort }\n : isArray(sort)\n ? { sortIndexField: sortArrayIndexField(fieldDef, channel) }\n : {})\n };\n }\n }\n this.childModel = model.child;\n }\n hash() {\n let out = `Facet`;\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n out += ` ${channel.charAt(0)}:${hash(this[channel])}`;\n }\n }\n return out;\n }\n get fields() {\n const f = [];\n for (const channel of FACET_CHANNELS) {\n if (this[channel]?.fields) {\n f.push(...this[channel].fields);\n }\n }\n return f;\n }\n dependentFields() {\n const depFields = new Set(this.fields);\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n if (this[channel].sortField) {\n depFields.add(this[channel].sortField.field);\n }\n if (this[channel].sortIndexField) {\n depFields.add(this[channel].sortIndexField);\n }\n }\n }\n return depFields;\n }\n producedFields() {\n return new Set(); // facet does not produce any new fields\n }\n /**\n * The name to reference this source is its name.\n */\n getSource() {\n return this.name;\n }\n getChildIndependentFieldsWithStep() {\n const childIndependentFieldsWithStep = {};\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.childModel.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n // independent scale\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.childModel, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n childIndependentFieldsWithStep[channel] = field;\n }\n else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n return childIndependentFieldsWithStep;\n }\n assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep) {\n const childChannel = { row: 'y', column: 'x', facet: undefined }[channel];\n const fields = [];\n const ops = [];\n const as = [];\n if (childChannel && childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) {\n if (crossedDataName) {\n // If there is a crossed data, calculate max\n fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n ops.push('max');\n }\n else {\n // If there is no crossed data, just calculate distinct\n fields.push(childIndependentFieldsWithStep[childChannel]);\n ops.push('distinct');\n }\n // Although it is technically a max, just name it distinct so it's easier to refer to it\n as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n }\n const { sortField, sortIndexField } = this[channel];\n if (sortField) {\n const { op = DEFAULT_SORT_OP, field } = sortField;\n fields.push(field);\n ops.push(op);\n as.push(vgField(sortField, { forAs: true }));\n }\n else if (sortIndexField) {\n fields.push(sortIndexField);\n ops.push('max');\n as.push(sortIndexField);\n }\n return {\n name: this[channel].name,\n // Use data from the crossed one if it exist\n source: crossedDataName ?? this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this[channel].fields,\n ...(fields.length\n ? {\n fields,\n ops,\n as\n }\n : {})\n }\n ]\n };\n }\n assembleFacetHeaderData(childIndependentFieldsWithStep) {\n const { columns } = this.model.layout;\n const { layoutHeaders } = this.model.component;\n const data = [];\n const hasSharedAxis = {};\n for (const headerChannel of HEADER_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const headers = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) ?? [];\n for (const header of headers) {\n if (header.axes?.length > 0) {\n hasSharedAxis[headerChannel] = true;\n break;\n }\n }\n }\n if (hasSharedAxis[headerChannel]) {\n const cardinality = `length(data(\"${this.facet.name}\"))`;\n const stop = headerChannel === 'row'\n ? columns\n ? { signal: `ceil(${cardinality} / ${columns})` }\n : 1\n : columns\n ? { signal: `min(${cardinality}, ${columns})` }\n : { signal: cardinality };\n data.push({\n name: `${this.facet.name}_${headerChannel}`,\n transform: [\n {\n type: 'sequence',\n start: 0,\n stop\n }\n ]\n });\n }\n }\n const { row, column } = hasSharedAxis;\n if (row || column) {\n data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep));\n }\n return data;\n }\n assemble() {\n const data = [];\n let crossedDataName = null;\n const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep();\n const { column, row, facet } = this;\n if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) {\n // Need to create a cross dataset to correctly calculate cardinality\n crossedDataName = `cross_${this.column.name}_${this.row.name}`;\n const fields = [].concat(childIndependentFieldsWithStep.x ?? [], childIndependentFieldsWithStep.y ?? []);\n const ops = fields.map(() => 'distinct');\n data.push({\n name: crossedDataName,\n source: this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this.fields,\n fields,\n ops\n }\n ]\n });\n }\n for (const channel of [COLUMN, ROW]) {\n if (this[channel]) {\n data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep));\n }\n }\n if (facet) {\n const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep);\n if (facetData) {\n data.push(...facetData);\n }\n }\n return data;\n }\n}\n//# sourceMappingURL=facet.js.map","import { isNumber, isString } from 'vega-util';\nimport { isMinMaxOp } from '../../aggregate';\nimport { getMainRangeChannel } from '../../channel';\nimport { isFieldDef, isFieldOrDatumDefForTimeFormat, isScaleFieldDef, isTypedFieldDef } from '../../channeldef';\nimport { isGenerator } from '../../data';\nimport { isDateTime } from '../../datetime';\nimport * as log from '../../log';\nimport { forEachLeaf } from '../../logical';\nimport { isPathMark } from '../../mark';\nimport { isFieldEqualPredicate, isFieldGTEPredicate, isFieldGTPredicate, isFieldLTEPredicate, isFieldLTPredicate, isFieldOneOfPredicate, isFieldPredicate, isFieldRangePredicate } from '../../predicate';\nimport { isSortField } from '../../sort';\nimport { accessPathDepth, accessPathWithDatum, duplicate, hash, keys, removePathFromField } from '../../util';\nimport { signalRefOrValue } from '../common';\nimport { isFacetModel, isUnitModel } from '../model';\nimport { Split } from '../split';\nimport { DataFlowNode } from './dataflow';\n/**\n * Remove quotes from a string.\n */\nfunction unquote(pattern) {\n if ((pattern.startsWith(\"'\") && pattern.endsWith(\"'\")) || (pattern.startsWith('\"') && pattern.endsWith('\"'))) {\n return pattern.slice(1, -1);\n }\n return pattern;\n}\n/**\n * @param field The field.\n * @param parse What to parse the field as.\n */\nfunction parseExpression(field, parse) {\n const f = accessPathWithDatum(field);\n if (parse === 'number') {\n return `toNumber(${f})`;\n }\n else if (parse === 'boolean') {\n return `toBoolean(${f})`;\n }\n else if (parse === 'string') {\n return `toString(${f})`;\n }\n else if (parse === 'date') {\n return `toDate(${f})`;\n }\n else if (parse === 'flatten') {\n return f;\n }\n else if (parse.startsWith('date:')) {\n const specifier = unquote(parse.slice(5, parse.length));\n return `timeParse(${f},'${specifier}')`;\n }\n else if (parse.startsWith('utc:')) {\n const specifier = unquote(parse.slice(4, parse.length));\n return `utcParse(${f},'${specifier}')`;\n }\n else {\n log.warn(log.message.unrecognizedParse(parse));\n return null;\n }\n}\nexport function getImplicitFromFilterTransform(transform) {\n const implicit = {};\n forEachLeaf(transform.filter, filter => {\n if (isFieldPredicate(filter)) {\n // Automatically add a parse node for filters with filter objects\n let val = null;\n // For EqualFilter, just use the equal property.\n // For RangeFilter and OneOfFilter, all array members should have\n // the same type, so we only use the first one.\n if (isFieldEqualPredicate(filter)) {\n val = signalRefOrValue(filter.equal);\n }\n else if (isFieldLTEPredicate(filter)) {\n val = signalRefOrValue(filter.lte);\n }\n else if (isFieldLTPredicate(filter)) {\n val = signalRefOrValue(filter.lt);\n }\n else if (isFieldGTPredicate(filter)) {\n val = signalRefOrValue(filter.gt);\n }\n else if (isFieldGTEPredicate(filter)) {\n val = signalRefOrValue(filter.gte);\n }\n else if (isFieldRangePredicate(filter)) {\n val = filter.range[0];\n }\n else if (isFieldOneOfPredicate(filter)) {\n val = (filter.oneOf ?? filter['in'])[0];\n } // else -- for filter expression, we can't infer anything\n if (val) {\n if (isDateTime(val)) {\n implicit[filter.field] = 'date';\n }\n else if (isNumber(val)) {\n implicit[filter.field] = 'number';\n }\n else if (isString(val)) {\n implicit[filter.field] = 'string';\n }\n }\n if (filter.timeUnit) {\n implicit[filter.field] = 'date';\n }\n }\n });\n return implicit;\n}\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromEncoding(model) {\n const implicit = {};\n function add(fieldDef) {\n if (isFieldOrDatumDefForTimeFormat(fieldDef)) {\n implicit[fieldDef.field] = 'date';\n }\n else if (fieldDef.type === 'quantitative' &&\n isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max\n ) {\n implicit[fieldDef.field] = 'number';\n }\n else if (accessPathDepth(fieldDef.field) > 1) {\n // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field.\n // (Parsing numbers / dates already flattens numeric and temporal fields.)\n if (!(fieldDef.field in implicit)) {\n implicit[fieldDef.field] = 'flatten';\n }\n }\n else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) {\n // Flatten fields that we sort by but that are not otherwise flattened.\n if (!(fieldDef.sort.field in implicit)) {\n implicit[fieldDef.sort.field] = 'flatten';\n }\n }\n }\n if (isUnitModel(model) || isFacetModel(model)) {\n // Parse encoded fields\n model.forEachFieldDef((fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef)) {\n add(fieldDef);\n }\n else {\n const mainChannel = getMainRangeChannel(channel);\n const mainFieldDef = model.fieldDef(mainChannel);\n add({\n ...fieldDef,\n type: mainFieldDef.type\n });\n }\n });\n }\n // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly.\n if (isUnitModel(model)) {\n const { mark, markDef, encoding } = model;\n if (isPathMark(mark) &&\n // No need to sort by dimension if we have a connected scatterplot (order channel is present)\n !model.encoding.order) {\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (isFieldDef(dimensionChannelDef) &&\n dimensionChannelDef.type === 'quantitative' &&\n !(dimensionChannelDef.field in implicit)) {\n implicit[dimensionChannelDef.field] = 'number';\n }\n }\n }\n return implicit;\n}\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromSelection(model) {\n const implicit = {};\n if (isUnitModel(model) && model.component.selection) {\n for (const name of keys(model.component.selection)) {\n const selCmpt = model.component.selection[name];\n for (const proj of selCmpt.project.items) {\n if (!proj.channel && accessPathDepth(proj.field) > 1) {\n implicit[proj.field] = 'flatten';\n }\n }\n }\n }\n return implicit;\n}\nexport class ParseNode extends DataFlowNode {\n clone() {\n return new ParseNode(null, duplicate(this._parse));\n }\n constructor(parent, parse) {\n super(parent);\n this._parse = parse;\n }\n hash() {\n return `Parse ${hash(this._parse)}`;\n }\n /**\n * Creates a parse node from a data.format.parse and updates ancestorParse.\n */\n static makeExplicit(parent, model, ancestorParse) {\n // Custom parse\n let explicit = {};\n const data = model.data;\n if (!isGenerator(data) && data?.format?.parse) {\n explicit = data.format.parse;\n }\n return this.makeWithAncestors(parent, explicit, {}, ancestorParse);\n }\n /**\n * Creates a parse node from \"explicit\" parse and \"implicit\" parse and updates ancestorParse.\n */\n static makeWithAncestors(parent, explicit, implicit, ancestorParse) {\n // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as \"derived\"). We also don't need to flatten a field that has already been parsed.\n for (const field of keys(implicit)) {\n const parsedAs = ancestorParse.getWithExplicit(field);\n if (parsedAs.value !== undefined) {\n // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types.\n if (parsedAs.explicit ||\n parsedAs.value === implicit[field] ||\n parsedAs.value === 'derived' ||\n implicit[field] === 'flatten') {\n delete implicit[field];\n }\n else {\n log.warn(log.message.differentParse(field, implicit[field], parsedAs.value));\n }\n }\n }\n for (const field of keys(explicit)) {\n const parsedAs = ancestorParse.get(field);\n if (parsedAs !== undefined) {\n // Don't parse a field again if it has been parsed with the same type already.\n if (parsedAs === explicit[field]) {\n delete explicit[field];\n }\n else {\n log.warn(log.message.differentParse(field, explicit[field], parsedAs));\n }\n }\n }\n const parse = new Split(explicit, implicit);\n // add the format parse from this model so that children don't parse the same field again\n ancestorParse.copyAll(parse);\n // copy only non-null parses\n const p = {};\n for (const key of keys(parse.combine())) {\n const val = parse.get(key);\n if (val !== null) {\n p[key] = val;\n }\n }\n if (keys(p).length === 0 || ancestorParse.parseNothing) {\n return null;\n }\n return new ParseNode(parent, p);\n }\n get parse() {\n return this._parse;\n }\n merge(other) {\n this._parse = { ...this._parse, ...other.parse };\n other.remove();\n }\n /**\n * Assemble an object for Vega's format.parse property.\n */\n assembleFormatParse() {\n const formatParse = {};\n for (const field of keys(this._parse)) {\n const p = this._parse[field];\n if (accessPathDepth(field) === 1) {\n formatParse[field] = p;\n }\n }\n return formatParse;\n }\n // format parse depends and produces all fields in its parse\n producedFields() {\n return new Set(keys(this._parse));\n }\n dependentFields() {\n return new Set(keys(this._parse));\n }\n assembleTransforms(onlyNested = false) {\n return keys(this._parse)\n .filter(field => (onlyNested ? accessPathDepth(field) > 1 : true))\n .map(field => {\n const expr = parseExpression(field, this._parse[field]);\n if (!expr) {\n return null;\n }\n const formula = {\n type: 'formula',\n expr,\n as: removePathFromField(field) // Vega output is always flattened\n };\n return formula;\n })\n .filter(t => t !== null);\n }\n}\n//# sourceMappingURL=formatparse.js.map","import { SELECTION_ID } from '../../selection';\nimport { DataFlowNode } from './dataflow';\nexport class IdentifierNode extends DataFlowNode {\n clone() {\n return new IdentifierNode(null);\n }\n constructor(parent) {\n super(parent);\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return new Set([SELECTION_ID]);\n }\n hash() {\n return 'Identifier';\n }\n assemble() {\n return { type: 'identifier', as: SELECTION_ID };\n }\n}\n//# sourceMappingURL=identifier.js.map","import { hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class GraticuleNode extends DataFlowNode {\n clone() {\n return new GraticuleNode(null, this.params);\n }\n constructor(parent, params) {\n super(parent);\n this.params = params;\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return undefined; // there should never be a node before graticule\n }\n hash() {\n return `Graticule ${hash(this.params)}`;\n }\n assemble() {\n return {\n type: 'graticule',\n ...(this.params === true ? {} : this.params)\n };\n }\n}\n//# sourceMappingURL=graticule.js.map","import { hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class SequenceNode extends DataFlowNode {\n clone() {\n return new SequenceNode(null, this.params);\n }\n constructor(parent, params) {\n super(parent);\n this.params = params;\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return new Set([this.params.as ?? 'data']);\n }\n hash() {\n return `Hash ${hash(this.params)}`;\n }\n assemble() {\n return {\n type: 'sequence',\n ...this.params\n };\n }\n}\n//# sourceMappingURL=sequence.js.map","import { isGenerator, isInlineData, isNamedData, isSphereGenerator, isUrlData } from '../../data';\nimport { contains, isEmpty, omit } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class SourceNode extends DataFlowNode {\n constructor(data) {\n super(null); // source cannot have parent\n data ?? (data = { name: 'source' });\n let format;\n if (!isGenerator(data)) {\n format = data.format ? { ...omit(data.format, ['parse']) } : {};\n }\n if (isInlineData(data)) {\n this._data = { values: data.values };\n }\n else if (isUrlData(data)) {\n this._data = { url: data.url };\n if (!format.type) {\n // Extract extension from URL using snippet from\n // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript\n let defaultExtension = /(?:\\.([^.]+))?$/.exec(data.url)[1];\n if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) {\n defaultExtension = 'json';\n }\n // defaultExtension has type string but we ensure that it is DataFormatType above\n format.type = defaultExtension;\n }\n }\n else if (isSphereGenerator(data)) {\n // hardwire GeoJSON sphere data into output specification\n this._data = { values: [{ type: 'Sphere' }] };\n }\n else if (isNamedData(data) || isGenerator(data)) {\n this._data = {};\n }\n // set flag to check if generator\n this._generator = isGenerator(data);\n // any dataset can be named\n if (data.name) {\n this._name = data.name;\n }\n if (format && !isEmpty(format)) {\n this._data.format = format;\n }\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return undefined; // we don't know what this source produces\n }\n get data() {\n return this._data;\n }\n hasName() {\n return !!this._name;\n }\n get isGenerator() {\n return this._generator;\n }\n get dataName() {\n return this._name;\n }\n set dataName(name) {\n this._name = name;\n }\n set parent(parent) {\n throw new Error('Source nodes have to be roots.');\n }\n remove() {\n throw new Error('Source nodes are roots and cannot be removed.');\n }\n hash() {\n throw new Error('Cannot hash sources');\n }\n assemble() {\n return {\n name: this._name,\n ...this._data,\n transform: []\n };\n }\n}\n//# sourceMappingURL=source.js.map","var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _Optimizer_modified;\nimport { GraticuleNode } from './graticule';\nimport { SequenceNode } from './sequence';\nimport { SourceNode } from './source';\n/**\n * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator.\n */\nexport function isDataSourceNode(node) {\n return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode;\n}\n/**\n * Abstract base class for Dataflow optimizers.\n * Contains only mutation handling logic. Subclasses need to implement iteration logic.\n */\nexport class Optimizer {\n constructor() {\n _Optimizer_modified.set(this, void 0);\n __classPrivateFieldSet(this, _Optimizer_modified, false, \"f\");\n }\n // Once true, #modified is never set to false\n setModified() {\n __classPrivateFieldSet(this, _Optimizer_modified, true, \"f\");\n }\n get modifiedFlag() {\n return __classPrivateFieldGet(this, _Optimizer_modified, \"f\");\n }\n}\n_Optimizer_modified = new WeakMap();\n/**\n * Starts from a node and runs the optimization function (the \"run\" method) upwards to the root,\n * depending on the continue and modified flag values returned by the optimization function.\n */\nexport class BottomUpOptimizer extends Optimizer {\n /**\n * Compute a map of node depths that we can use to determine a topological sort order.\n */\n getNodeDepths(node, depth, depths) {\n depths.set(node, depth);\n for (const child of node.children) {\n this.getNodeDepths(child, depth + 1, depths);\n }\n return depths;\n }\n /**\n * Run the optimizer on all nodes starting from the leaves.\n */\n optimize(node) {\n const depths = this.getNodeDepths(node, 0, new Map());\n const topologicalSort = [...depths.entries()].sort((a, b) => b[1] - a[1]);\n for (const tuple of topologicalSort) {\n this.run(tuple[0]);\n }\n return this.modifiedFlag;\n }\n}\n/**\n * The optimizer function (the \"run\" method), is invoked on the given node and then continues recursively.\n */\nexport class TopDownOptimizer extends Optimizer {\n /**\n * Run the optimizer depth first on all nodes starting from the roots.\n */\n optimize(node) {\n this.run(node);\n for (const child of node.children) {\n this.optimize(child);\n }\n return this.modifiedFlag;\n }\n}\n//# sourceMappingURL=optimizer.js.map","import { fieldIntersection, hash, hasIntersection, isEmpty, keys, some } from '../../util';\nimport { requiresSelectionId } from '../selection';\nimport { AggregateNode } from './aggregate';\nimport { BinNode } from './bin';\nimport { OutputNode } from './dataflow';\nimport { FacetNode } from './facet';\nimport { FilterNode } from './filter';\nimport { ParseNode } from './formatparse';\nimport { IdentifierNode } from './identifier';\nimport { BottomUpOptimizer, isDataSourceNode, Optimizer, TopDownOptimizer } from './optimizer';\nimport { SourceNode } from './source';\nimport { TimeUnitNode } from './timeunit';\n/**\n * Merge identical nodes at forks by comparing hashes.\n *\n * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler.\n */\nexport class MergeIdenticalNodes extends TopDownOptimizer {\n mergeNodes(parent, nodes) {\n const mergedNode = nodes.shift();\n for (const node of nodes) {\n parent.removeChild(node);\n node.parent = mergedNode;\n node.remove();\n }\n }\n run(node) {\n const hashes = node.children.map(x => x.hash());\n const buckets = {};\n for (let i = 0; i < hashes.length; i++) {\n if (buckets[hashes[i]] === undefined) {\n buckets[hashes[i]] = [node.children[i]];\n }\n else {\n buckets[hashes[i]].push(node.children[i]);\n }\n }\n for (const k of keys(buckets)) {\n if (buckets[k].length > 1) {\n this.setModified();\n this.mergeNodes(node, buckets[k]);\n }\n }\n }\n}\n/**\n * Optimizer that removes identifier nodes that are not needed for selections.\n */\nexport class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer {\n constructor(model) {\n super();\n this.requiresSelectionId = model && requiresSelectionId(model);\n }\n run(node) {\n if (node instanceof IdentifierNode) {\n // Only preserve IdentifierNodes if we have default discrete selections\n // in our model tree, and if the nodes come after tuple producing nodes.\n if (!(this.requiresSelectionId &&\n (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode))) {\n this.setModified();\n node.remove();\n }\n }\n }\n}\n/**\n * Removes duplicate time unit nodes (as determined by the name of the output field) that may be generated due to\n * selections projected over time units. Only keeps the first time unit in any branch.\n *\n * This optimizer is a custom top down optimizer that keep track of produced fields in a branch.\n */\nexport class RemoveDuplicateTimeUnits extends Optimizer {\n optimize(node) {\n this.run(node, new Set());\n return this.modifiedFlag;\n }\n run(node, timeUnitFields) {\n let producedFields = new Set();\n if (node instanceof TimeUnitNode) {\n producedFields = node.producedFields();\n if (hasIntersection(producedFields, timeUnitFields)) {\n this.setModified();\n node.removeFormulas(timeUnitFields);\n if (node.producedFields.length === 0) {\n node.remove();\n }\n }\n }\n for (const child of node.children) {\n this.run(child, new Set([...timeUnitFields, ...producedFields]));\n }\n }\n}\n/**\n * Remove output nodes that are not required.\n */\nexport class RemoveUnnecessaryOutputNodes extends TopDownOptimizer {\n constructor() {\n super();\n }\n run(node) {\n if (node instanceof OutputNode && !node.isRequired()) {\n this.setModified();\n node.remove();\n }\n }\n}\n/**\n * Move parse nodes up to forks and merges them if possible.\n */\nexport class MoveParseUp extends BottomUpOptimizer {\n run(node) {\n if (isDataSourceNode(node)) {\n return;\n }\n if (node.numChildren() > 1) {\n // Don't move parse further up but continue with parent.\n return;\n }\n for (const child of node.children) {\n if (child instanceof ParseNode) {\n if (node instanceof ParseNode) {\n this.setModified();\n node.merge(child);\n }\n else {\n // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup).\n if (fieldIntersection(node.producedFields(), child.dependentFields())) {\n continue;\n }\n this.setModified();\n child.swapWithParent();\n }\n }\n }\n return;\n }\n}\n/**\n * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes.\n *\n * We assume that dependent paths that do not have a parse node can be just merged.\n */\nexport class MergeParse extends BottomUpOptimizer {\n run(node) {\n const originalChildren = [...node.children];\n const parseChildren = node.children.filter((child) => child instanceof ParseNode);\n if (node.numChildren() > 1 && parseChildren.length >= 1) {\n const commonParse = {};\n const conflictingParse = new Set();\n for (const parseNode of parseChildren) {\n const parse = parseNode.parse;\n for (const k of keys(parse)) {\n if (!(k in commonParse)) {\n commonParse[k] = parse[k];\n }\n else if (commonParse[k] !== parse[k]) {\n conflictingParse.add(k);\n }\n }\n }\n for (const field of conflictingParse) {\n delete commonParse[field];\n }\n if (!isEmpty(commonParse)) {\n this.setModified();\n const mergedParseNode = new ParseNode(node, commonParse);\n for (const childNode of originalChildren) {\n if (childNode instanceof ParseNode) {\n for (const key of keys(commonParse)) {\n delete childNode.parse[key];\n }\n }\n node.removeChild(childNode);\n childNode.parent = mergedParseNode;\n // remove empty parse nodes\n if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) {\n childNode.remove();\n }\n }\n }\n }\n }\n}\n/**\n * Repeatedly remove leaf nodes that are not output or facet nodes.\n * The reason is that we don't need subtrees that don't have any output nodes.\n * Facet nodes are needed for the row or column domains.\n */\nexport class RemoveUnusedSubtrees extends BottomUpOptimizer {\n run(node) {\n if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) {\n // no need to continue with parent because it is output node or will have children (there was a fork)\n }\n else if (node instanceof SourceNode) {\n // ignore empty unused sources as they will be removed in optimizationDataflowHelper\n }\n else {\n this.setModified();\n node.remove();\n }\n }\n}\n/**\n * Merge adjacent time unit nodes.\n */\nexport class MergeTimeUnits extends BottomUpOptimizer {\n run(node) {\n const timeUnitChildren = node.children.filter((x) => x instanceof TimeUnitNode);\n const combination = timeUnitChildren.pop();\n for (const timeUnit of timeUnitChildren) {\n this.setModified();\n combination.merge(timeUnit);\n }\n }\n}\nexport class MergeAggregates extends BottomUpOptimizer {\n run(node) {\n const aggChildren = node.children.filter((child) => child instanceof AggregateNode);\n // Object which we'll use to map the fields which an aggregate is grouped by to\n // the set of aggregates with that grouping. This is useful as only aggregates\n // with the same group by can be merged\n const groupedAggregates = {};\n // Build groupedAggregates\n for (const agg of aggChildren) {\n const groupBys = hash(agg.groupBy);\n if (!(groupBys in groupedAggregates)) {\n groupedAggregates[groupBys] = [];\n }\n groupedAggregates[groupBys].push(agg);\n }\n // Merge aggregateNodes with same key in groupedAggregates\n for (const group of keys(groupedAggregates)) {\n const mergeableAggs = groupedAggregates[group];\n if (mergeableAggs.length > 1) {\n const mergedAggs = mergeableAggs.pop();\n for (const agg of mergeableAggs) {\n if (mergedAggs.merge(agg)) {\n node.removeChild(agg);\n agg.parent = mergedAggs;\n agg.remove();\n this.setModified();\n }\n }\n }\n }\n }\n}\n/**\n * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node.\n */\nexport class MergeBins extends BottomUpOptimizer {\n constructor(model) {\n super();\n this.model = model;\n }\n run(node) {\n const moveBinsUp = !(isDataSourceNode(node) ||\n node instanceof FilterNode ||\n node instanceof ParseNode ||\n node instanceof IdentifierNode);\n const promotableBins = [];\n const remainingBins = [];\n for (const child of node.children) {\n if (child instanceof BinNode) {\n if (moveBinsUp && !fieldIntersection(node.producedFields(), child.dependentFields())) {\n promotableBins.push(child);\n }\n else {\n remainingBins.push(child);\n }\n }\n }\n if (promotableBins.length > 0) {\n const promotedBin = promotableBins.pop();\n for (const bin of promotableBins) {\n promotedBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setModified();\n if (node instanceof BinNode) {\n node.merge(promotedBin, this.model.renameSignal.bind(this.model));\n }\n else {\n promotedBin.swapWithParent();\n }\n }\n if (remainingBins.length > 1) {\n const remainingBin = remainingBins.pop();\n for (const bin of remainingBins) {\n remainingBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setModified();\n }\n }\n}\n/**\n * This optimizer takes output nodes that are at a fork and moves them before the fork.\n *\n * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes.\n * It then moves all output nodes before that main output node. All other children (and the children of the output nodes)\n * are inserted after the main output node.\n */\nexport class MergeOutputs extends BottomUpOptimizer {\n run(node) {\n const children = [...node.children];\n const hasOutputChild = some(children, child => child instanceof OutputNode);\n if (!hasOutputChild || node.numChildren() <= 1) {\n return;\n }\n const otherChildren = [];\n // The output node we will connect all other nodes to.\n // Output nodes will be added before the new node, other nodes after.\n let mainOutput;\n for (const child of children) {\n if (child instanceof OutputNode) {\n let lastOutput = child;\n while (lastOutput.numChildren() === 1) {\n const [theChild] = lastOutput.children;\n if (theChild instanceof OutputNode) {\n lastOutput = theChild;\n }\n else {\n break;\n }\n }\n otherChildren.push(...lastOutput.children);\n if (mainOutput) {\n // Move the output nodes before the mainOutput. We do this by setting\n // the parent of the first not to the parent of the main output and\n // the main output's parent to the last output.\n // note: the child is the first output\n node.removeChild(child);\n child.parent = mainOutput.parent;\n mainOutput.parent.removeChild(mainOutput);\n mainOutput.parent = lastOutput;\n this.setModified();\n }\n else {\n mainOutput = lastOutput;\n }\n }\n else {\n otherChildren.push(child);\n }\n }\n if (otherChildren.length) {\n this.setModified();\n for (const child of otherChildren) {\n child.parent.removeChild(child);\n child.parent = mainOutput;\n }\n }\n }\n}\n//# sourceMappingURL=optimizers.js.map","import { vgField } from '../../channeldef';\nimport { duplicate, hash } from '../../util';\nimport { unique } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for the join aggregate transform nodes.\n */\nexport class JoinAggregateTransformNode extends DataFlowNode {\n clone() {\n return new JoinAggregateTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n }\n addDimensions(fields) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n dependentFields() {\n const out = new Set();\n if (this.transform.groupby) {\n this.transform.groupby.forEach(out.add, out);\n }\n this.transform.joinaggregate\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n return out;\n }\n producedFields() {\n return new Set(this.transform.joinaggregate.map(this.getDefaultName));\n }\n getDefaultName(joinAggregateFieldDef) {\n return joinAggregateFieldDef.as ?? vgField(joinAggregateFieldDef);\n }\n hash() {\n return `JoinAggregateTransform ${hash(this.transform)}`;\n }\n assemble() {\n const fields = [];\n const ops = [];\n const as = [];\n for (const joinaggregate of this.transform.joinaggregate) {\n ops.push(joinaggregate.op);\n as.push(this.getDefaultName(joinaggregate));\n fields.push(joinaggregate.field === undefined ? null : joinaggregate.field);\n }\n const groupby = this.transform.groupby;\n return {\n type: 'joinaggregate',\n as,\n ops,\n fields,\n ...(groupby !== undefined ? { groupby } : {})\n };\n }\n}\n//# sourceMappingURL=joinaggregate.js.map","import { isArray, isString } from 'vega-util';\nimport { getFieldDef, isFieldDef, isOrderOnlyDef, vgField } from '../../channeldef';\nimport { duplicate, getFirstDefined, hash } from '../../util';\nimport { sortParams } from '../common';\nimport { DataFlowNode } from './dataflow';\nfunction getStackByFields(model) {\n return model.stack.stackBy.reduce((fields, by) => {\n const fieldDef = by.fieldDef;\n const _field = vgField(fieldDef);\n if (_field) {\n fields.push(_field);\n }\n return fields;\n }, []);\n}\nfunction isValidAsArray(as) {\n return isArray(as) && as.every(s => isString(s)) && as.length > 1;\n}\nexport class StackNode extends DataFlowNode {\n clone() {\n return new StackNode(null, duplicate(this._stack));\n }\n constructor(parent, stack) {\n super(parent);\n this._stack = stack;\n }\n static makeFromTransform(parent, stackTransform) {\n const { stack, groupby, as, offset = 'zero' } = stackTransform;\n const sortFields = [];\n const sortOrder = [];\n if (stackTransform.sort !== undefined) {\n for (const sortField of stackTransform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(getFirstDefined(sortField.order, 'ascending'));\n }\n }\n const sort = {\n field: sortFields,\n order: sortOrder\n };\n let normalizedAs;\n if (isValidAsArray(as)) {\n normalizedAs = as;\n }\n else if (isString(as)) {\n normalizedAs = [as, `${as}_end`];\n }\n else {\n normalizedAs = [`${stackTransform.stack}_start`, `${stackTransform.stack}_end`];\n }\n return new StackNode(parent, {\n dimensionFieldDefs: [],\n stackField: stack,\n groupby,\n offset,\n sort,\n facetby: [],\n as: normalizedAs\n });\n }\n static makeFromEncoding(parent, model) {\n const stackProperties = model.stack;\n const { encoding } = model;\n if (!stackProperties) {\n return null;\n }\n const { groupbyChannels, fieldChannel, offset, impute } = stackProperties;\n const dimensionFieldDefs = groupbyChannels\n .map(groupbyChannel => {\n const cDef = encoding[groupbyChannel];\n return getFieldDef(cDef);\n })\n .filter(def => !!def);\n const stackby = getStackByFields(model);\n const orderDef = model.encoding.order;\n let sort;\n if (isArray(orderDef) || isFieldDef(orderDef)) {\n sort = sortParams(orderDef);\n }\n else {\n const sortOrder = isOrderOnlyDef(orderDef) ? orderDef.sort : fieldChannel === 'y' ? 'descending' : 'ascending';\n // default = descending by stackFields\n // FIXME is the default here correct for binned fields?\n sort = stackby.reduce((s, field) => {\n s.field.push(field);\n s.order.push(sortOrder);\n return s;\n }, { field: [], order: [] });\n }\n return new StackNode(parent, {\n dimensionFieldDefs,\n stackField: model.vgField(fieldChannel),\n facetby: [],\n stackby,\n sort,\n offset,\n impute,\n as: [\n model.vgField(fieldChannel, { suffix: 'start', forAs: true }),\n model.vgField(fieldChannel, { suffix: 'end', forAs: true })\n ]\n });\n }\n get stack() {\n return this._stack;\n }\n addDimensions(fields) {\n this._stack.facetby.push(...fields);\n }\n dependentFields() {\n const out = new Set();\n out.add(this._stack.stackField);\n this.getGroupbyFields().forEach(out.add, out);\n this._stack.facetby.forEach(out.add, out);\n this._stack.sort.field.forEach(out.add, out);\n return out;\n }\n producedFields() {\n return new Set(this._stack.as);\n }\n hash() {\n return `Stack ${hash(this._stack)}`;\n }\n getGroupbyFields() {\n const { dimensionFieldDefs, impute, groupby } = this._stack;\n if (dimensionFieldDefs.length > 0) {\n return dimensionFieldDefs\n .map(dimensionFieldDef => {\n if (dimensionFieldDef.bin) {\n if (impute) {\n // For binned group by field with impute, we calculate bin_mid\n // as we cannot impute two fields simultaneously\n return [vgField(dimensionFieldDef, { binSuffix: 'mid' })];\n }\n return [\n // For binned group by field without impute, we need both bin (start) and bin_end\n vgField(dimensionFieldDef, {}),\n vgField(dimensionFieldDef, { binSuffix: 'end' })\n ];\n }\n return [vgField(dimensionFieldDef)];\n })\n .flat();\n }\n return groupby ?? [];\n }\n assemble() {\n const transform = [];\n const { facetby, dimensionFieldDefs, stackField: field, stackby, sort, offset, impute, as } = this._stack;\n // Impute\n if (impute) {\n for (const dimensionFieldDef of dimensionFieldDefs) {\n const { bandPosition = 0.5, bin } = dimensionFieldDef;\n if (bin) {\n // As we can only impute one field at a time, we need to calculate\n // mid point for a binned field\n const binStart = vgField(dimensionFieldDef, { expr: 'datum' });\n const binEnd = vgField(dimensionFieldDef, { expr: 'datum', binSuffix: 'end' });\n transform.push({\n type: 'formula',\n expr: `${bandPosition}*${binStart}+${1 - bandPosition}*${binEnd}`,\n as: vgField(dimensionFieldDef, { binSuffix: 'mid', forAs: true })\n });\n }\n transform.push({\n type: 'impute',\n field,\n groupby: [...stackby, ...facetby],\n key: vgField(dimensionFieldDef, { binSuffix: 'mid' }),\n method: 'value',\n value: 0\n });\n }\n }\n // Stack\n transform.push({\n type: 'stack',\n groupby: [...this.getGroupbyFields(), ...facetby],\n field,\n sort,\n as,\n offset\n });\n return transform;\n }\n}\n//# sourceMappingURL=stack.js.map","import { isAggregateOp } from '../../aggregate';\nimport { vgField } from '../../channeldef';\nimport { duplicate, hash } from '../../util';\nimport { unique } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for the window transform nodes\n */\nexport class WindowTransformNode extends DataFlowNode {\n clone() {\n return new WindowTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n }\n addDimensions(fields) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n dependentFields() {\n const out = new Set();\n (this.transform.groupby ?? []).forEach(out.add, out);\n (this.transform.sort ?? []).forEach(m => out.add(m.field));\n this.transform.window\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n return out;\n }\n producedFields() {\n return new Set(this.transform.window.map(this.getDefaultName));\n }\n getDefaultName(windowFieldDef) {\n return windowFieldDef.as ?? vgField(windowFieldDef);\n }\n hash() {\n return `WindowTransform ${hash(this.transform)}`;\n }\n assemble() {\n const fields = [];\n const ops = [];\n const as = [];\n const params = [];\n for (const window of this.transform.window) {\n ops.push(window.op);\n as.push(this.getDefaultName(window));\n params.push(window.param === undefined ? null : window.param);\n fields.push(window.field === undefined ? null : window.field);\n }\n const frame = this.transform.frame;\n const groupby = this.transform.groupby;\n if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) {\n // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate\n return {\n type: 'joinaggregate',\n as,\n ops: ops,\n fields,\n ...(groupby !== undefined ? { groupby } : {})\n };\n }\n const sortFields = [];\n const sortOrder = [];\n if (this.transform.sort !== undefined) {\n for (const sortField of this.transform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(sortField.order ?? 'ascending');\n }\n }\n const sort = {\n field: sortFields,\n order: sortOrder\n };\n const ignorePeers = this.transform.ignorePeers;\n return {\n type: 'window',\n params,\n as,\n ops,\n fields,\n sort,\n ...(ignorePeers !== undefined ? { ignorePeers } : {}),\n ...(groupby !== undefined ? { groupby } : {}),\n ...(frame !== undefined ? { frame } : {})\n };\n }\n}\n//# sourceMappingURL=window.js.map","import { DataSourceType } from '../../data';\nimport { AggregateNode } from './aggregate';\nimport { OutputNode } from './dataflow';\nimport { FacetNode } from './facet';\nimport { JoinAggregateTransformNode } from './joinaggregate';\nimport { FACET_SCALE_PREFIX } from './optimize';\nimport { StackNode } from './stack';\nimport { WindowTransformNode } from './window';\n/**\n * Clones the subtree and ignores output nodes except for the leaves, which are renamed.\n */\nfunction cloneSubtree(facet) {\n function clone(node) {\n if (!(node instanceof FacetNode)) {\n const copy = node.clone();\n if (copy instanceof OutputNode) {\n const newName = FACET_SCALE_PREFIX + copy.getSource();\n copy.setSource(newName);\n facet.model.component.data.outputNodes[newName] = copy;\n }\n else if (copy instanceof AggregateNode ||\n copy instanceof StackNode ||\n copy instanceof WindowTransformNode ||\n copy instanceof JoinAggregateTransformNode) {\n copy.addDimensions(facet.fields);\n }\n for (const n of node.children.flatMap(clone)) {\n n.parent = copy;\n }\n return [copy];\n }\n return node.children.flatMap(clone);\n }\n return clone;\n}\n/**\n * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node.\n * After moving down the facet node, make a copy of the subtree and make it a child of the main output.\n */\nexport function moveFacetDown(node) {\n if (node instanceof FacetNode) {\n if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) {\n // move down until we hit a fork or output node\n const child = node.children[0];\n if (child instanceof AggregateNode ||\n child instanceof StackNode ||\n child instanceof WindowTransformNode ||\n child instanceof JoinAggregateTransformNode) {\n child.addDimensions(node.fields);\n }\n child.swapWithParent();\n moveFacetDown(node);\n }\n else {\n // move main to facet\n const facetMain = node.model.component.data.main;\n moveMainDownToFacet(facetMain);\n // replicate the subtree and place it before the facet's main node\n const cloner = cloneSubtree(node);\n const copy = node.children.map(cloner).flat();\n for (const c of copy) {\n c.parent = facetMain;\n }\n }\n }\n else {\n node.children.map(moveFacetDown);\n }\n}\nfunction moveMainDownToFacet(node) {\n if (node instanceof OutputNode && node.type === DataSourceType.Main) {\n if (node.numChildren() === 1) {\n const child = node.children[0];\n if (!(child instanceof FacetNode)) {\n child.swapWithParent();\n moveMainDownToFacet(node);\n }\n }\n }\n}\n//# sourceMappingURL=subtree.js.map","import * as log from '../../log';\nimport * as optimizers from './optimizers';\nimport { moveFacetDown } from './subtree';\nexport const FACET_SCALE_PREFIX = 'scale_';\nexport const MAX_OPTIMIZATION_RUNS = 5;\n/**\n * Iterates over a dataflow graph and checks whether all links are consistent.\n */\nexport function checkLinks(nodes) {\n for (const node of nodes) {\n for (const child of node.children) {\n if (child.parent !== node) {\n // log.error('Dataflow graph is inconsistent.', node, child);\n return false;\n }\n }\n if (!checkLinks(node.children)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Run the specified optimizer on the provided nodes.\n *\n * @param optimizer The optimizer instance to run.\n * @param nodes A set of nodes to optimize.\n */\nfunction runOptimizer(optimizer, nodes) {\n let modified = false;\n for (const node of nodes) {\n modified = optimizer.optimize(node) || modified;\n }\n return modified;\n}\nfunction optimizationDataflowHelper(dataComponent, model, firstPass) {\n let roots = dataComponent.sources;\n let modified = false;\n modified = runOptimizer(new optimizers.RemoveUnnecessaryOutputNodes(), roots) || modified;\n modified = runOptimizer(new optimizers.RemoveUnnecessaryIdentifierNodes(model), roots) || modified;\n // remove source nodes that don't have any children because they also don't have output nodes\n roots = roots.filter(r => r.numChildren() > 0);\n modified = runOptimizer(new optimizers.RemoveUnusedSubtrees(), roots) || modified;\n roots = roots.filter(r => r.numChildren() > 0);\n if (!firstPass) {\n // Only run these optimizations after the optimizer has moved down the facet node.\n // With this change, we can be more aggressive in the optimizations.\n modified = runOptimizer(new optimizers.MoveParseUp(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeBins(model), roots) || modified;\n modified = runOptimizer(new optimizers.RemoveDuplicateTimeUnits(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeParse(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeAggregates(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeTimeUnits(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeIdenticalNodes(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeOutputs(), roots) || modified;\n }\n dataComponent.sources = roots;\n return modified;\n}\n/**\n * Optimizes the dataflow of the passed in data component.\n */\nexport function optimizeDataflow(data, model) {\n // check before optimizations\n checkLinks(data.sources);\n let firstPassCounter = 0;\n let secondPassCounter = 0;\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, true)) {\n break;\n }\n firstPassCounter++;\n }\n // move facets down and make a copy of the subtree so that we can have scales at the top level\n data.sources.map(moveFacetDown);\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, false)) {\n break;\n }\n secondPassCounter++;\n }\n // check after optimizations\n checkLinks(data.sources);\n if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) {\n log.warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`);\n }\n}\n//# sourceMappingURL=optimize.js.map","/**\n * A class that behaves like a SignalRef but lazily generates the signal.\n * The provided generator function should use `Model.getSignalName` to use the correct signal name.\n */\nexport class SignalRefWrapper {\n constructor(exprGenerator) {\n Object.defineProperty(this, 'signal', {\n enumerable: true,\n get: exprGenerator\n });\n }\n static fromName(rename, signalName) {\n return new SignalRefWrapper(() => rename(signalName));\n }\n}\n//# sourceMappingURL=signal.js.map","import { isObject, isString } from 'vega-util';\nimport { isAggregateOp, isArgmaxDef, isArgminDef, MULTIDOMAIN_SORT_OP_INDEX as UNIONDOMAIN_SORT_OP_INDEX, SHARED_DOMAIN_OPS } from '../../aggregate';\nimport { isBinning, isBinParams, isParameterExtent } from '../../bin';\nimport { getSecondaryRangeChannel, isScaleChannel } from '../../channel';\nimport { binRequiresRange, getBandPosition, getFieldOrDatumDef, hasBandEnd, isDatumDef, isFieldDef, valueExpr, vgField } from '../../channeldef';\nimport { DataSourceType } from '../../data';\nimport * as log from '../../log';\nimport { hasDiscreteDomain, isDomainUnionWith, isParameterDomain } from '../../scale';\nimport { DEFAULT_SORT_OP, isSortArray, isSortByEncoding, isSortField } from '../../sort';\nimport { normalizeTimeUnit } from '../../timeunit';\nimport * as util from '../../util';\nimport { isDataRefDomain, isDataRefUnionedDomain, isFieldRefUnionDomain, isSignalRef } from '../../vega.schema';\nimport { getBinSignalName } from '../data/bin';\nimport { sortArrayIndexField } from '../data/calculate';\nimport { FACET_SCALE_PREFIX } from '../data/optimize';\nimport { isFacetModel, isUnitModel } from '../model';\nimport { SignalRefWrapper } from '../signal';\nimport { makeExplicit, makeImplicit, mergeValuesWithExplicit } from '../split';\nimport { isRectBasedMark } from '../../mark';\nimport { OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX } from '../data/timeunit';\nexport function parseScaleDomain(model) {\n if (isUnitModel(model)) {\n parseUnitScaleDomain(model);\n }\n else {\n parseNonUnitScaleDomain(model);\n }\n}\nfunction parseUnitScaleDomain(model) {\n const localScaleComponents = model.component.scales;\n for (const channel of util.keys(localScaleComponents)) {\n const domains = parseDomainForChannel(model, channel);\n const localScaleCmpt = localScaleComponents[channel];\n localScaleCmpt.setWithExplicit('domains', domains);\n parseSelectionDomain(model, channel);\n if (model.component.data.isFaceted) {\n // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not\n let facetParent = model;\n while (!isFacetModel(facetParent) && facetParent.parent) {\n facetParent = facetParent.parent;\n }\n const resolve = facetParent.component.resolve.scale[channel];\n if (resolve === 'shared') {\n for (const domain of domains.value) {\n // Replace the scale domain with data output from a cloned subtree after the facet.\n if (isDataRefDomain(domain)) {\n // use data from cloned subtree (which is the same as data but with a prefix added once)\n domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, '');\n }\n }\n }\n }\n }\n}\nfunction parseNonUnitScaleDomain(model) {\n for (const child of model.children) {\n parseScaleDomain(child);\n }\n const localScaleComponents = model.component.scales;\n for (const channel of util.keys(localScaleComponents)) {\n let domains;\n let selectionExtent = null;\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n if (domains === undefined) {\n domains = childComponent.getWithExplicit('domains');\n }\n else {\n domains = mergeValuesWithExplicit(domains, childComponent.getWithExplicit('domains'), 'domains', 'scale', domainsTieBreaker);\n }\n const se = childComponent.get('selectionExtent');\n if (selectionExtent && se && selectionExtent.param !== se.param) {\n log.warn(log.message.NEEDS_SAME_SELECTION);\n }\n selectionExtent = se;\n }\n }\n localScaleComponents[channel].setWithExplicit('domains', domains);\n if (selectionExtent) {\n localScaleComponents[channel].set('selectionExtent', selectionExtent, true);\n }\n }\n}\n/**\n * Remove unaggregated domain if it is not applicable\n * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true.\n */\nfunction normalizeUnaggregatedDomain(domain, fieldDef, scaleType, scaleConfig) {\n if (domain === 'unaggregated') {\n const { valid, reason } = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (!valid) {\n log.warn(reason);\n return undefined;\n }\n }\n else if (domain === undefined && scaleConfig.useUnaggregatedDomain) {\n // Apply config if domain is not specified.\n const { valid } = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (valid) {\n return 'unaggregated';\n }\n }\n return domain;\n}\nexport function parseDomainForChannel(model, channel) {\n const scaleType = model.getScaleComponent(channel).get('type');\n const { encoding } = model;\n const domain = normalizeUnaggregatedDomain(model.scaleDomain(channel), model.typedFieldDef(channel), scaleType, model.config.scale);\n if (domain !== model.scaleDomain(channel)) {\n model.specifiedScales[channel] = {\n ...model.specifiedScales[channel],\n domain\n };\n }\n // If channel is either X or Y then union them with X2 & Y2 if they exist\n if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) {\n if (getFieldOrDatumDef(encoding.x)) {\n return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'x'), parseSingleChannelDomain(scaleType, domain, model, 'x2'), 'domain', 'scale', domainsTieBreaker);\n }\n else {\n return parseSingleChannelDomain(scaleType, domain, model, 'x2');\n }\n }\n else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) {\n if (getFieldOrDatumDef(encoding.y)) {\n return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'y'), parseSingleChannelDomain(scaleType, domain, model, 'y2'), 'domain', 'scale', domainsTieBreaker);\n }\n else {\n return parseSingleChannelDomain(scaleType, domain, model, 'y2');\n }\n }\n return parseSingleChannelDomain(scaleType, domain, model, channel);\n}\nfunction mapDomainToDataSignal(domain, type, timeUnit) {\n return domain.map(v => {\n const data = valueExpr(v, { timeUnit, type });\n return { signal: `{data: ${data}}` };\n });\n}\nfunction convertDomainIfItIsDateTime(domain, type, timeUnit) {\n // explicit value\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit)?.unit;\n if (type === 'temporal' || normalizedTimeUnit) {\n return mapDomainToDataSignal(domain, type, normalizedTimeUnit);\n }\n return [domain]; // Date time won't make sense\n}\nfunction parseSingleChannelDomain(scaleType, domain, model, channel) {\n const { encoding, markDef, mark, config, stack } = model;\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]);\n const { type } = fieldOrDatumDef;\n const timeUnit = fieldOrDatumDef['timeUnit'];\n if (isDomainUnionWith(domain)) {\n const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel);\n const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit);\n return makeExplicit([...unionWith, ...defaultDomain.value]);\n }\n else if (isSignalRef(domain)) {\n return makeExplicit([domain]);\n }\n else if (domain && domain !== 'unaggregated' && !isParameterDomain(domain)) {\n return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit));\n }\n if (stack && channel === stack.fieldChannel) {\n if (stack.offset === 'normalize') {\n return makeImplicit([[0, 1]]);\n }\n const data = model.requestDataName(DataSourceType.Main);\n return makeImplicit([\n {\n data,\n field: model.vgField(channel, { suffix: 'start' })\n },\n {\n data,\n field: model.vgField(channel, { suffix: 'end' })\n }\n ]);\n }\n const sort = isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined;\n if (isDatumDef(fieldOrDatumDef)) {\n const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit);\n return makeImplicit(d);\n }\n const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef\n if (domain === 'unaggregated') {\n const data = model.requestDataName(DataSourceType.Main);\n const { field } = fieldOrDatumDef;\n return makeImplicit([\n {\n data,\n field: vgField({ field, aggregate: 'min' })\n },\n {\n data,\n field: vgField({ field, aggregate: 'max' })\n }\n ]);\n }\n else if (isBinning(fieldDef.bin)) {\n if (hasDiscreteDomain(scaleType)) {\n if (scaleType === 'bin-ordinal') {\n // we can omit the domain as it is inferred from the `bins` property\n return makeImplicit([]);\n }\n // ordinal bin scale takes domain from bin_range, ordered by bin start\n // This is useful for both axis-based scale (x/y) and legend-based scale (other channels).\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n // Use range if we added it and the scale does not support computing a range as a signal.\n field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? { binSuffix: 'range' } : {}),\n // we have to use a sort object if sort = true to make the sort correct by bin start\n sort: sort === true || !isObject(sort)\n ? {\n field: model.vgField(channel, {}),\n op: 'min' // min or max doesn't matter since we sort by the start of the bin range\n }\n : sort\n }\n ]);\n }\n else {\n // continuous scales\n const { bin } = fieldDef;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return makeImplicit([\n new SignalRefWrapper(() => {\n const signal = model.getSignalName(binSignal);\n return `[${signal}.start, ${signal}.stop]`;\n })\n ]);\n }\n else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel, {})\n }\n ]);\n }\n }\n }\n else if (fieldDef.timeUnit && util.contains(['time', 'utc'], scaleType)) {\n const fieldDef2 = encoding[getSecondaryRangeChannel(channel)];\n if (hasBandEnd(fieldDef, fieldDef2, markDef, config)) {\n const data = model.requestDataName(DataSourceType.Main);\n const bandPosition = getBandPosition({ fieldDef, fieldDef2, markDef, config });\n const isRectWithOffset = isRectBasedMark(mark) && bandPosition !== 0.5;\n return makeImplicit([\n {\n data,\n field: model.vgField(channel, isRectWithOffset ? { suffix: OFFSETTED_RECT_START_SUFFIX } : {})\n },\n {\n data,\n field: model.vgField(channel, { suffix: isRectWithOffset ? OFFSETTED_RECT_END_SUFFIX : 'end' })\n }\n ]);\n }\n }\n if (sort) {\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n field: model.vgField(channel),\n sort\n }\n ]);\n }\n else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel)\n }\n ]);\n }\n}\nfunction normalizeSortField(sort, isStackedMeasure) {\n const { op, field, order } = sort;\n return {\n // Apply default op\n op: op ?? (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP),\n // flatten nested fields\n ...(field ? { field: util.replacePathInField(field) } : {}),\n ...(order ? { order } : {})\n };\n}\nfunction parseSelectionDomain(model, channel) {\n const scale = model.component.scales[channel];\n const spec = model.specifiedScales[channel].domain;\n const bin = model.fieldDef(channel)?.bin;\n const domain = isParameterDomain(spec) && spec;\n const extent = isBinParams(bin) && isParameterExtent(bin.extent) && bin.extent;\n if (domain || extent) {\n // As scale parsing occurs before selection parsing, we cannot set\n // domainRaw directly. So instead, we store the selectionExtent on\n // the scale component, and then add domainRaw during scale assembly.\n scale.set('selectionExtent', domain ?? extent, true);\n }\n}\nexport function domainSort(model, channel, scaleType) {\n if (!hasDiscreteDomain(scaleType)) {\n return undefined;\n }\n // save to cast as the only exception is the geojson type for shape, which would not generate a scale\n const fieldDef = model.fieldDef(channel);\n const sort = fieldDef.sort;\n // if the sort is specified with array, use the derived sort index field\n if (isSortArray(sort)) {\n return {\n op: 'min',\n field: sortArrayIndexField(fieldDef, channel),\n order: 'ascending'\n };\n }\n const { stack } = model;\n const stackDimensions = stack\n ? new Set([...stack.groupbyFields, ...stack.stackBy.map(s => s.fieldDef.field)])\n : undefined;\n // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)\n if (isSortField(sort)) {\n const isStackedMeasure = stack && !stackDimensions.has(sort.field);\n return normalizeSortField(sort, isStackedMeasure);\n }\n else if (isSortByEncoding(sort)) {\n const { encoding, order } = sort;\n const fieldDefToSortBy = model.fieldDef(encoding);\n const { aggregate, field } = fieldDefToSortBy;\n const isStackedMeasure = stack && !stackDimensions.has(field);\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n return normalizeSortField({\n field: vgField(fieldDefToSortBy),\n order\n }, isStackedMeasure);\n }\n else if (isAggregateOp(aggregate) || !aggregate) {\n return normalizeSortField({\n op: aggregate,\n field,\n order\n }, isStackedMeasure);\n }\n }\n else if (sort === 'descending') {\n return {\n op: 'min',\n field: model.vgField(channel),\n order: 'descending'\n };\n }\n else if (util.contains(['ascending', undefined /* default =ascending*/], sort)) {\n return true;\n }\n // sort == null\n return undefined;\n}\n/**\n * Determine if a scale can use unaggregated domain.\n * @return {Boolean} Returns true if all of the following conditions apply:\n * 1. `scale.domain` is `unaggregated`\n * 2. Aggregation function is not `count` or `sum`\n * 3. The scale is quantitative or time scale.\n */\nexport function canUseUnaggregatedDomain(fieldDef, scaleType) {\n const { aggregate, type } = fieldDef;\n if (!aggregate) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainHasNoEffectForRawField(fieldDef)\n };\n }\n if (isString(aggregate) && !SHARED_DOMAIN_OPS.has(aggregate)) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainWithNonSharedDomainOp(aggregate)\n };\n }\n if (type === 'quantitative') {\n if (scaleType === 'log') {\n return {\n valid: false,\n reason: log.message.unaggregatedDomainWithLogScale(fieldDef)\n };\n }\n }\n return { valid: true };\n}\n/**\n * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values.\n */\nfunction domainsTieBreaker(v1, v2, property, propertyOf) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, concat the domains so that we union them later.\n return { explicit: v1.explicit, value: [...v1.value, ...v2.value] };\n}\n/**\n * Converts an array of domains to a single Vega scale domain.\n */\nexport function mergeDomains(domains) {\n const uniqueDomains = util.unique(domains.map(domain => {\n // ignore sort property when computing the unique domains\n if (isDataRefDomain(domain)) {\n const { sort: _s, ...domainWithoutSort } = domain;\n return domainWithoutSort;\n }\n return domain;\n }), util.hash);\n const sorts = util.unique(domains\n .map(d => {\n if (isDataRefDomain(d)) {\n const s = d.sort;\n if (s !== undefined && !util.isBoolean(s)) {\n if ('op' in s && s.op === 'count') {\n // let's make sure that if op is count, we don't use a field\n delete s.field;\n }\n if (s.order === 'ascending') {\n // drop order: ascending as it is the default\n delete s.order;\n }\n }\n return s;\n }\n return undefined;\n })\n .filter(s => s !== undefined), util.hash);\n if (uniqueDomains.length === 0) {\n return undefined;\n }\n else if (uniqueDomains.length === 1) {\n const domain = domains[0];\n if (isDataRefDomain(domain) && sorts.length > 0) {\n let sort = sorts[0];\n if (sorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n // Get sorts with non-default ops\n const filteredSorts = sorts.filter(s => isObject(s) && 'op' in s && s.op !== 'min');\n if (sorts.every(s => isObject(s) && 'op' in s) && filteredSorts.length === 1) {\n sort = filteredSorts[0];\n }\n else {\n sort = true;\n }\n }\n else {\n // Simplify domain sort by removing field and op when the field is the same as the domain field.\n if (isObject(sort) && 'field' in sort) {\n const sortField = sort.field;\n if (domain.field === sortField) {\n sort = sort.order ? { order: sort.order } : true;\n }\n }\n }\n return {\n ...domain,\n sort\n };\n }\n return domain;\n }\n // only keep sort properties that work with unioned domains\n const unionDomainSorts = util.unique(sorts.map(s => {\n if (util.isBoolean(s) || !('op' in s) || (isString(s.op) && s.op in UNIONDOMAIN_SORT_OP_INDEX)) {\n return s;\n }\n log.warn(log.message.domainSortDropped(s));\n return true;\n }), util.hash);\n let sort;\n if (unionDomainSorts.length === 1) {\n sort = unionDomainSorts[0];\n }\n else if (unionDomainSorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n sort = true;\n }\n const allData = util.unique(domains.map(d => {\n if (isDataRefDomain(d)) {\n return d.data;\n }\n return null;\n }), x => x);\n if (allData.length === 1 && allData[0] !== null) {\n // create a union domain of different fields with a single data source\n const domain = {\n data: allData[0],\n fields: uniqueDomains.map(d => d.field),\n ...(sort ? { sort } : {})\n };\n return domain;\n }\n return { fields: uniqueDomains, ...(sort ? { sort } : {}) };\n}\n/**\n * Return a field if a scale uses a single field.\n * Return `undefined` otherwise.\n */\nexport function getFieldFromDomain(domain) {\n if (isDataRefDomain(domain) && isString(domain.field)) {\n return domain.field;\n }\n else if (isDataRefUnionedDomain(domain)) {\n let field;\n for (const nonUnionDomain of domain.fields) {\n if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) {\n if (!field) {\n field = nonUnionDomain.field;\n }\n else if (field !== nonUnionDomain.field) {\n log.warn(log.message.FACETED_INDEPENDENT_DIFFERENT_SOURCES);\n return field;\n }\n }\n }\n log.warn(log.message.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES);\n return field;\n }\n else if (isFieldRefUnionDomain(domain)) {\n log.warn(log.message.FACETED_INDEPENDENT_SAME_SOURCE);\n const field = domain.fields[0];\n return isString(field) ? field : undefined;\n }\n return undefined;\n}\nexport function assembleDomain(model, channel) {\n const scaleComponent = model.component.scales[channel];\n const domains = scaleComponent.get('domains').map((domain) => {\n // Correct references to data as the original domain's data was determined\n // in parseScale, which happens before parseData. Thus the original data\n // reference can be incorrect.\n if (isDataRefDomain(domain)) {\n domain.data = model.lookupDataSource(domain.data);\n }\n return domain;\n });\n // domains is an array that has to be merged into a single vega domain\n return mergeDomains(domains);\n}\n//# sourceMappingURL=domain.js.map","import { isObject } from 'vega-util';\nimport { isXorY } from '../../channel';\nimport { keys } from '../../util';\nimport { isDataRefDomain, isVgRangeStep } from '../../vega.schema';\nimport { isConcatModel, isLayerModel } from '../model';\nimport { assembleSelectionScaleDomain } from '../selection/assemble';\nimport { assembleDomain } from './domain';\nexport function assembleScales(model) {\n if (isLayerModel(model) || isConcatModel(model)) {\n // For concat and layer, include scales of children too\n return model.children.reduce((scales, child) => {\n return scales.concat(assembleScales(child));\n }, assembleScalesForModel(model));\n }\n else {\n // For facet, child scales would not be included in the parent's scope.\n // For unit, there is no child.\n return assembleScalesForModel(model);\n }\n}\nexport function assembleScalesForModel(model) {\n return keys(model.component.scales).reduce((scales, channel) => {\n const scaleComponent = model.component.scales[channel];\n if (scaleComponent.merged) {\n // Skipped merged scales\n return scales;\n }\n const scale = scaleComponent.combine();\n const { name, type, selectionExtent, domains: _d, range: _r, reverse, ...otherScaleProps } = scale;\n const range = assembleScaleRange(scale.range, name, channel, model);\n const domain = assembleDomain(model, channel);\n const domainRaw = selectionExtent\n ? assembleSelectionScaleDomain(model, selectionExtent, scaleComponent, domain)\n : null;\n scales.push({\n name,\n type,\n ...(domain ? { domain } : {}),\n ...(domainRaw ? { domainRaw } : {}),\n range,\n ...(reverse !== undefined ? { reverse: reverse } : {}),\n ...otherScaleProps\n });\n return scales;\n }, []);\n}\nexport function assembleScaleRange(scaleRange, scaleName, channel, model) {\n // add signals to x/y range\n if (isXorY(channel)) {\n if (isVgRangeStep(scaleRange)) {\n // For width/height step, use a signal created in layout assemble instead of a constant step.\n return {\n step: { signal: `${scaleName}_step` }\n };\n }\n }\n else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) {\n return {\n ...scaleRange,\n data: model.lookupDataSource(scaleRange.data)\n };\n }\n return scaleRange;\n}\n//# sourceMappingURL=assemble.js.map","import { isArray, isNumber } from 'vega-util';\nimport { some } from '../../util';\nimport { Split } from '../split';\nexport class ScaleComponent extends Split {\n constructor(name, typeWithExplicit) {\n super({}, // no initial explicit property\n { name } // name as initial implicit property\n );\n this.merged = false;\n this.setWithExplicit('type', typeWithExplicit);\n }\n /**\n * Whether the scale definitely includes zero in the domain\n */\n domainDefinitelyIncludesZero() {\n if (this.get('zero') !== false) {\n return true;\n }\n return some(this.get('domains'), d => isArray(d) && d.length === 2 && isNumber(d[0]) && d[0] <= 0 && isNumber(d[1]) && d[1] >= 0);\n }\n}\n//# sourceMappingURL=component.js.map","import { isArray, isNumber, isObject } from 'vega-util';\nimport { isBinning } from '../../bin';\nimport { ANGLE, COLOR, FILL, FILLOPACITY, getOffsetScaleChannel, getSizeChannel, isXorY, isXorYOffset, OPACITY, RADIUS, SCALE_CHANNELS, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, THETA, X, XOFFSET, Y, YOFFSET } from '../../channel';\nimport { getBandPosition, getFieldOrDatumDef, isFieldDef, isFieldOrDatumDef } from '../../channeldef';\nimport { getViewConfigDiscreteSize, getViewConfigDiscreteStep } from '../../config';\nimport { DataSourceType } from '../../data';\nimport { channelHasFieldOrDatum } from '../../encoding';\nimport * as log from '../../log';\nimport { channelScalePropertyIncompatability, hasContinuousDomain, hasDiscreteDomain, isContinuousToDiscrete, isExtendedScheme, scaleTypeSupportProperty } from '../../scale';\nimport { getStepFor, isStep } from '../../spec/base';\nimport { isDiscrete } from '../../type';\nimport * as util from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { exprFromSignalRefOrValue, signalOrStringValue } from '../common';\nimport { getBinSignalName } from '../data/bin';\nimport { SignalRefWrapper } from '../signal';\nimport { makeExplicit, makeImplicit } from '../split';\nimport { durationExpr } from '../../timeunit';\nexport const RANGE_PROPERTIES = ['range', 'scheme'];\nexport function parseUnitScaleRange(model) {\n const localScaleComponents = model.component.scales;\n // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first!\n for (const channel of SCALE_CHANNELS) {\n const localScaleCmpt = localScaleComponents[channel];\n if (!localScaleCmpt) {\n continue;\n }\n const rangeWithExplicit = parseRangeForChannel(channel, model);\n localScaleCmpt.setWithExplicit('range', rangeWithExplicit);\n }\n}\nfunction getBinStepSignal(model, channel) {\n const fieldDef = model.fieldDef(channel);\n if (fieldDef?.bin) {\n const { bin, field } = fieldDef;\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n if (isObject(bin) && bin.binned && bin.step !== undefined) {\n return new SignalRefWrapper(() => {\n const scaleName = model.scaleName(channel);\n const binCount = `(domain(\"${scaleName}\")[1] - domain(\"${scaleName}\")[0]) / ${bin.step}`;\n return `${model.getSignalName(sizeSignal)} / (${binCount})`;\n });\n }\n else if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, field, bin);\n // TODO: extract this to be range step signal\n return new SignalRefWrapper(() => {\n const updatedName = model.getSignalName(binSignal);\n const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`;\n return `${model.getSignalName(sizeSignal)} / (${binCount})`;\n });\n }\n }\n return undefined;\n}\n/**\n * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme).\n */\nexport function parseRangeForChannel(channel, model) {\n const specifiedScale = model.specifiedScales[channel];\n const { size } = model;\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n // Check if any of the range properties is specified.\n // If so, check if it is compatible and make sure that we only output one of the properties\n for (const property of RANGE_PROPERTIES) {\n if (specifiedScale[property] !== undefined) {\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n }\n else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n }\n else {\n switch (property) {\n case 'range': {\n const range = specifiedScale.range;\n if (isArray(range)) {\n if (isXorY(channel)) {\n return makeExplicit(range.map(v => {\n if (v === 'width' || v === 'height') {\n // get signal for width/height\n // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames.\n const sizeSignal = model.getName(v);\n const getSignalName = model.getSignalName.bind(model);\n return SignalRefWrapper.fromName(getSignalName, sizeSignal);\n }\n return v;\n }));\n }\n }\n else if (isObject(range)) {\n return makeExplicit({\n data: model.requestDataName(DataSourceType.Main),\n field: range.field,\n sort: { op: 'min', field: model.vgField(channel) }\n });\n }\n return makeExplicit(range);\n }\n case 'scheme':\n return makeExplicit(parseScheme(specifiedScale[property]));\n }\n }\n }\n }\n const sizeChannel = channel === X || channel === 'xOffset' ? 'width' : 'height';\n const sizeValue = size[sizeChannel];\n if (isStep(sizeValue)) {\n if (isXorY(channel)) {\n if (hasDiscreteDomain(scaleType)) {\n const step = getPositionStep(sizeValue, model, channel);\n // Need to be explicit so layer with step wins over layer without step\n if (step) {\n return makeExplicit({ step });\n }\n }\n else {\n log.warn(log.message.stepDropped(sizeChannel));\n }\n }\n else if (isXorYOffset(channel)) {\n const positionChannel = channel === XOFFSET ? 'x' : 'y';\n const positionScaleCmpt = model.getScaleComponent(positionChannel);\n const positionScaleType = positionScaleCmpt.get('type');\n if (positionScaleType === 'band') {\n const step = getOffsetStep(sizeValue, scaleType);\n if (step) {\n return makeExplicit(step);\n }\n }\n }\n }\n const { rangeMin, rangeMax } = specifiedScale;\n const d = defaultRange(channel, model);\n if ((rangeMin !== undefined || rangeMax !== undefined) &&\n // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same\n scaleTypeSupportProperty(scaleType, 'rangeMin') &&\n isArray(d) &&\n d.length === 2) {\n return makeExplicit([rangeMin ?? d[0], rangeMax ?? d[1]]);\n }\n return makeImplicit(d);\n}\nfunction parseScheme(scheme) {\n if (isExtendedScheme(scheme)) {\n return {\n scheme: scheme.name,\n ...util.omit(scheme, ['name'])\n };\n }\n return { scheme };\n}\nfunction fullWidthOrHeightRange(channel, model, scaleType, { center } = {}) {\n // If step is null, use zero to width or height.\n // Note that we use SignalRefWrapper to account for potential merges and renames.\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n const getSignalName = model.getSignalName.bind(model);\n if (channel === Y && hasContinuousDomain(scaleType)) {\n // For y continuous scale, we have to start from the height as the bottom part has the max value.\n return center\n ? [\n SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal),\n SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal)\n ]\n : [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0];\n }\n else {\n return center\n ? [\n SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal),\n SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal)\n ]\n : [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)];\n }\n}\nfunction defaultRange(channel, model) {\n const { size, config, mark, encoding } = model;\n const { type } = getFieldOrDatumDef(encoding[channel]);\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n const { domain, domainMid } = model.specifiedScales[channel];\n switch (channel) {\n case X:\n case Y: {\n // If there is no explicit width/height for discrete x/y scales\n if (util.contains(['point', 'band'], scaleType)) {\n const positionSize = getDiscretePositionSize(channel, size, config.view);\n if (isStep(positionSize)) {\n const step = getPositionStep(positionSize, model, channel);\n return { step };\n }\n }\n return fullWidthOrHeightRange(channel, model, scaleType);\n }\n case XOFFSET:\n case YOFFSET:\n return getOffsetRange(channel, model, scaleType);\n case SIZE: {\n // TODO: support custom rangeMin, rangeMax\n const zero = model.component.scales[channel].get('zero');\n const rangeMin = sizeRangeMin(mark, zero, config);\n const rangeMax = sizeRangeMax(mark, size, model, config);\n if (isContinuousToDiscrete(scaleType)) {\n return interpolateRange(rangeMin, rangeMax, defaultContinuousToDiscreteCount(scaleType, config, domain, channel));\n }\n else {\n return [rangeMin, rangeMax];\n }\n }\n case THETA:\n return [0, Math.PI * 2];\n case ANGLE:\n // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks.\n // (It's weird to add just config.scale.min/maxAngleDegree for now)\n return [0, 360];\n case RADIUS: {\n // max radius = half od min(width,height)\n return [\n 0,\n new SignalRefWrapper(() => {\n const w = model.getSignalName('width');\n const h = model.getSignalName('height');\n return `min(${w},${h})/2`;\n })\n ];\n }\n case STROKEWIDTH:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth];\n case STROKEDASH:\n return [\n // TODO: add this to Vega's config.range?\n [1, 0],\n [4, 2],\n [2, 1],\n [1, 1],\n [1, 2, 4, 2]\n ];\n case SHAPE:\n return 'symbol';\n case COLOR:\n case FILL:\n case STROKE:\n if (scaleType === 'ordinal') {\n // Only nominal data uses ordinal scale by default\n return type === 'nominal' ? 'category' : 'ordinal';\n }\n else {\n if (domainMid !== undefined) {\n return 'diverging';\n }\n else {\n return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp';\n }\n }\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minOpacity, config.scale.maxOpacity];\n }\n}\nfunction getPositionStep(step, model, channel) {\n const { encoding } = model;\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const offsetChannel = getOffsetScaleChannel(channel);\n const offsetDef = encoding[offsetChannel];\n const stepFor = getStepFor({ step, offsetIsDiscrete: isFieldOrDatumDef(offsetDef) && isDiscrete(offsetDef.type) });\n if (stepFor === 'offset' && channelHasFieldOrDatum(encoding, offsetChannel)) {\n const offsetScaleCmpt = model.getScaleComponent(offsetChannel);\n const offsetScaleName = model.scaleName(offsetChannel);\n let stepCount = `domain('${offsetScaleName}').length`;\n if (offsetScaleCmpt.get('type') === 'band') {\n const offsetPaddingInner = offsetScaleCmpt.get('paddingInner') ?? offsetScaleCmpt.get('padding') ?? 0;\n const offsetPaddingOuter = offsetScaleCmpt.get('paddingOuter') ?? offsetScaleCmpt.get('padding') ?? 0;\n stepCount = `bandspace(${stepCount}, ${offsetPaddingInner}, ${offsetPaddingOuter})`;\n }\n const paddingInner = mergedScaleCmpt.get('paddingInner') ?? mergedScaleCmpt.get('padding');\n return {\n signal: `${step.step} * ${stepCount} / (1-${exprFromSignalRefOrValue(paddingInner)})`\n };\n }\n else {\n return step.step;\n }\n}\nfunction getOffsetStep(step, offsetScaleType) {\n const stepFor = getStepFor({ step, offsetIsDiscrete: hasDiscreteDomain(offsetScaleType) });\n if (stepFor === 'offset') {\n return { step: step.step };\n }\n return undefined;\n}\nfunction getOffsetRange(channel, model, offsetScaleType) {\n const positionChannel = channel === XOFFSET ? 'x' : 'y';\n const positionScaleCmpt = model.getScaleComponent(positionChannel);\n if (!positionScaleCmpt) {\n return fullWidthOrHeightRange(positionChannel, model, offsetScaleType, { center: true });\n }\n const positionScaleType = positionScaleCmpt.get('type');\n const positionScaleName = model.scaleName(positionChannel);\n const { markDef, config } = model;\n if (positionScaleType === 'band') {\n const size = getDiscretePositionSize(positionChannel, model.size, model.config.view);\n if (isStep(size)) {\n // step is for offset\n const step = getOffsetStep(size, offsetScaleType);\n if (step) {\n return step;\n }\n }\n // otherwise use the position\n return [0, { signal: `bandwidth('${positionScaleName}')` }];\n }\n else {\n // continuous scale\n const positionDef = model.encoding[positionChannel];\n if (isFieldDef(positionDef) && positionDef.timeUnit) {\n const duration = durationExpr(positionDef.timeUnit, expr => `scale('${positionScaleName}', ${expr})`);\n const padding = model.config.scale.bandWithNestedOffsetPaddingInner;\n const bandPositionOffset = getBandPosition({\n fieldDef: positionDef,\n markDef,\n config\n }) - 0.5;\n const bandPositionOffsetExpr = bandPositionOffset !== 0 ? ` + ${bandPositionOffset}` : '';\n if (padding) {\n const startRatio = isSignalRef(padding)\n ? `${padding.signal}/2` + bandPositionOffsetExpr\n : `${padding / 2 + bandPositionOffset}`;\n const endRatio = isSignalRef(padding)\n ? `(1 - ${padding.signal}/2)` + bandPositionOffsetExpr\n : `${1 - padding / 2 + bandPositionOffset}`;\n return [{ signal: `${startRatio} * (${duration})` }, { signal: `${endRatio} * (${duration})` }];\n }\n return [0, { signal: duration }];\n }\n return util.never(`Cannot use ${channel} scale if ${positionChannel} scale is not discrete.`);\n }\n}\nfunction getDiscretePositionSize(channel, size, viewConfig) {\n const sizeChannel = channel === X ? 'width' : 'height';\n const sizeValue = size[sizeChannel];\n if (sizeValue) {\n return sizeValue;\n }\n return getViewConfigDiscreteSize(viewConfig, sizeChannel);\n}\nexport function defaultContinuousToDiscreteCount(scaleType, config, domain, channel) {\n switch (scaleType) {\n case 'quantile':\n return config.scale.quantileCount;\n case 'quantize':\n return config.scale.quantizeCount;\n case 'threshold':\n if (domain !== undefined && isArray(domain)) {\n return domain.length + 1;\n }\n else {\n log.warn(log.message.domainRequiredForThresholdScale(channel));\n // default threshold boundaries for threshold scale since domain has cardinality of 2\n return 3;\n }\n }\n}\n/**\n * Returns the linear interpolation of the range according to the cardinality\n *\n * @param rangeMin start of the range\n * @param rangeMax end of the range\n * @param cardinality number of values in the output range\n */\nexport function interpolateRange(rangeMin, rangeMax, cardinality) {\n // always return a signal since it's better to compute the sequence in Vega later\n const f = () => {\n const rMax = signalOrStringValue(rangeMax);\n const rMin = signalOrStringValue(rangeMin);\n const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`;\n return `sequence(${rMin}, ${rMax} + ${step}, ${step})`;\n };\n if (isSignalRef(rangeMax)) {\n return new SignalRefWrapper(f);\n }\n else {\n return { signal: f() };\n }\n}\nfunction sizeRangeMin(mark, zero, config) {\n if (zero) {\n if (isSignalRef(zero)) {\n return { signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}` };\n }\n else {\n return 0;\n }\n }\n switch (mark) {\n case 'bar':\n case 'tick':\n return config.scale.minBandSize;\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.minStrokeWidth;\n case 'text':\n return config.scale.minFontSize;\n case 'point':\n case 'square':\n case 'circle':\n return config.scale.minSize;\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMin not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\nexport const MAX_SIZE_RANGE_STEP_RATIO = 0.95;\nfunction sizeRangeMax(mark, size, model, config) {\n const xyStepSignals = {\n x: getBinStepSignal(model, 'x'),\n y: getBinStepSignal(model, 'y')\n };\n switch (mark) {\n case 'bar':\n case 'tick': {\n if (config.scale.maxBandSize !== undefined) {\n return config.scale.maxBandSize;\n }\n const min = minXYStep(size, xyStepSignals, config.view);\n if (isNumber(min)) {\n return min - 1;\n }\n else {\n return new SignalRefWrapper(() => `${min.signal} - 1`);\n }\n }\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.maxStrokeWidth;\n case 'text':\n return config.scale.maxFontSize;\n case 'point':\n case 'square':\n case 'circle': {\n if (config.scale.maxSize) {\n return config.scale.maxSize;\n }\n const pointStep = minXYStep(size, xyStepSignals, config.view);\n if (isNumber(pointStep)) {\n return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2);\n }\n else {\n return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`);\n }\n }\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMax not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\n/**\n * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale.\n */\nfunction minXYStep(size, xyStepSignals, viewConfig) {\n const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width');\n const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height');\n if (xyStepSignals.x || xyStepSignals.y) {\n return new SignalRefWrapper(() => {\n const exprs = [\n xyStepSignals.x ? xyStepSignals.x.signal : widthStep,\n xyStepSignals.y ? xyStepSignals.y.signal : heightStep\n ];\n return `min(${exprs.join(', ')})`;\n });\n }\n return Math.min(widthStep, heightStep);\n}\n//# sourceMappingURL=range.js.map","import { isArray, isNumber } from 'vega-util';\nimport { isBinned, isBinning, isBinParams } from '../../bin';\nimport { COLOR, FILL, getSecondaryRangeChannel, isXorY, isXorYOffset, POLAR_POSITION_SCALE_CHANNELS, POSITION_SCALE_CHANNELS, STROKE } from '../../channel';\nimport { getFieldDef, getFieldOrDatumDef, isFieldDef, valueExpr } from '../../channeldef';\nimport { isDateTime } from '../../datetime';\nimport { channelHasNestedOffsetScale } from '../../encoding';\nimport * as log from '../../log';\nimport { channelScalePropertyIncompatability, hasContinuousDomain, isContinuousToContinuous, isContinuousToDiscrete, ScaleType, scaleTypeSupportProperty } from '../../scale';\nimport * as util from '../../util';\nimport { contains, getFirstDefined, keys } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { getBinSignalName } from '../data/bin';\nimport { isUnitModel } from '../model';\nimport { SignalRefWrapper } from '../signal';\nimport { mergeValuesWithExplicit, tieBreakByComparing } from '../split';\nimport { parseUnitScaleRange } from './range';\nexport function parseScaleProperty(model, property) {\n if (isUnitModel(model)) {\n parseUnitScaleProperty(model, property);\n }\n else {\n parseNonUnitScaleProperty(model, property);\n }\n}\nfunction parseUnitScaleProperty(model, property) {\n const localScaleComponents = model.component.scales;\n const { config, encoding, markDef, specifiedScales } = model;\n for (const channel of keys(localScaleComponents)) {\n const specifiedScale = specifiedScales[channel];\n const localScaleCmpt = localScaleComponents[channel];\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]);\n const specifiedValue = specifiedScale[property];\n const scaleType = mergedScaleCmpt.get('type');\n const scalePadding = mergedScaleCmpt.get('padding');\n const scalePaddingInner = mergedScaleCmpt.get('paddingInner');\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n if (specifiedValue !== undefined) {\n // If there is a specified value, check if it is compatible with scale type and channel\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n }\n else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n }\n }\n if (supportedByScaleType && channelIncompatability === undefined) {\n if (specifiedValue !== undefined) {\n const timeUnit = fieldOrDatumDef['timeUnit'];\n const type = fieldOrDatumDef.type;\n switch (property) {\n // domainMax/Min to signal if the value is a datetime object\n case 'domainMax':\n case 'domainMin':\n if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) {\n localScaleCmpt.set(property, { signal: valueExpr(specifiedScale[property], { type, timeUnit }) }, true);\n }\n else {\n localScaleCmpt.set(property, specifiedScale[property], true);\n }\n break;\n default:\n localScaleCmpt.copyKeyFromObject(property, specifiedScale);\n }\n }\n else {\n const value = property in scaleRules\n ? scaleRules[property]({\n model,\n channel,\n fieldOrDatumDef,\n scaleType,\n scalePadding,\n scalePaddingInner,\n domain: specifiedScale.domain,\n domainMin: specifiedScale.domainMin,\n domainMax: specifiedScale.domainMax,\n markDef,\n config,\n hasNestedOffsetScale: channelHasNestedOffsetScale(encoding, channel),\n hasSecondaryRangeChannel: !!encoding[getSecondaryRangeChannel(channel)]\n })\n : config.scale[property];\n if (value !== undefined) {\n localScaleCmpt.set(property, value, false);\n }\n }\n }\n }\n}\nexport const scaleRules = {\n bins: ({ model, fieldOrDatumDef }) => (isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined),\n interpolate: ({ channel, fieldOrDatumDef }) => interpolate(channel, fieldOrDatumDef.type),\n nice: ({ scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef }) => nice(scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef),\n padding: ({ channel, scaleType, fieldOrDatumDef, markDef, config }) => padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar),\n paddingInner: ({ scalePadding, channel, markDef, scaleType, config, hasNestedOffsetScale }) => paddingInner(scalePadding, channel, markDef.type, scaleType, config.scale, hasNestedOffsetScale),\n paddingOuter: ({ scalePadding, channel, scaleType, scalePaddingInner, config, hasNestedOffsetScale }) => paddingOuter(scalePadding, channel, scaleType, scalePaddingInner, config.scale, hasNestedOffsetScale),\n reverse: ({ fieldOrDatumDef, scaleType, channel, config }) => {\n const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined;\n return reverse(scaleType, sort, channel, config.scale);\n },\n zero: ({ channel, fieldOrDatumDef, domain, markDef, scaleType, config, hasSecondaryRangeChannel }) => zero(channel, fieldOrDatumDef, domain, markDef, scaleType, config.scale, hasSecondaryRangeChannel)\n};\n// This method is here rather than in range.ts to avoid circular dependency.\nexport function parseScaleRange(model) {\n if (isUnitModel(model)) {\n parseUnitScaleRange(model);\n }\n else {\n parseNonUnitScaleProperty(model, 'range');\n }\n}\nexport function parseNonUnitScaleProperty(model, property) {\n const localScaleComponents = model.component.scales;\n for (const child of model.children) {\n if (property === 'range') {\n parseScaleRange(child);\n }\n else {\n parseScaleProperty(child, property);\n }\n }\n for (const channel of keys(localScaleComponents)) {\n let valueWithExplicit;\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n const childValueWithExplicit = childComponent.getWithExplicit(property);\n valueWithExplicit = mergeValuesWithExplicit(valueWithExplicit, childValueWithExplicit, property, 'scale', tieBreakByComparing((v1, v2) => {\n switch (property) {\n case 'range':\n // For step, prefer larger step\n if (v1.step && v2.step) {\n return v1.step - v2.step;\n }\n return 0;\n // TODO: precedence rule for other properties\n }\n return 0;\n }));\n }\n }\n localScaleComponents[channel].setWithExplicit(property, valueWithExplicit);\n }\n}\nexport function bins(model, fieldDef) {\n const bin = fieldDef.bin;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return new SignalRefWrapper(() => {\n return model.getSignalName(binSignal);\n });\n }\n else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) {\n // start and stop will be determined from the scale domain\n return {\n step: bin.step\n };\n }\n return undefined;\n}\nexport function interpolate(channel, type) {\n if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') {\n return 'hcl';\n }\n return undefined;\n}\nexport function nice(scaleType, channel, specifiedDomain, domainMin, domainMax, fieldOrDatumDef) {\n if (getFieldDef(fieldOrDatumDef)?.bin ||\n isArray(specifiedDomain) ||\n domainMax != null ||\n domainMin != null ||\n util.contains([ScaleType.TIME, ScaleType.UTC], scaleType)) {\n return undefined;\n }\n return isXorY(channel) ? true : undefined;\n}\nexport function padding(channel, scaleType, scaleConfig, fieldOrDatumDef, markDef, barConfig) {\n if (isXorY(channel)) {\n if (isContinuousToContinuous(scaleType)) {\n if (scaleConfig.continuousPadding !== undefined) {\n return scaleConfig.continuousPadding;\n }\n const { type, orient } = markDef;\n if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) {\n if ((orient === 'vertical' && channel === 'x') || (orient === 'horizontal' && channel === 'y')) {\n return barConfig.continuousBandSize;\n }\n }\n }\n if (scaleType === ScaleType.POINT) {\n return scaleConfig.pointPadding;\n }\n }\n return undefined;\n}\nexport function paddingInner(paddingValue, channel, mark, scaleType, scaleConfig, hasNestedOffsetScale = false) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingInner.\n return undefined;\n }\n if (isXorY(channel)) {\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n // paddingOuter would only be called if it's a band scale, just return the default for bandScale.\n const { bandPaddingInner, barBandPaddingInner, rectBandPaddingInner, bandWithNestedOffsetPaddingInner } = scaleConfig;\n if (hasNestedOffsetScale) {\n return bandWithNestedOffsetPaddingInner;\n }\n return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner);\n }\n else if (isXorYOffset(channel)) {\n if (scaleType === ScaleType.BAND) {\n return scaleConfig.offsetBandPaddingInner;\n }\n }\n return undefined;\n}\nexport function paddingOuter(paddingValue, channel, scaleType, paddingInnerValue, scaleConfig, hasNestedOffsetScale = false) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingOuter.\n return undefined;\n }\n if (isXorY(channel)) {\n const { bandPaddingOuter, bandWithNestedOffsetPaddingOuter } = scaleConfig;\n if (hasNestedOffsetScale) {\n return bandWithNestedOffsetPaddingOuter;\n }\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n if (scaleType === ScaleType.BAND) {\n return getFirstDefined(bandPaddingOuter, \n /* By default, paddingOuter is paddingInner / 2. The reason is that\n size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter).\n and we want the width/height to be integer by default.\n Note that step (by default) and cardinality are integers.) */\n isSignalRef(paddingInnerValue) ? { signal: `${paddingInnerValue.signal}/2` } : paddingInnerValue / 2);\n }\n }\n else if (isXorYOffset(channel)) {\n if (scaleType === ScaleType.POINT) {\n return 0.5; // so the point positions align with centers of band scales.\n }\n else if (scaleType === ScaleType.BAND) {\n return scaleConfig.offsetBandPaddingOuter;\n }\n }\n return undefined;\n}\nexport function reverse(scaleType, sort, channel, scaleConfig) {\n if (channel === 'x' && scaleConfig.xReverse !== undefined) {\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n if (isSignalRef(scaleConfig.xReverse)) {\n return { signal: `!${scaleConfig.xReverse.signal}` };\n }\n else {\n return !scaleConfig.xReverse;\n }\n }\n return scaleConfig.xReverse;\n }\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n // For continuous domain scales, Vega does not support domain sort.\n // Thus, we reverse range instead if sort is descending\n return true;\n }\n return undefined;\n}\nexport function zero(channel, fieldDef, specifiedDomain, markDef, scaleType, scaleConfig, hasSecondaryRangeChannel) {\n // If users explicitly provide a domain, we should not augment zero as that will be unexpected.\n const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated';\n if (hasCustomDomain) {\n if (hasContinuousDomain(scaleType)) {\n if (isArray(specifiedDomain)) {\n const first = specifiedDomain[0];\n const last = specifiedDomain[specifiedDomain.length - 1];\n if (isNumber(first) && first <= 0 && isNumber(last) && last >= 0) {\n // if the domain includes zero, make zero remain true\n return true;\n }\n }\n return false;\n }\n }\n // If there is no custom domain, return configZero value (=`true` as default) only for the following cases:\n // 1) using quantitative field with size\n // While this can be either ratio or interval fields, our assumption is that\n // ratio are more common. However, if the scaleType is discretizing scale, we want to return\n // false so that range doesn't start at zero\n if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) {\n return true;\n }\n // 2) non-binned, quantitative x-scale or y-scale\n // (For binning, we should not include zero by default because binning are calculated without zero.)\n // (For area/bar charts with ratio scale chart, we should always include zero.)\n if (!(isFieldDef(fieldDef) && fieldDef.bin) &&\n util.contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel)) {\n const { orient, type } = markDef;\n if (contains(['bar', 'area', 'line', 'trail'], type)) {\n if ((orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x')) {\n return false;\n }\n }\n if (contains(['bar', 'area'], type) && !hasSecondaryRangeChannel) {\n return true;\n }\n return scaleConfig?.zero;\n }\n return false;\n}\n//# sourceMappingURL=properties.js.map","import { isBinning } from '../../bin';\nimport { getSizeChannel, isColorChannel, isScaleChannel, isXorY, isXorYOffset, rangeType } from '../../channel';\nimport { isFieldDef, isPositionFieldOrDatumDef } from '../../channeldef';\nimport * as log from '../../log';\nimport { isRelativeBandSize } from '../../mark';\nimport { channelSupportScaleType, scaleTypeSupportDataType } from '../../scale';\nimport { normalizeTimeUnit } from '../../timeunit';\nimport * as util from '../../util';\nimport { POLAR_POSITION_SCALE_CHANNEL_INDEX } from './../../channel';\n/**\n * Determine if there is a specified scale type and if it is appropriate,\n * or determine default type if type is unspecified or inappropriate.\n */\n// NOTE: CompassQL uses this method.\nexport function scaleType(specifiedScale, channel, fieldDef, mark, hasNestedOffsetScale = false) {\n const defaultScaleType = defaultType(channel, fieldDef, mark, hasNestedOffsetScale);\n const { type } = specifiedScale;\n if (!isScaleChannel(channel)) {\n // There is no scale for these channels\n return null;\n }\n if (type !== undefined) {\n // Check if explicitly specified scale type is supported by the channel\n if (!channelSupportScaleType(channel, type)) {\n log.warn(log.message.scaleTypeNotWorkWithChannel(channel, type, defaultScaleType));\n return defaultScaleType;\n }\n // Check if explicitly specified scale type is supported by the data type\n if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) {\n log.warn(log.message.scaleTypeNotWorkWithFieldDef(type, defaultScaleType));\n return defaultScaleType;\n }\n return type;\n }\n return defaultScaleType;\n}\n/**\n * Determine appropriate default scale type.\n */\n// NOTE: Voyager uses this method.\nfunction defaultType(channel, fieldDef, mark, hasNestedOffsetScale) {\n switch (fieldDef.type) {\n case 'nominal':\n case 'ordinal': {\n if (isColorChannel(channel) || rangeType(channel) === 'discrete') {\n if (channel === 'shape' && fieldDef.type === 'ordinal') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'ordinal'));\n }\n return 'ordinal';\n }\n if (isXorY(channel) || isXorYOffset(channel)) {\n if (util.contains(['rect', 'bar', 'image', 'rule'], mark.type)) {\n // The rect/bar mark should fit into a band.\n // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429\n return 'band';\n }\n if (hasNestedOffsetScale) {\n // If there is a nested offset scale, then there is a \"band\" for the span of the nested scale.\n return 'band';\n }\n }\n else if (mark.type === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) {\n return 'band';\n }\n const dimensionSize = mark[getSizeChannel(channel)];\n if (isRelativeBandSize(dimensionSize)) {\n return 'band';\n }\n if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand) {\n return 'band';\n }\n // Otherwise, use ordinal point scale so we can easily get center positions of the marks.\n return 'point';\n }\n case 'temporal':\n if (isColorChannel(channel)) {\n return 'time';\n }\n else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'temporal'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n }\n else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) {\n return 'utc';\n }\n return 'time';\n case 'quantitative':\n if (isColorChannel(channel)) {\n if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n return 'bin-ordinal';\n }\n return 'linear';\n }\n else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'quantitative'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n }\n return 'linear';\n case 'geojson':\n return undefined;\n }\n /* istanbul ignore next: should never reach this */\n throw new Error(log.message.invalidFieldType(fieldDef.type));\n}\n//# sourceMappingURL=type.js.map","import { SCALE_CHANNELS, SHAPE } from '../../channel';\nimport { getFieldOrDatumDef } from '../../channeldef';\nimport { channelHasNestedOffsetScale } from '../../encoding';\nimport { GEOSHAPE } from '../../mark';\nimport { NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES, scaleCompatible, scaleTypePrecedence } from '../../scale';\nimport { GEOJSON } from '../../type';\nimport { keys } from '../../util';\nimport { isUnitModel } from '../model';\nimport { defaultScaleResolve } from '../resolve';\nimport { mergeValuesWithExplicit, tieBreakByComparing } from '../split';\nimport { ScaleComponent } from './component';\nimport { parseScaleDomain } from './domain';\nimport { parseScaleProperty, parseScaleRange } from './properties';\nimport { scaleType } from './type';\nexport function parseScales(model, { ignoreRange } = {}) {\n parseScaleCore(model);\n parseScaleDomain(model);\n for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) {\n parseScaleProperty(model, prop);\n }\n if (!ignoreRange) {\n // range depends on zero\n parseScaleRange(model);\n }\n}\nexport function parseScaleCore(model) {\n if (isUnitModel(model)) {\n model.component.scales = parseUnitScaleCore(model);\n }\n else {\n model.component.scales = parseNonUnitScaleCore(model);\n }\n}\n/**\n * Parse scales for all channels of a model.\n */\nfunction parseUnitScaleCore(model) {\n const { encoding, mark, markDef } = model;\n const scaleComponents = {};\n for (const channel of SCALE_CHANNELS) {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); // must be typed def to have scale\n // Don't generate scale for shape of geoshape\n if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) {\n continue;\n }\n let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale'];\n if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) {\n specifiedScale ?? (specifiedScale = {});\n const hasNestedOffsetScale = channelHasNestedOffsetScale(encoding, channel);\n const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, markDef, hasNestedOffsetScale);\n scaleComponents[channel] = new ScaleComponent(model.scaleName(`${channel}`, true), {\n value: sType,\n explicit: specifiedScale.type === sType\n });\n }\n }\n return scaleComponents;\n}\nconst scaleTypeTieBreaker = tieBreakByComparing((st1, st2) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2));\nfunction parseNonUnitScaleCore(model) {\n var _a;\n const scaleComponents = (model.component.scales = {});\n const scaleTypeWithExplicitIndex = {};\n const resolve = model.component.resolve;\n // Parse each child scale and determine if a particular channel can be merged.\n for (const child of model.children) {\n parseScaleCore(child);\n // Instead of always merging right away -- check if it is compatible to merge first!\n for (const channel of keys(child.component.scales)) {\n // if resolve is undefined, set default first\n (_a = resolve.scale)[channel] ?? (_a[channel] = defaultScaleResolve(channel, model));\n if (resolve.scale[channel] === 'shared') {\n const explicitScaleType = scaleTypeWithExplicitIndex[channel];\n const childScaleType = child.component.scales[channel].getWithExplicit('type');\n if (explicitScaleType) {\n if (scaleCompatible(explicitScaleType.value, childScaleType.value)) {\n // merge scale component if type are compatible\n scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(explicitScaleType, childScaleType, 'type', 'scale', scaleTypeTieBreaker);\n }\n else {\n // Otherwise, update conflicting channel to be independent\n resolve.scale[channel] = 'independent';\n // Remove from the index so they don't get merged\n delete scaleTypeWithExplicitIndex[channel];\n }\n }\n else {\n scaleTypeWithExplicitIndex[channel] = childScaleType;\n }\n }\n }\n }\n // Merge each channel listed in the index\n for (const channel of keys(scaleTypeWithExplicitIndex)) {\n // Create new merged scale component\n const name = model.scaleName(channel, true);\n const typeWithExplicit = scaleTypeWithExplicitIndex[channel];\n scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit);\n // rename each child and mark them as merged\n for (const child of model.children) {\n const childScale = child.component.scales[channel];\n if (childScale) {\n child.renameScale(childScale.get('name'), name);\n childScale.merged = true;\n }\n }\n }\n return scaleComponents;\n}\n//# sourceMappingURL=parse.js.map","import { FACET_CHANNELS, getPositionScaleChannel, isChannel, isScaleChannel } from '../channel';\nimport { getFieldDef, vgField } from '../channeldef';\nimport { DataSourceType } from '../data';\nimport { forEach, reduce } from '../encoding';\nimport { replaceExprRef } from '../expr';\nimport * as log from '../log';\nimport { hasDiscreteDomain } from '../scale';\nimport { isFacetSpec } from '../spec';\nimport { extractCompositionLayout } from '../spec/base';\nimport { extractTitleConfig, isText } from '../title';\nimport { normalizeTransform } from '../transform';\nimport { contains, duplicate, isEmpty, keys, varName } from '../util';\nimport { isVgRangeStep } from '../vega.schema';\nimport { assembleAxes } from './axis/assemble';\nimport { signalOrValueRef } from './common';\nimport { assembleHeaderGroups, assembleLayoutTitleBand, assembleTitleGroup } from './header/assemble';\nimport { HEADER_CHANNELS } from './header/component';\nimport { sizeExpr } from './layoutsize/assemble';\nimport { getSizeTypeFromLayoutSizeType } from './layoutsize/component';\nimport { assembleLegends } from './legend/assemble';\nimport { parseLegend } from './legend/parse';\nimport { assembleProjections } from './projection/assemble';\nimport { parseProjection } from './projection/parse';\nimport { assembleScales } from './scale/assemble';\nimport { assembleDomain, getFieldFromDomain } from './scale/domain';\nimport { parseScales } from './scale/parse';\nimport { Split } from './split';\nexport class NameMap {\n constructor() {\n this.nameMap = {};\n }\n rename(oldName, newName) {\n this.nameMap[oldName] = newName;\n }\n has(name) {\n return this.nameMap[name] !== undefined;\n }\n get(name) {\n // If the name appears in the _nameMap, we need to read its new name.\n // We have to loop over the dict just in case the new name also gets renamed.\n while (this.nameMap[name] && name !== this.nameMap[name]) {\n name = this.nameMap[name];\n }\n return name;\n }\n}\n/*\n We use type guards instead of `instanceof` as `instanceof` makes\n different parts of the compiler depend on the actual implementation of\n the model classes, which in turn depend on different parts of the compiler.\n Thus, `instanceof` leads to circular dependency problems.\n\n On the other hand, type guards only make different parts of the compiler\n depend on the type of the model classes, but not the actual implementation.\n*/\nexport function isUnitModel(model) {\n return model?.type === 'unit';\n}\nexport function isFacetModel(model) {\n return model?.type === 'facet';\n}\nexport function isConcatModel(model) {\n return model?.type === 'concat';\n}\nexport function isLayerModel(model) {\n return model?.type === 'layer';\n}\nexport class Model {\n constructor(spec, type, parent, parentGivenName, config, resolve, view) {\n this.type = type;\n this.parent = parent;\n this.config = config;\n /**\n * Corrects the data references in marks after assemble.\n */\n this.correctDataNames = (mark) => {\n // TODO: make this correct\n // for normal data references\n if (mark.from?.data) {\n mark.from.data = this.lookupDataSource(mark.from.data);\n }\n // for access to facet data\n if (mark.from?.facet?.data) {\n mark.from.facet.data = this.lookupDataSource(mark.from.facet.data);\n }\n return mark;\n };\n this.parent = parent;\n this.config = config;\n this.view = replaceExprRef(view);\n // If name is not provided, always use parent's givenName to avoid name conflicts.\n this.name = spec.name ?? parentGivenName;\n this.title = isText(spec.title) ? { text: spec.title } : spec.title ? replaceExprRef(spec.title) : undefined;\n // Shared name maps\n this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap();\n this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap();\n this.signalNameMap = parent ? parent.signalNameMap : new NameMap();\n this.data = spec.data;\n this.description = spec.description;\n this.transforms = normalizeTransform(spec.transform ?? []);\n this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config);\n this.component = {\n data: {\n sources: parent ? parent.component.data.sources : [],\n outputNodes: parent ? parent.component.data.outputNodes : {},\n outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {},\n // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined\n isFaceted: isFacetSpec(spec) || (parent?.component.data.isFaceted && spec.data === undefined)\n },\n layoutSize: new Split(),\n layoutHeaders: { row: {}, column: {}, facet: {} },\n mark: null,\n resolve: {\n scale: {},\n axis: {},\n legend: {},\n ...(resolve ? duplicate(resolve) : {})\n },\n selection: null,\n scales: null,\n projection: null,\n axes: {},\n legends: {}\n };\n }\n get width() {\n return this.getSizeSignalRef('width');\n }\n get height() {\n return this.getSizeSignalRef('height');\n }\n parse() {\n this.parseScale();\n this.parseLayoutSize(); // depends on scale\n this.renameTopLevelLayoutSizeSignal();\n this.parseSelections();\n this.parseProjection();\n this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name.\n this.parseAxesAndHeaders(); // depends on scale and layout size\n this.parseLegends(); // depends on scale, markDef\n this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark.\n }\n parseScale() {\n parseScales(this);\n }\n parseProjection() {\n parseProjection(this);\n }\n /**\n * Rename top-level spec's size to be just width / height, ignoring model name.\n * This essentially merges the top-level spec's width/height signals with the width/height signals\n * to help us reduce redundant signals declaration.\n */\n renameTopLevelLayoutSizeSignal() {\n if (this.getName('width') !== 'width') {\n this.renameSignal(this.getName('width'), 'width');\n }\n if (this.getName('height') !== 'height') {\n this.renameSignal(this.getName('height'), 'height');\n }\n }\n parseLegends() {\n parseLegend(this);\n }\n assembleEncodeFromView(view) {\n // Exclude \"style\"\n const { style: _, ...baseView } = view;\n const e = {};\n for (const property of keys(baseView)) {\n const value = baseView[property];\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n return e;\n }\n assembleGroupEncodeEntry(isTopLevel) {\n let encodeEntry = {};\n if (this.view) {\n encodeEntry = this.assembleEncodeFromView(this.view);\n }\n if (!isTopLevel) {\n // Descriptions are already added to the top-level description so we only need to add them to the inner views.\n if (this.description) {\n encodeEntry['description'] = signalOrValueRef(this.description);\n }\n // For top-level spec, we can set the global width and height signal to adjust the group size.\n // For other child specs, we have to manually set width and height in the encode entry.\n if (this.type === 'unit' || this.type === 'layer') {\n return {\n width: this.getSizeSignalRef('width'),\n height: this.getSizeSignalRef('height'),\n ...(encodeEntry ?? {})\n };\n }\n }\n return isEmpty(encodeEntry) ? undefined : encodeEntry;\n }\n assembleLayout() {\n if (!this.layout) {\n return undefined;\n }\n const { spacing, ...layout } = this.layout;\n const { component, config } = this;\n const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config);\n return {\n padding: spacing,\n ...this.assembleDefaultLayout(),\n ...layout,\n ...(titleBand ? { titleBand } : {})\n };\n }\n assembleDefaultLayout() {\n return {};\n }\n assembleHeaderMarks() {\n const { layoutHeaders } = this.component;\n let headerMarks = [];\n for (const channel of FACET_CHANNELS) {\n if (layoutHeaders[channel].title) {\n headerMarks.push(assembleTitleGroup(this, channel));\n }\n }\n for (const channel of HEADER_CHANNELS) {\n headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel));\n }\n return headerMarks;\n }\n assembleAxes() {\n return assembleAxes(this.component.axes, this.config);\n }\n assembleLegends() {\n return assembleLegends(this);\n }\n assembleProjections() {\n return assembleProjections(this);\n }\n assembleTitle() {\n const { encoding, ...titleNoEncoding } = this.title ?? {};\n const title = {\n ...extractTitleConfig(this.config.title).nonMarkTitleProperties,\n ...titleNoEncoding,\n ...(encoding ? { encode: { update: encoding } } : {})\n };\n if (title.text) {\n if (contains(['unit', 'layer'], this.type)) {\n // Unit/Layer\n if (contains(['middle', undefined], title.anchor)) {\n title.frame ?? (title.frame = 'group');\n }\n }\n else {\n // composition with Vega layout\n // Set title = \"start\" by default for composition as \"middle\" does not look nice\n // https://github.com/vega/vega/issues/960#issuecomment-471360328\n title.anchor ?? (title.anchor = 'start');\n }\n return isEmpty(title) ? undefined : title;\n }\n return undefined;\n }\n /**\n * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals.\n */\n assembleGroup(signals = []) {\n const group = {};\n signals = signals.concat(this.assembleSignals());\n if (signals.length > 0) {\n group.signals = signals;\n }\n const layout = this.assembleLayout();\n if (layout) {\n group.layout = layout;\n }\n group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks());\n // Only include scales if this spec is top-level or if parent is facet.\n // (Otherwise, it will be merged with upper-level's scope.)\n const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : [];\n if (scales.length > 0) {\n group.scales = scales;\n }\n const axes = this.assembleAxes();\n if (axes.length > 0) {\n group.axes = axes;\n }\n const legends = this.assembleLegends();\n if (legends.length > 0) {\n group.legends = legends;\n }\n return group;\n }\n getName(text) {\n return varName((this.name ? `${this.name}_` : '') + text);\n }\n getDataName(type) {\n return this.getName(DataSourceType[type].toLowerCase());\n }\n /**\n * Request a data source name for the given data source type and mark that data source as required.\n * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData().\n * You can lookup the correct dataset name in assemble with `lookupDataSource`.\n */\n requestDataName(name) {\n const fullName = this.getDataName(name);\n // Increase ref count. This is critical because otherwise we won't create a data source.\n // We also increase the ref counts on OutputNode.getSource() calls.\n const refCounts = this.component.data.outputNodeRefCounts;\n refCounts[fullName] = (refCounts[fullName] || 0) + 1;\n return fullName;\n }\n getSizeSignalRef(layoutSizeType) {\n if (isFacetModel(this.parent)) {\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const scaleComponent = this.component.scales[channel];\n if (scaleComponent && !scaleComponent.merged) {\n // independent scale\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = scaleComponent.get('name');\n const domain = assembleDomain(this, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n const fieldRef = vgField({ aggregate: 'distinct', field }, { expr: 'datum' });\n return {\n signal: sizeExpr(scaleName, scaleComponent, fieldRef)\n };\n }\n else {\n log.warn(log.message.unknownField(channel));\n return null;\n }\n }\n }\n }\n return {\n signal: this.signalNameMap.get(this.getName(layoutSizeType))\n };\n }\n /**\n * Lookup the name of the datasource for an output node. You probably want to call this in assemble.\n */\n lookupDataSource(name) {\n const node = this.component.data.outputNodes[name];\n if (!node) {\n // Name not found in map so let's just return what we got.\n // This can happen if we already have the correct name.\n return name;\n }\n return node.getSource();\n }\n getSignalName(oldSignalName) {\n return this.signalNameMap.get(oldSignalName);\n }\n renameSignal(oldName, newName) {\n this.signalNameMap.rename(oldName, newName);\n }\n renameScale(oldName, newName) {\n this.scaleNameMap.rename(oldName, newName);\n }\n renameProjection(oldName, newName) {\n this.projectionNameMap.rename(oldName, newName);\n }\n /**\n * @return scale name for a given channel after the scale has been parsed and named.\n */\n scaleName(originalScaleName, parse) {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a scale can't be renamed\n // before it has the original name.\n return this.getName(originalScaleName);\n }\n // If there is a scale for the channel, it should either\n // be in the scale component or exist in the name map\n if (\n // If there is a scale for the channel, there should be a local scale component for it\n (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) ||\n // in the scale name map (the scale get merged by its parent)\n this.scaleNameMap.has(this.getName(originalScaleName))) {\n return this.scaleNameMap.get(this.getName(originalScaleName));\n }\n return undefined;\n }\n /**\n * @return projection name after the projection has been parsed and named.\n */\n projectionName(parse) {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a projection can't be renamed\n // before it has the original name.\n return this.getName('projection');\n }\n if ((this.component.projection && !this.component.projection.merged) ||\n this.projectionNameMap.has(this.getName('projection'))) {\n return this.projectionNameMap.get(this.getName('projection'));\n }\n return undefined;\n }\n /**\n * Traverse a model's hierarchy to get the scale component for a particular channel.\n */\n getScaleComponent(channel) {\n /* istanbul ignore next: This is warning for debugging test */\n if (!this.component.scales) {\n throw new Error('getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().');\n }\n const localScaleComponent = this.component.scales[channel];\n if (localScaleComponent && !localScaleComponent.merged) {\n return localScaleComponent;\n }\n return this.parent ? this.parent.getScaleComponent(channel) : undefined;\n }\n /**\n * Traverse a model's hierarchy to get a particular selection component.\n */\n getSelectionComponent(variableName, origName) {\n let sel = this.component.selection[variableName];\n if (!sel && this.parent) {\n sel = this.parent.getSelectionComponent(variableName, origName);\n }\n if (!sel) {\n throw new Error(log.message.selectionNotFound(origName));\n }\n return sel;\n }\n /**\n * Returns true if the model has a signalRef for an axis orient.\n */\n hasAxisOrientSignalRef() {\n return (this.component.axes.x?.some(a => a.hasOrientSignalRef()) ||\n this.component.axes.y?.some(a => a.hasOrientSignalRef()));\n }\n}\n/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */\nexport class ModelWithField extends Model {\n /** Get \"field\" reference for Vega */\n vgField(channel, opt = {}) {\n const fieldDef = this.fieldDef(channel);\n if (!fieldDef) {\n return undefined;\n }\n return vgField(fieldDef, opt);\n }\n reduceFieldDef(f, init) {\n return reduce(this.getMapping(), (acc, cd, c) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n return f(acc, fieldDef, c);\n }\n return acc;\n }, init);\n }\n forEachFieldDef(f, t) {\n forEach(this.getMapping(), (cd, c) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n f(fieldDef, c);\n }\n }, t);\n }\n}\n//# sourceMappingURL=model.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for density transform nodes\n */\nexport class DensityTransformNode extends DataFlowNode {\n clone() {\n return new DensityTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density'];\n }\n dependentFields() {\n return new Set([this.transform.density, ...(this.transform.groupby ?? [])]);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `DensityTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { density, ...rest } = this.transform;\n const result = {\n type: 'kde',\n field: density,\n ...rest\n };\n if (this.transform.groupby) {\n result.resolve = 'shared';\n }\n return result;\n }\n}\n//# sourceMappingURL=density.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for flatten transform nodes\n */\nexport class ExtentTransformNode extends DataFlowNode {\n clone() {\n return new ExtentTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform);\n }\n dependentFields() {\n return new Set([this.transform.extent]);\n }\n producedFields() {\n return new Set([]);\n }\n hash() {\n return `ExtentTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { extent, param } = this.transform;\n const result = {\n type: 'extent',\n field: extent,\n signal: param\n };\n return result;\n }\n}\n//# sourceMappingURL=extent.js.map","import { isScaleChannel } from '../../channel';\nimport { vgField as fieldRef } from '../../channeldef';\nimport { isPathMark } from '../../mark';\nimport { hasContinuousDomain } from '../../scale';\nimport { hash, keys } from '../../util';\nimport { getMarkPropOrConfig } from '../common';\nimport { DataFlowNode } from './dataflow';\nexport class FilterInvalidNode extends DataFlowNode {\n clone() {\n return new FilterInvalidNode(null, { ...this.filter });\n }\n constructor(parent, filter) {\n super(parent);\n this.filter = filter;\n }\n static make(parent, model) {\n const { config, mark, markDef } = model;\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid !== 'filter') {\n return null;\n }\n const filter = model.reduceFieldDef((aggregator, fieldDef, channel) => {\n const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n // While discrete domain scales can handle invalid values, continuous scales can't.\n // Thus, for non-path marks, we have to filter null for scales with continuous domains.\n // (For path marks, we will use \"defined\" property and skip these values instead.)\n if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) {\n aggregator[fieldDef.field] = fieldDef; // we know that the fieldDef is a typed field def\n }\n }\n return aggregator;\n }, {});\n if (!keys(filter).length) {\n return null;\n }\n return new FilterInvalidNode(parent, filter);\n }\n dependentFields() {\n return new Set(keys(this.filter));\n }\n producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n hash() {\n return `FilterInvalid ${hash(this.filter)}`;\n }\n /**\n * Create the VgTransforms for each of the filtered fields.\n */\n assemble() {\n const filters = keys(this.filter).reduce((vegaFilters, field) => {\n const fieldDef = this.filter[field];\n const ref = fieldRef(fieldDef, { expr: 'datum' });\n if (fieldDef !== null) {\n if (fieldDef.type === 'temporal') {\n vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`);\n }\n else if (fieldDef.type === 'quantitative') {\n vegaFilters.push(`isValid(${ref})`);\n vegaFilters.push(`isFinite(+${ref})`);\n }\n else {\n // should never get here\n }\n }\n return vegaFilters;\n }, []);\n return filters.length > 0\n ? {\n type: 'filter',\n expr: filters.join(' && ')\n }\n : null;\n }\n}\n//# sourceMappingURL=filterinvalid.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for flatten transform nodes\n */\nexport class FlattenTransformNode extends DataFlowNode {\n clone() {\n return new FlattenTransformNode(this.parent, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const { flatten, as = [] } = this.transform;\n this.transform.as = flatten.map((f, i) => as[i] ?? f);\n }\n dependentFields() {\n return new Set(this.transform.flatten);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `FlattenTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { flatten: fields, as } = this.transform;\n const result = {\n type: 'flatten',\n fields,\n as\n };\n return result;\n }\n}\n//# sourceMappingURL=flatten.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for flatten transform nodes\n */\nexport class FoldTransformNode extends DataFlowNode {\n clone() {\n return new FoldTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'key', specifiedAs[1] ?? 'value'];\n }\n dependentFields() {\n return new Set(this.transform.fold);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `FoldTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { fold, as } = this.transform;\n const result = {\n type: 'fold',\n fields: fold,\n as\n };\n return result;\n }\n}\n//# sourceMappingURL=fold.js.map","import { isString } from 'vega-util';\nimport { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE } from '../../channel';\nimport { getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef } from '../../channeldef';\nimport { GEOJSON } from '../../type';\nimport { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class GeoJSONNode extends DataFlowNode {\n clone() {\n return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal);\n }\n static parseAll(parent, model) {\n if (model.component.projection && !model.component.projection.isFit) {\n return parent;\n }\n let geoJsonCounter = 0;\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? { expr: `${def.datum}` }\n : isValueDef(def)\n ? { expr: `${def['value']}` }\n : undefined;\n });\n if (pair[0] || pair[1]) {\n parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n if (model.channelHasField(SHAPE)) {\n const fieldDef = model.typedFieldDef(SHAPE);\n if (fieldDef.type === GEOJSON) {\n parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n return parent;\n }\n constructor(parent, fields, geojson, signal) {\n super(parent);\n this.fields = fields;\n this.geojson = geojson;\n this.signal = signal;\n }\n dependentFields() {\n const fields = (this.fields ?? []).filter(isString);\n return new Set([...(this.geojson ? [this.geojson] : []), ...fields]);\n }\n producedFields() {\n return new Set();\n }\n hash() {\n return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`;\n }\n assemble() {\n return [\n ...(this.geojson\n ? [\n {\n type: 'filter',\n expr: `isValid(datum[\"${this.geojson}\"])`\n }\n ]\n : []),\n {\n type: 'geojson',\n ...(this.fields ? { fields: this.fields } : {}),\n ...(this.geojson ? { geojson: this.geojson } : {}),\n signal: this.signal\n }\n ];\n }\n}\n//# sourceMappingURL=geojson.js.map","import { isString } from 'vega-util';\nimport { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2 } from '../../channel';\nimport { getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef } from '../../channeldef';\nimport { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class GeoPointNode extends DataFlowNode {\n clone() {\n return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as));\n }\n constructor(parent, projection, fields, as) {\n super(parent);\n this.projection = projection;\n this.fields = fields;\n this.as = as;\n }\n static parseAll(parent, model) {\n if (!model.projectionName()) {\n return parent;\n }\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? { expr: `${def.datum}` }\n : isValueDef(def)\n ? { expr: `${def['value']}` }\n : undefined;\n });\n const suffix = coordinates[0] === LONGITUDE2 ? '2' : '';\n if (pair[0] || pair[1]) {\n parent = new GeoPointNode(parent, model.projectionName(), pair, [\n model.getName(`x${suffix}`),\n model.getName(`y${suffix}`)\n ]);\n }\n }\n return parent;\n }\n dependentFields() {\n return new Set(this.fields.filter(isString));\n }\n producedFields() {\n return new Set(this.as);\n }\n hash() {\n return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`;\n }\n assemble() {\n return {\n type: 'geopoint',\n projection: this.projection,\n fields: this.fields,\n as: this.as\n };\n }\n}\n//# sourceMappingURL=geopoint.js.map","import { isFieldDef } from '../../channeldef';\nimport { pathGroupingFields } from '../../encoding';\nimport { isImputeSequence } from '../../transform';\nimport { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class ImputeNode extends DataFlowNode {\n clone() {\n return new ImputeNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n }\n dependentFields() {\n return new Set([this.transform.impute, this.transform.key, ...(this.transform.groupby ?? [])]);\n }\n producedFields() {\n return new Set([this.transform.impute]);\n }\n processSequence(keyvals) {\n const { start = 0, stop, step } = keyvals;\n const result = [start, stop, ...(step ? [step] : [])].join(',');\n return { signal: `sequence(${result})` };\n }\n static makeFromTransform(parent, imputeTransform) {\n return new ImputeNode(parent, imputeTransform);\n }\n static makeFromEncoding(parent, model) {\n const encoding = model.encoding;\n const xDef = encoding.x;\n const yDef = encoding.y;\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined;\n if (imputedChannel === undefined) {\n return undefined;\n }\n const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined;\n const { method, value, frame, keyvals } = imputedChannel.impute;\n const groupbyFields = pathGroupingFields(model.mark, encoding);\n return new ImputeNode(parent, {\n impute: imputedChannel.field,\n key: keyChannel.field,\n ...(method ? { method } : {}),\n ...(value !== undefined ? { value } : {}),\n ...(frame ? { frame } : {}),\n ...(keyvals !== undefined ? { keyvals } : {}),\n ...(groupbyFields.length ? { groupby: groupbyFields } : {})\n });\n }\n return null;\n }\n hash() {\n return `Impute ${hash(this.transform)}`;\n }\n assemble() {\n const { impute, key, keyvals, method, groupby, value, frame = [null, null] } = this.transform;\n const imputeTransform = {\n type: 'impute',\n field: impute,\n key,\n ...(keyvals ? { keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals } : {}),\n method: 'value',\n ...(groupby ? { groupby } : {}),\n value: !method || method === 'value' ? value : null\n };\n if (method && method !== 'value') {\n const deriveNewField = {\n type: 'window',\n as: [`imputed_${impute}_value`],\n ops: [method],\n fields: [impute],\n frame,\n ignorePeers: false,\n ...(groupby ? { groupby } : {})\n };\n const replaceOriginal = {\n type: 'formula',\n expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`,\n as: impute\n };\n return [imputeTransform, deriveNewField, replaceOriginal];\n }\n else {\n return [imputeTransform];\n }\n }\n}\n//# sourceMappingURL=impute.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for loess transform nodes\n */\nexport class LoessTransformNode extends DataFlowNode {\n clone() {\n return new LoessTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.loess];\n }\n dependentFields() {\n return new Set([this.transform.loess, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `LoessTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { loess, on, ...rest } = this.transform;\n const result = {\n type: 'loess',\n x: on,\n y: loess,\n ...rest\n };\n return result;\n }\n}\n//# sourceMappingURL=loess.js.map","import { array, isString } from 'vega-util';\nimport * as log from '../../log';\nimport { isLookupData, isLookupSelection } from '../../transform';\nimport { duplicate, hash, varName } from '../../util';\nimport { DataFlowNode, OutputNode } from './dataflow';\nimport { findSource } from './parse';\nimport { SourceNode } from './source';\nimport { DataSourceType } from '../../data';\nexport class LookupNode extends DataFlowNode {\n clone() {\n return new LookupNode(null, duplicate(this.transform), this.secondary);\n }\n constructor(parent, transform, secondary) {\n super(parent);\n this.transform = transform;\n this.secondary = secondary;\n }\n static make(parent, model, transform, counter) {\n const sources = model.component.data.sources;\n const { from } = transform;\n let fromOutputNode = null;\n if (isLookupData(from)) {\n let fromSource = findSource(from.data, sources);\n if (!fromSource) {\n fromSource = new SourceNode(from.data);\n sources.push(fromSource);\n }\n const fromOutputName = model.getName(`lookup_${counter}`);\n fromOutputNode = new OutputNode(fromSource, fromOutputName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts);\n model.component.data.outputNodes[fromOutputName] = fromOutputNode;\n }\n else if (isLookupSelection(from)) {\n const selName = from.param;\n transform = { as: selName, ...transform };\n let selCmpt;\n try {\n selCmpt = model.getSelectionComponent(varName(selName), selName);\n }\n catch (e) {\n throw new Error(log.message.cannotLookupVariableParameter(selName));\n }\n fromOutputNode = selCmpt.materialized;\n if (!fromOutputNode) {\n throw new Error(log.message.noSameUnitLookup(selName));\n }\n }\n return new LookupNode(parent, transform, fromOutputNode.getSource());\n }\n dependentFields() {\n return new Set([this.transform.lookup]);\n }\n producedFields() {\n return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields);\n }\n hash() {\n return `Lookup ${hash({ transform: this.transform, secondary: this.secondary })}`;\n }\n assemble() {\n let foreign;\n if (this.transform.from.fields) {\n // lookup a few fields and add create a flat output\n foreign = {\n values: this.transform.from.fields,\n ...(this.transform.as ? { as: array(this.transform.as) } : {})\n };\n }\n else {\n // lookup full record and nest it\n let asName = this.transform.as;\n if (!isString(asName)) {\n log.warn(log.message.NO_FIELDS_NEEDS_AS);\n asName = '_lookup';\n }\n foreign = {\n as: [asName]\n };\n }\n return {\n type: 'lookup',\n from: this.secondary,\n key: this.transform.from.key,\n fields: [this.transform.lookup],\n ...foreign,\n ...(this.transform.default ? { default: this.transform.default } : {})\n };\n }\n}\n//# sourceMappingURL=lookup.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for quantile transform nodes\n */\nexport class QuantileTransformNode extends DataFlowNode {\n clone() {\n return new QuantileTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'prob', specifiedAs[1] ?? 'value'];\n }\n dependentFields() {\n return new Set([this.transform.quantile, ...(this.transform.groupby ?? [])]);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `QuantileTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { quantile, ...rest } = this.transform;\n const result = {\n type: 'quantile',\n field: quantile,\n ...rest\n };\n return result;\n }\n}\n//# sourceMappingURL=quantile.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for regression transform nodes\n */\nexport class RegressionTransformNode extends DataFlowNode {\n clone() {\n return new RegressionTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.regression];\n }\n dependentFields() {\n return new Set([this.transform.regression, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `RegressionTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { regression, on, ...rest } = this.transform;\n const result = {\n type: 'regression',\n x: on,\n y: regression,\n ...rest\n };\n return result;\n }\n}\n//# sourceMappingURL=regression.js.map","import { duplicate, hash, unique } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for pivot transform nodes.\n */\nexport class PivotTransformNode extends DataFlowNode {\n clone() {\n return new PivotTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n }\n addDimensions(fields) {\n this.transform.groupby = unique((this.transform.groupby ?? []).concat(fields), d => d);\n }\n producedFields() {\n return undefined; // return undefined so that potentially everything can depend on the pivot\n }\n dependentFields() {\n return new Set([this.transform.pivot, this.transform.value, ...(this.transform.groupby ?? [])]);\n }\n hash() {\n return `PivotTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { pivot, value, groupby, limit, op } = this.transform;\n return {\n type: 'pivot',\n field: pivot,\n value,\n ...(limit !== undefined ? { limit } : {}),\n ...(op !== undefined ? { op } : {}),\n ...(groupby !== undefined ? { groupby } : {})\n };\n }\n}\n//# sourceMappingURL=pivot.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for the sample transform nodes\n */\nexport class SampleTransformNode extends DataFlowNode {\n clone() {\n return new SampleTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return new Set();\n }\n hash() {\n return `SampleTransform ${hash(this.transform)}`;\n }\n assemble() {\n return {\n type: 'sample',\n size: this.transform.sample\n };\n }\n}\n//# sourceMappingURL=sample.js.map","import { isUrlData } from '../../data';\nimport { AggregateNode } from './aggregate';\nimport { BinNode } from './bin';\nimport { CalculateNode } from './calculate';\nimport { OutputNode } from './dataflow';\nimport { DensityTransformNode } from './density';\nimport { ExtentTransformNode } from './extent';\nimport { FacetNode } from './facet';\nimport { FilterNode } from './filter';\nimport { FilterInvalidNode } from './filterinvalid';\nimport { FlattenTransformNode } from './flatten';\nimport { FoldTransformNode } from './fold';\nimport { ParseNode } from './formatparse';\nimport { GeoJSONNode } from './geojson';\nimport { GeoPointNode } from './geopoint';\nimport { GraticuleNode } from './graticule';\nimport { IdentifierNode } from './identifier';\nimport { ImputeNode } from './impute';\nimport { JoinAggregateTransformNode } from './joinaggregate';\nimport { LoessTransformNode } from './loess';\nimport { LookupNode } from './lookup';\nimport { QuantileTransformNode } from './quantile';\nimport { RegressionTransformNode } from './regression';\nimport { PivotTransformNode } from './pivot';\nimport { SampleTransformNode } from './sample';\nimport { SequenceNode } from './sequence';\nimport { SourceNode } from './source';\nimport { StackNode } from './stack';\nimport { TimeUnitNode } from './timeunit';\nimport { WindowTransformNode } from './window';\nfunction makeWalkTree(data) {\n // to name datasources\n let datasetIndex = 0;\n /**\n * Recursively walk down the tree.\n */\n function walkTree(node, dataSource) {\n if (node instanceof SourceNode) {\n // If the source is a named data source or a data source with values, we need\n // to put it in a different data source. Otherwise, Vega may override the data.\n if (!node.isGenerator && !isUrlData(node.data)) {\n data.push(dataSource);\n const newData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n if (node instanceof ParseNode) {\n if (node.parent instanceof SourceNode && !dataSource.source) {\n // If node's parent is a root source and the data source does not refer to another data source, use normal format parse\n dataSource.format = {\n ...(dataSource.format ?? {}),\n parse: node.assembleFormatParse()\n };\n // add calculates for all nested fields\n dataSource.transform.push(...node.assembleTransforms(true));\n }\n else {\n // Otherwise use Vega expression to parse\n dataSource.transform.push(...node.assembleTransforms());\n }\n }\n if (node instanceof FacetNode) {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n node.data = dataSource.name;\n }\n else {\n node.data = dataSource.source;\n }\n data.push(...node.assemble());\n // break here because the rest of the tree has to be taken care of by the facet.\n return;\n }\n if (node instanceof GraticuleNode ||\n node instanceof SequenceNode ||\n node instanceof FilterInvalidNode ||\n node instanceof FilterNode ||\n node instanceof CalculateNode ||\n node instanceof GeoPointNode ||\n node instanceof AggregateNode ||\n node instanceof LookupNode ||\n node instanceof WindowTransformNode ||\n node instanceof JoinAggregateTransformNode ||\n node instanceof FoldTransformNode ||\n node instanceof FlattenTransformNode ||\n node instanceof DensityTransformNode ||\n node instanceof LoessTransformNode ||\n node instanceof QuantileTransformNode ||\n node instanceof RegressionTransformNode ||\n node instanceof IdentifierNode ||\n node instanceof SampleTransformNode ||\n node instanceof PivotTransformNode ||\n node instanceof ExtentTransformNode) {\n dataSource.transform.push(node.assemble());\n }\n if (node instanceof BinNode ||\n node instanceof TimeUnitNode ||\n node instanceof ImputeNode ||\n node instanceof StackNode ||\n node instanceof GeoJSONNode) {\n dataSource.transform.push(...node.assemble());\n }\n if (node instanceof OutputNode) {\n if (dataSource.source && dataSource.transform.length === 0) {\n node.setSource(dataSource.source);\n }\n else if (node.parent instanceof OutputNode) {\n // Note that an output node may be required but we still do not assemble a\n // separate data source for it.\n node.setSource(dataSource.name);\n }\n else {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n // Here we set the name of the datasource we generated. From now on\n // other assemblers can use it.\n node.setSource(dataSource.name);\n // if this node has more than one child, we will add a datasource automatically\n if (node.numChildren() === 1) {\n data.push(dataSource);\n const newData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n }\n switch (node.numChildren()) {\n case 0:\n // done\n if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) {\n // do not push empty datasources that are simply references\n data.push(dataSource);\n }\n break;\n case 1:\n walkTree(node.children[0], dataSource);\n break;\n default: {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n let source = dataSource.name;\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n }\n else {\n source = dataSource.source;\n }\n for (const child of node.children) {\n const newData = {\n name: null,\n source,\n transform: []\n };\n walkTree(child, newData);\n }\n break;\n }\n }\n }\n return walkTree;\n}\n/**\n * Assemble data sources that are derived from faceted data.\n */\nexport function assembleFacetData(root) {\n const data = [];\n const walkTree = makeWalkTree(data);\n for (const child of root.children) {\n walkTree(child, {\n source: root.name,\n name: null,\n transform: []\n });\n }\n return data;\n}\n/**\n * Create Vega data array from a given compiled model and append all of them to the given array\n *\n * @param model\n * @param data array\n * @return modified data array\n */\nexport function assembleRootData(dataComponent, datasets) {\n const data = [];\n // dataComponent.sources.forEach(debug);\n // draw(dataComponent.sources);\n const walkTree = makeWalkTree(data);\n let sourceIndex = 0;\n for (const root of dataComponent.sources) {\n // assign a name if the source does not have a name yet\n if (!root.hasName()) {\n root.dataName = `source_${sourceIndex++}`;\n }\n const newData = root.assemble();\n walkTree(root, newData);\n }\n // remove empty transform arrays for cleaner output\n for (const d of data) {\n if (d.transform.length === 0) {\n delete d.transform;\n }\n }\n // move sources without transforms (the ones that are potentially used in lookups) to the beginning\n let whereTo = 0;\n for (const [i, d] of data.entries()) {\n if ((d.transform ?? []).length === 0 && !d.source) {\n data.splice(whereTo++, 0, data.splice(i, 1)[0]);\n }\n }\n // now fix the from references in lookup transforms\n for (const d of data) {\n for (const t of d.transform ?? []) {\n if (t.type === 'lookup') {\n t.from = dataComponent.outputNodes[t.from].getSource();\n }\n }\n }\n // inline values for datasets that are in the datastore\n for (const d of data) {\n if (d.name in datasets) {\n d.values = datasets[d.name];\n }\n }\n return data;\n}\n//# sourceMappingURL=assemble.js.map","import { isArray } from 'vega-util';\nimport { FACET_CHANNELS } from '../../channel';\nimport { title as fieldDefTitle } from '../../channeldef';\nimport { contains, getFirstDefined } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { assembleAxis } from '../axis/assemble';\nimport { parseGuideResolve } from '../resolve';\nimport { getHeaderProperty } from './common';\nexport function getHeaderType(orient) {\n if (orient === 'top' || orient === 'left' || isSignalRef(orient)) {\n // we always use header for orient signal since we can't dynamically make header becomes footer\n return 'header';\n }\n return 'footer';\n}\nexport function parseFacetHeaders(model) {\n for (const channel of FACET_CHANNELS) {\n parseFacetHeader(model, channel);\n }\n mergeChildAxis(model, 'x');\n mergeChildAxis(model, 'y');\n}\nfunction parseFacetHeader(model, channel) {\n const { facet, config, child, component } = model;\n if (model.channelHasField(channel)) {\n const fieldDef = facet[channel];\n const titleConfig = getHeaderProperty('title', null, config, channel);\n let title = fieldDefTitle(fieldDef, config, {\n allowDisabling: true,\n includeDefault: titleConfig === undefined || !!titleConfig\n });\n if (child.component.layoutHeaders[channel].title) {\n // TODO: better handle multiline titles\n title = isArray(title) ? title.join(', ') : title;\n // merge title with child to produce \"Title / Subtitle / Sub-subtitle\"\n title += ` / ${child.component.layoutHeaders[channel].title}`;\n child.component.layoutHeaders[channel].title = null;\n }\n const labelOrient = getHeaderProperty('labelOrient', fieldDef.header, config, channel);\n const labels = fieldDef.header !== null ? getFirstDefined(fieldDef.header?.labels, config.header.labels, true) : false;\n const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header';\n component.layoutHeaders[channel] = {\n title: fieldDef.header !== null ? title : null,\n facetFieldDef: fieldDef,\n [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)]\n };\n }\n}\nfunction makeHeaderComponent(model, channel, labels) {\n const sizeType = channel === 'row' ? 'height' : 'width';\n return {\n labels,\n sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined,\n axes: []\n };\n}\nfunction mergeChildAxis(model, channel) {\n const { child } = model;\n if (child.component.axes[channel]) {\n const { layoutHeaders, resolve } = model.component;\n resolve.axis[channel] = parseGuideResolve(resolve, channel);\n if (resolve.axis[channel] === 'shared') {\n // For shared axis, move the axes to facet's header or footer\n const headerChannel = channel === 'x' ? 'column' : 'row';\n const layoutHeader = layoutHeaders[headerChannel];\n for (const axisComponent of child.component.axes[channel]) {\n const headerType = getHeaderType(axisComponent.get('orient'));\n layoutHeader[headerType] ?? (layoutHeader[headerType] = [makeHeaderComponent(model, headerChannel, false)]);\n // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes\n const mainAxis = assembleAxis(axisComponent, 'main', model.config, { header: true });\n if (mainAxis) {\n // LayoutHeader no longer keep track of property precedence, thus let's combine.\n layoutHeader[headerType][0].axes.push(mainAxis);\n }\n axisComponent.mainExtracted = true;\n }\n }\n else {\n // Otherwise do nothing for independent axes\n }\n }\n}\n//# sourceMappingURL=parse.js.map","import { getPositionScaleChannel, getSizeChannel, POSITION_SCALE_CHANNELS } from '../../channel';\nimport { getViewConfigContinuousSize, getViewConfigDiscreteSize } from '../../config';\nimport { hasDiscreteDomain } from '../../scale';\nimport { isStep } from '../../spec/base';\nimport { isVgRangeStep } from '../../vega.schema';\nimport { defaultScaleResolve } from '../resolve';\nimport { mergeValuesWithExplicit } from '../split';\nimport { getSizeTypeFromLayoutSizeType } from './component';\nexport function parseLayerLayoutSize(model) {\n parseChildrenLayoutSize(model);\n parseNonUnitLayoutSizeForChannel(model, 'width');\n parseNonUnitLayoutSizeForChannel(model, 'height');\n}\nexport function parseConcatLayoutSize(model) {\n parseChildrenLayoutSize(model);\n // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth.\n const widthType = model.layout.columns === 1 ? 'width' : 'childWidth';\n // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight.\n const heightType = model.layout.columns === undefined ? 'height' : 'childHeight';\n parseNonUnitLayoutSizeForChannel(model, widthType);\n parseNonUnitLayoutSizeForChannel(model, heightType);\n}\nexport function parseChildrenLayoutSize(model) {\n for (const child of model.children) {\n child.parseLayoutSize();\n }\n}\n/**\n * Merge child layout size (width or height).\n */\nfunction parseNonUnitLayoutSizeForChannel(model, layoutSizeType) {\n /*\n * For concat, the parent width or height might not be the same as the children's shared height.\n * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width.\n *\n * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height)\n * while the sizeType represents the properties of the child.\n */\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const resolve = model.component.resolve;\n const layoutSizeCmpt = model.component.layoutSize;\n let mergedSize;\n // Try to merge layout size\n for (const child of model.children) {\n const childSize = child.component.layoutSize.getWithExplicit(sizeType);\n const scaleResolve = resolve.scale[channel] ?? defaultScaleResolve(channel, model);\n if (scaleResolve === 'independent' && childSize.value === 'step') {\n // Do not merge independent scales with range-step as their size depends\n // on the scale domains, which can be different between scales.\n mergedSize = undefined;\n break;\n }\n if (mergedSize) {\n if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) {\n // For independent scale, only merge if all the sizes are the same.\n // If the values are different, abandon the merge!\n mergedSize = undefined;\n break;\n }\n mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, '');\n }\n else {\n mergedSize = childSize;\n }\n }\n if (mergedSize) {\n // If merged, rename size and set size of all children.\n for (const child of model.children) {\n model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType));\n child.component.layoutSize.set(sizeType, 'merged', false);\n }\n layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize);\n }\n else {\n layoutSizeCmpt.setWithExplicit(layoutSizeType, {\n explicit: false,\n value: undefined\n });\n }\n}\nexport function parseUnitLayoutSize(model) {\n const { size, component } = model;\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n if (size[sizeType]) {\n const specifiedSize = size[sizeType];\n component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true);\n }\n else {\n const defaultSize = defaultUnitSize(model, sizeType);\n component.layoutSize.set(sizeType, defaultSize, false);\n }\n }\n}\nfunction defaultUnitSize(model, sizeType) {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const config = model.config;\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n if (hasDiscreteDomain(scaleType)) {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n if (isVgRangeStep(range) || isStep(size)) {\n // For discrete domain with range.step, use dynamic width/height\n return 'step';\n }\n else {\n return size;\n }\n }\n else {\n return getViewConfigContinuousSize(config.view, sizeType);\n }\n }\n else if (model.hasProjection || model.mark === 'arc') {\n // arc should use continuous size by default otherwise the pie is extremely small\n return getViewConfigContinuousSize(config.view, sizeType);\n }\n else {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n return isStep(size) ? size.step : size;\n }\n}\n//# sourceMappingURL=parse.js.map","import { isArray } from 'vega-util';\nimport { isBinning } from '../bin';\nimport { COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW } from '../channel';\nimport { initFieldDef, vgField } from '../channeldef';\nimport { replaceExprRef } from '../expr';\nimport * as log from '../log';\nimport { hasDiscreteDomain } from '../scale';\nimport { DEFAULT_SORT_OP, isSortField } from '../sort';\nimport { isFacetMapping } from '../spec/facet';\nimport { keys } from '../util';\nimport { isVgRangeStep } from '../vega.schema';\nimport { buildModel } from './buildmodel';\nimport { assembleFacetData } from './data/assemble';\nimport { sortArrayIndexField } from './data/calculate';\nimport { parseData } from './data/parse';\nimport { assembleLabelTitle } from './header/assemble';\nimport { getHeaderChannel, getHeaderProperty } from './header/common';\nimport { HEADER_CHANNELS, HEADER_TYPES } from './header/component';\nimport { parseFacetHeaders } from './header/parse';\nimport { parseChildrenLayoutSize } from './layoutsize/parse';\nimport { ModelWithField } from './model';\nimport { assembleDomain, getFieldFromDomain } from './scale/domain';\nimport { assembleFacetSignals } from './selection/assemble';\nexport function facetSortFieldName(fieldDef, sort, opt) {\n return vgField(sort, { suffix: `by_${vgField(fieldDef)}`, ...(opt ?? {}) });\n}\nexport class FacetModel extends ModelWithField {\n constructor(spec, parent, parentGivenName, config) {\n super(spec, 'facet', parent, parentGivenName, config, spec.resolve);\n this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config);\n this.children = [this.child];\n this.facet = this.initFacet(spec.facet);\n }\n initFacet(facet) {\n // clone to prevent side effect to the original spec\n if (!isFacetMapping(facet)) {\n return { facet: this.initFacetFieldDef(facet, 'facet') };\n }\n const channels = keys(facet);\n const normalizedFacet = {};\n for (const channel of channels) {\n if (![ROW, COLUMN].includes(channel)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, 'facet'));\n break;\n }\n const fieldDef = facet[channel];\n if (fieldDef.field === undefined) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n break;\n }\n normalizedFacet[channel] = this.initFacetFieldDef(fieldDef, channel);\n }\n return normalizedFacet;\n }\n initFacetFieldDef(fieldDef, channel) {\n // Cast because we call initFieldDef, which assumes general FieldDef.\n // However, FacetFieldDef is a bit more constrained than the general FieldDef\n const facetFieldDef = initFieldDef(fieldDef, channel);\n if (facetFieldDef.header) {\n facetFieldDef.header = replaceExprRef(facetFieldDef.header);\n }\n else if (facetFieldDef.header === null) {\n facetFieldDef.header = null;\n }\n return facetFieldDef;\n }\n channelHasField(channel) {\n return !!this.facet[channel];\n }\n fieldDef(channel) {\n return this.facet[channel];\n }\n parseData() {\n this.component.data = parseData(this);\n this.child.parseData();\n }\n parseLayoutSize() {\n parseChildrenLayoutSize(this);\n }\n parseSelections() {\n // As a facet has a single child, the selection components are the same.\n // The child maintains its selections to assemble signals, which remain\n // within its unit.\n this.child.parseSelections();\n this.component.selection = this.child.component.selection;\n }\n parseMarkGroup() {\n this.child.parseMarkGroup();\n }\n parseAxesAndHeaders() {\n this.child.parseAxesAndHeaders();\n parseFacetHeaders(this);\n }\n assembleSelectionTopLevelSignals(signals) {\n return this.child.assembleSelectionTopLevelSignals(signals);\n }\n assembleSignals() {\n this.child.assembleSignals();\n return [];\n }\n assembleSelectionData(data) {\n return this.child.assembleSelectionData(data);\n }\n getHeaderLayoutMixins() {\n const layoutMixins = {};\n for (const channel of FACET_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const layoutHeaderComponent = this.component.layoutHeaders[channel];\n const headerComponent = layoutHeaderComponent[headerType];\n const { facetFieldDef } = layoutHeaderComponent;\n if (facetFieldDef) {\n const titleOrient = getHeaderProperty('titleOrient', facetFieldDef.header, this.config, channel);\n if (['right', 'bottom'].includes(titleOrient)) {\n const headerChannel = getHeaderChannel(channel, titleOrient);\n layoutMixins.titleAnchor ?? (layoutMixins.titleAnchor = {});\n layoutMixins.titleAnchor[headerChannel] = 'end';\n }\n }\n if (headerComponent?.[0]) {\n // set header/footerBand\n const sizeType = channel === 'row' ? 'height' : 'width';\n const bandType = headerType === 'header' ? 'headerBand' : 'footerBand';\n if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) {\n // If facet child does not have size signal, then apply headerBand\n layoutMixins[bandType] ?? (layoutMixins[bandType] = {});\n layoutMixins[bandType][channel] = 0.5;\n }\n if (layoutHeaderComponent.title) {\n layoutMixins.offset ?? (layoutMixins.offset = {});\n layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10;\n }\n }\n }\n }\n return layoutMixins;\n }\n assembleDefaultLayout() {\n const { column, row } = this.facet;\n const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined;\n let align = 'all';\n // Do not align the cells if the scale corresponding to the direction is indepent.\n // We always align when we facet into both row and column.\n if (!row && this.component.resolve.scale.x === 'independent') {\n align = 'none';\n }\n else if (!column && this.component.resolve.scale.y === 'independent') {\n align = 'none';\n }\n return {\n ...this.getHeaderLayoutMixins(),\n ...(columns ? { columns } : {}),\n bounds: 'full',\n align\n };\n }\n assembleLayoutSignals() {\n // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales.\n return this.child.assembleLayoutSignals();\n }\n columnDistinctSignal() {\n if (this.parent && this.parent instanceof FacetModel) {\n // For nested facet, we will add columns to group mark instead\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return undefined;\n }\n else {\n // In facetNode.assemble(), the name is always this.getName('column') + '_layout'.\n const facetLayoutDataName = this.getName('column_domain');\n return { signal: `length(data('${facetLayoutDataName}'))` };\n }\n }\n assembleGroupStyle() {\n return undefined;\n }\n assembleGroup(signals) {\n if (this.parent && this.parent instanceof FacetModel) {\n // Provide number of columns for layout.\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return {\n ...(this.channelHasField('column')\n ? {\n encode: {\n update: {\n // TODO(https://github.com/vega/vega-lite/issues/2759):\n // Correct the signal for facet of concat of facet_column\n columns: { field: vgField(this.facet.column, { prefix: 'distinct' }) }\n }\n }\n }\n : {}),\n ...super.assembleGroup(signals)\n };\n }\n return super.assembleGroup(signals);\n }\n /**\n * Aggregate cardinality for calculating size\n */\n getCardinalityAggregateForChild() {\n const fields = [];\n const ops = [];\n const as = [];\n if (this.child instanceof FacetModel) {\n if (this.child.channelHasField('column')) {\n const field = vgField(this.child.facet.column);\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n }\n }\n else {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.child.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.child, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n }\n else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n }\n return { fields, ops, as };\n }\n assembleFacet() {\n const { name, data } = this.component.data.facetRoot;\n const { row, column } = this.facet;\n const { fields, ops, as } = this.getCardinalityAggregateForChild();\n const groupby = [];\n for (const channel of FACET_CHANNELS) {\n const fieldDef = this.facet[channel];\n if (fieldDef) {\n groupby.push(vgField(fieldDef));\n const { bin, sort } = fieldDef;\n if (isBinning(bin)) {\n groupby.push(vgField(fieldDef, { binSuffix: 'end' }));\n }\n if (isSortField(sort)) {\n const { field, op = DEFAULT_SORT_OP } = sort;\n const outputName = facetSortFieldName(fieldDef, sort);\n if (row && column) {\n // For crossed facet, use pre-calculate field as it requires a different groupby\n // For each calculated field, apply max and assign them to the same name as\n // all values of the same group should be the same anyway.\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n }\n else {\n fields.push(field);\n ops.push(op);\n as.push(outputName);\n }\n }\n else if (isArray(sort)) {\n const outputName = sortArrayIndexField(fieldDef, channel);\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n }\n }\n }\n const cross = !!row && !!column;\n return {\n name,\n data,\n groupby,\n ...(cross || fields.length > 0\n ? {\n aggregate: {\n ...(cross ? { cross } : {}),\n ...(fields.length ? { fields, ops, as } : {})\n }\n }\n : {})\n };\n }\n facetSortFields(channel) {\n const { facet } = this;\n const fieldDef = facet[channel];\n if (fieldDef) {\n if (isSortField(fieldDef.sort)) {\n return [facetSortFieldName(fieldDef, fieldDef.sort, { expr: 'datum' })];\n }\n else if (isArray(fieldDef.sort)) {\n return [sortArrayIndexField(fieldDef, channel, { expr: 'datum' })];\n }\n return [vgField(fieldDef, { expr: 'datum' })];\n }\n return [];\n }\n facetSortOrder(channel) {\n const { facet } = this;\n const fieldDef = facet[channel];\n if (fieldDef) {\n const { sort } = fieldDef;\n const order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending';\n return [order];\n }\n return [];\n }\n assembleLabelTitle() {\n const { facet, config } = this;\n if (facet.facet) {\n // Facet always uses title to display labels\n return assembleLabelTitle(facet.facet, 'facet', config);\n }\n const ORTHOGONAL_ORIENT = {\n row: ['top', 'bottom'],\n column: ['left', 'right']\n };\n for (const channel of HEADER_CHANNELS) {\n if (facet[channel]) {\n const labelOrient = getHeaderProperty('labelOrient', facet[channel]?.header, config, channel);\n if (ORTHOGONAL_ORIENT[channel].includes(labelOrient)) {\n // Row/Column with orthogonal labelOrient must use title to display labels\n return assembleLabelTitle(facet[channel], channel, config);\n }\n }\n }\n return undefined;\n }\n assembleMarks() {\n const { child } = this;\n // If we facet by two dimensions, we need to add a cross operator to the aggregation\n // so that we create all groups\n const facetRoot = this.component.data.facetRoot;\n const data = assembleFacetData(facetRoot);\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n const title = this.assembleLabelTitle() || child.assembleTitle();\n const style = child.assembleGroupStyle();\n const markGroup = {\n name: this.getName('cell'),\n type: 'group',\n ...(title ? { title } : {}),\n ...(style ? { style } : {}),\n from: {\n facet: this.assembleFacet()\n },\n // TODO: move this to after data\n sort: {\n field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(),\n order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat()\n },\n ...(data.length > 0 ? { data } : {}),\n ...(encodeEntry ? { encode: { update: encodeEntry } } : {}),\n ...child.assembleGroup(assembleFacetSignals(this, []))\n };\n return [markGroup];\n }\n getMapping() {\n return this.facet;\n }\n}\n//# sourceMappingURL=facet.js.map","import { AncestorParse } from '.';\nimport { isGenerator, isGraticuleGenerator, isInlineData, isNamedData, isSequenceGenerator, isUrlData, DataSourceType } from '../../data';\nimport * as log from '../../log';\nimport { isAggregate, isBin, isCalculate, isDensity, isExtent, isFilter, isFlatten, isFold, isImpute, isJoinAggregate, isLoess, isLookup, isPivot, isQuantile, isRegression, isSample, isStack, isTimeUnit, isWindow } from '../../transform';\nimport { deepEqual, mergeDeep } from '../../util';\nimport { isFacetModel, isLayerModel, isUnitModel } from '../model';\nimport { requiresSelectionId } from '../selection';\nimport { materializeSelections } from '../selection/parse';\nimport { AggregateNode } from './aggregate';\nimport { BinNode } from './bin';\nimport { CalculateNode } from './calculate';\nimport { OutputNode } from './dataflow';\nimport { DensityTransformNode } from './density';\nimport { ExtentTransformNode } from './extent';\nimport { FacetNode } from './facet';\nimport { FilterNode } from './filter';\nimport { FilterInvalidNode } from './filterinvalid';\nimport { FlattenTransformNode } from './flatten';\nimport { FoldTransformNode } from './fold';\nimport { getImplicitFromEncoding, getImplicitFromFilterTransform, getImplicitFromSelection, ParseNode } from './formatparse';\nimport { GeoJSONNode } from './geojson';\nimport { GeoPointNode } from './geopoint';\nimport { GraticuleNode } from './graticule';\nimport { IdentifierNode } from './identifier';\nimport { ImputeNode } from './impute';\nimport { JoinAggregateTransformNode } from './joinaggregate';\nimport { makeJoinAggregateFromFacet } from './joinaggregatefacet';\nimport { LoessTransformNode } from './loess';\nimport { LookupNode } from './lookup';\nimport { PivotTransformNode } from './pivot';\nimport { QuantileTransformNode } from './quantile';\nimport { RegressionTransformNode } from './regression';\nimport { SampleTransformNode } from './sample';\nimport { SequenceNode } from './sequence';\nimport { SourceNode } from './source';\nimport { StackNode } from './stack';\nimport { TimeUnitNode } from './timeunit';\nimport { WindowTransformNode } from './window';\nexport function findSource(data, sources) {\n for (const other of sources) {\n const otherData = other.data;\n // if both datasets have a name defined, we cannot merge\n if (data.name && other.hasName() && data.name !== other.dataName) {\n continue;\n }\n const formatMesh = data['format']?.mesh;\n const otherFeature = otherData.format?.feature;\n // feature and mesh are mutually exclusive\n if (formatMesh && otherFeature) {\n continue;\n }\n // we have to extract the same feature or mesh\n const formatFeature = data['format']?.feature;\n if ((formatFeature || otherFeature) && formatFeature !== otherFeature) {\n continue;\n }\n const otherMesh = otherData.format?.mesh;\n if ((formatMesh || otherMesh) && formatMesh !== otherMesh) {\n continue;\n }\n if (isInlineData(data) && isInlineData(otherData)) {\n if (deepEqual(data.values, otherData.values)) {\n return other;\n }\n }\n else if (isUrlData(data) && isUrlData(otherData)) {\n if (data.url === otherData.url) {\n return other;\n }\n }\n else if (isNamedData(data)) {\n if (data.name === other.dataName) {\n return other;\n }\n }\n }\n return null;\n}\nfunction parseRoot(model, sources) {\n if (model.data || !model.parent) {\n // if the model defines a data source or is the root, create a source node\n if (model.data === null) {\n // data: null means we should ignore the parent's data so we just create a new data source\n const source = new SourceNode({ values: [] });\n sources.push(source);\n return source;\n }\n const existingSource = findSource(model.data, sources);\n if (existingSource) {\n if (!isGenerator(model.data)) {\n existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format);\n }\n // if the new source has a name but the existing one does not, we can set it\n if (!existingSource.hasName() && model.data.name) {\n existingSource.dataName = model.data.name;\n }\n return existingSource;\n }\n else {\n const source = new SourceNode(model.data);\n sources.push(source);\n return source;\n }\n }\n else {\n // If we don't have a source defined (overriding parent's data), use the parent's facet root or main.\n return model.parent.component.data.facetRoot\n ? model.parent.component.data.facetRoot\n : model.parent.component.data.main;\n }\n}\n/**\n * Parses a transform array into a chain of connected dataflow nodes.\n */\nexport function parseTransformArray(head, model, ancestorParse) {\n let lookupCounter = 0;\n for (const t of model.transforms) {\n let derivedType = undefined;\n let transformNode;\n if (isCalculate(t)) {\n transformNode = head = new CalculateNode(head, t);\n derivedType = 'derived';\n }\n else if (isFilter(t)) {\n const implicit = getImplicitFromFilterTransform(t);\n transformNode = head = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse) ?? head;\n head = new FilterNode(head, model, t.filter);\n }\n else if (isBin(t)) {\n transformNode = head = BinNode.makeFromTransform(head, t, model);\n derivedType = 'number';\n }\n else if (isTimeUnit(t)) {\n derivedType = 'date';\n const parsedAs = ancestorParse.getWithExplicit(t.field);\n // Create parse node because the input to time unit is always date.\n if (parsedAs.value === undefined) {\n head = new ParseNode(head, { [t.field]: derivedType });\n ancestorParse.set(t.field, derivedType, false);\n }\n transformNode = head = TimeUnitNode.makeFromTransform(head, t);\n }\n else if (isAggregate(t)) {\n transformNode = head = AggregateNode.makeFromTransform(head, t);\n derivedType = 'number';\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n }\n else if (isLookup(t)) {\n transformNode = head = LookupNode.make(head, model, t, lookupCounter++);\n derivedType = 'derived';\n }\n else if (isWindow(t)) {\n transformNode = head = new WindowTransformNode(head, t);\n derivedType = 'number';\n }\n else if (isJoinAggregate(t)) {\n transformNode = head = new JoinAggregateTransformNode(head, t);\n derivedType = 'number';\n }\n else if (isStack(t)) {\n transformNode = head = StackNode.makeFromTransform(head, t);\n derivedType = 'derived';\n }\n else if (isFold(t)) {\n transformNode = head = new FoldTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isExtent(t)) {\n transformNode = head = new ExtentTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isFlatten(t)) {\n transformNode = head = new FlattenTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isPivot(t)) {\n transformNode = head = new PivotTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isSample(t)) {\n head = new SampleTransformNode(head, t);\n }\n else if (isImpute(t)) {\n transformNode = head = ImputeNode.makeFromTransform(head, t);\n derivedType = 'derived';\n }\n else if (isDensity(t)) {\n transformNode = head = new DensityTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isQuantile(t)) {\n transformNode = head = new QuantileTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isRegression(t)) {\n transformNode = head = new RegressionTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isLoess(t)) {\n transformNode = head = new LoessTransformNode(head, t);\n derivedType = 'derived';\n }\n else {\n log.warn(log.message.invalidTransformIgnored(t));\n continue;\n }\n if (transformNode && derivedType !== undefined) {\n for (const field of transformNode.producedFields() ?? []) {\n ancestorParse.set(field, derivedType, false);\n }\n }\n }\n return head;\n}\n/*\nDescription of the dataflow (http://asciiflow.com/):\n +--------+\n | Source |\n +---+----+\n |\n v\n FormatParse\n (explicit)\n |\n v\n Transforms\n(Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...)\n |\n v\n FormatParse\n (implicit)\n |\n v\n Binning (in `encoding`)\n |\n v\n Timeunit (in `encoding`)\n |\n v\nFormula From Sort Array\n |\n v\n +--+--+\n | Raw |\n +-----+\n |\n v\n Aggregate (in `encoding`)\n |\n v\n Stack (in `encoding`)\n |\n v\n Invalid Filter\n |\n v\n +----------+\n | Main |\n +----------+\n |\n v\n +-------+\n | Facet |----> \"column\", \"column-layout\", and \"row\"\n +-------+\n |\n v\n ...Child data...\n*/\nexport function parseData(model) {\n let head = parseRoot(model, model.component.data.sources);\n const { outputNodes, outputNodeRefCounts } = model.component.data;\n const data = model.data;\n const newData = data && (isGenerator(data) || isUrlData(data) || isInlineData(data));\n const ancestorParse = !newData && model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse();\n if (isGenerator(data)) {\n // insert generator transform\n if (isSequenceGenerator(data)) {\n head = new SequenceNode(head, data.sequence);\n }\n else if (isGraticuleGenerator(data)) {\n head = new GraticuleNode(head, data.graticule);\n }\n // no parsing necessary for generator\n ancestorParse.parseNothing = true;\n }\n else if (data?.format?.parse === null) {\n // format.parse: null means disable parsing\n ancestorParse.parseNothing = true;\n }\n head = ParseNode.makeExplicit(head, model, ancestorParse) ?? head;\n // Default discrete selections require an identifer transform to\n // uniquely identify data points. Add this transform at the head of\n // the pipeline such that the identifier field is available for all\n // subsequent datasets. During optimization, we will remove this\n // transform if it proves to be unnecessary. Additional identifier\n // transforms will be necessary when new tuples are constructed\n // (e.g., post-aggregation).\n head = new IdentifierNode(head);\n // HACK: This is equivalent for merging bin extent for union scale.\n // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale\n const parentIsLayer = model.parent && isLayerModel(model.parent);\n if (isUnitModel(model) || isFacetModel(model)) {\n if (parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n }\n if (model.transforms.length > 0) {\n head = parseTransformArray(head, model, ancestorParse);\n }\n // create parse nodes for fields that need to be parsed (or flattened) implicitly\n const implicitSelection = getImplicitFromSelection(model);\n const implicitEncoding = getImplicitFromEncoding(model);\n head = ParseNode.makeWithAncestors(head, {}, { ...implicitSelection, ...implicitEncoding }, ancestorParse) ?? head;\n if (isUnitModel(model)) {\n head = GeoJSONNode.parseAll(head, model);\n head = GeoPointNode.parseAll(head, model);\n }\n if (isUnitModel(model) || isFacetModel(model)) {\n if (!parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n head = TimeUnitNode.makeFromEncoding(head, model) ?? head;\n head = CalculateNode.parseAllForSortIndex(head, model);\n }\n // add an output node pre aggregation\n const rawName = model.getDataName(DataSourceType.Raw);\n const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts);\n outputNodes[rawName] = raw;\n head = raw;\n if (isUnitModel(model)) {\n const agg = AggregateNode.makeFromEncoding(head, model);\n if (agg) {\n head = agg;\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n }\n head = ImputeNode.makeFromEncoding(head, model) ?? head;\n head = StackNode.makeFromEncoding(head, model) ?? head;\n }\n if (isUnitModel(model)) {\n head = FilterInvalidNode.make(head, model) ?? head;\n }\n // output node for marks\n const mainName = model.getDataName(DataSourceType.Main);\n const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts);\n outputNodes[mainName] = main;\n head = main;\n if (isUnitModel(model)) {\n materializeSelections(model, main);\n }\n // add facet marker\n let facetRoot = null;\n if (isFacetModel(model)) {\n const facetName = model.getName('facet');\n // Derive new aggregate for facet's sort field\n // augment data source with new fields for crossed facet\n head = makeJoinAggregateFromFacet(head, model.facet) ?? head;\n facetRoot = new FacetNode(head, model, facetName, main.getSource());\n outputNodes[facetName] = facetRoot;\n }\n return {\n ...model.component.data,\n outputNodes,\n outputNodeRefCounts,\n raw,\n main,\n facetRoot,\n ancestorParse\n };\n}\n//# sourceMappingURL=parse.js.map","import { vgField } from '../../channeldef';\nimport { DEFAULT_SORT_OP, isSortField } from '../../sort';\nimport { facetSortFieldName } from '../facet';\nimport { JoinAggregateTransformNode } from './joinaggregate';\nexport function makeJoinAggregateFromFacet(parent, facet) {\n const { row, column } = facet;\n if (row && column) {\n let newParent = null;\n // only need to make one for crossed facet\n for (const fieldDef of [row, column]) {\n if (isSortField(fieldDef.sort)) {\n const { field, op = DEFAULT_SORT_OP } = fieldDef.sort;\n parent = newParent = new JoinAggregateTransformNode(parent, {\n joinaggregate: [\n {\n op,\n field,\n as: facetSortFieldName(fieldDef, fieldDef.sort, { forAs: true })\n }\n ],\n groupby: [vgField(fieldDef)]\n });\n }\n }\n return newParent;\n }\n return null;\n}\n//# sourceMappingURL=joinaggregatefacet.js.map","import * as log from '../log';\nimport { isHConcatSpec, isVConcatSpec } from '../spec';\nimport { keys } from '../util';\nimport { buildModel } from './buildmodel';\nimport { parseData } from './data/parse';\nimport { assembleLayoutSignals } from './layoutsize/assemble';\nimport { parseConcatLayoutSize } from './layoutsize/parse';\nimport { Model } from './model';\nexport class ConcatModel extends Model {\n constructor(spec, parent, parentGivenName, config) {\n super(spec, 'concat', parent, parentGivenName, config, spec.resolve);\n if (spec.resolve?.axis?.x === 'shared' || spec.resolve?.axis?.y === 'shared') {\n log.warn(log.message.CONCAT_CANNOT_SHARE_AXIS);\n }\n this.children = this.getChildren(spec).map((child, i) => {\n return buildModel(child, this, this.getName(`concat_${i}`), undefined, config);\n });\n }\n parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n parseAxesAndHeaders() {\n for (const child of this.children) {\n child.parseAxesAndHeaders();\n }\n // TODO(#2415): support shared axes\n }\n getChildren(spec) {\n if (isVConcatSpec(spec)) {\n return spec.vconcat;\n }\n else if (isHConcatSpec(spec)) {\n return spec.hconcat;\n }\n return spec.concat;\n }\n parseLayoutSize() {\n parseConcatLayoutSize(this);\n }\n parseAxisGroup() {\n return null;\n }\n assembleSelectionTopLevelSignals(signals) {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n assembleSignals() {\n this.children.forEach(child => child.assembleSignals());\n return [];\n }\n assembleLayoutSignals() {\n const layoutSignals = assembleLayoutSignals(this);\n for (const child of this.children) {\n layoutSignals.push(...child.assembleLayoutSignals());\n }\n return layoutSignals;\n }\n assembleSelectionData(data) {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n assembleMarks() {\n // only children have marks\n return this.children.map(child => {\n const title = child.assembleTitle();\n const style = child.assembleGroupStyle();\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n return {\n type: 'group',\n name: child.getName('group'),\n ...(title ? { title } : {}),\n ...(style ? { style } : {}),\n ...(encodeEntry ? { encode: { update: encodeEntry } } : {}),\n ...child.assembleGroup()\n };\n });\n }\n assembleGroupStyle() {\n return undefined;\n }\n assembleDefaultLayout() {\n const columns = this.layout.columns;\n return {\n ...(columns != null ? { columns } : {}),\n bounds: 'full',\n // Use align each so it can work with multiple plots with different size\n align: 'each'\n };\n }\n}\n//# sourceMappingURL=concat.js.map","import { COMMON_AXIS_PROPERTIES_INDEX } from '../../axis';\nimport { duplicate, keys } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { Split } from '../split';\nfunction isFalseOrNull(v) {\n return v === false || v === null;\n}\nconst AXIS_COMPONENT_PROPERTIES_INDEX = {\n disable: 1,\n gridScale: 1,\n scale: 1,\n ...COMMON_AXIS_PROPERTIES_INDEX,\n labelExpr: 1,\n encode: 1\n};\nexport const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX);\nexport class AxisComponent extends Split {\n constructor(explicit = {}, implicit = {}, mainExtracted = false) {\n super();\n this.explicit = explicit;\n this.implicit = implicit;\n this.mainExtracted = mainExtracted;\n }\n clone() {\n return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted);\n }\n hasAxisPart(part) {\n // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme.\n if (part === 'axis') {\n // always has the axis container part\n return true;\n }\n if (part === 'grid' || part === 'title') {\n return !!this.get(part);\n }\n // Other parts are enabled by default, so they should not be false or null.\n return !isFalseOrNull(this.get(part));\n }\n hasOrientSignalRef() {\n return isSignalRef(this.explicit.orient);\n }\n}\n//# sourceMappingURL=component.js.map","import { AXIS_PARTS, isAxisProperty, isConditionalAxisValue } from '../../axis';\nimport { POSITION_SCALE_CHANNELS } from '../../channel';\nimport { getFieldOrDatumDef } from '../../channeldef';\nimport { getFirstDefined, isEmpty, keys, normalizeAngle } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { mergeTitleComponent } from '../common';\nimport { guideEncodeEntry } from '../guide';\nimport { parseGuideResolve } from '../resolve';\nimport { defaultTieBreaker, mergeValuesWithExplicit } from '../split';\nimport { AxisComponent, AXIS_COMPONENT_PROPERTIES } from './component';\nimport { getAxisConfig, getAxisConfigs } from './config';\nimport * as encode from './encode';\nimport { axisRules, defaultOrient, getFieldDefTitle, getLabelAngle } from './properties';\nimport { guideFormat, guideFormatType } from '../format';\nexport function parseUnitAxes(model) {\n return POSITION_SCALE_CHANNELS.reduce((axis, channel) => {\n if (model.component.scales[channel]) {\n axis[channel] = [parseAxis(channel, model)];\n }\n return axis;\n }, {});\n}\nconst OPPOSITE_ORIENT = {\n bottom: 'top',\n top: 'bottom',\n left: 'right',\n right: 'left'\n};\nexport function parseLayerAxes(model) {\n const { axes, resolve } = model.component;\n const axisCount = { top: 0, bottom: 0, right: 0, left: 0 };\n for (const child of model.children) {\n child.parseAxesAndHeaders();\n for (const channel of keys(child.component.axes)) {\n resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel);\n if (resolve.axis[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]);\n if (!axes[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the axis shared.\n // Thus, mark axis as independent and remove the axis component.\n resolve.axis[channel] = 'independent';\n delete axes[channel];\n }\n }\n }\n }\n // Move axes to layer's axis component and merge shared axes\n for (const channel of POSITION_SCALE_CHANNELS) {\n for (const child of model.children) {\n if (!child.component.axes[channel]) {\n // skip if the child does not have a particular axis\n continue;\n }\n if (resolve.axis[channel] === 'independent') {\n // If axes are independent, concat the axisComponent array.\n axes[channel] = (axes[channel] ?? []).concat(child.component.axes[channel]);\n // Automatically adjust orient\n for (const axisComponent of child.component.axes[channel]) {\n const { value: orient, explicit } = axisComponent.getWithExplicit('orient');\n if (isSignalRef(orient)) {\n continue;\n }\n if (axisCount[orient] > 0 && !explicit) {\n // Change axis orient if the number do not match\n const oppositeOrient = OPPOSITE_ORIENT[orient];\n if (axisCount[orient] > axisCount[oppositeOrient]) {\n axisComponent.set('orient', oppositeOrient, false);\n }\n }\n axisCount[orient]++;\n // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset?\n }\n }\n // After merging, make sure to remove axes from child\n delete child.component.axes[channel];\n }\n // Show gridlines for first axis only for dual-axis chart\n if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) {\n for (const [index, axisCmpt] of (axes[channel] || []).entries()) {\n if (index > 0 && !!axisCmpt.get('grid') && !axisCmpt.explicit.grid) {\n axisCmpt.implicit.grid = false;\n }\n }\n }\n }\n}\nfunction mergeAxisComponents(mergedAxisCmpts, childAxisCmpts) {\n if (mergedAxisCmpts) {\n // FIXME: this is a bit wrong once we support multiple axes\n if (mergedAxisCmpts.length !== childAxisCmpts.length) {\n return undefined; // Cannot merge axis component with different number of axes.\n }\n const length = mergedAxisCmpts.length;\n for (let i = 0; i < length; i++) {\n const merged = mergedAxisCmpts[i];\n const child = childAxisCmpts[i];\n if (!!merged !== !!child) {\n return undefined;\n }\n else if (merged && child) {\n const mergedOrient = merged.getWithExplicit('orient');\n const childOrient = child.getWithExplicit('orient');\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n // Cannot merge due to inconsistent orient\n return undefined;\n }\n else {\n mergedAxisCmpts[i] = mergeAxisComponent(merged, child);\n }\n }\n }\n }\n else {\n // For first one, return a copy of the child\n return childAxisCmpts.map(axisComponent => axisComponent.clone());\n }\n return mergedAxisCmpts;\n}\nfunction mergeAxisComponent(merged, child) {\n for (const prop of AXIS_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(merged.getWithExplicit(prop), child.getWithExplicit(prop), prop, 'axis', \n // Tie breaker function\n (v1, v2) => {\n switch (prop) {\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'gridScale':\n return {\n explicit: v1.explicit,\n value: getFirstDefined(v1.value, v2.value)\n };\n }\n return defaultTieBreaker(v1, v2, prop, 'axis');\n });\n merged.setWithExplicit(prop, mergedValueWithExplicit);\n }\n return merged;\n}\nfunction isExplicit(value, property, axis, model, channel) {\n if (property === 'disable') {\n return axis !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit\n }\n axis = axis || {};\n switch (property) {\n case 'titleAngle':\n case 'labelAngle':\n return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle));\n case 'values':\n return !!axis.values;\n // specified axis.values is already respected, but may get transformed.\n case 'encode':\n // both VL axis.encoding and axis.labelAngle affect VG axis.encode\n return !!axis.encoding || !!axis.labelAngle;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (value === getFieldDefTitle(model, channel)) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === axis[property];\n}\n/**\n * Properties to always include values from config\n */\nconst propsToAlwaysIncludeConfig = new Set([\n 'grid',\n 'translate',\n // the rest are not axis configs in Vega, but are in VL, so we need to set too.\n 'format',\n 'formatType',\n 'orient',\n 'labelExpr',\n 'tickCount',\n 'position',\n 'tickMinStep'\n]);\nfunction parseAxis(channel, model) {\n let axis = model.axis(channel);\n const axisComponent = new AxisComponent();\n const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]);\n const { mark, config } = model;\n const orient = axis?.orient ||\n config[channel === 'x' ? 'axisX' : 'axisY']?.orient ||\n config.axis?.orient ||\n defaultOrient(channel);\n const scaleType = model.getScaleComponent(channel).get('type');\n const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config);\n const disable = axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis?.style, axisConfigs).configValue;\n axisComponent.set('disable', disable, axis !== undefined);\n if (disable) {\n return axisComponent;\n }\n axis = axis || {};\n const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs);\n const formatType = guideFormatType(axis.formatType, fieldOrDatumDef, scaleType);\n const format = guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, axis.format, axis.formatType, config, true);\n const ruleParams = {\n fieldOrDatumDef,\n axis,\n channel,\n model,\n scaleType,\n orient,\n labelAngle,\n format,\n formatType,\n mark,\n config\n };\n // 1.2. Add properties\n for (const property of AXIS_COMPONENT_PROPERTIES) {\n const value = property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined;\n const hasValue = value !== undefined;\n const explicit = isExplicit(value, property, axis, model, channel);\n if (hasValue && explicit) {\n axisComponent.set(property, value, explicit);\n }\n else {\n const { configValue = undefined, configFrom = undefined } = isAxisProperty(property) && property !== 'values'\n ? getAxisConfig(property, config.style, axis.style, axisConfigs)\n : {};\n const hasConfigValue = configValue !== undefined;\n if (hasValue && !hasConfigValue) {\n // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config)\n axisComponent.set(property, value, explicit);\n }\n else if (\n // Cases need implicit values\n // 1. Axis config that aren't available in Vega\n !(configFrom === 'vgAxisConfig') ||\n // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details)\n (propsToAlwaysIncludeConfig.has(property) && hasConfigValue) ||\n // 3. Conditional axis values and signals\n isConditionalAxisValue(configValue) ||\n isSignalRef(configValue)) {\n // If a config is specified and is conditional, copy conditional value from axis config\n axisComponent.set(property, configValue, false);\n }\n }\n }\n // 2) Add guide encode definition groups\n const axisEncoding = axis.encoding ?? {};\n const axisEncode = AXIS_PARTS.reduce((e, part) => {\n if (!axisComponent.hasAxisPart(part)) {\n // No need to create encode for a disabled part.\n return e;\n }\n const axisEncodingPart = guideEncodeEntry(axisEncoding[part] ?? {}, model);\n const value = part === 'labels' ? encode.labels(model, channel, axisEncodingPart) : axisEncodingPart;\n if (value !== undefined && !isEmpty(value)) {\n e[part] = { update: value };\n }\n return e;\n }, {});\n // FIXME: By having encode as one property, we won't have fine grained encode merging.\n if (!isEmpty(axisEncode)) {\n axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined);\n }\n return axisComponent;\n}\n//# sourceMappingURL=parse.js.map","import { getSecondaryRangeChannel } from '../../channel';\nimport { channelDefType, getFieldOrDatumDef, isFieldDef, isPositionFieldOrDatumDef } from '../../channeldef';\nimport { formatCustomType, isCustomFormatType } from '../format';\nexport function labels(model, channel, specifiedLabelsSpec) {\n const { encoding, config } = model;\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) ?? getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]);\n const axis = model.axis(channel) || {};\n const { format, formatType } = axis;\n if (isCustomFormatType(formatType)) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (channelDefType(fieldOrDatumDef) === 'quantitative') {\n if (isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize' &&\n config.normalizedNumberFormatType) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.normalizedNumberFormat,\n formatType: config.normalizedNumberFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n else if (config.numberFormatType) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.numberFormat,\n formatType: config.numberFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n }\n if (channelDefType(fieldOrDatumDef) === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n !fieldOrDatumDef.timeUnit) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.timeFormat,\n formatType: config.timeFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n }\n return specifiedLabelsSpec;\n}\n//# sourceMappingURL=encode.js.map","import * as encode from './encode';\nfunction encodeEntry(model, fixedShape) {\n const { config } = model;\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid' }),\n ...encode.nonPosition('size', model),\n ...encode.nonPosition('angle', model),\n ...shapeMixins(model, config, fixedShape)\n };\n}\nexport function shapeMixins(model, config, fixedShape) {\n if (fixedShape) {\n return { shape: { value: fixedShape } };\n }\n return encode.nonPosition('shape', model);\n}\nexport const point = {\n vgMark: 'symbol',\n encodeEntry: (model) => {\n return encodeEntry(model);\n }\n};\nexport const circle = {\n vgMark: 'symbol',\n encodeEntry: (model) => {\n return encodeEntry(model, 'circle');\n }\n};\nexport const square = {\n vgMark: 'symbol',\n encodeEntry: (model) => {\n return encodeEntry(model, 'square');\n }\n};\n//# sourceMappingURL=point.js.map","import { getMarkPropOrConfig } from '../common';\nimport * as encode from './encode';\nexport const text = {\n vgMark: 'text',\n encodeEntry: (model) => {\n const { config, encoding } = model;\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'include',\n baseline: 'include',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'include'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid' }),\n ...encode.text(model),\n ...encode.nonPosition('size', model, {\n vgChannel: 'fontSize' // VL's text size is fontSize\n }),\n ...encode.nonPosition('angle', model),\n ...encode.valueIfDefined('align', align(model.markDef, encoding, config)),\n ...encode.valueIfDefined('baseline', baseline(model.markDef, encoding, config)),\n ...encode.pointPosition('radius', model, { defaultPos: null }),\n ...encode.pointPosition('theta', model, { defaultPos: null })\n };\n }\n};\nfunction align(markDef, encoding, config) {\n const a = getMarkPropOrConfig('align', markDef, config);\n if (a === undefined) {\n return 'center';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\nfunction baseline(markDef, encoding, config) {\n const b = getMarkPropOrConfig('baseline', markDef, config);\n if (b === undefined) {\n return 'middle';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\n//# sourceMappingURL=text.js.map","import { isNumber } from 'vega-util';\nimport { getViewConfigDiscreteStep } from '../../config';\nimport { isVgRangeStep } from '../../vega.schema';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../common';\nimport * as encode from './encode';\nexport const tick = {\n vgMark: 'rect',\n encodeEntry: (model) => {\n const { config, markDef } = model;\n const orient = markDef.orient;\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width';\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid', vgChannel: 'xc' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid', vgChannel: 'yc' }),\n // size / thickness => width / height\n ...encode.nonPosition('size', model, {\n defaultValue: defaultSize(model),\n vgChannel: vgSizeChannel\n }),\n [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config))\n };\n }\n};\nfunction defaultSize(model) {\n const { config, markDef } = model;\n const { orient } = markDef;\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y');\n const markPropOrConfig = getMarkPropOrConfig('size', markDef, config, { vgChannel: vgSizeChannel }) ?? config.tick.bandSize;\n if (markPropOrConfig !== undefined) {\n return markPropOrConfig;\n }\n else {\n const scaleRange = scale ? scale.get('range') : undefined;\n if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return (scaleRange.step * 3) / 4;\n }\n const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel);\n return (defaultViewStep * 3) / 4;\n }\n}\n//# sourceMappingURL=tick.js.map","import { isArray } from 'vega-util';\nimport { isFieldDef, isValueDef, vgField } from '../../channeldef';\nimport { DataSourceType } from '../../data';\nimport { isAggregate, pathGroupingFields } from '../../encoding';\nimport { AREA, BAR, isPathMark, LINE, TRAIL } from '../../mark';\nimport { isSortByEncoding, isSortField } from '../../sort';\nimport { contains, getFirstDefined, isNullOrFalse, keys, omit, pick } from '../../util';\nimport { VG_CORNERRADIUS_CHANNELS } from '../../vega.schema';\nimport { getMarkConfig, getMarkPropOrConfig, getStyles, signalOrValueRef, sortParams } from '../common';\nimport { arc } from './arc';\nimport { area } from './area';\nimport { bar } from './bar';\nimport { geoshape } from './geoshape';\nimport { image } from './image';\nimport { line, trail } from './line';\nimport { circle, point, square } from './point';\nimport { rect } from './rect';\nimport { rule } from './rule';\nimport { text } from './text';\nimport { tick } from './tick';\nconst markCompiler = {\n arc,\n area,\n bar,\n circle,\n geoshape,\n image,\n line,\n point,\n rect,\n rule,\n square,\n text,\n tick,\n trail\n};\nexport function parseMarkGroups(model) {\n if (contains([LINE, AREA, TRAIL], model.mark)) {\n const details = pathGroupingFields(model.mark, model.encoding);\n if (details.length > 0) {\n return getPathGroups(model, details);\n }\n // otherwise use standard mark groups\n }\n else if (model.mark === BAR) {\n const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop => getMarkPropOrConfig(prop, model.markDef, model.config));\n if (model.stack && !model.fieldDef('size') && hasCornerRadius) {\n return getGroupsForStackedBarWithCornerRadius(model);\n }\n }\n return getMarkGroup(model);\n}\nconst FACETED_PATH_PREFIX = 'faceted_path_';\nfunction getPathGroups(model, details) {\n // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?)\n return [\n {\n name: model.getName('pathgroup'),\n type: 'group',\n from: {\n facet: {\n name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main),\n data: model.requestDataName(DataSourceType.Main),\n groupby: details\n }\n },\n encode: {\n update: {\n width: { field: { group: 'width' } },\n height: { field: { group: 'height' } }\n }\n },\n // With subfacet for line/area group, need to use faceted data from above.\n marks: getMarkGroup(model, { fromPrefix: FACETED_PATH_PREFIX })\n }\n ];\n}\nconst STACK_GROUP_PREFIX = 'stack_group_';\n/**\n * We need to put stacked bars into groups in order to enable cornerRadius for stacks.\n * If stack is used and the model doesn't have size encoding, we put the mark into groups,\n * and apply cornerRadius properties at the group.\n */\nfunction getGroupsForStackedBarWithCornerRadius(model) {\n // Generate the mark\n const [mark] = getMarkGroup(model, { fromPrefix: STACK_GROUP_PREFIX });\n // Get the scale for the stacked field\n const fieldScale = model.scaleName(model.stack.fieldChannel);\n const stackField = (opt = {}) => model.vgField(model.stack.fieldChannel, opt);\n // Find the min/max of the pixel value on the stacked direction\n const stackFieldGroup = (func, expr) => {\n const vgFieldMinMax = [\n stackField({ prefix: 'min', suffix: 'start', expr }),\n stackField({ prefix: 'max', suffix: 'start', expr }),\n stackField({ prefix: 'min', suffix: 'end', expr }),\n stackField({ prefix: 'max', suffix: 'end', expr })\n ];\n return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`;\n };\n let groupUpdate;\n let innerGroupUpdate;\n // Build the encoding for group and an inner group\n if (model.stack.fieldChannel === 'x') {\n // Move cornerRadius, y/yc/y2/height properties to group\n // Group x/x2 should be the min/max of the marks within\n groupUpdate = {\n ...pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS]),\n x: { signal: stackFieldGroup('min', 'datum') },\n x2: { signal: stackFieldGroup('max', 'datum') },\n clip: { value: true }\n };\n // Inner group should revert the x translation, and pass height through\n innerGroupUpdate = {\n x: { field: { group: 'x' }, mult: -1 },\n height: { field: { group: 'height' } }\n };\n // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group)\n // This is why size encoding is not supported yet\n mark.encode.update = {\n ...omit(mark.encode.update, ['y', 'yc', 'y2']),\n height: { field: { group: 'height' } }\n };\n }\n else {\n groupUpdate = {\n ...pick(mark.encode.update, ['x', 'xc', 'x2', 'width']),\n y: { signal: stackFieldGroup('min', 'datum') },\n y2: { signal: stackFieldGroup('max', 'datum') },\n clip: { value: true }\n };\n innerGroupUpdate = {\n y: { field: { group: 'y' }, mult: -1 },\n width: { field: { group: 'width' } }\n };\n mark.encode.update = {\n ...omit(mark.encode.update, ['x', 'xc', 'x2']),\n width: { field: { group: 'width' } }\n };\n }\n // Deal with cornerRadius properties\n for (const key of VG_CORNERRADIUS_CHANNELS) {\n const configValue = getMarkConfig(key, model.markDef, model.config);\n // Move from mark to group\n if (mark.encode.update[key]) {\n groupUpdate[key] = mark.encode.update[key];\n delete mark.encode.update[key];\n }\n else if (configValue) {\n groupUpdate[key] = signalOrValueRef(configValue);\n }\n // Overwrite any cornerRadius on mark set by config --- they are already moved to the group\n if (configValue) {\n mark.encode.update[key] = { value: 0 };\n }\n }\n const groupby = [];\n if (model.stack.groupbyChannels?.length > 0) {\n for (const groupbyChannel of model.stack.groupbyChannels) {\n // For bin and time unit, we have to add bin/timeunit -end channels.\n const groupByField = model.fieldDef(groupbyChannel);\n const field = vgField(groupByField);\n if (field) {\n groupby.push(field);\n }\n if (groupByField?.bin || groupByField?.timeUnit) {\n groupby.push(vgField(groupByField, { binSuffix: 'end' }));\n }\n }\n }\n const strokeProperties = [\n 'stroke',\n 'strokeWidth',\n 'strokeJoin',\n 'strokeCap',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeMiterLimit',\n 'strokeOpacity'\n ];\n // Generate stroke properties for the group\n groupUpdate = strokeProperties.reduce((encode, prop) => {\n if (mark.encode.update[prop]) {\n return { ...encode, [prop]: mark.encode.update[prop] };\n }\n else {\n const configValue = getMarkConfig(prop, model.markDef, model.config);\n if (configValue !== undefined) {\n return { ...encode, [prop]: signalOrValueRef(configValue) };\n }\n else {\n return encode;\n }\n }\n }, groupUpdate);\n // Apply strokeForeground and strokeOffset if stroke is used\n if (groupUpdate.stroke) {\n groupUpdate.strokeForeground = { value: true };\n groupUpdate.strokeOffset = { value: 0 };\n }\n return [\n {\n type: 'group',\n from: {\n facet: {\n data: model.requestDataName(DataSourceType.Main),\n name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main),\n groupby,\n aggregate: {\n fields: [\n stackField({ suffix: 'start' }),\n stackField({ suffix: 'start' }),\n stackField({ suffix: 'end' }),\n stackField({ suffix: 'end' })\n ],\n ops: ['min', 'max', 'min', 'max']\n }\n }\n },\n encode: {\n update: groupUpdate\n },\n marks: [\n {\n type: 'group',\n encode: { update: innerGroupUpdate },\n marks: [mark]\n }\n ]\n }\n ];\n}\nexport function getSort(model) {\n const { encoding, stack, mark, markDef, config } = model;\n const order = encoding.order;\n if ((!isArray(order) && isValueDef(order) && isNullOrFalse(order.value)) ||\n (!order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config)))) {\n return undefined;\n }\n else if ((isArray(order) || isFieldDef(order)) && !stack) {\n // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.)\n return sortParams(order, { expr: 'datum' });\n }\n else if (isPathMark(mark)) {\n // For both line and area, we sort values based on dimension by default\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (isFieldDef(dimensionChannelDef)) {\n const s = dimensionChannelDef.sort;\n if (isArray(s)) {\n return {\n field: vgField(dimensionChannelDef, { prefix: dimensionChannel, suffix: 'sort_index', expr: 'datum' })\n };\n }\n else if (isSortField(s)) {\n return {\n field: vgField({\n // FIXME: this op might not already exist?\n // FIXME: what if dimensionChannel (x or y) contains custom domain?\n aggregate: isAggregate(model.encoding) ? s.op : undefined,\n field: s.field\n }, { expr: 'datum' })\n };\n }\n else if (isSortByEncoding(s)) {\n const fieldDefToSort = model.fieldDef(s.encoding);\n return {\n field: vgField(fieldDefToSort, { expr: 'datum' }),\n order: s.order\n };\n }\n else if (s === null) {\n return undefined;\n }\n else {\n return {\n field: vgField(dimensionChannelDef, {\n // For stack with imputation, we only have bin_mid\n binSuffix: model.stack?.impute ? 'mid' : undefined,\n expr: 'datum'\n })\n };\n }\n }\n return undefined;\n }\n return undefined;\n}\nfunction getMarkGroup(model, opt = { fromPrefix: '' }) {\n const { mark, markDef, encoding, config } = model;\n const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model));\n const style = getStyles(markDef);\n const key = encoding.key;\n const sort = getSort(model);\n const interactive = interactiveFlag(model);\n const aria = getMarkPropOrConfig('aria', markDef, config);\n const postEncodingTransform = markCompiler[mark].postEncodingTransform\n ? markCompiler[mark].postEncodingTransform(model)\n : null;\n return [\n {\n name: model.getName('marks'),\n type: markCompiler[mark].vgMark,\n ...(clip ? { clip: true } : {}),\n ...(style ? { style } : {}),\n ...(key ? { key: key.field } : {}),\n ...(sort ? { sort } : {}),\n ...(interactive ? interactive : {}),\n ...(aria === false ? { aria } : {}),\n from: { data: opt.fromPrefix + model.requestDataName(DataSourceType.Main) },\n encode: {\n update: markCompiler[mark].encodeEntry(model)\n },\n ...(postEncodingTransform\n ? {\n transform: postEncodingTransform\n }\n : {})\n }\n ];\n}\n/**\n * If scales are bound to interval selections, we want to automatically clip\n * marks to account for panning/zooming interactions. We identify bound scales\n * by the selectionExtent property, which gets added during scale parsing.\n */\nfunction scaleClip(model) {\n const xScale = model.getScaleComponent('x');\n const yScale = model.getScaleComponent('y');\n return xScale?.get('selectionExtent') || yScale?.get('selectionExtent') ? true : undefined;\n}\n/**\n * If we use a custom projection with auto-fitting to the geodata extent,\n * we need to clip to ensure the chart size doesn't explode.\n */\nfunction projectionClip(model) {\n const projection = model.component.projection;\n return projection && !projection.isFit ? true : undefined;\n}\n/**\n * Only output interactive flags if we have selections defined somewhere in our model hierarchy.\n */\nfunction interactiveFlag(model) {\n if (!model.component.selection)\n return null;\n const unitCount = keys(model.component.selection).length;\n let parentCount = unitCount;\n let parent = model.parent;\n while (parent && parentCount === 0) {\n parentCount = keys(parent.component.selection).length;\n parent = parent.parent;\n }\n return parentCount\n ? {\n interactive: unitCount > 0 || model.mark === 'geoshape' || !!model.encoding.tooltip\n }\n : null;\n}\n//# sourceMappingURL=mark.js.map","import * as encode from './encode';\nexport const arc = {\n vgMark: 'arc',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid' }),\n // arcs are rectangles in polar coordinates\n ...encode.rectPosition(model, 'radius'),\n ...encode.rectPosition(model, 'theta')\n };\n }\n};\n//# sourceMappingURL=arc.js.map","import * as encode from './encode';\nexport const area = {\n vgMark: 'area',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'include',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'horizontal'\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'vertical'\n }),\n ...encode.defined(model)\n };\n }\n};\n//# sourceMappingURL=area.js.map","import * as encode from './encode';\nexport const bar = {\n vgMark: 'rect',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y')\n };\n }\n};\n//# sourceMappingURL=bar.js.map","import { isFieldDef, vgField } from '../../channeldef';\nimport { GEOJSON } from '../../type';\nimport * as encode from './encode';\nexport const geoshape = {\n vgMark: 'shape',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n })\n };\n },\n postEncodingTransform: (model) => {\n const { encoding } = model;\n const shapeDef = encoding.shape;\n const transform = {\n type: 'geoshape',\n projection: model.projectionName(),\n // as: 'shape',\n ...(shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON\n ? { field: vgField(shapeDef, { expr: 'datum' }) }\n : {})\n };\n return [transform];\n }\n};\n//# sourceMappingURL=geoshape.js.map","import * as encode from './encode';\nexport const image = {\n vgMark: 'image',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'ignore',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y'),\n ...encode.text(model, 'url')\n };\n }\n};\n//# sourceMappingURL=image.js.map","import * as encode from './encode';\nexport const line = {\n vgMark: 'line',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid' }),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's line size is strokeWidth\n }),\n ...encode.defined(model)\n };\n }\n};\nexport const trail = {\n vgMark: 'trail',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid' }),\n ...encode.nonPosition('size', model),\n ...encode.defined(model)\n };\n }\n};\n//# sourceMappingURL=line.js.map","import * as encode from './encode';\nexport const rect = {\n vgMark: 'rect',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y')\n };\n }\n};\n//# sourceMappingURL=rect.js.map","import * as encode from './encode';\nexport const rule = {\n vgMark: 'rule',\n encodeEntry: (model) => {\n const { markDef } = model;\n const orient = markDef.orient;\n if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) {\n // Show nothing if we have none of x, y, lat, and long.\n return {};\n }\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'vertical' // include x2 for horizontal or line segment rule\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'horizontal' // include y2 for vertical or line segment rule\n }),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's rule size is strokeWidth\n })\n };\n }\n};\n//# sourceMappingURL=rule.js.map","import { isArray } from 'vega-util';\nimport { isConditionalAxisValue } from '../axis';\nimport { GEOPOSITION_CHANNELS, NONPOSITION_SCALE_CHANNELS, POSITION_SCALE_CHANNELS, SCALE_CHANNELS, supportLegend, X, Y } from '../channel';\nimport { getFieldDef, getFieldOrDatumDef, isFieldOrDatumDef, isTypedFieldDef } from '../channeldef';\nimport { isGraticuleGenerator } from '../data';\nimport * as vlEncoding from '../encoding';\nimport { initEncoding } from '../encoding';\nimport { replaceExprRef } from '../expr';\nimport { GEOSHAPE, isMarkDef } from '../mark';\nimport { isSelectionParameter } from '../selection';\nimport { isFrameMixins } from '../spec/base';\nimport { stack } from '../stack';\nimport { keys } from '../util';\nimport { assembleAxisSignals } from './axis/assemble';\nimport { parseUnitAxes } from './axis/parse';\nimport { signalOrValueRefWithCondition, signalRefOrValue } from './common';\nimport { parseData } from './data/parse';\nimport { assembleLayoutSignals } from './layoutsize/assemble';\nimport { initLayoutSize } from './layoutsize/init';\nimport { parseUnitLayoutSize } from './layoutsize/parse';\nimport { defaultFilled, initMarkdef } from './mark/init';\nimport { parseMarkGroups } from './mark/mark';\nimport { isLayerModel, ModelWithField } from './model';\nimport { assembleTopLevelSignals, assembleUnitSelectionData, assembleUnitSelectionMarks, assembleUnitSelectionSignals } from './selection/assemble';\nimport { parseUnitSelection } from './selection/parse';\n/**\n * Internal model of Vega-Lite specification for the compiler.\n */\nexport class UnitModel extends ModelWithField {\n constructor(spec, parent, parentGivenName, parentGivenSize = {}, config) {\n super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined);\n this.specifiedScales = {};\n this.specifiedAxes = {};\n this.specifiedLegends = {};\n this.specifiedProjection = {};\n this.selection = [];\n this.children = [];\n const markDef = isMarkDef(spec.mark) ? { ...spec.mark } : { type: spec.mark };\n const mark = markDef.type;\n // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding\n if (markDef.filled === undefined) {\n markDef.filled = defaultFilled(markDef, config, {\n graticule: spec.data && isGraticuleGenerator(spec.data)\n });\n }\n const encoding = (this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config));\n this.markDef = initMarkdef(markDef, encoding, config);\n this.size = initLayoutSize({\n encoding,\n size: isFrameMixins(spec)\n ? {\n ...parentGivenSize,\n ...(spec.width ? { width: spec.width } : {}),\n ...(spec.height ? { height: spec.height } : {})\n }\n : parentGivenSize\n });\n // calculate stack properties\n this.stack = stack(this.markDef, encoding);\n this.specifiedScales = this.initScales(mark, encoding);\n this.specifiedAxes = this.initAxes(encoding);\n this.specifiedLegends = this.initLegends(encoding);\n this.specifiedProjection = spec.projection;\n // Selections will be initialized upon parse.\n this.selection = (spec.params ?? []).filter(p => isSelectionParameter(p));\n }\n get hasProjection() {\n const { encoding } = this;\n const isGeoShapeMark = this.mark === GEOSHAPE;\n const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel]));\n return isGeoShapeMark || hasGeoPosition;\n }\n /**\n * Return specified Vega-Lite scale domain for a particular channel\n * @param channel\n */\n scaleDomain(channel) {\n const scale = this.specifiedScales[channel];\n return scale ? scale.domain : undefined;\n }\n axis(channel) {\n return this.specifiedAxes[channel];\n }\n legend(channel) {\n return this.specifiedLegends[channel];\n }\n initScales(mark, encoding) {\n return SCALE_CHANNELS.reduce((scales, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]);\n if (fieldOrDatumDef) {\n scales[channel] = this.initScale(fieldOrDatumDef.scale ?? {});\n }\n return scales;\n }, {});\n }\n initScale(scale) {\n const { domain, range } = scale;\n // TODO: we could simplify this function if we had a recursive replace function\n const scaleInternal = replaceExprRef(scale);\n if (isArray(domain)) {\n scaleInternal.domain = domain.map(signalRefOrValue);\n }\n if (isArray(range)) {\n scaleInternal.range = range.map(signalRefOrValue);\n }\n return scaleInternal;\n }\n initAxes(encoding) {\n return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => {\n // Position Axis\n // TODO: handle ConditionFieldDef\n const channelDef = encoding[channel];\n if (isFieldOrDatumDef(channelDef) ||\n (channel === X && isFieldOrDatumDef(encoding.x2)) ||\n (channel === Y && isFieldOrDatumDef(encoding.y2))) {\n const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined;\n _axis[channel] = axisSpec\n ? this.initAxis({ ...axisSpec }) // convert truthy value to object\n : axisSpec;\n }\n return _axis;\n }, {});\n }\n initAxis(axis) {\n const props = keys(axis);\n const axisInternal = {};\n for (const prop of props) {\n const val = axis[prop];\n axisInternal[prop] = isConditionalAxisValue(val)\n ? signalOrValueRefWithCondition(val)\n : signalRefOrValue(val);\n }\n return axisInternal;\n }\n initLegends(encoding) {\n return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]);\n if (fieldOrDatumDef && supportLegend(channel)) {\n const legend = fieldOrDatumDef.legend;\n _legend[channel] = legend\n ? replaceExprRef(legend) // convert truthy value to object\n : legend;\n }\n return _legend;\n }, {});\n }\n parseData() {\n this.component.data = parseData(this);\n }\n parseLayoutSize() {\n parseUnitLayoutSize(this);\n }\n parseSelections() {\n this.component.selection = parseUnitSelection(this, this.selection);\n }\n parseMarkGroup() {\n this.component.mark = parseMarkGroups(this);\n }\n parseAxesAndHeaders() {\n this.component.axes = parseUnitAxes(this);\n }\n assembleSelectionTopLevelSignals(signals) {\n return assembleTopLevelSignals(this, signals);\n }\n assembleSignals() {\n return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])];\n }\n assembleSelectionData(data) {\n return assembleUnitSelectionData(this, data);\n }\n assembleLayout() {\n return null;\n }\n assembleLayoutSignals() {\n return assembleLayoutSignals(this);\n }\n assembleMarks() {\n let marks = this.component.mark ?? [];\n // If this unit is part of a layer, selections should augment\n // all in concert rather than each unit individually. This\n // ensures correct interleaving of clipping and brushed marks.\n if (!this.parent || !isLayerModel(this.parent)) {\n marks = assembleUnitSelectionMarks(this, marks);\n }\n return marks.map(this.correctDataNames);\n }\n assembleGroupStyle() {\n const { style } = this.view || {};\n if (style !== undefined) {\n return style;\n }\n if (this.encoding.x || this.encoding.y) {\n return 'cell';\n }\n else {\n return 'view';\n }\n }\n getMapping() {\n return this.encoding;\n }\n get mark() {\n return this.markDef.type;\n }\n channelHasField(channel) {\n return vlEncoding.channelHasField(this.encoding, channel);\n }\n fieldDef(channel) {\n const channelDef = this.encoding[channel];\n return getFieldDef(channelDef);\n }\n typedFieldDef(channel) {\n const fieldDef = this.fieldDef(channel);\n if (isTypedFieldDef(fieldDef)) {\n return fieldDef;\n }\n return null;\n }\n}\n//# sourceMappingURL=unit.js.map","import { getSizeChannel, POSITION_SCALE_CHANNELS } from '../../channel';\nimport { isContinuousFieldOrDatumDef } from '../../channeldef';\nimport * as log from '../../log';\nimport { isStep } from '../../spec/base';\nexport function initLayoutSize({ encoding, size }) {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n if (isStep(size[sizeType])) {\n if (isContinuousFieldOrDatumDef(encoding[channel])) {\n delete size[sizeType];\n log.warn(log.message.stepDropped(sizeType));\n }\n }\n }\n return size;\n}\n//# sourceMappingURL=init.js.map","import { array } from 'vega-util';\nimport * as log from '../log';\nimport { isLayerSpec, isUnitSpec } from '../spec';\nimport { keys } from '../util';\nimport { assembleAxisSignals } from './axis/assemble';\nimport { parseLayerAxes } from './axis/parse';\nimport { parseData } from './data/parse';\nimport { assembleLayoutSignals } from './layoutsize/assemble';\nimport { parseLayerLayoutSize } from './layoutsize/parse';\nimport { assembleLegends } from './legend/assemble';\nimport { Model } from './model';\nimport { assembleLayerSelectionMarks } from './selection/assemble';\nimport { UnitModel } from './unit';\nexport class LayerModel extends Model {\n constructor(spec, parent, parentGivenName, parentGivenSize, config) {\n super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view);\n const layoutSize = {\n ...parentGivenSize,\n ...(spec.width ? { width: spec.width } : {}),\n ...(spec.height ? { height: spec.height } : {})\n };\n this.children = spec.layer.map((layer, i) => {\n if (isLayerSpec(layer)) {\n return new LayerModel(layer, this, this.getName(`layer_${i}`), layoutSize, config);\n }\n else if (isUnitSpec(layer)) {\n return new UnitModel(layer, this, this.getName(`layer_${i}`), layoutSize, config);\n }\n throw new Error(log.message.invalidSpec(layer));\n });\n }\n parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n parseLayoutSize() {\n parseLayerLayoutSize(this);\n }\n parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n parseAxesAndHeaders() {\n parseLayerAxes(this);\n }\n assembleSelectionTopLevelSignals(signals) {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n // TODO: Support same named selections across children.\n assembleSignals() {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleSignals());\n }, assembleAxisSignals(this));\n }\n assembleLayoutSignals() {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleLayoutSignals());\n }, assembleLayoutSignals(this));\n }\n assembleSelectionData(data) {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n assembleGroupStyle() {\n const uniqueStyles = new Set();\n for (const child of this.children) {\n for (const style of array(child.assembleGroupStyle())) {\n uniqueStyles.add(style);\n }\n }\n const styles = Array.from(uniqueStyles);\n return styles.length > 1 ? styles : styles.length === 1 ? styles[0] : undefined;\n }\n assembleTitle() {\n let title = super.assembleTitle();\n if (title) {\n return title;\n }\n // If title does not provide layer, look into children\n for (const child of this.children) {\n title = child.assembleTitle();\n if (title) {\n return title;\n }\n }\n return undefined;\n }\n assembleLayout() {\n return null;\n }\n assembleMarks() {\n return assembleLayerSelectionMarks(this, this.children.flatMap(child => {\n return child.assembleMarks();\n }));\n }\n assembleLegends() {\n return this.children.reduce((legends, child) => {\n return legends.concat(child.assembleLegends());\n }, assembleLegends(this));\n }\n}\n//# sourceMappingURL=layer.js.map","import * as log from '../log';\nimport { isAnyConcatSpec, isFacetSpec, isLayerSpec, isUnitSpec } from '../spec';\nimport { ConcatModel } from './concat';\nimport { FacetModel } from './facet';\nimport { LayerModel } from './layer';\nimport { UnitModel } from './unit';\nexport function buildModel(spec, parent, parentGivenName, unitSize, config) {\n if (isFacetSpec(spec)) {\n return new FacetModel(spec, parent, parentGivenName, config);\n }\n else if (isLayerSpec(spec)) {\n return new LayerModel(spec, parent, parentGivenName, unitSize, config);\n }\n else if (isUnitSpec(spec)) {\n return new UnitModel(spec, parent, parentGivenName, unitSize, config);\n }\n else if (isAnyConcatSpec(spec)) {\n return new ConcatModel(spec, parent, parentGivenName, config);\n }\n throw new Error(log.message.invalidSpec(spec));\n}\n//# sourceMappingURL=buildmodel.js.map","import { isString, mergeConfig } from 'vega-util';\nimport { getPositionScaleChannel } from '../channel';\nimport * as vlFieldDef from '../channeldef';\nimport { initConfig, stripAndRedirectConfig } from '../config';\nimport * as log from '../log';\nimport { normalize } from '../normalize';\nimport { assembleParameterSignals } from '../parameter';\nimport { extractTopLevelProperties, getFitType, isFitType } from '../spec/toplevel';\nimport { keys } from '../util';\nimport { buildModel } from './buildmodel';\nimport { assembleRootData } from './data/assemble';\nimport { optimizeDataflow } from './data/optimize';\n/**\n * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec.\n *\n * At a high-level, we make the following transformations in different phases:\n *\n * Input spec\n * |\n * | (Normalization)\n * v\n * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.)\n * |\n * | (Build Model)\n * v\n * A model tree of the spec\n * |\n * | (Parse)\n * v\n * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged)\n * |\n * | (Optimize)\n * v\n * A model tree with parsed components with the data component optimized\n * |\n * | (Assemble)\n * v\n * Vega spec\n *\n * @param inputSpec The Vega-Lite specification.\n * @param opt Optional arguments passed to the Vega-Lite compiler.\n * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec.\n */\nexport function compile(inputSpec, opt = {}) {\n // 0. Augment opt with default opts\n if (opt.logger) {\n // set the singleton logger to the provided logger\n log.set(opt.logger);\n }\n if (opt.fieldTitle) {\n // set the singleton field title formatter\n vlFieldDef.setTitleFormatter(opt.fieldTitle);\n }\n try {\n // 1. Initialize config by deep merging default config with the config provided via option and the input spec.\n const config = initConfig(mergeConfig(opt.config, inputSpec.config));\n // 2. Normalize: Convert input spec -> normalized spec\n // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec.\n // - Normalize autosize and width or height spec\n const spec = normalize(inputSpec, config);\n // 3. Build Model: normalized spec -> Model (a tree structure)\n // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors.\n // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models.\n const model = buildModel(spec, null, '', undefined, config);\n // 4 Parse: Model --> Model with components\n // Note that components = intermediate representations that are equivalent to Vega specs.\n // We need these intermediate representation because we need to merge many visualization \"components\" like projections, scales, axes, and legends.\n // We will later convert these components into actual Vega specs in the assemble phase.\n // In this phase, we do a bottom-up traversal over the whole tree to\n // parse for each type of components once (e.g., data, layout, mark, scale).\n // By doing bottom-up traversal, we start parsing components of unit specs and\n // then merge child components of parent composite specs.\n //\n // Please see inside model.parse() for order of different components parsed.\n model.parse();\n // drawDataflow(model.component.data.sources);\n // 5. Optimize the dataflow. This will modify the data component of the model.\n optimizeDataflow(model.component.data, model);\n // drawDataflow(model.component.data.sources);\n // 6. Assemble: convert model components --> Vega Spec.\n const vgSpec = assembleTopLevelModel(model, getTopLevelProperties(inputSpec, spec.autosize, config, model), inputSpec.datasets, inputSpec.usermeta);\n return {\n spec: vgSpec,\n normalized: spec\n };\n }\n finally {\n // Reset the singleton logger if a logger is provided\n if (opt.logger) {\n log.reset();\n }\n // Reset the singleton field title formatter if provided\n if (opt.fieldTitle) {\n vlFieldDef.resetTitleFormatter();\n }\n }\n}\nfunction getTopLevelProperties(inputSpec, autosize, config, model) {\n const width = model.component.layoutSize.get('width');\n const height = model.component.layoutSize.get('height');\n if (autosize === undefined) {\n autosize = { type: 'pad' };\n if (model.hasAxisOrientSignalRef()) {\n autosize.resize = true;\n }\n }\n else if (isString(autosize)) {\n autosize = { type: autosize };\n }\n if (width && height && isFitType(autosize.type)) {\n if (width === 'step' && height === 'step') {\n log.warn(log.message.droppingFit());\n autosize.type = 'pad';\n }\n else if (width === 'step' || height === 'step') {\n // effectively XOR, because else if\n // get step dimension\n const sizeType = width === 'step' ? 'width' : 'height';\n // log that we're dropping fit for respective channel\n log.warn(log.message.droppingFit(getPositionScaleChannel(sizeType)));\n // setting type to inverse fit (so if we dropped fit-x, type is now fit-y)\n const inverseSizeType = sizeType === 'width' ? 'height' : 'width';\n autosize.type = getFitType(inverseSizeType);\n }\n }\n return {\n ...(keys(autosize).length === 1 && autosize.type\n ? autosize.type === 'pad'\n ? {}\n : { autosize: autosize.type }\n : { autosize }),\n ...extractTopLevelProperties(config, false),\n ...extractTopLevelProperties(inputSpec, true)\n };\n}\n/*\n * Assemble the top-level model to a Vega spec.\n *\n * Note: this couldn't be `model.assemble()` since the top-level model\n * needs some special treatment to generate top-level properties.\n */\nfunction assembleTopLevelModel(model, topLevelProperties, datasets = {}, usermeta) {\n // Config with Vega-Lite only config removed.\n const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined;\n const data = [].concat(model.assembleSelectionData([]), \n // only assemble data in the root\n assembleRootData(model.component.data, datasets));\n const projections = model.assembleProjections();\n const title = model.assembleTitle();\n const style = model.assembleGroupStyle();\n const encodeEntry = model.assembleGroupEncodeEntry(true);\n let layoutSignals = model.assembleLayoutSignals();\n // move width and height signals with values to top level\n layoutSignals = layoutSignals.filter(signal => {\n if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) {\n topLevelProperties[signal.name] = +signal.value;\n return false;\n }\n return true;\n });\n const { params, ...otherTopLevelProps } = topLevelProperties;\n return {\n $schema: 'https://vega.github.io/schema/vega/v5.json',\n ...(model.description ? { description: model.description } : {}),\n ...otherTopLevelProps,\n ...(title ? { title } : {}),\n ...(style ? { style } : {}),\n ...(encodeEntry ? { encode: { update: encodeEntry } } : {}),\n data,\n ...(projections.length > 0 ? { projections } : {}),\n ...model.assembleGroup([\n ...layoutSignals,\n ...model.assembleSelectionTopLevelSignals([]),\n ...assembleParameterSignals(params)\n ]),\n ...(vgConfig ? { config: vgConfig } : {}),\n ...(usermeta ? { usermeta } : {})\n };\n}\n//# sourceMappingURL=compile.js.map","import pkg from '../package.json';\nexport const version = pkg.version;\nexport { compile } from './compile/compile';\nexport { normalize } from './normalize';\nexport * from './util';\n//# sourceMappingURL=index.js.map","function e(e){const[n,r]=/schema\\/([\\w-]+)\\/([\\w\\.\\-]+)\\.json$/g.exec(e).slice(1,3);return{library:n,version:r}}export default e;\n//# sourceMappingURL=parser.module.js.map\n","var name = \"vega-themes\";\nvar version$1 = \"2.14.0\";\nvar description = \"Themes for stylized Vega and Vega-Lite visualizations.\";\nvar keywords = [\"vega\", \"vega-lite\", \"themes\", \"style\"];\nvar license = \"BSD-3-Clause\";\nvar author = {\n name: \"UW Interactive Data Lab\",\n url: \"https://idl.cs.washington.edu\"\n};\nvar contributors = [{\n name: \"Emily Gu\",\n url: \"https://github.com/emilygu\"\n}, {\n name: \"Arvind Satyanarayan\",\n url: \"http://arvindsatya.com\"\n}, {\n name: \"Jeffrey Heer\",\n url: \"https://idl.cs.washington.edu\"\n}, {\n name: \"Dominik Moritz\",\n url: \"https://www.domoritz.de\"\n}];\nvar main = \"build/vega-themes.js\";\nvar module = \"build/vega-themes.module.js\";\nvar unpkg = \"build/vega-themes.min.js\";\nvar jsdelivr = \"build/vega-themes.min.js\";\nvar types = \"build/vega-themes.module.d.ts\";\nvar repository = {\n type: \"git\",\n url: \"https://github.com/vega/vega-themes.git\"\n};\nvar files = [\"src\", \"build\"];\nvar scripts = {\n prebuild: \"yarn clean\",\n build: \"rollup -c\",\n clean: \"rimraf build && rimraf examples/build\",\n \"copy:data\": \"rsync -r node_modules/vega-datasets/data/* examples/data\",\n \"copy:build\": \"rsync -r build/* examples/build\",\n \"deploy:gh\": \"yarn build && mkdir -p examples/build && rsync -r build/* examples/build && gh-pages -d examples\",\n preversion: \"yarn lint\",\n serve: \"browser-sync start -s -f build examples --serveStatic examples\",\n start: \"yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'\",\n format: \"eslint . --fix\",\n lint: \"eslint .\",\n release: \"release-it\"\n};\nvar devDependencies = {\n \"@babel/core\": \"^7.22.9\",\n \"@babel/plugin-proposal-async-generator-functions\": \"^7.20.7\",\n \"@babel/plugin-proposal-json-strings\": \"^7.18.6\",\n \"@babel/plugin-proposal-object-rest-spread\": \"^7.20.7\",\n \"@babel/plugin-proposal-optional-catch-binding\": \"^7.18.6\",\n \"@babel/plugin-transform-runtime\": \"^7.22.9\",\n \"@babel/preset-env\": \"^7.22.9\",\n \"@babel/preset-typescript\": \"^7.22.5\",\n \"@release-it/conventional-changelog\": \"^7.0.0\",\n \"@rollup/plugin-json\": \"^6.0.0\",\n \"@rollup/plugin-node-resolve\": \"^15.1.0\",\n \"@rollup/plugin-terser\": \"^0.4.3\",\n \"@typescript-eslint/eslint-plugin\": \"^6.0.0\",\n \"@typescript-eslint/parser\": \"^6.0.0\",\n \"browser-sync\": \"^2.29.3\",\n concurrently: \"^8.2.0\",\n eslint: \"^8.45.0\",\n \"eslint-config-prettier\": \"^8.8.0\",\n \"eslint-plugin-prettier\": \"^5.0.0\",\n \"gh-pages\": \"^5.0.0\",\n prettier: \"^3.0.0\",\n \"release-it\": \"^16.1.0\",\n rollup: \"^3.26.2\",\n \"rollup-plugin-bundle-size\": \"^1.0.3\",\n \"rollup-plugin-ts\": \"^3.2.0\",\n typescript: \"^5.1.6\",\n vega: \"^5.25.0\",\n \"vega-lite\": \"^5.9.3\"\n};\nvar peerDependencies = {\n vega: \"*\",\n \"vega-lite\": \"*\"\n};\nvar dependencies = {};\nvar pkg = {\n name: name,\n version: version$1,\n description: description,\n keywords: keywords,\n license: license,\n author: author,\n contributors: contributors,\n main: main,\n module: module,\n unpkg: unpkg,\n jsdelivr: jsdelivr,\n types: types,\n repository: repository,\n files: files,\n scripts: scripts,\n devDependencies: devDependencies,\n peerDependencies: peerDependencies,\n dependencies: dependencies\n};\n\nconst lightColor = '#fff';\nconst medColor = '#888';\nconst darkTheme = {\n background: '#333',\n view: {\n stroke: medColor\n },\n title: {\n color: lightColor,\n subtitleColor: lightColor\n },\n style: {\n 'guide-label': {\n fill: lightColor\n },\n 'guide-title': {\n fill: lightColor\n }\n },\n axis: {\n domainColor: lightColor,\n gridColor: medColor,\n tickColor: lightColor\n }\n};\n\nconst markColor$7 = '#4572a7';\nconst excelTheme = {\n background: '#fff',\n arc: {\n fill: markColor$7\n },\n area: {\n fill: markColor$7\n },\n line: {\n stroke: markColor$7,\n strokeWidth: 2\n },\n path: {\n stroke: markColor$7\n },\n rect: {\n fill: markColor$7\n },\n shape: {\n stroke: markColor$7\n },\n symbol: {\n fill: markColor$7,\n strokeWidth: 1.5,\n size: 50\n },\n axis: {\n bandPosition: 0.5,\n grid: true,\n gridColor: '#000000',\n gridOpacity: 1,\n gridWidth: 0.5,\n labelPadding: 10,\n tickSize: 5,\n tickWidth: 0.5\n },\n axisBand: {\n grid: false,\n tickExtra: true\n },\n legend: {\n labelBaseline: 'middle',\n labelFontSize: 11,\n symbolSize: 50,\n symbolType: 'square'\n },\n range: {\n category: ['#4572a7', '#aa4643', '#8aa453', '#71598e', '#4598ae', '#d98445', '#94aace', '#d09393', '#b9cc98', '#a99cbc']\n }\n};\n\nconst markColor$6 = '#30a2da';\nconst axisColor$2 = '#cbcbcb';\nconst guideLabelColor = '#999';\nconst guideTitleColor = '#333';\nconst backgroundColor$2 = '#f0f0f0';\nconst blackTitle = '#333';\nconst fiveThirtyEightTheme = {\n arc: {\n fill: markColor$6\n },\n area: {\n fill: markColor$6\n },\n axis: {\n domainColor: axisColor$2,\n grid: true,\n gridColor: axisColor$2,\n gridWidth: 1,\n labelColor: guideLabelColor,\n labelFontSize: 10,\n titleColor: guideTitleColor,\n tickColor: axisColor$2,\n tickSize: 10,\n titleFontSize: 14,\n titlePadding: 10,\n labelPadding: 4\n },\n axisBand: {\n grid: false\n },\n background: backgroundColor$2,\n group: {\n fill: backgroundColor$2\n },\n legend: {\n labelColor: blackTitle,\n labelFontSize: 11,\n padding: 1,\n symbolSize: 30,\n symbolType: 'square',\n titleColor: blackTitle,\n titleFontSize: 14,\n titlePadding: 10\n },\n line: {\n stroke: markColor$6,\n strokeWidth: 2\n },\n path: {\n stroke: markColor$6,\n strokeWidth: 0.5\n },\n rect: {\n fill: markColor$6\n },\n range: {\n category: ['#30a2da', '#fc4f30', '#e5ae38', '#6d904f', '#8b8b8b', '#b96db8', '#ff9e27', '#56cc60', '#52d2ca', '#52689e', '#545454', '#9fe4f8'],\n diverging: ['#cc0020', '#e77866', '#f6e7e1', '#d6e8ed', '#91bfd9', '#1d78b5'],\n heatmap: ['#d6e8ed', '#cee0e5', '#91bfd9', '#549cc6', '#1d78b5']\n },\n point: {\n filled: true,\n shape: 'circle'\n },\n shape: {\n stroke: markColor$6\n },\n bar: {\n binSpacing: 2,\n fill: markColor$6,\n stroke: null\n },\n title: {\n anchor: 'start',\n fontSize: 24,\n fontWeight: 600,\n offset: 20\n }\n};\n\nconst markColor$5 = '#000';\nconst ggplot2Theme = {\n group: {\n fill: '#e5e5e5'\n },\n arc: {\n fill: markColor$5\n },\n area: {\n fill: markColor$5\n },\n line: {\n stroke: markColor$5\n },\n path: {\n stroke: markColor$5\n },\n rect: {\n fill: markColor$5\n },\n shape: {\n stroke: markColor$5\n },\n symbol: {\n fill: markColor$5,\n size: 40\n },\n axis: {\n domain: false,\n grid: true,\n gridColor: '#FFFFFF',\n gridOpacity: 1,\n labelColor: '#7F7F7F',\n labelPadding: 4,\n tickColor: '#7F7F7F',\n tickSize: 5.67,\n titleFontSize: 16,\n titleFontWeight: 'normal'\n },\n legend: {\n labelBaseline: 'middle',\n labelFontSize: 11,\n symbolSize: 40\n },\n range: {\n category: ['#000000', '#7F7F7F', '#1A1A1A', '#999999', '#333333', '#B0B0B0', '#4D4D4D', '#C9C9C9', '#666666', '#DCDCDC']\n }\n};\n\nconst headlineFontSize = 22;\nconst headlineFontWeight = 'normal';\nconst labelFont$1 = 'Benton Gothic, sans-serif';\nconst labelFontSize = 11.5;\nconst labelFontWeight = 'normal';\nconst markColor$4 = '#82c6df';\n// const markHighlight = '#006d8f';\n// const markDemocrat = '#5789b8';\n// const markRepublican = '#d94f54';\nconst titleFont = 'Benton Gothic Bold, sans-serif';\nconst titleFontWeight = 'normal';\nconst titleFontSize$1 = 13;\nconst colorSchemes$1 = {\n 'category-6': ['#ec8431', '#829eb1', '#c89d29', '#3580b1', '#adc839', '#ab7fb4'],\n 'fire-7': ['#fbf2c7', '#f9e39c', '#f8d36e', '#f4bb6a', '#e68a4f', '#d15a40', '#ab4232'],\n 'fireandice-6': ['#e68a4f', '#f4bb6a', '#f9e39c', '#dadfe2', '#a6b7c6', '#849eae'],\n 'ice-7': ['#edefee', '#dadfe2', '#c4ccd2', '#a6b7c6', '#849eae', '#607785', '#47525d']\n};\nconst latimesTheme = {\n background: '#ffffff',\n title: {\n anchor: 'start',\n color: '#000000',\n font: titleFont,\n fontSize: headlineFontSize,\n fontWeight: headlineFontWeight\n },\n arc: {\n fill: markColor$4\n },\n area: {\n fill: markColor$4\n },\n line: {\n stroke: markColor$4,\n strokeWidth: 2\n },\n path: {\n stroke: markColor$4\n },\n rect: {\n fill: markColor$4\n },\n shape: {\n stroke: markColor$4\n },\n symbol: {\n fill: markColor$4,\n size: 30\n },\n axis: {\n labelFont: labelFont$1,\n labelFontSize,\n labelFontWeight,\n titleFont,\n titleFontSize: titleFontSize$1,\n titleFontWeight\n },\n axisX: {\n labelAngle: 0,\n labelPadding: 4,\n tickSize: 3\n },\n axisY: {\n labelBaseline: 'middle',\n maxExtent: 45,\n minExtent: 45,\n tickSize: 2,\n titleAlign: 'left',\n titleAngle: 0,\n titleX: -45,\n titleY: -11\n },\n legend: {\n labelFont: labelFont$1,\n labelFontSize,\n symbolType: 'square',\n titleFont,\n titleFontSize: titleFontSize$1,\n titleFontWeight\n },\n range: {\n category: colorSchemes$1['category-6'],\n diverging: colorSchemes$1['fireandice-6'],\n heatmap: colorSchemes$1['fire-7'],\n ordinal: colorSchemes$1['fire-7'],\n ramp: colorSchemes$1['fire-7']\n }\n};\n\nconst markColor$3 = '#ab5787';\nconst axisColor$1 = '#979797';\nconst quartzTheme = {\n background: '#f9f9f9',\n arc: {\n fill: markColor$3\n },\n area: {\n fill: markColor$3\n },\n line: {\n stroke: markColor$3\n },\n path: {\n stroke: markColor$3\n },\n rect: {\n fill: markColor$3\n },\n shape: {\n stroke: markColor$3\n },\n symbol: {\n fill: markColor$3,\n size: 30\n },\n axis: {\n domainColor: axisColor$1,\n domainWidth: 0.5,\n gridWidth: 0.2,\n labelColor: axisColor$1,\n tickColor: axisColor$1,\n tickWidth: 0.2,\n titleColor: axisColor$1\n },\n axisBand: {\n grid: false\n },\n axisX: {\n grid: true,\n tickSize: 10\n },\n axisY: {\n domain: false,\n grid: true,\n tickSize: 0\n },\n legend: {\n labelFontSize: 11,\n padding: 1,\n symbolSize: 30,\n symbolType: 'square'\n },\n range: {\n category: ['#ab5787', '#51b2e5', '#703c5c', '#168dd9', '#d190b6', '#00609f', '#d365ba', '#154866', '#666666', '#c4c4c4']\n }\n};\n\nconst markColor$2 = '#3e5c69';\nconst voxTheme = {\n background: '#fff',\n arc: {\n fill: markColor$2\n },\n area: {\n fill: markColor$2\n },\n line: {\n stroke: markColor$2\n },\n path: {\n stroke: markColor$2\n },\n rect: {\n fill: markColor$2\n },\n shape: {\n stroke: markColor$2\n },\n symbol: {\n fill: markColor$2\n },\n axis: {\n domainWidth: 0.5,\n grid: true,\n labelPadding: 2,\n tickSize: 5,\n tickWidth: 0.5,\n titleFontWeight: 'normal'\n },\n axisBand: {\n grid: false\n },\n axisX: {\n gridWidth: 0.2\n },\n axisY: {\n gridDash: [3],\n gridWidth: 0.4\n },\n legend: {\n labelFontSize: 11,\n padding: 1,\n symbolType: 'square'\n },\n range: {\n category: ['#3e5c69', '#6793a6', '#182429', '#0570b0', '#3690c0', '#74a9cf', '#a6bddb', '#e2ddf2']\n }\n};\n\nconst markColor$1 = '#1696d2';\nconst axisColor = '#000000';\nconst backgroundColor$1 = '#FFFFFF';\nconst font = 'Lato';\nconst labelFont = 'Lato';\nconst sourceFont = 'Lato';\nconst gridColor$1 = '#DEDDDD';\nconst titleFontSize = 18;\nconst colorSchemes = {\n 'main-colors': ['#1696d2', '#d2d2d2', '#000000', '#fdbf11', '#ec008b', '#55b748', '#5c5859', '#db2b27'],\n 'shades-blue': ['#CFE8F3', '#A2D4EC', '#73BFE2', '#46ABDB', '#1696D2', '#12719E', '#0A4C6A', '#062635'],\n 'shades-gray': ['#F5F5F5', '#ECECEC', '#E3E3E3', '#DCDBDB', '#D2D2D2', '#9D9D9D', '#696969', '#353535'],\n 'shades-yellow': ['#FFF2CF', '#FCE39E', '#FDD870', '#FCCB41', '#FDBF11', '#E88E2D', '#CA5800', '#843215'],\n 'shades-magenta': ['#F5CBDF', '#EB99C2', '#E46AA7', '#E54096', '#EC008B', '#AF1F6B', '#761548', '#351123'],\n 'shades-green': ['#DCEDD9', '#BCDEB4', '#98CF90', '#78C26D', '#55B748', '#408941', '#2C5C2D', '#1A2E19'],\n 'shades-black': ['#D5D5D4', '#ADABAC', '#848081', '#5C5859', '#332D2F', '#262223', '#1A1717', '#0E0C0D'],\n 'shades-red': ['#F8D5D4', '#F1AAA9', '#E9807D', '#E25552', '#DB2B27', '#A4201D', '#6E1614', '#370B0A'],\n 'one-group': ['#1696d2', '#000000'],\n 'two-groups-cat-1': ['#1696d2', '#000000'],\n 'two-groups-cat-2': ['#1696d2', '#fdbf11'],\n 'two-groups-cat-3': ['#1696d2', '#db2b27'],\n 'two-groups-seq': ['#a2d4ec', '#1696d2'],\n 'three-groups-cat': ['#1696d2', '#fdbf11', '#000000'],\n 'three-groups-seq': ['#a2d4ec', '#1696d2', '#0a4c6a'],\n 'four-groups-cat-1': ['#000000', '#d2d2d2', '#fdbf11', '#1696d2'],\n 'four-groups-cat-2': ['#1696d2', '#ec0008b', '#fdbf11', '#5c5859'],\n 'four-groups-seq': ['#cfe8f3', '#73bf42', '#1696d2', '#0a4c6a'],\n 'five-groups-cat-1': ['#1696d2', '#fdbf11', '#d2d2d2', '#ec008b', '#000000'],\n 'five-groups-cat-2': ['#1696d2', '#0a4c6a', '#d2d2d2', '#fdbf11', '#332d2f'],\n 'five-groups-seq': ['#cfe8f3', '#73bf42', '#1696d2', '#0a4c6a', '#000000'],\n 'six-groups-cat-1': ['#1696d2', '#ec008b', '#fdbf11', '#000000', '#d2d2d2', '#55b748'],\n 'six-groups-cat-2': ['#1696d2', '#d2d2d2', '#ec008b', '#fdbf11', '#332d2f', '#0a4c6a'],\n 'six-groups-seq': ['#cfe8f3', '#a2d4ec', '#73bfe2', '#46abdb', '#1696d2', '#12719e'],\n 'diverging-colors': ['#ca5800', '#fdbf11', '#fdd870', '#fff2cf', '#cfe8f3', '#73bfe2', '#1696d2', '#0a4c6a']\n};\nconst urbanInstituteTheme = {\n background: backgroundColor$1,\n title: {\n anchor: 'start',\n fontSize: titleFontSize,\n font: font\n },\n axisX: {\n domain: true,\n domainColor: axisColor,\n domainWidth: 1,\n grid: false,\n labelFontSize: 12,\n labelFont: labelFont,\n labelAngle: 0,\n tickColor: axisColor,\n tickSize: 5,\n titleFontSize: 12,\n titlePadding: 10,\n titleFont: font\n },\n axisY: {\n domain: false,\n domainWidth: 1,\n grid: true,\n gridColor: gridColor$1,\n gridWidth: 1,\n labelFontSize: 12,\n labelFont: labelFont,\n labelPadding: 8,\n ticks: false,\n titleFontSize: 12,\n titlePadding: 10,\n titleFont: font,\n titleAngle: 0,\n titleY: -10,\n titleX: 18\n },\n legend: {\n labelFontSize: 12,\n labelFont: labelFont,\n symbolSize: 100,\n titleFontSize: 12,\n titlePadding: 10,\n titleFont: font,\n orient: 'right',\n offset: 10\n },\n view: {\n stroke: 'transparent'\n },\n range: {\n category: colorSchemes['six-groups-cat-1'],\n diverging: colorSchemes['diverging-colors'],\n heatmap: colorSchemes['diverging-colors'],\n ordinal: colorSchemes['six-groups-seq'],\n ramp: colorSchemes['shades-blue']\n },\n area: {\n fill: markColor$1\n },\n rect: {\n fill: markColor$1\n },\n line: {\n color: markColor$1,\n stroke: markColor$1,\n strokeWidth: 5\n },\n trail: {\n color: markColor$1,\n stroke: markColor$1,\n strokeWidth: 0,\n size: 1\n },\n path: {\n stroke: markColor$1,\n strokeWidth: 0.5\n },\n point: {\n filled: true\n },\n text: {\n font: sourceFont,\n color: markColor$1,\n fontSize: 11,\n align: 'center',\n fontWeight: 400,\n size: 11\n },\n style: {\n bar: {\n fill: markColor$1,\n stroke: null\n }\n },\n arc: {\n fill: markColor$1\n },\n shape: {\n stroke: markColor$1\n },\n symbol: {\n fill: markColor$1,\n size: 30\n }\n};\n\n/**\n * Copyright 2020 Google LLC.\n *\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file or at\n * https://developers.google.com/open-source/licenses/bsd\n */\n\nconst markColor = '#3366CC';\nconst gridColor = '#ccc';\nconst defaultFont$1 = 'Arial, sans-serif';\nconst googlechartsTheme = {\n arc: {\n fill: markColor\n },\n area: {\n fill: markColor\n },\n path: {\n stroke: markColor\n },\n rect: {\n fill: markColor\n },\n shape: {\n stroke: markColor\n },\n symbol: {\n stroke: markColor\n },\n circle: {\n fill: markColor\n },\n background: '#fff',\n padding: {\n top: 10,\n right: 10,\n bottom: 10,\n left: 10\n },\n style: {\n 'guide-label': {\n font: defaultFont$1,\n fontSize: 12\n },\n 'guide-title': {\n font: defaultFont$1,\n fontSize: 12\n },\n 'group-title': {\n font: defaultFont$1,\n fontSize: 12\n }\n },\n title: {\n font: defaultFont$1,\n fontSize: 14,\n fontWeight: 'bold',\n dy: -3,\n anchor: 'start'\n },\n axis: {\n gridColor: gridColor,\n tickColor: gridColor,\n domain: false,\n grid: true\n },\n range: {\n category: ['#4285F4', '#DB4437', '#F4B400', '#0F9D58', '#AB47BC', '#00ACC1', '#FF7043', '#9E9D24', '#5C6BC0', '#F06292', '#00796B', '#C2185B'],\n heatmap: ['#c6dafc', '#5e97f6', '#2a56c6']\n }\n};\n\nconst ptToPx = value => value * (1 / 3 + 1);\nconst fontSmallPx = ptToPx(9);\nconst legendFontPx = ptToPx(10);\nconst fontLargePx = ptToPx(12);\nconst fontStandard = 'Segoe UI';\nconst fontTitle = 'wf_standard-font, helvetica, arial, sans-serif';\nconst firstLevelElementColor = '#252423';\nconst secondLevelElementColor = '#605E5C';\nconst backgroundColor = 'transparent';\nconst backgroundSecondaryColor = '#C8C6C4';\nconst paletteColor1 = '#118DFF';\nconst paletteColor2 = '#12239E';\nconst paletteColor3 = '#E66C37';\nconst paletteColor4 = '#6B007B';\nconst paletteColor5 = '#E044A7';\nconst paletteColor6 = '#744EC2';\nconst paletteColor7 = '#D9B300';\nconst paletteColor8 = '#D64550';\nconst divergentColorMax = paletteColor1;\nconst divergentColorMin = '#DEEFFF';\nconst divergentPalette = [divergentColorMin, divergentColorMax];\nconst ordinalPalette = [divergentColorMin, '#c7e4ff', '#b0d9ff', '#9aceff', '#83c3ff', '#6cb9ff', '#55aeff', '#3fa3ff', '#2898ff', divergentColorMax];\nconst powerbiTheme = {\n view: {\n stroke: backgroundColor\n },\n background: backgroundColor,\n font: fontStandard,\n header: {\n titleFont: fontTitle,\n titleFontSize: fontLargePx,\n titleColor: firstLevelElementColor,\n labelFont: fontStandard,\n labelFontSize: legendFontPx,\n labelColor: secondLevelElementColor\n },\n axis: {\n ticks: false,\n grid: false,\n domain: false,\n labelColor: secondLevelElementColor,\n labelFontSize: fontSmallPx,\n titleFont: fontTitle,\n titleColor: firstLevelElementColor,\n titleFontSize: fontLargePx,\n titleFontWeight: 'normal'\n },\n axisQuantitative: {\n tickCount: 3,\n grid: true,\n gridColor: backgroundSecondaryColor,\n gridDash: [1, 5],\n labelFlush: false\n },\n axisBand: {\n tickExtra: true\n },\n axisX: {\n labelPadding: 5\n },\n axisY: {\n labelPadding: 10\n },\n bar: {\n fill: paletteColor1\n },\n line: {\n stroke: paletteColor1,\n strokeWidth: 3,\n strokeCap: 'round',\n strokeJoin: 'round'\n },\n text: {\n font: fontStandard,\n fontSize: fontSmallPx,\n fill: secondLevelElementColor\n },\n arc: {\n fill: paletteColor1\n },\n area: {\n fill: paletteColor1,\n line: true,\n opacity: 0.6\n },\n path: {\n stroke: paletteColor1\n },\n rect: {\n fill: paletteColor1\n },\n point: {\n fill: paletteColor1,\n filled: true,\n size: 75\n },\n shape: {\n stroke: paletteColor1\n },\n symbol: {\n fill: paletteColor1,\n strokeWidth: 1.5,\n size: 50\n },\n legend: {\n titleFont: fontStandard,\n titleFontWeight: 'bold',\n titleColor: secondLevelElementColor,\n labelFont: fontStandard,\n labelFontSize: legendFontPx,\n labelColor: secondLevelElementColor,\n symbolType: 'circle',\n symbolSize: 75\n },\n range: {\n category: [paletteColor1, paletteColor2, paletteColor3, paletteColor4, paletteColor5, paletteColor6, paletteColor7, paletteColor8],\n diverging: divergentPalette,\n heatmap: divergentPalette,\n ordinal: ordinalPalette\n }\n};\n\nconst defaultFont = 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif';\nconst fontWeight = 400;\nconst darkCategories = ['#8a3ffc', '#33b1ff', '#007d79', '#ff7eb6', '#fa4d56', '#fff1f1', '#6fdc8c', '#4589ff', '#d12771', '#d2a106', '#08bdba', '#bae6ff', '#ba4e00', '#d4bbff'];\nconst lightCategories = ['#6929c4', '#1192e8', '#005d5d', '#9f1853', '#fa4d56', '#570408', '#198038', '#002d9c', '#ee538b', '#b28600', '#009d9a', '#012749', '#8a3800', '#a56eff'];\nfunction genCarbonConfig({\n type,\n background\n}) {\n const viewbg = type === 'dark' ? '#161616' : '#ffffff';\n const textColor = type === 'dark' ? '#f4f4f4' : '#161616';\n const category = type === 'dark' ? darkCategories : lightCategories;\n const markColor = type === 'dark' ? '#d4bbff' : '#6929c4';\n return {\n background,\n arc: {\n fill: markColor\n },\n area: {\n fill: markColor\n },\n path: {\n stroke: markColor\n },\n rect: {\n fill: markColor\n },\n shape: {\n stroke: markColor\n },\n symbol: {\n stroke: markColor\n },\n circle: {\n fill: markColor\n },\n view: {\n fill: viewbg,\n stroke: viewbg\n },\n group: {\n fill: viewbg\n },\n title: {\n color: textColor,\n anchor: 'start',\n dy: -15,\n fontSize: 16,\n font: defaultFont,\n fontWeight: 600\n },\n axis: {\n labelColor: textColor,\n labelFontSize: 12,\n grid: true,\n gridColor: '#525252',\n titleColor: textColor,\n labelAngle: 0\n },\n style: {\n 'guide-label': {\n font: defaultFont,\n fill: textColor,\n fontWeight: fontWeight\n },\n 'guide-title': {\n font: defaultFont,\n fill: textColor,\n fontWeight: fontWeight\n }\n },\n range: {\n category,\n diverging: ['#750e13', '#a2191f', '#da1e28', '#fa4d56', '#ff8389', '#ffb3b8', '#ffd7d9', '#fff1f1', '#e5f6ff', '#bae6ff', '#82cfff', '#33b1ff', '#1192e8', '#0072c3', '#00539a', '#003a6d'],\n heatmap: ['#f6f2ff', '#e8daff', '#d4bbff', '#be95ff', '#a56eff', '#8a3ffc', '#6929c4', '#491d8b', '#31135e', '#1c0f30']\n }\n };\n}\n\nconst carbonwhite = genCarbonConfig({\n type: 'light',\n background: '#ffffff'\n});\n\nconst carbong10 = genCarbonConfig({\n type: 'light',\n background: '#f4f4f4'\n});\n\nconst carbong90 = genCarbonConfig({\n type: 'dark',\n background: '#262626'\n});\n\nconst carbong100 = genCarbonConfig({\n type: 'dark',\n background: '#161616'\n});\n\nconst version = pkg.version;\n\nexport { carbong10, carbong100, carbong90, carbonwhite, darkTheme as dark, excelTheme as excel, fiveThirtyEightTheme as fivethirtyeight, ggplot2Theme as ggplot2, googlechartsTheme as googlecharts, latimesTheme as latimes, powerbiTheme as powerbi, quartzTheme as quartz, urbanInstituteTheme as urbaninstitute, version, voxTheme as vox };\n","import { isArray, isString, isObject } from 'vega-util';\n\nvar name = \"vega-tooltip\";\nvar version$1 = \"0.33.0\";\nvar description = \"A tooltip plugin for Vega-Lite and Vega visualizations.\";\nvar keywords = [\"vega-lite\", \"vega\", \"tooltip\"];\nvar repository = {\n type: \"git\",\n url: \"https://github.com/vega/vega-tooltip.git\"\n};\nvar author = {\n name: \"UW Interactive Data Lab\",\n url: \"https://idl.cs.washington.edu\"\n};\nvar collaborators = [\"Dominik Moritz\", \"Sira Horradarn\", \"Zening Qu\", \"Kanit Wongsuphasawat\", \"Yuri Astrakhan\", \"Jeffrey Heer\"];\nvar license = \"BSD-3-Clause\";\nvar bugs = {\n url: \"https://github.com/vega/vega-tooltip/issues\"\n};\nvar homepage = \"https://github.com/vega/vega-tooltip#readme\";\nvar main = \"build/vega-tooltip.js\";\nvar module = \"build/vega-tooltip.module.js\";\nvar unpkg = \"build/vega-tooltip.min.js\";\nvar jsdelivr = \"build/vega-tooltip.min.js\";\nvar types = \"build/vega-tooltip.module.d.ts\";\nvar files = [\"src\", \"build\", \"types\"];\nvar scripts = {\n prebuild: \"yarn clean && yarn build:style\",\n build: \"rollup -c\",\n \"build:style\": \"./build-style.sh\",\n clean: \"rimraf build && rimraf src/style.ts\",\n \"copy:data\": \"rsync -r node_modules/vega-datasets/data/* examples/data\",\n \"copy:build\": \"rsync -r build/* examples/build\",\n \"deploy:gh\": \"yarn build && yarn copy:build && gh-pages -d examples && yarn clean\",\n prepublishOnly: \"yarn clean && yarn build\",\n preversion: \"yarn lint && yarn test\",\n serve: \"browser-sync start -s -f build examples --serveStatic examples\",\n start: \"yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'\",\n pretest: \"yarn build:style\",\n test: \"jest\",\n \"test:inspect\": \"node --inspect-brk ./node_modules/.bin/jest --runInBand\",\n prepare: \"yarn copy:data\",\n prettierbase: \"prettier '*.{css,scss,html}'\",\n format: \"eslint . --fix && yarn prettierbase --write\",\n lint: \"eslint . && yarn prettierbase --check\",\n release: \"release-it\"\n};\nvar devDependencies = {\n \"@babel/core\": \"^7.22.10\",\n \"@babel/plugin-proposal-async-generator-functions\": \"^7.20.7\",\n \"@babel/plugin-proposal-json-strings\": \"^7.18.6\",\n \"@babel/plugin-proposal-object-rest-spread\": \"^7.20.7\",\n \"@babel/plugin-proposal-optional-catch-binding\": \"^7.18.6\",\n \"@babel/plugin-transform-runtime\": \"^7.22.10\",\n \"@babel/preset-env\": \"^7.22.10\",\n \"@babel/preset-typescript\": \"^7.22.5\",\n \"@release-it/conventional-changelog\": \"^7.0.0\",\n \"@rollup/plugin-json\": \"^6.0.0\",\n \"@rollup/plugin-node-resolve\": \"^15.1.0\",\n \"@rollup/plugin-terser\": \"^0.4.3\",\n \"@types/jest\": \"^29.5.3\",\n \"@typescript-eslint/eslint-plugin\": \"^6.3.0\",\n \"@typescript-eslint/parser\": \"^6.3.0\",\n \"browser-sync\": \"^2.29.3\",\n concurrently: \"^8.2.0\",\n eslint: \"^8.46.0\",\n \"eslint-config-prettier\": \"^9.0.0\",\n \"eslint-plugin-jest\": \"^27.2.3\",\n \"eslint-plugin-prettier\": \"^5.0.0\",\n \"gh-pages\": \"^5.0.0\",\n jest: \"^29.6.2\",\n \"jest-environment-jsdom\": \"^29.6.2\",\n path: \"^0.12.7\",\n prettier: \"^3.0.1\",\n \"release-it\": \"^16.1.3\",\n rollup: \"^3.27.2\",\n \"rollup-plugin-bundle-size\": \"^1.0.3\",\n \"rollup-plugin-ts\": \"^3.4.3\",\n sass: \"^1.64.2\",\n typescript: \"~5.1.6\",\n \"vega-datasets\": \"^2.7.0\",\n \"vega-typings\": \"^0.24.2\"\n};\nvar dependencies = {\n \"vega-util\": \"^1.17.2\"\n};\nvar pkg = {\n name: name,\n version: version$1,\n description: description,\n keywords: keywords,\n repository: repository,\n author: author,\n collaborators: collaborators,\n license: license,\n bugs: bugs,\n homepage: homepage,\n main: main,\n module: module,\n unpkg: unpkg,\n jsdelivr: jsdelivr,\n types: types,\n files: files,\n scripts: scripts,\n devDependencies: devDependencies,\n dependencies: dependencies\n};\n\n/**\n * Format the value to be shown in the tooltip.\n *\n * @param value The value to show in the tooltip.\n * @param valueToHtml Function to convert a single cell value to an HTML string\n */\nfunction formatValue(value, valueToHtml, maxDepth) {\n if (isArray(value)) {\n return `[${value.map(v => valueToHtml(isString(v) ? v : stringify(v, maxDepth))).join(', ')}]`;\n }\n if (isObject(value)) {\n let content = '';\n const {\n title,\n image,\n ...rest\n } = value;\n if (title) {\n content += `

${valueToHtml(title)}

`;\n }\n if (image) {\n content += ``;\n }\n const keys = Object.keys(rest);\n if (keys.length > 0) {\n content += '';\n for (const key of keys) {\n let val = rest[key];\n\n // ignore undefined properties\n if (val === undefined) {\n continue;\n }\n if (isObject(val)) {\n val = stringify(val, maxDepth);\n }\n content += ``;\n }\n content += `
${valueToHtml(key)}${valueToHtml(val)}
`;\n }\n return content || '{}'; // show empty object if there are no properties\n }\n\n return valueToHtml(value);\n}\nfunction replacer(maxDepth) {\n const stack = [];\n return function (key, value) {\n if (typeof value !== 'object' || value === null) {\n return value;\n }\n const pos = stack.indexOf(this) + 1;\n stack.length = pos;\n if (stack.length > maxDepth) {\n return '[Object]';\n }\n if (stack.indexOf(value) >= 0) {\n return '[Circular]';\n }\n stack.push(value);\n return value;\n };\n}\n\n/**\n * Stringify any JS object to valid JSON\n */\nfunction stringify(obj, maxDepth) {\n return JSON.stringify(obj, replacer(maxDepth));\n}\n\n// generated with build-style.sh\nvar defaultStyle = `#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n`;\n\nconst EL_ID = 'vg-tooltip-element';\nconst DEFAULT_OPTIONS = {\n /**\n * X offset.\n */\n offsetX: 10,\n /**\n * Y offset.\n */\n offsetY: 10,\n /**\n * ID of the tooltip element.\n */\n id: EL_ID,\n /**\n * ID of the tooltip CSS style.\n */\n styleId: 'vega-tooltip-style',\n /**\n * The name of the theme. You can use the CSS class called [THEME]-theme to style the tooltips.\n *\n * There are two predefined themes: \"light\" (default) and \"dark\".\n */\n theme: 'light',\n /**\n * Do not use the default styles provided by Vega Tooltip. If you enable this option, you need to use your own styles. It is not necessary to disable the default style when using a custom theme.\n */\n disableDefaultStyle: false,\n /**\n * HTML sanitizer function that removes dangerous HTML to prevent XSS.\n *\n * This should be a function from string to string. You may replace it with a formatter such as a markdown formatter.\n */\n sanitize: escapeHTML,\n /**\n * The maximum recursion depth when printing objects in the tooltip.\n */\n maxDepth: 2,\n /**\n * A function to customize the rendered HTML of the tooltip.\n * @param value A value string, or object of value strings keyed by field\n * @param sanitize The `sanitize` function from `options.sanitize`\n * @returns {string} The returned string will become the `innerHTML` of the tooltip element\n */\n formatTooltip: formatValue\n};\n/**\n * Escape special HTML characters.\n *\n * @param value A value to convert to string and HTML-escape.\n */\nfunction escapeHTML(value) {\n return String(value).replace(/&/g, '&').replace(/ window.innerWidth) {\n x = +event.clientX - offsetX - tooltipBox.width;\n }\n let y = event.clientY + offsetY;\n if (y + tooltipBox.height > window.innerHeight) {\n y = +event.clientY - offsetY - tooltipBox.height;\n }\n return {\n x,\n y\n };\n}\n\n/**\n * The tooltip handler class.\n */\nclass Handler {\n /**\n * The handler function. We bind this to this function in the constructor.\n */\n\n /**\n * Complete tooltip options.\n */\n\n /**\n * The tooltip html element.\n */\n\n /**\n * Create the tooltip handler and initialize the element and style.\n *\n * @param options Tooltip Options\n */\n constructor(options) {\n this.options = {\n ...DEFAULT_OPTIONS,\n ...options\n };\n const elementId = this.options.id;\n this.el = null;\n\n // bind this to call\n this.call = this.tooltipHandler.bind(this);\n\n // prepend a default stylesheet for tooltips to the head\n if (!this.options.disableDefaultStyle && !document.getElementById(this.options.styleId)) {\n const style = document.createElement('style');\n style.setAttribute('id', this.options.styleId);\n style.innerHTML = createDefaultStyle(elementId);\n const head = document.head;\n if (head.childNodes.length > 0) {\n head.insertBefore(style, head.childNodes[0]);\n } else {\n head.appendChild(style);\n }\n }\n }\n\n /**\n * The tooltip handler function.\n */\n tooltipHandler(handler, event, item, value) {\n // console.log(handler, event, item, value);\n\n // append a div element that we use as a tooltip unless it already exists\n this.el = document.getElementById(this.options.id);\n if (!this.el) {\n this.el = document.createElement('div');\n this.el.setAttribute('id', this.options.id);\n this.el.classList.add('vg-tooltip');\n const tooltipContainer = document.fullscreenElement ?? document.body;\n tooltipContainer.appendChild(this.el);\n }\n\n // hide tooltip for null, undefined, or empty string values\n if (value == null || value === '') {\n this.el.classList.remove('visible', `${this.options.theme}-theme`);\n return;\n }\n\n // set the tooltip content\n this.el.innerHTML = this.options.formatTooltip(value, this.options.sanitize, this.options.maxDepth);\n\n // make the tooltip visible\n this.el.classList.add('visible', `${this.options.theme}-theme`);\n const {\n x,\n y\n } = calculatePosition(event, this.el.getBoundingClientRect(), this.options.offsetX, this.options.offsetY);\n this.el.style.top = `${y}px`;\n this.el.style.left = `${x}px`;\n }\n}\n\nconst version = pkg.version;\n\n/**\n * Create a tooltip handler and register it with the provided view.\n *\n * @param view The Vega view.\n * @param opt Tooltip options.\n */\nfunction index (view, opt) {\n const handler = new Handler(opt);\n view.tooltip(handler.call).run();\n return handler;\n}\n\nexport { DEFAULT_OPTIONS, Handler, calculatePosition, createDefaultStyle, index as default, escapeHTML, formatValue, replacer, stringify, version };\n//# sourceMappingURL=vega-tooltip.module.js.map\n","import { applyPatch } from 'fast-json-patch';\nimport stringify from 'json-stringify-pretty-compact';\nimport * as vegaImport from 'vega';\nimport { writeConfig, isString, mergeConfig, isBoolean, isObject } from 'vega';\nimport { expressionInterpreter } from 'vega-interpreter';\nimport * as vegaLiteImport from 'vega-lite';\nimport schemaParser from 'vega-schema-url-parser';\nimport * as themes from 'vega-themes';\nimport { Handler } from 'vega-tooltip';\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}\n\nfunction _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}\n\nfunction _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}\n\nfunction _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nvar iterator;\nvar hasRequiredIterator;\nfunction requireIterator() {\n if (hasRequiredIterator) return iterator;\n hasRequiredIterator = 1;\n iterator = function (Yallist) {\n Yallist.prototype[Symbol.iterator] = function* () {\n for (let walker = this.head; walker; walker = walker.next) {\n yield walker.value;\n }\n };\n };\n return iterator;\n}\n\nvar yallist = Yallist$1;\nYallist$1.Node = Node;\nYallist$1.create = Yallist$1;\nfunction Yallist$1(list) {\n var self = this;\n if (!(self instanceof Yallist$1)) {\n self = new Yallist$1();\n }\n self.tail = null;\n self.head = null;\n self.length = 0;\n if (list && typeof list.forEach === 'function') {\n list.forEach(function (item) {\n self.push(item);\n });\n } else if (arguments.length > 0) {\n for (var i = 0, l = arguments.length; i < l; i++) {\n self.push(arguments[i]);\n }\n }\n return self;\n}\nYallist$1.prototype.removeNode = function (node) {\n if (node.list !== this) {\n throw new Error('removing node which does not belong to this list');\n }\n var next = node.next;\n var prev = node.prev;\n if (next) {\n next.prev = prev;\n }\n if (prev) {\n prev.next = next;\n }\n if (node === this.head) {\n this.head = next;\n }\n if (node === this.tail) {\n this.tail = prev;\n }\n node.list.length--;\n node.next = null;\n node.prev = null;\n node.list = null;\n return next;\n};\nYallist$1.prototype.unshiftNode = function (node) {\n if (node === this.head) {\n return;\n }\n if (node.list) {\n node.list.removeNode(node);\n }\n var head = this.head;\n node.list = this;\n node.next = head;\n if (head) {\n head.prev = node;\n }\n this.head = node;\n if (!this.tail) {\n this.tail = node;\n }\n this.length++;\n};\nYallist$1.prototype.pushNode = function (node) {\n if (node === this.tail) {\n return;\n }\n if (node.list) {\n node.list.removeNode(node);\n }\n var tail = this.tail;\n node.list = this;\n node.prev = tail;\n if (tail) {\n tail.next = node;\n }\n this.tail = node;\n if (!this.head) {\n this.head = node;\n }\n this.length++;\n};\nYallist$1.prototype.push = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n push(this, arguments[i]);\n }\n return this.length;\n};\nYallist$1.prototype.unshift = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n unshift(this, arguments[i]);\n }\n return this.length;\n};\nYallist$1.prototype.pop = function () {\n if (!this.tail) {\n return undefined;\n }\n var res = this.tail.value;\n this.tail = this.tail.prev;\n if (this.tail) {\n this.tail.next = null;\n } else {\n this.head = null;\n }\n this.length--;\n return res;\n};\nYallist$1.prototype.shift = function () {\n if (!this.head) {\n return undefined;\n }\n var res = this.head.value;\n this.head = this.head.next;\n if (this.head) {\n this.head.prev = null;\n } else {\n this.tail = null;\n }\n this.length--;\n return res;\n};\nYallist$1.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this;\n for (var walker = this.head, i = 0; walker !== null; i++) {\n fn.call(thisp, walker.value, i, this);\n walker = walker.next;\n }\n};\nYallist$1.prototype.forEachReverse = function (fn, thisp) {\n thisp = thisp || this;\n for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n fn.call(thisp, walker.value, i, this);\n walker = walker.prev;\n }\n};\nYallist$1.prototype.get = function (n) {\n for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.next;\n }\n if (i === n && walker !== null) {\n return walker.value;\n }\n};\nYallist$1.prototype.getReverse = function (n) {\n for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev;\n }\n if (i === n && walker !== null) {\n return walker.value;\n }\n};\nYallist$1.prototype.map = function (fn, thisp) {\n thisp = thisp || this;\n var res = new Yallist$1();\n for (var walker = this.head; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this));\n walker = walker.next;\n }\n return res;\n};\nYallist$1.prototype.mapReverse = function (fn, thisp) {\n thisp = thisp || this;\n var res = new Yallist$1();\n for (var walker = this.tail; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this));\n walker = walker.prev;\n }\n return res;\n};\nYallist$1.prototype.reduce = function (fn, initial) {\n var acc;\n var walker = this.head;\n if (arguments.length > 1) {\n acc = initial;\n } else if (this.head) {\n walker = this.head.next;\n acc = this.head.value;\n } else {\n throw new TypeError('Reduce of empty list with no initial value');\n }\n for (var i = 0; walker !== null; i++) {\n acc = fn(acc, walker.value, i);\n walker = walker.next;\n }\n return acc;\n};\nYallist$1.prototype.reduceReverse = function (fn, initial) {\n var acc;\n var walker = this.tail;\n if (arguments.length > 1) {\n acc = initial;\n } else if (this.tail) {\n walker = this.tail.prev;\n acc = this.tail.value;\n } else {\n throw new TypeError('Reduce of empty list with no initial value');\n }\n for (var i = this.length - 1; walker !== null; i--) {\n acc = fn(acc, walker.value, i);\n walker = walker.prev;\n }\n return acc;\n};\nYallist$1.prototype.toArray = function () {\n var arr = new Array(this.length);\n for (var i = 0, walker = this.head; walker !== null; i++) {\n arr[i] = walker.value;\n walker = walker.next;\n }\n return arr;\n};\nYallist$1.prototype.toArrayReverse = function () {\n var arr = new Array(this.length);\n for (var i = 0, walker = this.tail; walker !== null; i++) {\n arr[i] = walker.value;\n walker = walker.prev;\n }\n return arr;\n};\nYallist$1.prototype.slice = function (from, to) {\n to = to || this.length;\n if (to < 0) {\n to += this.length;\n }\n from = from || 0;\n if (from < 0) {\n from += this.length;\n }\n var ret = new Yallist$1();\n if (to < from || to < 0) {\n return ret;\n }\n if (from < 0) {\n from = 0;\n }\n if (to > this.length) {\n to = this.length;\n }\n for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n walker = walker.next;\n }\n for (; walker !== null && i < to; i++, walker = walker.next) {\n ret.push(walker.value);\n }\n return ret;\n};\nYallist$1.prototype.sliceReverse = function (from, to) {\n to = to || this.length;\n if (to < 0) {\n to += this.length;\n }\n from = from || 0;\n if (from < 0) {\n from += this.length;\n }\n var ret = new Yallist$1();\n if (to < from || to < 0) {\n return ret;\n }\n if (from < 0) {\n from = 0;\n }\n if (to > this.length) {\n to = this.length;\n }\n for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n walker = walker.prev;\n }\n for (; walker !== null && i > from; i--, walker = walker.prev) {\n ret.push(walker.value);\n }\n return ret;\n};\nYallist$1.prototype.splice = function (start, deleteCount, ...nodes) {\n if (start > this.length) {\n start = this.length - 1;\n }\n if (start < 0) {\n start = this.length + start;\n }\n for (var i = 0, walker = this.head; walker !== null && i < start; i++) {\n walker = walker.next;\n }\n var ret = [];\n for (var i = 0; walker && i < deleteCount; i++) {\n ret.push(walker.value);\n walker = this.removeNode(walker);\n }\n if (walker === null) {\n walker = this.tail;\n }\n if (walker !== this.head && walker !== this.tail) {\n walker = walker.prev;\n }\n for (var i = 0; i < nodes.length; i++) {\n walker = insert(this, walker, nodes[i]);\n }\n return ret;\n};\nYallist$1.prototype.reverse = function () {\n var head = this.head;\n var tail = this.tail;\n for (var walker = head; walker !== null; walker = walker.prev) {\n var p = walker.prev;\n walker.prev = walker.next;\n walker.next = p;\n }\n this.head = tail;\n this.tail = head;\n return this;\n};\nfunction insert(self, node, value) {\n var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);\n if (inserted.next === null) {\n self.tail = inserted;\n }\n if (inserted.prev === null) {\n self.head = inserted;\n }\n self.length++;\n return inserted;\n}\nfunction push(self, item) {\n self.tail = new Node(item, self.tail, null, self);\n if (!self.head) {\n self.head = self.tail;\n }\n self.length++;\n}\nfunction unshift(self, item) {\n self.head = new Node(item, null, self.head, self);\n if (!self.tail) {\n self.tail = self.head;\n }\n self.length++;\n}\nfunction Node(value, prev, next, list) {\n if (!(this instanceof Node)) {\n return new Node(value, prev, next, list);\n }\n this.list = list;\n this.value = value;\n if (prev) {\n prev.next = this;\n this.prev = prev;\n } else {\n this.prev = null;\n }\n if (next) {\n next.prev = this;\n this.next = next;\n } else {\n this.next = null;\n }\n}\ntry {\n // add if support for Symbol.iterator is present\n requireIterator()(Yallist$1);\n} catch (er) {}\n\n// A linked list to keep track of recently-used-ness\nconst Yallist = yallist;\nconst MAX = Symbol('max');\nconst LENGTH = Symbol('length');\nconst LENGTH_CALCULATOR = Symbol('lengthCalculator');\nconst ALLOW_STALE = Symbol('allowStale');\nconst MAX_AGE = Symbol('maxAge');\nconst DISPOSE = Symbol('dispose');\nconst NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');\nconst LRU_LIST = Symbol('lruList');\nconst CACHE = Symbol('cache');\nconst UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');\nconst naiveLength = () => 1;\n\n// lruList is a yallist where the head is the youngest\n// item, and the tail is the oldest. the list contains the Hit\n// objects as the entries.\n// Each Hit object has a reference to its Yallist.Node. This\n// never changes.\n//\n// cache is a Map (or PseudoMap) that matches the keys to\n// the Yallist.Node object.\nclass LRUCache {\n constructor(options) {\n if (typeof options === 'number') options = {\n max: options\n };\n if (!options) options = {};\n if (options.max && (typeof options.max !== 'number' || options.max < 0)) throw new TypeError('max must be a non-negative number');\n // Kind of weird to have a default max of Infinity, but oh well.\n this[MAX] = options.max || Infinity;\n const lc = options.length || naiveLength;\n this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc;\n this[ALLOW_STALE] = options.stale || false;\n if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number');\n this[MAX_AGE] = options.maxAge || 0;\n this[DISPOSE] = options.dispose;\n this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;\n this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;\n this.reset();\n }\n\n // resize the cache when the max changes.\n set max(mL) {\n if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number');\n this[MAX] = mL || Infinity;\n trim(this);\n }\n get max() {\n return this[MAX];\n }\n set allowStale(allowStale) {\n this[ALLOW_STALE] = !!allowStale;\n }\n get allowStale() {\n return this[ALLOW_STALE];\n }\n set maxAge(mA) {\n if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number');\n this[MAX_AGE] = mA;\n trim(this);\n }\n get maxAge() {\n return this[MAX_AGE];\n }\n\n // resize the cache when the lengthCalculator changes.\n set lengthCalculator(lC) {\n if (typeof lC !== 'function') lC = naiveLength;\n if (lC !== this[LENGTH_CALCULATOR]) {\n this[LENGTH_CALCULATOR] = lC;\n this[LENGTH] = 0;\n this[LRU_LIST].forEach(hit => {\n hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);\n this[LENGTH] += hit.length;\n });\n }\n trim(this);\n }\n get lengthCalculator() {\n return this[LENGTH_CALCULATOR];\n }\n get length() {\n return this[LENGTH];\n }\n get itemCount() {\n return this[LRU_LIST].length;\n }\n rforEach(fn, thisp) {\n thisp = thisp || this;\n for (let walker = this[LRU_LIST].tail; walker !== null;) {\n const prev = walker.prev;\n forEachStep(this, fn, walker, thisp);\n walker = prev;\n }\n }\n forEach(fn, thisp) {\n thisp = thisp || this;\n for (let walker = this[LRU_LIST].head; walker !== null;) {\n const next = walker.next;\n forEachStep(this, fn, walker, thisp);\n walker = next;\n }\n }\n keys() {\n return this[LRU_LIST].toArray().map(k => k.key);\n }\n values() {\n return this[LRU_LIST].toArray().map(k => k.value);\n }\n reset() {\n if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {\n this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));\n }\n this[CACHE] = new Map(); // hash of items by key\n this[LRU_LIST] = new Yallist(); // list of items in order of use recency\n this[LENGTH] = 0; // length of items in the list\n }\n\n dump() {\n return this[LRU_LIST].map(hit => isStale(this, hit) ? false : {\n k: hit.key,\n v: hit.value,\n e: hit.now + (hit.maxAge || 0)\n }).toArray().filter(h => h);\n }\n dumpLru() {\n return this[LRU_LIST];\n }\n set(key, value, maxAge) {\n maxAge = maxAge || this[MAX_AGE];\n if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number');\n const now = maxAge ? Date.now() : 0;\n const len = this[LENGTH_CALCULATOR](value, key);\n if (this[CACHE].has(key)) {\n if (len > this[MAX]) {\n del(this, this[CACHE].get(key));\n return false;\n }\n const node = this[CACHE].get(key);\n const item = node.value;\n\n // dispose of the old one before overwriting\n // split out into 2 ifs for better coverage tracking\n if (this[DISPOSE]) {\n if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value);\n }\n item.now = now;\n item.maxAge = maxAge;\n item.value = value;\n this[LENGTH] += len - item.length;\n item.length = len;\n this.get(key);\n trim(this);\n return true;\n }\n const hit = new Entry(key, value, len, now, maxAge);\n\n // oversized objects fall out of cache automatically.\n if (hit.length > this[MAX]) {\n if (this[DISPOSE]) this[DISPOSE](key, value);\n return false;\n }\n this[LENGTH] += hit.length;\n this[LRU_LIST].unshift(hit);\n this[CACHE].set(key, this[LRU_LIST].head);\n trim(this);\n return true;\n }\n has(key) {\n if (!this[CACHE].has(key)) return false;\n const hit = this[CACHE].get(key).value;\n return !isStale(this, hit);\n }\n get(key) {\n return get(this, key, true);\n }\n peek(key) {\n return get(this, key, false);\n }\n pop() {\n const node = this[LRU_LIST].tail;\n if (!node) return null;\n del(this, node);\n return node.value;\n }\n del(key) {\n del(this, this[CACHE].get(key));\n }\n load(arr) {\n // reset the cache\n this.reset();\n const now = Date.now();\n // A previous serialized cache has the most recent items first\n for (let l = arr.length - 1; l >= 0; l--) {\n const hit = arr[l];\n const expiresAt = hit.e || 0;\n if (expiresAt === 0)\n // the item was created without expiration in a non aged cache\n this.set(hit.k, hit.v);else {\n const maxAge = expiresAt - now;\n // dont add already expired items\n if (maxAge > 0) {\n this.set(hit.k, hit.v, maxAge);\n }\n }\n }\n }\n prune() {\n this[CACHE].forEach((value, key) => get(this, key, false));\n }\n}\nconst get = (self, key, doUse) => {\n const node = self[CACHE].get(key);\n if (node) {\n const hit = node.value;\n if (isStale(self, hit)) {\n del(self, node);\n if (!self[ALLOW_STALE]) return undefined;\n } else {\n if (doUse) {\n if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now();\n self[LRU_LIST].unshiftNode(node);\n }\n }\n return hit.value;\n }\n};\nconst isStale = (self, hit) => {\n if (!hit || !hit.maxAge && !self[MAX_AGE]) return false;\n const diff = Date.now() - hit.now;\n return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];\n};\nconst trim = self => {\n if (self[LENGTH] > self[MAX]) {\n for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) {\n // We know that we're about to delete this one, and also\n // what the next least recently used key will be, so just\n // go ahead and set it now.\n const prev = walker.prev;\n del(self, walker);\n walker = prev;\n }\n }\n};\nconst del = (self, node) => {\n if (node) {\n const hit = node.value;\n if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value);\n self[LENGTH] -= hit.length;\n self[CACHE].delete(hit.key);\n self[LRU_LIST].removeNode(node);\n }\n};\nclass Entry {\n constructor(key, value, length, now, maxAge) {\n this.key = key;\n this.value = value;\n this.length = length;\n this.now = now;\n this.maxAge = maxAge || 0;\n }\n}\nconst forEachStep = (self, fn, node, thisp) => {\n let hit = node.value;\n if (isStale(self, hit)) {\n del(self, node);\n if (!self[ALLOW_STALE]) hit = undefined;\n }\n if (hit) fn.call(thisp, hit.value, hit.key, self);\n};\nvar lruCache = LRUCache;\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({\n loose: true\n});\nconst emptyOpts = Object.freeze({});\nconst parseOptions$1 = options => {\n if (!options) {\n return emptyOpts;\n }\n if (typeof options !== 'object') {\n return looseOption;\n }\n return options;\n};\nvar parseOptions_1 = parseOptions$1;\n\nvar re$1 = {exports: {}};\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0';\nconst MAX_LENGTH$1 = 256;\nconst MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16;\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;\nconst RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];\nvar constants = {\n MAX_LENGTH: MAX_LENGTH$1,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010\n};\n\nconst debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\\bsemver\\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {};\nvar debug_1 = debug$1;\n\n(function (module, exports) {\n const {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH\n } = constants;\n const debug = debug_1;\n exports = module.exports = {};\n\n // The actual regexps go on exports.re\n const re = exports.re = [];\n const safeRe = exports.safeRe = [];\n const src = exports.src = [];\n const t = exports.t = {};\n let R = 0;\n const LETTERDASHNUMBER = '[a-zA-Z0-9-]';\n\n // Replace some greedy regex tokens to prevent regex dos issues. These regex are\n // used internally via the safeRe object since all inputs in this library get\n // normalized first to trim and collapse all extra whitespace. The original\n // regexes are exported for userland consumption and lower level usage. A\n // future breaking change could export the safer regex only with a note that\n // all input should have extra whitespace removed.\n const safeRegexReplacements = [['\\\\s', 1], ['\\\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]];\n const makeSafeRegex = value => {\n for (const [token, max] of safeRegexReplacements) {\n value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);\n }\n return value;\n };\n const createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value);\n const index = R++;\n debug(name, index, value);\n t[name] = index;\n src[index] = value;\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined);\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);\n };\n\n // The following Regular Expressions can be used for tokenizing,\n // validating, and parsing SemVer version strings.\n\n // ## Numeric Identifier\n // A single `0`, or a non-zero digit followed by zero or more digits.\n\n createToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*');\n createToken('NUMERICIDENTIFIERLOOSE', '\\\\d+');\n\n // ## Non-numeric Identifier\n // Zero or more digits, followed by a letter or hyphen, and then zero or\n // more letters, digits, or hyphens.\n\n createToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);\n\n // ## Main Version\n // Three dot-separated numeric identifiers.\n\n createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` + `(${src[t.NUMERICIDENTIFIER]})\\\\.` + `(${src[t.NUMERICIDENTIFIER]})`);\n createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);\n\n // ## Pre-release Version Identifier\n // A numeric identifier, or a non-numeric identifier.\n\n createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);\n createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);\n\n // ## Pre-release Version\n // Hyphen, followed by one or more dot-separated pre-release version\n // identifiers.\n\n createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`);\n createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);\n\n // ## Build Metadata Identifier\n // Any combination of digits, letters, or hyphens.\n\n createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);\n\n // ## Build Metadata\n // Plus sign, followed by one or more period-separated build metadata\n // identifiers.\n\n createToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`);\n\n // ## Full Version String\n // A main version, followed optionally by a pre-release version and\n // build metadata.\n\n // Note that the only major, minor, patch, and pre-release sections of\n // the version string are capturing groups. The build metadata is not a\n // capturing group, because it should not ever be used in version\n // comparison.\n\n createToken('FULLPLAIN', `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);\n createToken('FULL', `^${src[t.FULLPLAIN]}$`);\n\n // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n // common in the npm registry.\n createToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);\n createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);\n createToken('GTLT', '((?:<|>)?=?)');\n\n // Something like \"2.*\" or \"1.2.x\".\n // Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n // Only the first item is strictly required.\n createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`);\n createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`);\n createToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);\n createToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);\n createToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`);\n createToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`);\n\n // Coercion.\n // Extract anything that could conceivably be a part of a valid semver\n createToken('COERCE', `${'(^|[^\\\\d])' + '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:$|[^\\\\d])`);\n createToken('COERCERTL', src[t.COERCE], true);\n\n // Tilde ranges.\n // Meaning is \"reasonably at or greater than\"\n createToken('LONETILDE', '(?:~>?)');\n createToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true);\n exports.tildeTrimReplace = '$1~';\n createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);\n createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);\n\n // Caret ranges.\n // Meaning is \"at least and backwards compatible with\"\n createToken('LONECARET', '(?:\\\\^)');\n createToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true);\n exports.caretTrimReplace = '$1^';\n createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);\n createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);\n\n // A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\n createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`);\n createToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`);\n\n // An expression to strip any whitespace between the gtlt and the thing\n // it modifies, so that `> 1.2.3` ==> `>1.2.3`\n createToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);\n exports.comparatorTrimReplace = '$1$2$3';\n\n // Something like `1.2.3 - 1.2.4`\n // Note that these all use the loose form, because they'll be\n // checked against either the strict or loose comparator form\n // later.\n createToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` + `\\\\s+-\\\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\\\s*$`);\n createToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\\\s+-\\\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\\\s*$`);\n\n // Star ranges basically just allow anything at all.\n createToken('STAR', '(<|>)?=?\\\\s*\\\\*');\n // >=0.0.0 is like a star\n createToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$');\n createToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$');\n})(re$1, re$1.exports);\nvar reExports = re$1.exports;\n\nconst numeric = /^[0-9]+$/;\nconst compareIdentifiers$1 = (a, b) => {\n const anum = numeric.test(a);\n const bnum = numeric.test(b);\n if (anum && bnum) {\n a = +a;\n b = +b;\n }\n return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;\n};\nconst rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);\nvar identifiers = {\n compareIdentifiers: compareIdentifiers$1,\n rcompareIdentifiers\n};\n\nconst debug = debug_1;\nconst {\n MAX_LENGTH,\n MAX_SAFE_INTEGER\n} = constants;\nconst {\n safeRe: re,\n t\n} = reExports;\nconst parseOptions = parseOptions_1;\nconst {\n compareIdentifiers\n} = identifiers;\nlet SemVer$1 = class SemVer {\n constructor(version, options) {\n options = parseOptions(options);\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {\n return version;\n } else {\n version = version.version;\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`);\n }\n if (version.length > MAX_LENGTH) {\n throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);\n }\n debug('SemVer', version, options);\n this.options = options;\n this.loose = !!options.loose;\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease;\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`);\n }\n this.raw = version;\n\n // these are actually numbers\n this.major = +m[1];\n this.minor = +m[2];\n this.patch = +m[3];\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version');\n }\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version');\n }\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version');\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = [];\n } else {\n this.prerelease = m[4].split('.').map(id => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id;\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num;\n }\n }\n return id;\n });\n }\n this.build = m[5] ? m[5].split('.') : [];\n this.format();\n }\n format() {\n this.version = `${this.major}.${this.minor}.${this.patch}`;\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`;\n }\n return this.version;\n }\n toString() {\n return this.version;\n }\n compare(other) {\n debug('SemVer.compare', this.version, this.options, other);\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0;\n }\n other = new SemVer(other, this.options);\n }\n if (other.version === this.version) {\n return 0;\n }\n return this.compareMain(other) || this.comparePre(other);\n }\n compareMain(other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options);\n }\n return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);\n }\n comparePre(other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options);\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1;\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1;\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0;\n }\n let i = 0;\n do {\n const a = this.prerelease[i];\n const b = other.prerelease[i];\n debug('prerelease compare', i, a, b);\n if (a === undefined && b === undefined) {\n return 0;\n } else if (b === undefined) {\n return 1;\n } else if (a === undefined) {\n return -1;\n } else if (a === b) {\n continue;\n } else {\n return compareIdentifiers(a, b);\n }\n } while (++i);\n }\n compareBuild(other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options);\n }\n let i = 0;\n do {\n const a = this.build[i];\n const b = other.build[i];\n debug('prerelease compare', i, a, b);\n if (a === undefined && b === undefined) {\n return 0;\n } else if (b === undefined) {\n return 1;\n } else if (a === undefined) {\n return -1;\n } else if (a === b) {\n continue;\n } else {\n return compareIdentifiers(a, b);\n }\n } while (++i);\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc(release, identifier, identifierBase) {\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0;\n this.patch = 0;\n this.minor = 0;\n this.major++;\n this.inc('pre', identifier, identifierBase);\n break;\n case 'preminor':\n this.prerelease.length = 0;\n this.patch = 0;\n this.minor++;\n this.inc('pre', identifier, identifierBase);\n break;\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0;\n this.inc('patch', identifier, identifierBase);\n this.inc('pre', identifier, identifierBase);\n break;\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase);\n }\n this.inc('pre', identifier, identifierBase);\n break;\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {\n this.major++;\n }\n this.minor = 0;\n this.patch = 0;\n this.prerelease = [];\n break;\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++;\n }\n this.patch = 0;\n this.prerelease = [];\n break;\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++;\n }\n this.prerelease = [];\n break;\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre':\n {\n const base = Number(identifierBase) ? 1 : 0;\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty');\n }\n if (this.prerelease.length === 0) {\n this.prerelease = [base];\n } else {\n let i = this.prerelease.length;\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++;\n i = -2;\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists');\n }\n this.prerelease.push(base);\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base];\n if (identifierBase === false) {\n prerelease = [identifier];\n }\n if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = prerelease;\n }\n } else {\n this.prerelease = prerelease;\n }\n }\n break;\n }\n default:\n throw new Error(`invalid increment argument: ${release}`);\n }\n this.raw = this.format();\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`;\n }\n return this;\n }\n};\nvar semver = SemVer$1;\n\nconst SemVer = semver;\nconst compare$6 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));\nvar compare_1 = compare$6;\n\nconst compare$5 = compare_1;\nconst eq$1 = (a, b, loose) => compare$5(a, b, loose) === 0;\nvar eq_1 = eq$1;\n\nconst compare$4 = compare_1;\nconst neq$1 = (a, b, loose) => compare$4(a, b, loose) !== 0;\nvar neq_1 = neq$1;\n\nconst compare$3 = compare_1;\nconst gt$1 = (a, b, loose) => compare$3(a, b, loose) > 0;\nvar gt_1 = gt$1;\n\nconst compare$2 = compare_1;\nconst gte$1 = (a, b, loose) => compare$2(a, b, loose) >= 0;\nvar gte_1 = gte$1;\n\nconst compare$1 = compare_1;\nconst lt$1 = (a, b, loose) => compare$1(a, b, loose) < 0;\nvar lt_1 = lt$1;\n\nconst compare = compare_1;\nconst lte$1 = (a, b, loose) => compare(a, b, loose) <= 0;\nvar lte_1 = lte$1;\n\nconst eq = eq_1;\nconst neq = neq_1;\nconst gt = gt_1;\nconst gte = gte_1;\nconst lt = lt_1;\nconst lte = lte_1;\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version;\n }\n if (typeof b === 'object') {\n b = b.version;\n }\n return a === b;\n case '!==':\n if (typeof a === 'object') {\n a = a.version;\n }\n if (typeof b === 'object') {\n b = b.version;\n }\n return a !== b;\n case '':\n case '=':\n case '==':\n return eq(a, b, loose);\n case '!=':\n return neq(a, b, loose);\n case '>':\n return gt(a, b, loose);\n case '>=':\n return gte(a, b, loose);\n case '<':\n return lt(a, b, loose);\n case '<=':\n return lte(a, b, loose);\n default:\n throw new TypeError(`Invalid operator: ${op}`);\n }\n};\nvar cmp_1 = cmp;\n\nvar comparator;\nvar hasRequiredComparator;\nfunction requireComparator() {\n if (hasRequiredComparator) return comparator;\n hasRequiredComparator = 1;\n const ANY = Symbol('SemVer ANY');\n // hoisted class for cyclic dependency\n class Comparator {\n static get ANY() {\n return ANY;\n }\n constructor(comp, options) {\n options = parseOptions(options);\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp;\n } else {\n comp = comp.value;\n }\n }\n comp = comp.trim().split(/\\s+/).join(' ');\n debug('comparator', comp, options);\n this.options = options;\n this.loose = !!options.loose;\n this.parse(comp);\n if (this.semver === ANY) {\n this.value = '';\n } else {\n this.value = this.operator + this.semver.version;\n }\n debug('comp', this);\n }\n parse(comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];\n const m = comp.match(r);\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`);\n }\n this.operator = m[1] !== undefined ? m[1] : '';\n if (this.operator === '=') {\n this.operator = '';\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY;\n } else {\n this.semver = new SemVer(m[2], this.options.loose);\n }\n }\n toString() {\n return this.value;\n }\n test(version) {\n debug('Comparator.test', version, this.options.loose);\n if (this.semver === ANY || version === ANY) {\n return true;\n }\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options);\n } catch (er) {\n return false;\n }\n }\n return cmp(version, this.operator, this.semver, this.options);\n }\n intersects(comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required');\n }\n if (this.operator === '') {\n if (this.value === '') {\n return true;\n }\n return new Range(comp.value, options).test(this.value);\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true;\n }\n return new Range(this.value, options).test(comp.semver);\n }\n options = parseOptions(options);\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease && (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false;\n }\n if (!options.includePrerelease && (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false;\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true;\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true;\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (this.semver.version === comp.semver.version && this.operator.includes('=') && comp.operator.includes('=')) {\n return true;\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) && this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true;\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) && this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true;\n }\n return false;\n }\n }\n comparator = Comparator;\n const parseOptions = parseOptions_1;\n const {\n safeRe: re,\n t\n } = reExports;\n const cmp = cmp_1;\n const debug = debug_1;\n const SemVer = semver;\n const Range = requireRange();\n return comparator;\n}\n\nvar range;\nvar hasRequiredRange;\nfunction requireRange() {\n if (hasRequiredRange) return range;\n hasRequiredRange = 1;\n // hoisted class for cyclic dependency\n class Range {\n constructor(range, options) {\n options = parseOptions(options);\n if (range instanceof Range) {\n if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {\n return range;\n } else {\n return new Range(range.raw, options);\n }\n }\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value;\n this.set = [[range]];\n this.format();\n return this;\n }\n this.options = options;\n this.loose = !!options.loose;\n this.includePrerelease = !!options.includePrerelease;\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().split(/\\s+/).join(' ');\n\n // First, split on ||\n this.set = this.raw.split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length);\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`);\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0];\n this.set = this.set.filter(c => !isNullSet(c[0]));\n if (this.set.length === 0) {\n this.set = [first];\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c];\n break;\n }\n }\n }\n }\n this.format();\n }\n format() {\n this.range = this.set.map(comps => comps.join(' ').trim()).join('||').trim();\n return this.range;\n }\n toString() {\n return this.range;\n }\n parseRange(range) {\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);\n const memoKey = memoOpts + ':' + range;\n const cached = cache.get(memoKey);\n if (cached) {\n return cached;\n }\n const loose = this.options.loose;\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease));\n debug('hyphen replace', range);\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);\n debug('comparator trim', range);\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace);\n debug('tilde trim', range);\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace);\n debug('caret trim', range);\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options));\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options);\n return !!comp.match(re[t.COMPARATORLOOSE]);\n });\n }\n debug('range list', rangeList);\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map();\n const comparators = rangeList.map(comp => new Comparator(comp, this.options));\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp];\n }\n rangeMap.set(comp.value, comp);\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('');\n }\n const result = [...rangeMap.values()];\n cache.set(memoKey, result);\n return result;\n }\n intersects(range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required');\n }\n return this.set.some(thisComparators => {\n return isSatisfiable(thisComparators, options) && range.set.some(rangeComparators => {\n return isSatisfiable(rangeComparators, options) && thisComparators.every(thisComparator => {\n return rangeComparators.every(rangeComparator => {\n return thisComparator.intersects(rangeComparator, options);\n });\n });\n });\n });\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test(version) {\n if (!version) {\n return false;\n }\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options);\n } catch (er) {\n return false;\n }\n }\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true;\n }\n }\n return false;\n }\n }\n range = Range;\n const LRU = lruCache;\n const cache = new LRU({\n max: 1000\n });\n const parseOptions = parseOptions_1;\n const Comparator = requireComparator();\n const debug = debug_1;\n const SemVer = semver;\n const {\n safeRe: re,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace\n } = reExports;\n const {\n FLAG_INCLUDE_PRERELEASE,\n FLAG_LOOSE\n } = constants;\n const isNullSet = c => c.value === '<0.0.0-0';\n const isAny = c => c.value === '';\n\n // take a set of comparators and determine whether there\n // exists a version which can satisfy it\n const isSatisfiable = (comparators, options) => {\n let result = true;\n const remainingComparators = comparators.slice();\n let testComparator = remainingComparators.pop();\n while (result && remainingComparators.length) {\n result = remainingComparators.every(otherComparator => {\n return testComparator.intersects(otherComparator, options);\n });\n testComparator = remainingComparators.pop();\n }\n return result;\n };\n\n // comprised of xranges, tildes, stars, and gtlt's at this point.\n // already replaced the hyphen ranges\n // turn into a set of JUST comparators.\n const parseComparator = (comp, options) => {\n debug('comp', comp, options);\n comp = replaceCarets(comp, options);\n debug('caret', comp);\n comp = replaceTildes(comp, options);\n debug('tildes', comp);\n comp = replaceXRanges(comp, options);\n debug('xrange', comp);\n comp = replaceStars(comp, options);\n debug('stars', comp);\n return comp;\n };\n const isX = id => !id || id.toLowerCase() === 'x' || id === '*';\n\n // ~, ~> --> * (any, kinda silly)\n // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n // ~0.0.1 --> >=0.0.1 <0.1.0-0\n const replaceTildes = (comp, options) => {\n return comp.trim().split(/\\s+/).map(c => replaceTilde(c, options)).join(' ');\n };\n const replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr);\n let ret;\n if (isX(M)) {\n ret = '';\n } else if (isX(m)) {\n ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;\n } else if (pr) {\n debug('replaceTilde pr', pr);\n ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;\n }\n debug('tilde return', ret);\n return ret;\n });\n };\n\n // ^ --> * (any, kinda silly)\n // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n // ^1.2.3 --> >=1.2.3 <2.0.0-0\n // ^1.2.0 --> >=1.2.0 <2.0.0-0\n // ^0.0.1 --> >=0.0.1 <0.0.2-0\n // ^0.1.0 --> >=0.1.0 <0.2.0-0\n const replaceCarets = (comp, options) => {\n return comp.trim().split(/\\s+/).map(c => replaceCaret(c, options)).join(' ');\n };\n const replaceCaret = (comp, options) => {\n debug('caret', comp, options);\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];\n const z = options.includePrerelease ? '-0' : '';\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr);\n let ret;\n if (isX(M)) {\n ret = '';\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;\n }\n } else if (pr) {\n debug('replaceCaret pr', pr);\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;\n } else {\n ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;\n }\n } else {\n debug('no pr');\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;\n } else {\n ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;\n }\n } else {\n ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;\n }\n }\n debug('caret return', ret);\n return ret;\n });\n };\n const replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options);\n return comp.split(/\\s+/).map(c => replaceXRange(c, options)).join(' ');\n };\n const replaceXRange = (comp, options) => {\n comp = comp.trim();\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr);\n const xM = isX(M);\n const xm = xM || isX(m);\n const xp = xm || isX(p);\n const anyX = xp;\n if (gtlt === '=' && anyX) {\n gtlt = '';\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : '';\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0';\n } else {\n // nothing is forbidden\n ret = '*';\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0;\n }\n p = 0;\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>=';\n if (xm) {\n M = +M + 1;\n m = 0;\n p = 0;\n } else {\n m = +m + 1;\n p = 0;\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<';\n if (xm) {\n M = +M + 1;\n } else {\n m = +m + 1;\n }\n }\n if (gtlt === '<') {\n pr = '-0';\n }\n ret = `${gtlt + M}.${m}.${p}${pr}`;\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;\n }\n debug('xRange return', ret);\n return ret;\n });\n };\n\n // Because * is AND-ed with everything else in the comparator,\n // and '' means \"any version\", just remove the *s entirely.\n const replaceStars = (comp, options) => {\n debug('replaceStars', comp, options);\n // Looseness is ignored here. star is always as loose as it gets!\n return comp.trim().replace(re[t.STAR], '');\n };\n const replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options);\n return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '');\n };\n\n // This function is passed to string.replace(re[t.HYPHENRANGE])\n // M, m, patch, prerelease, build\n // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n // 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {\n if (isX(fM)) {\n from = '';\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`;\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;\n } else if (fpr) {\n from = `>=${from}`;\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`;\n }\n if (isX(tM)) {\n to = '';\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`;\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`;\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`;\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`;\n } else {\n to = `<=${to}`;\n }\n return `${from} ${to}`.trim();\n };\n const testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false;\n }\n }\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver);\n if (set[i].semver === Comparator.ANY) {\n continue;\n }\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver;\n if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {\n return true;\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false;\n }\n return true;\n };\n return range;\n}\n\nconst Range = requireRange();\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options);\n } catch (er) {\n return false;\n }\n return range.test(version);\n};\nvar satisfies_1 = satisfies;\nvar satisfies$1 = /*@__PURE__*/getDefaultExportFromCjs(satisfies_1);\n\n/**\n * Open editor url in a new window, and pass a message.\n */\nfunction post (window, url, data) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const editor = window.open(url);\n const wait = 10_000;\n const step = 250;\n const {\n origin\n } = new URL(url);\n // eslint-disable-next-line no-bitwise\n let count = ~~(wait / step);\n function listen(evt) {\n if (evt.source === editor) {\n count = 0;\n window.removeEventListener('message', listen, false);\n }\n }\n window.addEventListener('message', listen, false);\n\n // send message\n // periodically resend until ack received or timeout\n function send() {\n if (count <= 0) {\n return;\n }\n editor.postMessage(data, origin);\n setTimeout(send, step);\n count -= 1;\n }\n setTimeout(send, step);\n}\n\n// generated with build-style.sh\nvar embedStyle = `.vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box;\n}\n.vega-embed.has-actions {\n padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: \"\";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n`;\n\nfunction mergeDeep(dest, ...src) {\n for (const s of src) {\n deepMerge_(dest, s);\n }\n return dest;\n}\nfunction deepMerge_(dest, src) {\n for (const property of Object.keys(src)) {\n writeConfig(dest, property, src[property], true);\n }\n}\n\nvar name = \"vega-embed\";\nvar version$1 = \"6.23.0\";\nvar description = \"Publish Vega visualizations as embedded web components.\";\nvar keywords = [\"vega\", \"data\", \"visualization\", \"component\", \"embed\"];\nvar repository = {\n type: \"git\",\n url: \"http://github.com/vega/vega-embed.git\"\n};\nvar author = {\n name: \"UW Interactive Data Lab\",\n url: \"http://idl.cs.washington.edu\"\n};\nvar contributors = [{\n name: \"Dominik Moritz\",\n url: \"https://www.domoritz.de\"\n}];\nvar bugs = {\n url: \"https://github.com/vega/vega-embed/issues\"\n};\nvar homepage = \"https://github.com/vega/vega-embed#readme\";\nvar license = \"BSD-3-Clause\";\nvar main = \"build/vega-embed.js\";\nvar module = \"build/vega-embed.module.js\";\nvar unpkg = \"build/vega-embed.min.js\";\nvar jsdelivr = \"build/vega-embed.min.js\";\nvar types = \"build/vega-embed.module.d.ts\";\nvar files = [\"src\", \"build\", \"patches\"];\nvar devDependencies = {\n \"@babel/core\": \"^7.22.9\",\n \"@babel/plugin-proposal-async-generator-functions\": \"^7.20.7\",\n \"@babel/plugin-proposal-json-strings\": \"^7.18.6\",\n \"@babel/plugin-proposal-object-rest-spread\": \"^7.20.7\",\n \"@babel/plugin-proposal-optional-catch-binding\": \"^7.18.6\",\n \"@babel/plugin-transform-runtime\": \"^7.22.9\",\n \"@babel/preset-env\": \"^7.22.9\",\n \"@babel/preset-typescript\": \"^7.22.5\",\n \"@release-it/conventional-changelog\": \"^7.0.0\",\n \"@rollup/plugin-commonjs\": \"25.0.4\",\n \"@rollup/plugin-json\": \"^6.0.0\",\n \"@rollup/plugin-node-resolve\": \"^15.1.0\",\n \"@rollup/plugin-terser\": \"^0.4.3\",\n \"@types/semver\": \"^7.5.0\",\n \"@typescript-eslint/eslint-plugin\": \"^6.2.0\",\n \"@typescript-eslint/parser\": \"^6.2.0\",\n \"browser-sync\": \"^2.29.3\",\n concurrently: \"^8.2.0\",\n \"del-cli\": \"^5.0.0\",\n eslint: \"^8.46.0\",\n \"eslint-config-prettier\": \"^9.0.0\",\n \"eslint-plugin-jest\": \"^27.2.3\",\n \"eslint-plugin-prettier\": \"^5.0.0\",\n jest: \"^29.6.2\",\n \"jest-canvas-mock\": \"^2.5.2\",\n \"jest-environment-jsdom\": \"^29.6.2\",\n \"patch-package\": \"^8.0.0\",\n \"postinstall-postinstall\": \"^2.1.0\",\n prettier: \"^3.0.0\",\n \"release-it\": \"^16.1.3\",\n rollup: \"3.29.1\",\n \"rollup-plugin-bundle-size\": \"^1.0.3\",\n \"rollup-plugin-ts\": \"^3.2.0\",\n sass: \"^1.64.1\",\n typescript: \"^5.1.6\",\n vega: \"^5.22.1\",\n \"vega-lite\": \"^5.2.0\"\n};\nvar peerDependencies = {\n vega: \"^5.21.0\",\n \"vega-lite\": \"*\"\n};\nvar dependencies = {\n \"fast-json-patch\": \"^3.1.1\",\n \"json-stringify-pretty-compact\": \"^3.0.0\",\n semver: \"^7.5.4\",\n tslib: \"^2.6.1\",\n \"vega-interpreter\": \"^1.0.5\",\n \"vega-schema-url-parser\": \"^2.2.0\",\n \"vega-themes\": \"^2.14.0\",\n \"vega-tooltip\": \"^0.33.0\"\n};\nvar bundledDependencies = [\"yallist\"];\nvar scripts = {\n prebuild: \"yarn clean && yarn build:style\",\n build: \"rollup -c\",\n \"build:style\": \"./build-style.sh\",\n clean: \"del-cli build src/style.ts\",\n prepublishOnly: \"yarn clean && yarn build\",\n preversion: \"yarn lint && yarn test\",\n serve: \"browser-sync start --directory -s -f build *.html\",\n start: \"yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'\",\n pretest: \"yarn build:style\",\n test: \"jest\",\n \"test:inspect\": \"node --inspect-brk ./node_modules/.bin/jest --runInBand\",\n prettierbase: \"prettier '*.{css,scss,html}'\",\n format: \"eslint . --fix && yarn prettierbase --write\",\n lint: \"eslint . && yarn prettierbase --check\",\n release: \"release-it\"\n};\nvar pkg = {\n name: name,\n version: version$1,\n description: description,\n keywords: keywords,\n repository: repository,\n author: author,\n contributors: contributors,\n bugs: bugs,\n homepage: homepage,\n license: license,\n main: main,\n module: module,\n unpkg: unpkg,\n jsdelivr: jsdelivr,\n types: types,\n files: files,\n devDependencies: devDependencies,\n peerDependencies: peerDependencies,\n dependencies: dependencies,\n bundledDependencies: bundledDependencies,\n scripts: scripts\n};\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nconst version = pkg.version;\nconst vega = vegaImport;\nlet vegaLite = vegaLiteImport;\n\n// For backwards compatibility with Vega-Lite before v4.\nconst w = typeof window !== 'undefined' ? window : undefined;\nif (vegaLite === undefined && w?.vl?.compile) {\n vegaLite = w.vl;\n}\nconst DEFAULT_ACTIONS = {\n export: {\n svg: true,\n png: true\n },\n source: true,\n compiled: true,\n editor: true\n};\nconst I18N = {\n CLICK_TO_VIEW_ACTIONS: 'Click to view actions',\n COMPILED_ACTION: 'View Compiled Vega',\n EDITOR_ACTION: 'Open in Vega Editor',\n PNG_ACTION: 'Save as PNG',\n SOURCE_ACTION: 'View Source',\n SVG_ACTION: 'Save as SVG'\n};\nconst NAMES = {\n vega: 'Vega',\n 'vega-lite': 'Vega-Lite'\n};\nconst VERSION = {\n vega: vega.version,\n 'vega-lite': vegaLite ? vegaLite.version : 'not available'\n};\nconst PREPROCESSOR = {\n vega: vgSpec => vgSpec,\n 'vega-lite': (vlSpec, config) => vegaLite.compile(vlSpec, {\n config: config\n }).spec\n};\nconst SVG_CIRCLES = `\n\n \n \n \n`;\nconst CHART_WRAPPER_CLASS = 'chart-wrapper';\nfunction isTooltipHandler(h) {\n return typeof h === 'function';\n}\nfunction viewSource(source, sourceHeader, sourceFooter, mode) {\n const header = `${sourceHeader}
`;\n  const footer = `
${sourceFooter}`;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const win = window.open('');\n win.document.write(header + source + footer);\n win.document.title = `${NAMES[mode]} JSON Source`;\n}\n\n/**\n * Try to guess the type of spec.\n *\n * @param spec Vega or Vega-Lite spec.\n */\nfunction guessMode(spec, providedMode) {\n // Decide mode\n if (spec.$schema) {\n const parsed = schemaParser(spec.$schema);\n if (providedMode && providedMode !== parsed.library) {\n console.warn(`The given visualization spec is written in ${NAMES[parsed.library]}, but mode argument sets ${NAMES[providedMode] ?? providedMode}.`);\n }\n const mode = parsed.library;\n if (!satisfies$1(VERSION[mode], `^${parsed.version.slice(1)}`)) {\n console.warn(`The input spec uses ${NAMES[mode]} ${parsed.version}, but the current version of ${NAMES[mode]} is v${VERSION[mode]}.`);\n }\n return mode;\n }\n\n // try to guess from the provided spec\n if ('mark' in spec || 'encoding' in spec || 'layer' in spec || 'hconcat' in spec || 'vconcat' in spec || 'facet' in spec || 'repeat' in spec) {\n return 'vega-lite';\n }\n if ('marks' in spec || 'signals' in spec || 'scales' in spec || 'axes' in spec) {\n return 'vega';\n }\n return providedMode ?? 'vega';\n}\nfunction isLoader(o) {\n return !!(o && 'load' in o);\n}\nfunction createLoader(opts) {\n return isLoader(opts) ? opts : vega.loader(opts);\n}\nfunction embedOptionsFromUsermeta(parsedSpec) {\n const opts = parsedSpec.usermeta?.embedOptions ?? {};\n if (isString(opts.defaultStyle)) {\n // we don't allow styles set via usermeta since it would allow injection of logic (we set the style via innerHTML)\n opts.defaultStyle = false;\n }\n return opts;\n}\n\n/**\n * Embed a Vega visualization component in a web page. This function returns a promise.\n *\n * @param el DOM element in which to place component (DOM node or CSS selector).\n * @param spec String : A URL string from which to load the Vega specification.\n * Object : The Vega/Vega-Lite specification as a parsed JSON object.\n * @param opts A JavaScript object containing options for embedding.\n */\nasync function embed(el, spec, opts = {}) {\n let parsedSpec;\n let loader;\n if (isString(spec)) {\n loader = createLoader(opts.loader);\n parsedSpec = JSON.parse(await loader.load(spec));\n } else {\n parsedSpec = spec;\n }\n const loadedEmbedOptions = embedOptionsFromUsermeta(parsedSpec);\n const usermetaLoader = loadedEmbedOptions.loader;\n\n // either create the loader for the first time or create a new loader if the spec has new loader options\n if (!loader || usermetaLoader) {\n loader = createLoader(opts.loader ?? usermetaLoader);\n }\n const usermetaOpts = await loadOpts(loadedEmbedOptions, loader);\n const parsedOpts = await loadOpts(opts, loader);\n const mergedOpts = _objectSpread(_objectSpread({}, mergeDeep(parsedOpts, usermetaOpts)), {}, {\n config: mergeConfig(parsedOpts.config ?? {}, usermetaOpts.config ?? {})\n });\n return await _embed(el, parsedSpec, mergedOpts, loader);\n}\nasync function loadOpts(opt, loader) {\n const config = isString(opt.config) ? JSON.parse(await loader.load(opt.config)) : opt.config ?? {};\n const patch = isString(opt.patch) ? JSON.parse(await loader.load(opt.patch)) : opt.patch;\n return _objectSpread(_objectSpread(_objectSpread({}, opt), patch ? {\n patch\n } : {}), config ? {\n config\n } : {});\n}\nfunction getRoot(el) {\n const possibleRoot = el.getRootNode ? el.getRootNode() : document;\n return possibleRoot instanceof ShadowRoot ? {\n root: possibleRoot,\n rootContainer: possibleRoot\n } : {\n root: document,\n rootContainer: document.head ?? document.body\n };\n}\nasync function _embed(el, spec, opts = {}, loader) {\n const config = opts.theme ? mergeConfig(themes[opts.theme], opts.config ?? {}) : opts.config;\n const actions = isBoolean(opts.actions) ? opts.actions : mergeDeep({}, DEFAULT_ACTIONS, opts.actions ?? {});\n const i18n = _objectSpread(_objectSpread({}, I18N), opts.i18n);\n const renderer = opts.renderer ?? 'canvas';\n const logLevel = opts.logLevel ?? vega.Warn;\n const downloadFileName = opts.downloadFileName ?? 'visualization';\n const element = typeof el === 'string' ? document.querySelector(el) : el;\n if (!element) {\n throw new Error(`${el} does not exist`);\n }\n if (opts.defaultStyle !== false) {\n const ID = 'vega-embed-style';\n const {\n root,\n rootContainer\n } = getRoot(element);\n if (!root.getElementById(ID)) {\n const style = document.createElement('style');\n style.id = ID;\n style.innerHTML = opts.defaultStyle === undefined || opts.defaultStyle === true ? (embedStyle ).toString() : opts.defaultStyle;\n rootContainer.appendChild(style);\n }\n }\n const mode = guessMode(spec, opts.mode);\n let vgSpec = PREPROCESSOR[mode](spec, config);\n if (mode === 'vega-lite') {\n if (vgSpec.$schema) {\n const parsed = schemaParser(vgSpec.$schema);\n if (!satisfies$1(VERSION.vega, `^${parsed.version.slice(1)}`)) {\n console.warn(`The compiled spec uses Vega ${parsed.version}, but current version is v${VERSION.vega}.`);\n }\n }\n }\n element.classList.add('vega-embed');\n if (actions) {\n element.classList.add('has-actions');\n }\n element.innerHTML = ''; // clear container\n\n let container = element;\n if (actions) {\n const chartWrapper = document.createElement('div');\n chartWrapper.classList.add(CHART_WRAPPER_CLASS);\n element.appendChild(chartWrapper);\n container = chartWrapper;\n }\n const patch = opts.patch;\n if (patch) {\n vgSpec = patch instanceof Function ? patch(vgSpec) : applyPatch(vgSpec, patch, true, false).newDocument;\n }\n\n // Set locale. Note that this is a global setting.\n if (opts.formatLocale) {\n vega.formatLocale(opts.formatLocale);\n }\n if (opts.timeFormatLocale) {\n vega.timeFormatLocale(opts.timeFormatLocale);\n }\n\n // Set custom expression functions\n if (opts.expressionFunctions) {\n for (const name in opts.expressionFunctions) {\n const expressionFunction = opts.expressionFunctions[name];\n if ('fn' in expressionFunction) {\n vega.expressionFunction(name, expressionFunction.fn, expressionFunction['visitor']);\n } else if (expressionFunction instanceof Function) {\n vega.expressionFunction(name, expressionFunction);\n }\n }\n }\n const {\n ast\n } = opts;\n\n // Do not apply the config to Vega when we have already applied it to Vega-Lite.\n // This call may throw an Error if parsing fails.\n const runtime = vega.parse(vgSpec, mode === 'vega-lite' ? {} : config, {\n ast\n });\n const view = new (opts.viewClass || vega.View)(runtime, _objectSpread({\n loader,\n logLevel,\n renderer\n }, ast ? {\n expr: vega.expressionInterpreter ?? opts.expr ?? expressionInterpreter\n } : {}));\n view.addSignalListener('autosize', (_, autosize) => {\n const {\n type\n } = autosize;\n if (type == 'fit-x') {\n container.classList.add('fit-x');\n container.classList.remove('fit-y');\n } else if (type == 'fit-y') {\n container.classList.remove('fit-x');\n container.classList.add('fit-y');\n } else if (type == 'fit') {\n container.classList.add('fit-x', 'fit-y');\n } else {\n container.classList.remove('fit-x', 'fit-y');\n }\n });\n if (opts.tooltip !== false) {\n const handler = isTooltipHandler(opts.tooltip) ? opts.tooltip :\n // user provided boolean true or tooltip options\n new Handler(opts.tooltip === true ? {} : opts.tooltip).call;\n view.tooltip(handler);\n }\n let {\n hover\n } = opts;\n if (hover === undefined) {\n hover = mode === 'vega';\n }\n if (hover) {\n const {\n hoverSet,\n updateSet\n } = typeof hover === 'boolean' ? {} : hover;\n view.hover(hoverSet, updateSet);\n }\n if (opts) {\n if (opts.width != null) {\n view.width(opts.width);\n }\n if (opts.height != null) {\n view.height(opts.height);\n }\n if (opts.padding != null) {\n view.padding(opts.padding);\n }\n }\n await view.initialize(container, opts.bind).runAsync();\n let documentClickHandler;\n if (actions !== false) {\n let wrapper = element;\n if (opts.defaultStyle !== false || opts.forceActionsMenu) {\n const details = document.createElement('details');\n details.title = i18n.CLICK_TO_VIEW_ACTIONS;\n element.append(details);\n wrapper = details;\n const summary = document.createElement('summary');\n summary.innerHTML = SVG_CIRCLES;\n details.append(summary);\n documentClickHandler = ev => {\n if (!details.contains(ev.target)) {\n details.removeAttribute('open');\n }\n };\n document.addEventListener('click', documentClickHandler);\n }\n const ctrl = document.createElement('div');\n wrapper.append(ctrl);\n ctrl.classList.add('vega-actions');\n\n // add 'Export' action\n if (actions === true || actions.export !== false) {\n for (const ext of ['svg', 'png']) {\n if (actions === true || actions.export === true || actions.export[ext]) {\n const i18nExportAction = i18n[`${ext.toUpperCase()}_ACTION`];\n const exportLink = document.createElement('a');\n const scaleFactor = isObject(opts.scaleFactor) ? opts.scaleFactor[ext] : opts.scaleFactor;\n exportLink.text = i18nExportAction;\n exportLink.href = '#';\n exportLink.target = '_blank';\n exportLink.download = `${downloadFileName}.${ext}`;\n // add link on mousedown so that it's correct when the click happens\n exportLink.addEventListener('mousedown', async function (e) {\n e.preventDefault();\n const url = await view.toImageURL(ext, scaleFactor);\n this.href = url;\n });\n ctrl.append(exportLink);\n }\n }\n }\n\n // add 'View Source' action\n if (actions === true || actions.source !== false) {\n const viewSourceLink = document.createElement('a');\n viewSourceLink.text = i18n.SOURCE_ACTION;\n viewSourceLink.href = '#';\n viewSourceLink.addEventListener('click', function (e) {\n viewSource(stringify(spec), opts.sourceHeader ?? '', opts.sourceFooter ?? '', mode);\n e.preventDefault();\n });\n ctrl.append(viewSourceLink);\n }\n\n // add 'View Compiled' action\n if (mode === 'vega-lite' && (actions === true || actions.compiled !== false)) {\n const compileLink = document.createElement('a');\n compileLink.text = i18n.COMPILED_ACTION;\n compileLink.href = '#';\n compileLink.addEventListener('click', function (e) {\n viewSource(stringify(vgSpec), opts.sourceHeader ?? '', opts.sourceFooter ?? '', 'vega');\n e.preventDefault();\n });\n ctrl.append(compileLink);\n }\n\n // add 'Open in Vega Editor' action\n if (actions === true || actions.editor !== false) {\n const editorUrl = opts.editorUrl ?? 'https://vega.github.io/editor/';\n const editorLink = document.createElement('a');\n editorLink.text = i18n.EDITOR_ACTION;\n editorLink.href = '#';\n editorLink.addEventListener('click', function (e) {\n post(window, editorUrl, {\n config: config,\n mode,\n renderer,\n spec: stringify(spec)\n });\n e.preventDefault();\n });\n ctrl.append(editorLink);\n }\n }\n function finalize() {\n if (documentClickHandler) {\n document.removeEventListener('click', documentClickHandler);\n }\n view.finalize();\n }\n return {\n view,\n spec,\n vgSpec,\n finalize,\n embedOptions: opts\n };\n}\n\nexport { DEFAULT_ACTIONS, embed as default, guessMode, vega, vegaLite, version };\n//# sourceMappingURL=vega-embed.module.js.map\n","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n","import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return Array.from(this.children);\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n// Given some data, this returns an array-like view of it: an object that\n// exposes a length property and allows numeric indexing. Note that unlike\n// selectAll, this isn’t worried about “live” collections because the resulting\n// array will only be used briefly while data is being bound. (It is possible to\n// cause the data to change while iterating by using a key function, but please\n// don’t; we’d rather avoid a gratuitous copy.)\nfunction arraylike(data) {\n return typeof data === \"object\" && \"length\" in data\n ? data // Array, TypedArray, NodeList, array-like\n : Array.from(data); // Map, Set, iterable, string, or anything else\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n","import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n","import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n","import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n return array(select.apply(this, arguments));\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","// Given something array like (or null), returns something that is strictly an\n// array. This is used to ensure that array-like objects passed to d3.selectAll\n// or selection.selectAll are converted into proper arrays when creating a\n// selection; we don’t ever want to create a selection backed by a live\n// HTMLCollection or NodeList. However, note that selection.selectAll will use a\n// static NodeList as a group, since it safely derived from querySelectorAll.\nexport default function array(x) {\n return x == null ? [] : Array.isArray(x) ? x : Array.from(x);\n}\n","import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n if (typeof onenter === \"function\") {\n enter = onenter(enter);\n if (enter) enter = enter.selection();\n } else {\n enter = enter.append(onenter + \"\");\n }\n if (onupdate != null) {\n update = onupdate(update);\n if (update) update = update.selection();\n }\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(context) {\n var selection = context.selection ? context.selection() : context;\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n","import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n","import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n","import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n","import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n","import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n","import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n","import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n","import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n selectChild: selection_prototype.selectChild,\n selectChildren: selection_prototype.selectChildren,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n","import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n","import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n","import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n","import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n","import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n","import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n","function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n","import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n","function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n","function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n","import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n","import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n","import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n","export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n","import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n","import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n","import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolate} from \"d3-interpolate\";\nimport {pointer, select} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport BrushEvent from \"./event.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\nvar MODE_DRAG = {name: \"drag\"},\n MODE_SPACE = {name: \"space\"},\n MODE_HANDLE = {name: \"handle\"},\n MODE_CENTER = {name: \"center\"};\n\nconst {abs, max, min} = Math;\n\nfunction number1(e) {\n return [+e[0], +e[1]];\n}\n\nfunction number2(e) {\n return [number1(e[0]), number1(e[1])];\n}\n\nvar X = {\n name: \"x\",\n handles: [\"w\", \"e\"].map(type),\n input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },\n output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }\n};\n\nvar Y = {\n name: \"y\",\n handles: [\"n\", \"s\"].map(type),\n input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },\n output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }\n};\n\nvar XY = {\n name: \"xy\",\n handles: [\"n\", \"w\", \"e\", \"s\", \"nw\", \"ne\", \"sw\", \"se\"].map(type),\n input: function(xy) { return xy == null ? null : number2(xy); },\n output: function(xy) { return xy; }\n};\n\nvar cursors = {\n overlay: \"crosshair\",\n selection: \"move\",\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n};\n\nvar flipX = {\n e: \"w\",\n w: \"e\",\n nw: \"ne\",\n ne: \"nw\",\n se: \"sw\",\n sw: \"se\"\n};\n\nvar flipY = {\n n: \"s\",\n s: \"n\",\n nw: \"sw\",\n ne: \"se\",\n se: \"ne\",\n sw: \"nw\"\n};\n\nvar signsX = {\n overlay: +1,\n selection: +1,\n n: null,\n e: +1,\n s: null,\n w: -1,\n nw: -1,\n ne: +1,\n se: +1,\n sw: -1\n};\n\nvar signsY = {\n overlay: +1,\n selection: +1,\n n: -1,\n e: null,\n s: +1,\n w: null,\n nw: -1,\n ne: -1,\n se: +1,\n sw: +1\n};\n\nfunction type(t) {\n return {type: t};\n}\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n if (svg.hasAttribute(\"viewBox\")) {\n svg = svg.viewBox.baseVal;\n return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];\n }\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\n// Like d3.local, but with the name “__brush” rather than auto-generated.\nfunction local(node) {\n while (!node.__brush) if (!(node = node.parentNode)) return;\n return node.__brush;\n}\n\nfunction empty(extent) {\n return extent[0][0] === extent[1][0]\n || extent[0][1] === extent[1][1];\n}\n\nexport function brushSelection(node) {\n var state = node.__brush;\n return state ? state.dim.output(state.selection) : null;\n}\n\nexport function brushX() {\n return brush(X);\n}\n\nexport function brushY() {\n return brush(Y);\n}\n\nexport default function() {\n return brush(XY);\n}\n\nfunction brush(dim) {\n var extent = defaultExtent,\n filter = defaultFilter,\n touchable = defaultTouchable,\n keys = true,\n listeners = dispatch(\"start\", \"brush\", \"end\"),\n handleSize = 6,\n touchending;\n\n function brush(group) {\n var overlay = group\n .property(\"__brush\", initialize)\n .selectAll(\".overlay\")\n .data([type(\"overlay\")]);\n\n overlay.enter().append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"cursor\", cursors.overlay)\n .merge(overlay)\n .each(function() {\n var extent = local(this).extent;\n select(this)\n .attr(\"x\", extent[0][0])\n .attr(\"y\", extent[0][1])\n .attr(\"width\", extent[1][0] - extent[0][0])\n .attr(\"height\", extent[1][1] - extent[0][1]);\n });\n\n group.selectAll(\".selection\")\n .data([type(\"selection\")])\n .enter().append(\"rect\")\n .attr(\"class\", \"selection\")\n .attr(\"cursor\", cursors.selection)\n .attr(\"fill\", \"#777\")\n .attr(\"fill-opacity\", 0.3)\n .attr(\"stroke\", \"#fff\")\n .attr(\"shape-rendering\", \"crispEdges\");\n\n var handle = group.selectAll(\".handle\")\n .data(dim.handles, function(d) { return d.type; });\n\n handle.exit().remove();\n\n handle.enter().append(\"rect\")\n .attr(\"class\", function(d) { return \"handle handle--\" + d.type; })\n .attr(\"cursor\", function(d) { return cursors[d.type]; });\n\n group\n .each(redraw)\n .attr(\"fill\", \"none\")\n .attr(\"pointer-events\", \"all\")\n .on(\"mousedown.brush\", started)\n .filter(touchable)\n .on(\"touchstart.brush\", started)\n .on(\"touchmove.brush\", touchmoved)\n .on(\"touchend.brush touchcancel.brush\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n brush.move = function(group, selection, event) {\n if (group.tween) {\n group\n .on(\"start.brush\", function(event) { emitter(this, arguments).beforestart().start(event); })\n .on(\"interrupt.brush end.brush\", function(event) { emitter(this, arguments).end(event); })\n .tween(\"brush\", function() {\n var that = this,\n state = that.__brush,\n emit = emitter(that, arguments),\n selection0 = state.selection,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(this, arguments) : selection, state.extent),\n i = interpolate(selection0, selection1);\n\n function tween(t) {\n state.selection = t === 1 && selection1 === null ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 !== null && selection1 !== null ? tween : tween(1);\n });\n } else {\n group\n .each(function() {\n var that = this,\n args = arguments,\n state = that.__brush,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(that, args) : selection, state.extent),\n emit = emitter(that, args).beforestart();\n\n interrupt(that);\n state.selection = selection1 === null ? null : selection1;\n redraw.call(that);\n emit.start(event).brush(event).end(event);\n });\n }\n };\n\n brush.clear = function(group, event) {\n brush.move(group, null, event);\n };\n\n function redraw() {\n var group = select(this),\n selection = local(this).selection;\n\n if (selection) {\n group.selectAll(\".selection\")\n .style(\"display\", null)\n .attr(\"x\", selection[0][0])\n .attr(\"y\", selection[0][1])\n .attr(\"width\", selection[1][0] - selection[0][0])\n .attr(\"height\", selection[1][1] - selection[0][1]);\n\n group.selectAll(\".handle\")\n .style(\"display\", null)\n .attr(\"x\", function(d) { return d.type[d.type.length - 1] === \"e\" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })\n .attr(\"y\", function(d) { return d.type[0] === \"s\" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })\n .attr(\"width\", function(d) { return d.type === \"n\" || d.type === \"s\" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })\n .attr(\"height\", function(d) { return d.type === \"e\" || d.type === \"w\" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });\n }\n\n else {\n group.selectAll(\".selection,.handle\")\n .style(\"display\", \"none\")\n .attr(\"x\", null)\n .attr(\"y\", null)\n .attr(\"width\", null)\n .attr(\"height\", null);\n }\n }\n\n function emitter(that, args, clean) {\n var emit = that.__brush.emitter;\n return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean);\n }\n\n function Emitter(that, args, clean) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\n this.clean = clean;\n }\n\n Emitter.prototype = {\n beforestart: function() {\n if (++this.active === 1) this.state.emitter = this, this.starting = true;\n return this;\n },\n start: function(event, mode) {\n if (this.starting) this.starting = false, this.emit(\"start\", event, mode);\n else this.emit(\"brush\", event);\n return this;\n },\n brush: function(event, mode) {\n this.emit(\"brush\", event, mode);\n return this;\n },\n end: function(event, mode) {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\", event, mode);\n return this;\n },\n emit: function(type, event, mode) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new BrushEvent(type, {\n sourceEvent: event,\n target: brush,\n selection: dim.output(this.state.selection),\n mode,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function started(event) {\n if (touchending && !event.touches) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = event.target.__data__.type,\n mode = (keys && event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (keys && event.altKey ? MODE_CENTER : MODE_HANDLE),\n signX = dim === Y ? null : signsX[type],\n signY = dim === X ? null : signsY[type],\n state = local(that),\n extent = state.extent,\n selection = state.selection,\n W = extent[0][0], w0, w1,\n N = extent[0][1], n0, n1,\n E = extent[1][0], e0, e1,\n S = extent[1][1], s0, s1,\n dx = 0,\n dy = 0,\n moving,\n shifting = signX && signY && keys && event.shiftKey,\n lockX,\n lockY,\n points = Array.from(event.touches || [event], t => {\n const i = t.identifier;\n t = pointer(t, that);\n t.point0 = t.slice();\n t.identifier = i;\n return t;\n });\n\n interrupt(that);\n var emit = emitter(that, arguments, true).beforestart();\n\n if (type === \"overlay\") {\n if (selection) moving = true;\n const pts = [points[0], points[1] || points[0]];\n state.selection = selection = [[\n w0 = dim === Y ? W : min(pts[0][0], pts[1][0]),\n n0 = dim === X ? N : min(pts[0][1], pts[1][1])\n ], [\n e0 = dim === Y ? E : max(pts[0][0], pts[1][0]),\n s0 = dim === X ? S : max(pts[0][1], pts[1][1])\n ]];\n if (points.length > 1) move(event);\n } else {\n w0 = selection[0][0];\n n0 = selection[0][1];\n e0 = selection[1][0];\n s0 = selection[1][1];\n }\n\n w1 = w0;\n n1 = n0;\n e1 = e0;\n s1 = s0;\n\n var group = select(that)\n .attr(\"pointer-events\", \"none\");\n\n var overlay = group.selectAll(\".overlay\")\n .attr(\"cursor\", cursors[type]);\n\n if (event.touches) {\n emit.moved = moved;\n emit.ended = ended;\n } else {\n var view = select(event.view)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n if (keys) view\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n\n dragDisable(event.view);\n }\n\n redraw.call(that);\n emit.start(event, mode.name);\n\n function moved(event) {\n for (const p of event.changedTouches || [event]) {\n for (const d of points)\n if (d.identifier === p.identifier) d.cur = pointer(p, that);\n }\n if (shifting && !lockX && !lockY && points.length === 1) {\n const point = points[0];\n if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1]))\n lockY = true;\n else\n lockX = true;\n }\n for (const point of points)\n if (point.cur) point[0] = point.cur[0], point[1] = point.cur[1];\n moving = true;\n noevent(event);\n move(event);\n }\n\n function move(event) {\n const point = points[0], point0 = point.point0;\n var t;\n\n dx = point[0] - point0[0];\n dy = point[1] - point0[1];\n\n switch (mode) {\n case MODE_SPACE:\n case MODE_DRAG: {\n if (signX) dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (points[1]) {\n if (signX) w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1;\n if (signY) n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1;\n } else {\n if (signX < 0) dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n }\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX));\n if (signY) n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY));\n break;\n }\n }\n\n if (e1 < w1) {\n signX *= -1;\n t = w0, w0 = e0, e0 = t;\n t = w1, w1 = e1, e1 = t;\n if (type in flipX) overlay.attr(\"cursor\", cursors[type = flipX[type]]);\n }\n\n if (s1 < n1) {\n signY *= -1;\n t = n0, n0 = s0, s0 = t;\n t = n1, n1 = s1, s1 = t;\n if (type in flipY) overlay.attr(\"cursor\", cursors[type = flipY[type]]);\n }\n\n if (state.selection) selection = state.selection; // May be set by brush.move!\n if (lockX) w1 = selection[0][0], e1 = selection[1][0];\n if (lockY) n1 = selection[0][1], s1 = selection[1][1];\n\n if (selection[0][0] !== w1\n || selection[0][1] !== n1\n || selection[1][0] !== e1\n || selection[1][1] !== s1) {\n state.selection = [[w1, n1], [e1, s1]];\n redraw.call(that);\n emit.brush(event, mode.name);\n }\n }\n\n function ended(event) {\n nopropagation(event);\n if (event.touches) {\n if (event.touches.length) return;\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n } else {\n dragEnable(event.view, moving);\n view.on(\"keydown.brush keyup.brush mousemove.brush mouseup.brush\", null);\n }\n group.attr(\"pointer-events\", \"all\");\n overlay.attr(\"cursor\", cursors.overlay);\n if (state.selection) selection = state.selection; // May be set by brush.move (on start)!\n if (empty(selection)) state.selection = null, redraw.call(that);\n emit.end(event, mode.name);\n }\n\n function keydowned(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n shifting = signX && signY;\n break;\n }\n case 18: { // ALT\n if (mode === MODE_HANDLE) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n move(event);\n }\n break;\n }\n case 32: { // SPACE; takes priority over ALT\n if (mode === MODE_HANDLE || mode === MODE_CENTER) {\n if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;\n if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;\n mode = MODE_SPACE;\n overlay.attr(\"cursor\", cursors.selection);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n\n function keyupped(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move(event);\n }\n break;\n }\n case 18: { // ALT\n if (mode === MODE_CENTER) {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n move(event);\n }\n break;\n }\n case 32: { // SPACE\n if (mode === MODE_SPACE) {\n if (event.altKey) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n } else {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n }\n overlay.attr(\"cursor\", cursors[type]);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n }\n\n function touchmoved(event) {\n emitter(this, arguments).moved(event);\n }\n\n function touchended(event) {\n emitter(this, arguments).ended(event);\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = number2(extent.apply(this, arguments));\n state.dim = dim;\n return state;\n }\n\n brush.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant(number2(_)), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), brush) : filter;\n };\n\n brush.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), brush) : touchable;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\n };\n\n brush.keyModifiers = function(_) {\n return arguments.length ? (keys = !!_, brush) : keys;\n };\n\n brush.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? brush : value;\n };\n\n return brush;\n}\n","export function Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nexport var identity = new Transform(1, 0, 0);\n\ntransform.prototype = Transform.prototype;\n\nexport default function transform(node) {\n while (!node.__zoom) if (!(node = node.parentNode)) return identity;\n return node.__zoom;\n}\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { v4 as uuidv4 } from 'uuid';\nimport vegaEmbed, { EmbedOptions } from 'vega-embed';\nimport * as d3 from 'd3';\nimport * as debounce from 'lodash.debounce';\n\n\nexport default class Vega extends Component {\n constructor(props) {\n super(props);\n this.getRef = this.getRef.bind(this);\n this.divId = \"vega-\".concat(uuidv4());\n this.finalize = null;\n }\n\n getRef(el) {\n this.el = el;\n }\n\n componentDidMount() {\n this.update();\n }\n\n componentDidUpdate(prevProps) {\n if (this.props.id !== prevProps.id ||\n this.props.svgRendererScaleFactor !== prevProps.svgRendererScaleFactor ||\n JSON.stringify(this.props.opt) !== JSON.stringify(prevProps.opt) ||\n JSON.stringify(this.props.spec) !== JSON.stringify(prevProps.spec) ||\n JSON.stringify(this.props.style) !== JSON.stringify(prevProps.style) ||\n JSON.stringify(this.props.signalsToObserve) !== JSON.stringify(prevProps.signalsToObserve) ||\n this.props.className !== prevProps.className\n ) {\n this.update();\n }\n }\n\n cleanJson(data) {\n return JSON.parse(JSON.stringify(data))\n }\n\n update() {\n if (!this.props.spec) { return; }\n // Function exists if a view has been rendered before with this component\n // If so, it's better to call finalize before creating a new view to clean up\n // timers, event listeners, etc.\n if (this.finalize) { this.finalize(); }\n\n vegaEmbed(this.el, this.props.spec, this.props.opt).then((result) => {\n this.finalize = result.finalize;\n this.vegaView = result.view;\n let vegaSignals = this.vegaView.getState().signals || {};\n // Ignore the 'unit' signal as it's rather complex,\n // contains references which can't be serialized to JSON, and it's\n // not useful to most users in the Dash context\n if ('unit' in vegaSignals) {\n delete vegaSignals.unit;\n };\n // Only add signals to the props if they are in the signalsToObserve\n // list or if the list is equal to ['all'].\n // If the list is empty, no signals will be added to the props.\n let filteredSignals = {};\n if (this.props.signalsToObserve[0] === 'all') {\n filteredSignals = vegaSignals;\n } else {\n for (let signal in vegaSignals) {\n if (this.props.signalsToObserve.includes(signal)) {\n filteredSignals[signal] = vegaSignals[signal];\n }\n }\n }\n vegaSignals = filteredSignals;\n\n // Initially, set all signals so that the evaluated values are available\n // even if they never change. Else, the code below would only add\n // signals to the props if they change.\n this.props.setProps({ signalData: vegaSignals });\n\n const wait = this.props.debounceWait;\n const maxWait = wait;\n\n // Register signal listeners to update the props when signals change.\n const signalHandler = (name, value) => {\n // Not sure if this is needed but it's in the Jupyterchart\n // implementation in Vega-Altair. Worth to be\n // on the safe side for now.\n const cleanedValue = this.cleanJson(value);\n // Get a shallow copy of the signals. Shallow should be enough\n // as we overwrite the top level values anyway.\n let signalData = { ...this.props.signalData };\n signalData[name] = cleanedValue;\n this.props.setProps({ signalData: signalData });\n };\n for (let signal in vegaSignals) {\n this.vegaView.addSignalListener(signal, debounce(signalHandler, wait, { maxWait: maxWait }));\n }\n\n const options = this.props.opt || {};\n const renderer = options.renderer || 'canvas';\n if (renderer === 'svg' && this.props.svgRendererScaleFactor !== 1) {\n // Adjustment of width and height is based on https://github.com/vega/vega-lite/issues/1758#issuecomment-264677556\n const svg = d3.select(\"#\" + this.divId + \" svg\");\n const scaleFactor = this.props.svgRendererScaleFactor;\n const w = svg.attr(\"width\");\n const h = svg.attr(\"height\");\n svg.attr(\"width\", w * scaleFactor);\n svg.attr(\"height\", h * scaleFactor);\n }\n })\n }\n\n render() {\n return
;\n }\n}\n\nVega.defaultProps = { svgRendererScaleFactor: 1, signalsToObserve: [], signalData: {}, debounceWait: 10 };\n\nVega.propTypes = {\n /**\n * The ID used to identify this component in Dash callbacks.\n */\n id: PropTypes.string,\n\n /**\n * A Vega or Vega-Lite spec. To pass an Altair chart, use chart.to_dict().\n */\n spec: PropTypes.object,\n\n /**\n * Vega-Embed options. See https://github.com/vega/vega-embed#options for more details.\n */\n opt: PropTypes.object,\n\n /**\n * A number which is used to scale the chart in case the svg renderer is used.\n * This is useful when you want to increase the size of the chart keeping\n * the relative proportions of all chart elements to each other the same.\n * Default value is 1.\n */\n svgRendererScaleFactor: PropTypes.number,\n\n /**\n * A list of signal names to observe for changes. If you use Altair, these are the\n * names of the parameters you define. The values of these signals\n * will be available in the signalData property. You can pass [\"all\"] to\n * observe all signals.\n * Defaults to no signals.\n */\n signalsToObserve: PropTypes.arrayOf(PropTypes.string),\n\n /**\n * A read-only dictionary of signals with the key being the name of the signal.\n * The easiest way to make sense of it is to display the whole signalData dictionary\n * in your app layout or print it to the console\n * so that you see what the structure looks like.\n */\n signalData: PropTypes.object,\n\n /**\n * Generic style overrides on the Vega div\n */\n style: PropTypes.object,\n\n /**\n * Additional className of the Vega div\n */\n className: PropTypes.string,\n\n /**\n * Debouncing wait time in milliseconds before signals property is updated\n * Default value is 10.\n */\n debounceWait: PropTypes.number,\n\n /**\n * Dash-assigned callback that should be called to report property changes\n * to Dash, to make them available for callbacks.\n */\n setProps: PropTypes.func\n};\n","import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n","\"use strict\";\n\n// Note: This regex matches even invalid JSON strings, but since we’re\n// working on the output of `JSON.stringify` we know that only valid strings\n// are present (unless the user supplied a weird `options.indent` but in\n// that case we don’t care since the output would be invalid anyway).\nvar stringOrChar = /(\"(?:[^\\\\\"]|\\\\.)*\")|[:,]/g;\n\nmodule.exports = function stringify(passedObj, options) {\n var indent, maxLength, replacer;\n\n options = options || {};\n indent = JSON.stringify(\n [1],\n undefined,\n options.indent === undefined ? 2 : options.indent\n ).slice(2, -3);\n maxLength =\n indent === \"\"\n ? Infinity\n : options.maxLength === undefined\n ? 80\n : options.maxLength;\n replacer = options.replacer;\n\n return (function _stringify(obj, currentIndent, reserved) {\n // prettier-ignore\n var end, index, items, key, keyPart, keys, length, nextIndent, prettified, start, string, value;\n\n if (obj && typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n\n string = JSON.stringify(obj, replacer);\n\n if (string === undefined) {\n return string;\n }\n\n length = maxLength - currentIndent.length - reserved;\n\n if (string.length <= length) {\n prettified = string.replace(\n stringOrChar,\n function (match, stringLiteral) {\n return stringLiteral || match + \" \";\n }\n );\n if (prettified.length <= length) {\n return prettified;\n }\n }\n\n if (replacer != null) {\n obj = JSON.parse(string);\n replacer = undefined;\n }\n\n if (typeof obj === \"object\" && obj !== null) {\n nextIndent = currentIndent + indent;\n items = [];\n index = 0;\n\n if (Array.isArray(obj)) {\n start = \"[\";\n end = \"]\";\n length = obj.length;\n for (; index < length; index++) {\n items.push(\n _stringify(obj[index], nextIndent, index === length - 1 ? 0 : 1) ||\n \"null\"\n );\n }\n } else {\n start = \"{\";\n end = \"}\";\n keys = Object.keys(obj);\n length = keys.length;\n for (; index < length; index++) {\n key = keys[index];\n keyPart = JSON.stringify(key) + \": \";\n value = _stringify(\n obj[key],\n nextIndent,\n keyPart.length + (index === length - 1 ? 0 : 1)\n );\n if (value !== undefined) {\n items.push(keyPart + value);\n }\n }\n }\n\n if (items.length > 0) {\n return [start, indent + items.join(\",\\n\" + nextIndent), end].join(\n \"\\n\" + currentIndent\n );\n }\n }\n\n return string;\n })(passedObj, \"\", 0);\n};\n"],"names":["randomUUID","crypto","bind","getRandomValues","rnds8","Uint8Array","rng","Error","byteToHex","i","push","toString","slice","options","buf","offset","rnds","random","arr","unsafeStringify","extendStatics","__extends","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__","this","constructor","prototype","create","_hasOwnProperty","obj","key","call","_objectKeys","isArray","keys_1","length","k","keys","_deepClone","JSON","parse","stringify","isInteger","str","charCode","len","charCodeAt","escapePathComponent","path","indexOf","replace","unescapePathComponent","hasUndefined","undefined","i_1","objKeys","objKeysLength","patchErrorMessageFormatter","message","args","messageParts","value","join","PatchError","_super","name","index","operation","tree","_newTarget","_this","JsonPatchError","deepClone","objOps","add","document","newDocument","remove","removed","move","getValueByPointer","originalValue","applyOperation","op","from","copy","valueToCopy","test","_areEquals","_get","arrOps","splice","pointer","getOriginalDestination","validateOperation","mutateDocument","banPrototypeModifications","validator","returnValue","split","t","existingPathFragment","validateFunction","TypeError","applyPatch","patch","results","length_1","applyReducer","operationResult","pathLen","existingPathLen","error","sequence","externalValidator","e","a","arrA","arrB","beforeDict","WeakMap","Mirror","observers","Map","ObserverInfo","callback","observer","unobserve","root","observe","mirror","get","getMirror","observerInfo","getObserverFromMirror","set","next","dirtyCheck","generate","fastCheck","clearTimeout","setTimeout","window","addEventListener","patches","object","delete","removeObserverFromMirror","removeEventListener","invertible","_generate","temp","toJSON","newKeys","oldKeys","deleted","oldVal","newVal","compare","tree1","tree2","assign","accessor","fn","fields","fname","accessorName","accessorFields","getter","get1","getN","field","splitAccessPath","n","j","c","q","s","substring","opt","id","_","zero","one","truthy","falsy","log$1","method","level","input","concat","console","apply","None","Error$1","logger","handler","arguments","warn","info","debug","isObject","isLegalKey","mergeConfig","_len","configs","_key","reduce","out","source","signals","mergeNamed","r","layout","writeConfig","output","recurse","o","map","forEach","peek","array","toNumber","exp","sign","x","Math","log","symlog","log1p","abs","symexp","expm1","pow","exponent","pan","domain","delta","lift","ground","d0","d1","dd","panLinear","panLog","panPow","panSymlog","constant","zoom","anchor","scale","da","zoomLinear","zoomLog","zoomPow","zoomSymlog","quarter","date","Date","getMonth","utcquarter","getUTCMonth","clampRange","range","min","max","span","lo","hi","isFunction","DESCENDING","orders","ord","fmap","gen","comparator","f","ascending","u","v","compare1","compareN","order","debounce","delay","tid","extend","extent","extentIndex","hop","has","property","NULL","fastmap","has$1","size","empty","clear","clean","flush","threshold","left","right","center","l","inherits","child","parent","members","proto","defineProperty","writable","enumerable","configurable","inrange","r0","r1","isBoolean","isDate","isIterable","Symbol","iterator","isNumber","isRegExp","isString","flat","lerp","frac","DEFAULT_MAX_SIZE","lruCache","maxsize","curr","prev","update","merge","array0","array1","n0","n1","merged","i0","i1","repeat","reps","pad","padchar","align","ceil","$","toBoolean","defaultParser","toDate","parser","toSet","truncate","ellipsis","visitArray","filter","visitor","EOL","EOF","QUOTE","NEWLINE","RETURN","objectConverter","columns","Function","inferColumns","rows","columnSet","row","column","width","delimiter","reFormat","RegExp","DELIMITER","parseRows","text","N","I","eof","eol","token","preformatBody","formatValue","formatRow","year","hours","getUTCHours","minutes","getUTCMinutes","seconds","getUTCSeconds","milliseconds","getUTCMilliseconds","isNaN","getUTCFullYear","getUTCDate","formatDate","convert","customConverter","format","formatBody","formatRows","topology","objects","type","features","geometries","bbox","properties","geometry","transformPoint","transform","x0","y0","kx","ky","dx","translate","dy","arcs","arc","points","pop","reverse","point","line","ring","polygon","coordinates","stitchedArcs","fragmentByStart","fragmentByEnd","fragments","emptyIndex","start","end","g","p1","p0","dp","ends","fg","unshift","gf","meshArcs","geom","geomsByArc","extract0","extract1","extract2","extract3","geoms","extractArcs","stitch","e10","sqrt","e5","e2","tickSpec","stop","count","step","power","floor","log10","factor","i2","inc","round","ticks","tickIncrement","tickStep","prefixExponent","re","formatSpecifier","specifier","match","exec","FormatSpecifier","fill","symbol","comma","precision","trim","formatDecimalParts","toExponential","coefficient","NaN","toFixed","toLocaleString","toPrecision","formatRounded","toUpperCase","formatPrefix","prefixes","locale","grouping","thousands","group","Number","currencyPrefix","currency","currencySuffix","decimal","numerals","formatNumerals","String","percent","minus","nan","newFormat","formatTypes","prefix","toLowerCase","suffix","formatType","maybeSuffix","valuePrefix","valueSuffix","valueNegative","formatTrim","Infinity","padding","t0","t1","timeInterval","floori","offseti","interval","previous","setTime","every","isFinite","durationSecond","durationMinute","durationHour","durationDay","durationWeek","durationYear","timeDay","setHours","setDate","getDate","getTimezoneOffset","utcDay","setUTCHours","setUTCDate","unixDay","timeWeekday","getDay","timeSunday","timeMonday","timeTuesday","timeWednesday","timeThursday","timeFriday","timeSaturday","utcWeekday","getUTCDay","utcSunday","utcMonday","utcTuesday","utcWednesday","utcThursday","utcFriday","utcSaturday","timeYear","setMonth","setFullYear","getFullYear","utcYear","setUTCMonth","setUTCFullYear","timeMonth","utcMonth","timeHour","getMilliseconds","getSeconds","getMinutes","getHours","utcHour","setUTCMinutes","timeMinute","utcMinute","setUTCSeconds","second","millisecond","descending","bisector","compare2","mid","YEAR","QUARTER","MONTH","WEEK","DATE","DAY","DAYOFYEAR","HOURS","MINUTES","SECONDS","MILLISECONDS","TIME_UNITS","UNITS","timeUnits","units","m","unit","sort","defaultSpecifiers","timeUnitSpecifier","specifiers","fmt","localYear","y","dayofyear","localDayOfYear","week","localWeekNum","localFirst","localDate","H","M","S","L","utcdayofyear","utcDayOfYear","utcweek","utcWeekNum","UTC","utcFirst","utcDate","inv","newDate","phase","getUnit","weekday","day","firstDay","localGet","localInv","w","timeFloor","utcGet","utcInv","utcFloor","timeIntervals","utcIntervals","utcInterval","ival","timeOffset","utcOffset","timeSequence","utcSequence","Milli","Seconds","Minutes","Hours","Day","Month","Year","intervals","bin","ext","maxbins","target","formatLocale","locale_dateTime","dateTime","locale_date","locale_time","time","locale_periods","periods","locale_weekdays","days","locale_shortWeekdays","shortDays","locale_months","months","locale_shortMonths","shortMonths","periodRe","formatRe","periodLookup","formatLookup","weekdayRe","weekdayLookup","shortWeekdayRe","shortWeekdayLookup","monthRe","monthLookup","shortMonthRe","shortMonthLookup","formats","formatDayOfMonth","formatMicroseconds","formatYearISO","formatFullYearISO","formatHour24","formatHour12","formatDayOfYear","formatMilliseconds","formatMonthNumber","formatMinutes","formatUnixTimestamp","formatUnixTimestampSeconds","formatSeconds","formatWeekdayNumberMonday","formatWeekNumberSunday","formatWeekNumberISO","formatWeekdayNumberSunday","formatWeekNumberMonday","formatFullYear","formatZone","formatLiteralPercent","utcFormats","formatUTCDayOfMonth","formatUTCMicroseconds","formatUTCYearISO","formatUTCFullYearISO","formatUTCHour24","formatUTCHour12","formatUTCDayOfYear","formatUTCMilliseconds","formatUTCMonthNumber","formatUTCMinutes","formatUTCSeconds","formatUTCWeekdayNumberMonday","formatUTCWeekNumberSunday","formatUTCWeekNumberISO","formatUTCWeekdayNumberSunday","formatUTCWeekNumberMonday","formatUTCYear","formatUTCFullYear","formatUTCZone","parses","string","parseSpecifier","parseDayOfMonth","parseMicroseconds","parseYear","parseFullYear","parseHour24","parseDayOfYear","parseMilliseconds","parseMonthNumber","parseMinutes","parseQuarter","parseUnixTimestamp","parseUnixTimestampSeconds","parseSeconds","parseWeekdayNumberMonday","parseWeekNumberSunday","parseWeekNumberISO","parseWeekdayNumberSunday","parseWeekNumberMonday","parseZone","parseLiteralPercent","pads","charAt","newParse","Z","Q","V","W","U","X","utcFormat","utcParse","timeFormat","timeParse","numberRe","percentRe","requoteRe","requote","names","dISO","z","dow","UTCdISO","memoize","cache","spec","numberLocale","formatFloat","numberFormat","decimalChar","dec","idx","lastIndexOf","rightmostDigit","trimZeroes","formatSpan","precisionPrefix","precisionRound","precisionFixed","defaultNumberLocale","defaultTimeLocale","resetNumberFormatDefaultLocale","numberFormatLocale","definition","numberFormatDefaultLocale","timeMultiFormat","minute","hour","month","timeLocale","resetTimeFormatDefaultLocale","timeFormatLocale","timeFormatDefaultLocale","createLocale","number","numberSpec","timeSpec","resetDefaultLocale","protocol_re","allowed_re","whitespace_re","fileProtocol","async","load","uri","sanitize","url","href","localFile","file","http","fileAccess","result","isFile","loadFile","base","isAllowed","hasProtocol","baseURL","startsWith","endsWith","mode","defaultProtocol","rel","context","crossOrigin","fileLoader","fs","filename","Promise","accept","reject","readFile","data","fileReject","httpLoader","fetch","response","ok","status","statusText","httpReject","isValid","typeParsers","boolean","integer","unknown","typeTests","typeList","inferType","values","inferTypes","types","delimitedFormat","delim","responseType","header","dsv","json","prop","Buffer","isBuffer","parseJSON","filters","interior","exterior","topojson","feature","mesh","csv","tsv","reader","read","schema","timeParser","utcParser","datum","parsers","parts","pattern","loader","loaderFactory","UniqueList","idFunc","list","ids","asyncCallback","df","err","TUPLE_ID_KEY","TUPLE_ID","isTuple","tupleid","setid","ingest$1","derive","rederive","stableCompare","cmp","isChangeSet","changeset","rem","mod","remp","modp","reflow","insert","modify","tuple","encode","pulse","tuples","cur","modifies","CACHE","Parameters","force","modified","OP_ID","NO_PARAMS","Operator","init","params","react","stamp","rank","qrank","flags","_update","parameters","flag","bit","state","targets","_targets","skip","initonly","argval","_argval","argops","_argops","deps","marshall","item","detach","evaluate","StopPropagation","run","rv","STREAM_ID","EventStream","receive","_filter","_apply","stream","consume","_consume","evt","val","trg","preventDefault","stopPropagation","throttle","pause","now","dataflow","between","active","SKIP","onStream","func","touch","onOperator","updater","connect","Pulse","materialize","visit","addFilter","MultiPulse","pulses","hash","changed","ADD","REM","MOD","changes","reentrant","ADD_REM","ADD_MOD","ALL","REFLOW","SOURCE","NO_SOURCE","NO_FIELDS","fork","clone","addAll","src","addF","remF","modF","srcF","cleans","runAfter","nomod","some","sum","NO_OPT","siftdown","pidx","Dataflow","logLevel","_clock","_rank","_locale","_loader","_touched","_input","_pulse","_heap","nodes","last","ridx","cidx","siftup","Heap","_postrun","logMethod","_log","cleanThreshold","shift","sources","targetRank","rerank","queue","_enqueue","ingest","preload","pending","_pending","requests","done","loadPending","res","request","events","send","querySelectorAll","on","prerun","postrun","_getPulse","then","pr","priority","all","cb","runAsync","_running","enqueue","singlePulse","transforms","Definition","valueof","compareDefined","sd","swap","quantile","Float64Array","numbers","value0","subarray","quantileSorted","median","quantiles","quartiles","estimateBandwidth","mean","variance","deviation","h","maxb","logb","div","divide","minstep","steps","eps","nice","setRandom","bootstrapCI","samples","alpha","mu","dotbin","smooth","thresh","smoothing","seed","dist","sample","pdf","cdf","icdf","SQRT2PI","PI","SQRT2","nextSample","sampleNormal","stdev","rds","densityNormal","cumulativeNormal","cd","quantileNormal","erfinv","gaussian","sigma","kde","support","bandwidth","kernel","sampleLogNormal","densityLogNormal","cumulativeLogNormal","quantileLogNormal","lognormal","mixture","dists","weights","normalize","distributions","sampleUniform","densityUniform","cumulativeUniform","quantileUniform","uniform","coef","predict","rSquared","ols","uX","uY","uXY","uX2","slope","Y","xv","yv","ux","uy","visitPoints","SSE","SST","sse","sst","linear","XY","X2","ly","xy","YL","XYL","X2Y","c0","c1","YS","lx","quad","x2","X3","X4","X2X2","poly","lhs","rhs","matrix","gaussianElimination","uncenter","maxiters","epsilon","loess","bw","yhat","residuals","robustWeights","iter","edge","denom","xk","yk","tricube","xkw","updateInterval","medianResidual","arg","cnt","MIN_RADIANS","sampleCurve","minSteps","maxSteps","minX","maxX","sx","sy","ymin","ymax","scaleY","pm","angleDelta","a0","atan2","a1","groupkey","measureName","as","noop","base_op","AggregateOps","cell","store","num","__count__","missing","valid","product","mean_d","average","req","dev","variancep","stdevp","stderr","distinct","ci0","ci1","q2","q1","q3","argmin","argmax","exponential","exp_r","exponentialb","ValidAggregateOps","createMeasure","param","compareIndex","_ops","aggregate_param","_out","compileMeasures","agg","ops","getreqs","resolve","ctr","TupleStore","reset","measure","prototype$1","Aggregate","_adds","_mods","_alen","_mlen","_drop","_cross","_dims","_dnames","_measures","_countOnly","_counts","_prev","_inputs","_outputs","Bin","SortedList","resort","Collect","Compare","update$5","CountPattern","Cross","_add","_rem","_ext","_q","quartile","ci","_ci","aggr","drop","cross","dims","vals","collect","cells","inputs","outputs","inputMap","inputVisit","groupby","dname","cellkey","aggregate_params","mname","outname","newcell","newtuple","measures","celltuple","counts","adds","mods","band","bins","_bins","b0","b1","process","tokens","tcase","tokenize","case","_parameterCheck","_match","_stop","_finish","stopwords","_tuples","Distributions","normal","FUNCTION","def","Density","fieldNames","partition$1","groups","DotBin","Expression","update$4","expr","Extent","Subflow","Facet","_keys","Field","update$3","Filter","Flatten","Fold","Formula","Generate","distribution","minsteps","maxsteps","autostep","detachSubflow","activate","flow","subflow","flows","sf","_group","detached","initTargets","act","rekey","k0","k1","isMod","revisit","arrays","maxlen","fnames","generator","Methods","Empty","Impute","JoinAggregate","KDE","Key","update$2","Load","Lookup","MultiExtent","update$1","extents","MultiValues","Params","Pivot","PreFacet","Project","Quantile","Relay","Sample","Sequence","Sieve","TimeUnit","gVals","kVal","impute","getValue","getField","fName","kName","gNames","keyvals","gKey","kMap","gMap","partition","_impute","cumulative","density","defaultValue","default","_transform","limit","pivotKeys","aggregateParams","project","lut","dt","probs","cap","OUTPUT","TupleIndex","Values","utc","timezone","_floor","u0","u1","tunits","WindowOps","row_number","dense_rank","drank","percent_rank","cume_dist","cume","ntile","lag","lead","first_value","last_value","nth_value","nth","prev_value","next_value","find","ValidWindowOps","WindowState","windows","countOnly","visitInputs","WindowOp","Window","processPartition","ignorePeers","frame","setWindow","adjustRange","bisect","that","_context","bezierCurveTo","_x0","_x1","_y0","_y1","Basis","BasisClosed","BasisOpen","Bundle","beta","_basis","_beta","wind","areaStart","_line","areaEnd","lineStart","_point","lineEnd","lineTo","closePath","moveTo","_x2","_x3","_x4","_y2","_y3","_y4","_x","_y","custom","bundle","_k","Cardinal","tension","cardinal","CardinalOpen","CardinalClosed","_x5","_y5","cos","sin","pi","halfPi","tau","asin","x1","y1","y2","_l01_a","_l01_2a","_l12_a","_l12_2a","_l23_a","_l23_2a","CatmullRom","_alpha","x23","y23","catmullRom","CatmullRomClosed","CatmullRomOpen","Linear","LinearClosed","slope3","h0","h1","s0","s1","slope2","MonotoneX","MonotoneY","ReflectContext","Natural","controlPoints","Step","_t","_t0","px","py","tauEpsilon","append","strings","Path","digits","_append","appendRound","quadraticCurveTo","arcTo","x21","y21","x01","y01","l01_2","x20","y20","l21_2","l20_2","l21","l01","tan","acos","t01","t21","ccw","cw","rect","withPath","shape","RangeError","arcInnerRadius","innerRadius","arcOuterRadius","outerRadius","arcStartAngle","startAngle","arcEndAngle","endAngle","arcPadAngle","padAngle","cornerTangents","rc","ox","oy","x11","y11","x10","y10","x00","y00","d2","D","cx0","cy0","cx1","cy1","dx0","dy0","dx1","dy1","cx","cy","defined","curve","buffer","defined0","area","x0z","y0z","arealine","lineX0","lineY0","lineY1","lineX1","draw","domCanvas","createElement","getContext","height","domImage","Image","ascendingBisect","bisectRight","bisectLeft","factory","Color","darker","brighter","reI","reN","reP","reHex","reRgbInteger","reRgbPercent","reRgbaInteger","reRgbaPercent","reHslPercent","reHslaPercent","named","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","color_formatHex","rgb","formatHex","color_formatRgb","formatRgb","color","parseInt","rgbn","Rgb","rgba","hsla","rgbConvert","opacity","rgb_formatHex","hex","rgb_formatRgb","clampa","clampi","Hsl","hslConvert","hsl","clamph","clampt","hsl2rgb","m1","m2","v0","v1","v2","v3","t2","t3","channels","displayable","formatHex8","formatHsl","clamp","hue","nogamma","rgbGamma","gamma","rgbSpline","spline","colors","rgbBasis","rgbBasisClosed","isNumberArray","ArrayBuffer","isView","DataView","numberArray","genericArray","nb","na","reA","reB","am","bm","bs","bi","lastIndex","valueOf","bimap","interpolate","polymap","transformer","untransform","piecewise","rescale","clamper","invert","rangeRound","continuous","initRange","initInterpolator","interpolator","tickFormat","linearish","prestep","maxIter","transformLog","transformExp","transformLogn","transformExpn","pow10","reflect","loggish","logs","pows","E","log2","logp","powp","transformPow","transformSqrt","transformSquare","powish","transformSymlog","transformSymexp","symlogish","ticker","tickIntervals","tickInterval","utcTicks","utcTickInterval","timeTicks","timeTickInterval","calendar","formatMillisecond","formatSecond","formatMinute","formatHour","formatDay","formatWeek","formatMonth","formatYear","k10","sequential","sequentialPow","k21","r2","divergingPow","InternMap","entries","keyof","super","defineProperties","_intern","intern_get","intern_set","intern_delete","InternSet","Set","implicit","ordinal","svgNode","translateX","translateY","rotate","skewX","scaleX","atan","interpolateTransform","pxComma","pxParen","degParen","xa","ya","xb","yb","interpolateTransformCss","DOMMatrix","WebKitCSSMatrix","isIdentity","decompose","interpolateTransformSvg","createElementNS","setAttribute","baseVal","consolidate","cosh","zoomRho","rho","rho2","rho4","ux0","uy0","w0","ux1","uy1","w1","coshr0","tanh","sinh","duration","_1","_2","hslLong","Xn","Yn","Zn","labConvert","Lab","Hcl","hcl2lab","rgb2lrgb","xyz2lab","lab","lab2xyz","lrgb2rgb","hcl","hclConvert","hclLong","A","B","C","ED","EB","BC_DA","Cubehelix","bl","cubehelixConvert","cubehelix","cubehelixGamma","cubehelixLong","bandSpace","paddingInner","paddingOuter","space","Log","Pow","Sqrt","Symlog","Time","Sequential","Diverging","Quantize","Threshold","Ordinal","Point","Band","BinOrdinal","Continuous","Discrete","Discretizing","Interpolating","Temporal","ordinalRange","range$1","invertRange","pointish","scales","VEGA_SCALE","registerScale","metadata","invertExtent","invertRangeExtent","isValidScaleType","hasType","isContinuous","isDiscrete","isDiscretizing","isLogarithmic","isInterpolating","isQuantile","sequentialLog","sequentialSymlog","diverging","divergingLog","divergingSymlog","thresholds","quantize","scaleBinOrdinal","scaleProps","interpolateRange","interpolateColors","quantizeInterpolator","scaleFraction","scale$1","interp","palette","scheme","schemes","category10","category20","category20b","category20c","tableau10","tableau20","accent","dark2","paired","pastel1","pastel2","set1","set2","set3","blues","greens","greys","oranges","purples","reds","blueGreen","bluePurple","greenBlue","orangeRed","purpleBlue","purpleBlueGreen","purpleRed","redPurple","yellowGreen","yellowOrangeBrown","yellowOrangeRed","blueOrange","brownBlueGreen","purpleGreen","purpleOrange","redBlue","redGrey","yellowGreenBlue","redYellowBlue","redYellowGreen","pinkYellowGreen","spectral","viridis","magma","inferno","plasma","cividis","rainbow","sinebow","turbo","browns","tealBlues","teals","warmGreys","goldGreen","goldOrange","goldRed","lightGreyRed","lightGreyTeal","lightMulti","lightOrange","lightTealBlue","darkBlue","darkGold","darkGreen","darkMulti","darkRed","SymbolLegend","DiscreteLegend","defaultFormatter","tickCount","minStep","validTicks","endpoints","tickValues","noSkip","varfmt","tickLog","symbols","labelValues","binValues","thresholdValues","isDiscreteRange","labelFormat","thresholdFormat","formatRange","formatDiscrete","formatPoint","dflt","domainCaption","isTemporal","gradient_id","patternPrefix","isGradient","gradient","gradientRef","defs","Gradient","stops","lookup","horizontal","vertical","curves","orientation","entry","paramCounts","commandPattern","numberPattern","spacePattern","flagPattern","commands","cmd","paramCount","segment","ws","parseParams","DegToRad","HalfPi","Tau","HalfSqrt3","segmentCache","bezierCache","bezier","th0","th1","rx","ry","sin_th","cos_th","a00","a01","a10","a11","cos_th0","sin_th0","cos_th1","sin_th1","th_half","sin_th_h2","x3","y3","current","sX","sY","pathRender","tempX","tempY","tempControlX","tempControlY","controlX","controlY","anchorX","anchorY","beginPath","drawArc","coords","seg","large","sweep","rotateX","th","pl","sfactor_sq","sfactor","xc","yc","th_arc","segs","th2","th3","segments","bez","Tan30","builtins","parsed","customSymbol","rectangleX","rectangleY","rectangleWidth","rectangleHeight","vg_rect","crTL","crTR","crBL","crBR","rectangle","tl","tr","br","cornerRadius","vg_trail","ready","w2","ud","hypot","trail","value$1","arcShape","padRadius","da0","da1","ap","rp","rc0","rc1","oc","x32","y32","intersect","ax","ay","bx","by","kc","lc","centroid","areavShape","areahShape","lineShape","rectShape","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomRight","cornerRadiusBottomLeft","symbolShape","circle","trailShape","hasCornerRadius","clip_id","resetSVGClipId","clip$1","renderer","clip","_defs","clipping","Bounds","union","Item","mark","bounds","GroupItem","items","ResourceLoader","customLoader","increment","decrement","boundStroke","miter","stroke","strokeOpacity","sw","strokeWidth","expand","strokeJoin","miterAdjustment","MAX_VALUE","equals","angle","rotatedPoints","encloses","alignsWith","intersects","contains","sanitizeURL","catch","loadImage","img","cors","onload","onerror","complete","poll","circleThreshold","rot","ma","mb","mc","md","addL","addX","addY","addp","addpL","boundContext","deg","context$1","px1","py1","px2","py2","quadExtrema","px3","py3","cubicExtrema","sa","ea","cubic","s2","intersectPath","brush","isPointInPath","intersectPoint","box","intersectRect","intersectRule","intersectBoxLine","blend","globalCompositeOperation","addStops","addColorStop","createRadialGradient","image","ictx","fillStyle","createLinearGradient","fillRect","createPattern","fillOpacity","globalAlpha","lw","strokeStyle","lineWidth","lineCap","strokeCap","lineJoin","miterLimit","strokeMiterLimit","setLineDash","strokeDash","lineDashOffset","strokeDashOffset","zindex","zorder","scene","zdirty","zitems","pickVisit","hit","drawAll","drawPath","drawOne","pick$1","gx","gy","pixelRatio","hitPath","filled","isPointInStroke","pickPath","translateItem","markItemPath","isect","tag","nested","attr","emit","rotateItem","bound","pick","markMultiItemPath","tip","orient","clipGroup","offset$1","strokeOffset","emitRectangle","off","rectanglePath","hitBackground","hitForeground","hitCorner","noBound","markTypes","fore","strokeForeground","save","marktype","includes","restore","dw","dh","ix","interactive","pickMark","content","background","foreground","getImage","imageWidth","aspect","imageHeight","imageXOffset","imageYOffset","baseline","toDataURL","ar0","ar1","imageSmoothingEnabled","drawImage","xOffset","yOffset","path$1","pathCache","path$2","transformItem","draw$2","rule","widthCache","textMetrics","fontSize","measureWidth","estimateWidth","canvas","useCanvas","use","_estimateWidth","textValue","currentFontHeight","_measureWidth","font","currentFont","measureText","lineHeight","textLines","lineBreak","multiLineOffset","widthGetter","rtl","dir","fontFamily","quote","fontStyle","fontVariant","fontWeight","textAlign","tempBounds","anchorPoint","radius","theta","lh","fillText","strokeText","Marks","boundItem","DUMMY","boundMark","hasItems","sceneToJSON","indent","sceneFromJSON","initialize","Scenegraph","createMark","role","aria","description","domCreate","doc","ns","domFind","el","childNodes","tagName","domChild","ownerDocument","insertBefore","domClear","removeChild","cssClass","event","getBoundingClientRect","clientX","clientLeft","clientY","top","clientTop","Handler","customTooltip","_active","_handlers","_tooltip","defaultTooltip","element","Renderer","_el","_bgcolor","markdef","origin","_obj","firstChild","_origin","_scene","_handlerIndex","handlers","eventName","handleHref","MouseEvent","dispatchEvent","handleTooltip","show","tooltip","mdef","resolveItem","getItemBoundingClientRect","bottom","scaleFactor","resize","bgcolor","_width","_height","_scale","dirty","render","_call","_render","renderAsync","_ready","_load","redraw","DragEnterEvent","DragLeaveEvent","DragOverEvent","PointerDownEvent","PointerMoveEvent","PointerOutEvent","PointerOverEvent","ClickEvent","MouseWheelEvent","TouchStartEvent","TouchMoveEvent","TouchEndEvent","TooltipShowEvent","TooltipHideEvent","HrefEvent","CanvasHandler","_down","_touch","_first","_events","eventListenerCheck","eventBundle","fire","moveEvent","overEvent","outEvent","pickEvent","exit","inactive","_canvas","DOMMouseScroll","pointermove","dragover","pointerout","dragleave","pointerdown","click","touchstart","changedTouches","touchmove","touchend","vegaType","devicePixelRatio","CanvasRenderer","_options","_redraw","_dirty","_tempb","base$2","SVGHandler","_hrefHandler","listener","_tooltipHandler","externalContext","appendChild","inDOM","HTMLElement","parentNode","ratio","style","setTransform","ctx","db","vb","viewBounds","clipToBounds","clearRect","__data__","svg","_svg","ARIA_HIDDEN","ARIA_LABEL","ARIA_ROLE","ARIA_ROLEDESCRIPTION","GRAPHICS_OBJECT","GRAPHICS_SYMBOL","roledesc","label","AriaIgnore","AriaGuides","desc","caption","title","extractTitle","props","channelCaption","titleCaption","AriaEncode","ariaRole","ariaRoleDescription","ariaItemAttributes","hide","ariaMarkAttributes","ariaGuide","ariaMark","innerText","attrText","markup","outer","inner","stack","open","attrs","close","serializeXML","node","_serialize","hasAttributes","attributes","hasChildNodes","children","nodeType","nodeValue","stylesAttr","stylesCss","rootAttributes","xmlns","svgns","SVGRenderer","_dirtyID","_root","base$1","dirtyParents","updateGradient","grad","pt","setAttributes","viewBox","preserveAspectRatio","fx","fy","fr","updateClipping","mask","sibling","__values__","bg","cg","ownerSVGElement","previousSibling","siblingCheck","nextSibling","_clearDefs","setAttributeNS","RootIndex","setProperty","removeAttribute","_dirtyCheck","_dirtyAll","isDirty","markType","isGroup","lastChild","extra","mark_extras","setStyle","ts","textContent","removeAttributeNS","removeProperty","loc","location","SVGStringRenderer","_text","class","attrList","_hrefs","prefixed","styleList","display","OPTS","svgMarkTypes","svgOnTop","setHybridRendererOptions","HybridRenderer","_svgRenderer","_canvasRenderer","HybridHandler","_root_el","bottomEl","topEl","position","_svgEl","_canvasEl","pointerEvents","canvasMarkTypes","Canvas","Hybrid","RenderType","PNG","SVG","modules","renderModule","hits","intersectMark","intersectGroup","visitMark","intersectItem","marks","headless","clipBounds","boundClip","TOLERANCE","sceneEqual","pathEqual","ka","kb","objectEqual","resetSVGDefIds","Top","Left","Right","Bottom","Start","Middle","End","Group","AxisRole","TitleRole","LegendRole","RowHeader","RowFooter","RowTitle","ColHeader","ColFooter","ColTitle","FitX","FitY","All","Each","Flush","Column","Row","Bound","view","rebound","markBounds","COUNTER_NAME","Identifier","Mark","Overlap","counter","_signals","scenegraph","lookup$1","Init","methods","parity","greedy","sep","hasOverlap","hasBounds","Render","separation","boundScale","boundTolerance","tolerance","boundTest","boundOrient","isYAxis","axisLayout","axis","indices","grid","labels","axisIndices","minExtent","maxExtent","titlePadding","dl","axisTitleLayout","auto","bboxFlush","bboxFull","offsetValue","gridLayout","nodirty","alignCol","alignRow","padCol","padRow","ncols","nrows","xExtent","xMax","yExtent","yMax","boxes","boundFlush","boundFull","layoutHeaders","headers","isX","bf","stride","back","layoutTitle","legendParams","config","legends","offsets","mult","legendLayout","legend","_bounds","ex","ey","tpad","tx","ty","legendTitleOffset","legendGroupLayout","legendBounds","widths","legendEntryLayout","lr","noBar","vgrad","ViewLayout","AxisTicks","DataJoin","defaultItemCreate","Encode","LegendEntries","views","rowheaders","rowfooters","colheaders","colfooters","rowtitle","coltitle","gridLayoutGroups","headerBand","footerBand","titleAnchor","titleBand","trellisLayout","xBounds","yBounds","autosize","pos","subtitle","titleLayout","_autosize","viewWidth","viewHeight","_resizeView","viewSizeLayout","layoutGroup","shouldReflow","newMap","fmod","encoders","reenter","enter","fraction","lskip","perc","adjust","labelFraction","perc2","sourceX","sourceY","targetX","targetY","LinkPath","Paths","rr","iy","sr","ta","sc","ss","tc","mr","Pie","includePad","Scale","domainCheck","adjustScheme","flip","SortItems","isContinuousColor","rawDomain","domainMid","scaleKey","rangeStep","configureRangeStep","scheme$1","schemeExtent","interpolateGamma","schemeCount","configureScheme","configureRange","domainRaw","configureBins","raw","includeZero","padDomain","domainMin","domainMax","domainImplicit","configureDomain","Zero","Center","Normalize","DefOutput","Stack","stackCenter","stackNormalize","stackZero","lastPos","lastNeg","streamGeometry","streamGeometryType","streamObjectType","Feature","FeatureCollection","Sphere","sphere","MultiPoint","LineString","streamLine","MultiLineString","Polygon","streamPolygon","MultiPolygon","GeometryCollection","closed","coordinate","polygonStart","polygonEnd","Adder","_partials","_n","quarterPi","areaSum","areaRingSum","areaStream","areaRingStart","areaRingEnd","areaPointFirst","areaPoint","boundsStream","X0","Y0","Z0","X1","Y1","Z1","Y2","Z2","centroidStream","centroidPoint","centroidLineStart","centroidLineEnd","centroidRingStart","centroidRingEnd","centroidPointFirstLine","centroidPointLine","centroidPointFirstRing","centroidPointRing","PathContext","_radius","pointRadius","lengthRing","lengthSum","lengthStream","lengthPointFirst","lengthPoint","cacheDigits","cacheAppend","cacheRadius","cacheCircle","PathString","projection","projectionStream","contextStream","lines","rejoin","Intersection","other","compareIntersection","startInside","subject","pointEqual","isSubject","spherical","cartesian","lambda","phi","cosPhi","cartesianDot","cartesianCross","cartesianAddInPlace","cartesianScale","vector","cartesianNormalizeInPlace","longitude","flatten","pointVisible","clipLine","sink","ringBuffer","ringSink","polygonStarted","pointRing","ringStart","ringEnd","sinPhi","winding","point0","lambda0","phi0","sinPhi0","cosPhi0","lambda1","sinPhi1","cosPhi1","point1","phi1","absDelta","antimeridian","intersection","phiArc","polygonContains","pointLine","ringSegments","validSegment","sign0","sign1","sinLambda0Lambda1","clipAntimeridianIntersect","to","direction","circleRadius","cosRadius","clipMax","clipMin","clipRectangle","visible","corner","comparePoint","ca","x__","y__","v__","x_","y_","v_","first","activeStream","bufferStream","clipStream","linePoint","polygonInside","cleanInside","compose","rotationIdentity","deltaLambda","deltaPhi","deltaGamma","rotationLambda","rotationPhiGamma","forwardRotationLambda","rotation","cosDeltaPhi","sinDeltaPhi","cosDeltaGamma","sinDeltaGamma","TransformStream","fit","fitBounds","clipExtent","fitExtent","fitSize","fitWidth","fitHeight","maxDepth","cosMinDistance","delta2","resampleLineTo","depth","phi2","lambda2","dx2","dy2","dz","lambda00","b00","c00","resampleStream","ringPoint","resampleNone","transformRadians","scaleTranslateRotate","scaleTranslate","cosAlpha","sinAlpha","ai","fi","projectionMutator","projectAt","projectResample","projectTransform","projectRotateTransform","cacheStream","preclip","postclip","recenter","resample","transformRotate","clipAngle","cr","smallRadius","notHemisphere","two","n2","n2n2","n1n2","determinant","c2","n1xn2","uu","polar","code","v00","point2","sinRadius","circleStream","reflectX","reflectY","conicProjection","parallels","conicEqualAreaRaw","sy0","forward","cylindricalEqualAreaRaw","r0y","conicEqualArea","azimuthalRaw","azimuthalInvert","cc","azimuthalEqualAreaRaw","cxcy","azimuthalEquidistantRaw","mercatorRaw","mercatorProjection","reclip","tany","conicConformalRaw","equirectangularRaw","conicEquidistantRaw","nx","A1","A2","A3","A4","equalEarthRaw","l2","l6","gnomonicRaw","naturalEarth1Raw","phi4","orthographicRaw","stereographicRaw","transverseMercatorRaw","sqrt2","SQRT1_2","mollweideBromleyTheta","cp","cpsinPhi","mollweideRaw","mollweideBromleyRaw","defaultPath","projectionProperties","proj","projections","getProjectionPath","albers","albersusa","lower48Point","alaskaPoint","hawaiiPoint","lower48","alaska","hawaii","pointStream","albersUsa","streams","azimuthalequalarea","azimuthalequidistant","conicconformal","conicequalarea","conicequidistant","equalEarth","equirectangular","gnomonic","identity","mercator","mollweide","naturalEarth1","orthographic","stereographic","transversemercator","graticuleX","graticuleY","cases","contours","smoothLinear","tz","contour","polygons","holes","startIndex","endIndex","isorings","hole","xt","yt","_0","ringContains","xi","yi","pj","xj","yj","segmentContains","collinear","Isocontour","transformPolygon","transformRing","density2D","weight","values0","Float32Array","values1","blurX","blurY","sz","cellSize","LN2","KDE2D","levels","paths","transformPaths","PARAMS","Contour","post","GeoJSON","GeoPath","GeoPoint","GeoShape","Graticule","DX","DY","graticule","outline","extentMajor","extentMinor","stepMajor","stepMinor","Heatmap","dependency","$x","$y","$value","$max","Projection","xm","ym","xp","yp","leaf","defaultX","defaultY","quadtree","Quadtree","leaf_copy","_features","_points","lon","lat","geojson","initPath","shapeGenerator","shared","dep","opacity_","color_","can","getImageData","pix","putImageData","toCanvas","featurize","collectGeoJSON","treeProto","vx","vy","cover","xz","yz","quads","retainer","removeAll","visitAfter","Dispatch","typename","T","taskHead","taskTail","timeout","pokeDelay","clockLast","clockNow","clockSkew","clock","performance","setFrame","requestAnimationFrame","clearNow","Timer","_time","_next","timer","restart","wake","timerFlush","sleep","nap","poke","clearInterval","setInterval","initialAngle","nodeById","nodeId","ForceMap","strength","collide","radii","iterations","ri","ri2","prepare","rj","jiggle","_nodes","_random","nbody","strengths","distanceMin2","distanceMax2","theta2","accumulate","distanceMin","distanceMax","link","links","distances","bias","distance","initializeStrength","initializeDistance","Forces","ForceParams","ForceConfig","ForceOutput","Force","setup","sim","forces","getForce","numForces","setForceParam","hierarchy","mapChildren","objectChildren","childs","Node","eachBefore","computeHeight","copyData","optional","required","constantZero","change","iters","simulation","alphaMin","alphaDecay","alphaTarget","velocityDecay","stepper","tick","initializeNodes","initializeForce","randomSource","closest","stopped","static","finish","eachAfter","each","ancestor","aNodes","ancestors","bNodes","leastCommonAncestor","descendants","leaves","extendBasis","enclosesWeakAll","enclosesNot","encloseBasis2","encloseBasis3","dr","enclosesWeak","encloseBasis","r21","r3","a2","a3","b2","b3","c3","d3","ab","place","score","packSiblingsRandom","circles","aa","sj","sk","pack","shuffle","packEncloseRandom","defaultRadius","radiusLeaf","packChildrenRandom","translateChild","preroot","ambiguous","imputed","defaultId","defaultParentId","parentId","stratify","nodeKey","currentId","currentParentId","nodeByKey","slash","P","parentof","defaultSeparation","nextLeft","nextRight","moveSubtree","wm","wp","nextAncestor","vim","TreeNode","meanXReduce","maxYReduce","squarifyRatio","sumValue","minValue","maxValue","newRatio","minRatio","dice","squarify","resquarify","_squarify","Nest","nest","valuesByKey","keyValue","HierarchyLayout","setParams","setFields","Output$3","Pack","Output$2","Partition","Stratify","positionNode","parentKey","Layouts","tidy","nodeSize","treeRoot","firstWalk","secondWalk","sizeNode","siblings","executeShifts","midpoint","vip","vop","vom","sip","sop","som","apportion","cluster","previousNode","meanX","maxY","leafLeft","leafRight","Output$1","Tree","TreeLinks","Tiles","binary","sums","valueOffset","valueTarget","valueLeft","valueRight","slicedice","Treemap","tile","paddingStack","paddingTop","paddingRight","paddingBottom","paddingLeft","treemap","ALPHA_MASK","getBuffer","Uint32Array","DIV","SIZE","RIGHT0","RIGHT1","outOfBounds","textWidth","textHeight","collision","bm0","bm1","getRange","X_DIR","Y_DIR","Aligns","Baselines","boundary","isInside","anchorCode","TOP","MIDDLE","BOTTOM","placeAreaLabel","bitmaps","avoidBaseMark","markIndex","areaWidth","maxAreaWidth","tryLabel","maxSize","_xMid","_yMid","swapTmp","labelPlaced","labelPlaced2","setRange","bm2","bitmap","labelLayout","texts","avoidMarks","lineAnchor","positions","getOffsets","anchors","Int8Array","getAnchors","grouptype","isGroupArea","markBoundary","infPadding","isNaiveGroupArea","maxTextWidth","maxTextHeight","_set","_clear","indexStart","indexEnd","clearRange","Bitmap","scaler","labelInside","baseMark","border","baseMarkContext","strokeContext","baseMarkBuffer","strokeBuffer","layer1","layer2","strokeAlpha","baseMarkAlpha","markBitmaps","baseBitmaps","sizeFactor","insideFactor","placeMarkLabel","Anchors","Label","Loess","null","Regression","dof","degreesOfFreedom","model","dom","elen","flen","Qnew","hh","bvirt","enow","fnow","eindex","findex","hindex","vec","C1","C2","orient2d","detleft","detright","det","detsum","acxtail","acytail","bcxtail","bcytail","ahi","alo","bhi","blo","_i","_j","u3","acx","bcx","acy","bcy","errbound","C1len","C2len","Dlen","orient2dadapt","EDGE_STACK","Delaunator","getX","defaultGetX","getY","defaultGetY","maxTriangles","_triangles","_halfedges","Int32Array","_hashSize","_hullPrev","_hullNext","_hullTri","_hullHash","_ids","_dists","hullPrev","hullNext","hullTri","hullHash","minY","minDist","i0x","i0y","i1x","i1y","minRadius","circumradius","i2x","i2y","quicksort","hull","triangles","halfedges","cl","circumcenter","_cx","_cy","_hullStart","hullSize","_hashKey","trianglesLen","_addTriangle","_legalize","pseudoAngle","ar","al","inCircle","hbl","_link","bp","tempDist","tmp","Voronoi","delaunay","xmin","xmax","_circumcenters","vectors","_init","circumcenters","inedges","ti","tj","_renderSegment","_project","renderBounds","renderCell","_clip","cellPolygons","cellPolygon","_regioncode","_clipSegment","_step","neighbors","cj","loop","li","aj","lj","_cell","e0","_simplify","_clipInfinite","_clipFinite","e1","sx0","sx1","sy1","_edgecode","_edge","vx0","vy0","vxn","vyn","pointX","pointY","jitter","Delaunay","flatArray","flatIterable","_delaunator","_hullIndex","hullIndex","voronoi","dc","renderHull","renderPoints","hullPolygon","renderTriangle","trianglePolygons","trianglePolygon","defaultExtent","toPathString","cloudRadians","ch","cloudSprite","contextAndRatio","di","sprite","w32","maxh","wcr","wsr","hcr","hsr","xoff","yoff","hasText","pixels","seen","seenRow","cloudCollide","board","msx","cloudBounds","collideRects","archimedeanSpiral","functor","spirals","archimedean","rectangular","Wordcloud","spiral","words","cloud","dxdy","startX","startY","maxDelta","zeroArray","tags","fontSizeRange","fsize","sizeScale","array8","array16","Uint16Array","array32","Dimension","query","onAdd","added","dim","SortedIndex","addi","oldv","oldi","addv","index0","value1","index1","reindex","CrossFilter","lengthen","_index","Bitmaps","_indices","ResolveFilter","reinit","eval","bits","remMap","modMap","indexMap","incrementOne","incrementAll","old","lo1","hi1","lo0","hi0","ignore","pass","Literal","CallExpression","ASTNode","TokenName","lookahead","elements","callee","consequent","alternate","argument","TokenBooleanLiteral","TokenEOF","TokenIdentifier","TokenKeyword","TokenNullLiteral","TokenNumericLiteral","TokenPunctuator","TokenStringLiteral","SyntaxArrayExpression","SyntaxBinaryExpression","SyntaxCallExpression","SyntaxConditionalExpression","SyntaxIdentifier","SyntaxLiteral","SyntaxLogicalExpression","SyntaxMemberExpression","SyntaxObjectExpression","SyntaxProperty","SyntaxUnaryExpression","MessageUnexpectedToken","MessageUnexpectedNumber","MessageUnexpectedString","MessageUnexpectedIdentifier","MessageUnexpectedReserved","MessageUnexpectedEOS","MessageInvalidRegExp","MessageUnterminatedRegExp","MessageStrictOctalLiteral","MessageStrictDuplicateProperty","ILLEGAL","DISABLED","RegexNonAsciiIdentifierStart","RegexNonAsciiIdentifierPart","assert","condition","isDecimalDigit","isHexDigit","isOctalDigit","isWhiteSpace","isLineTerminator","isIdentifierStart","fromCharCode","isIdentifierPart","keywords","skipComment","scanHexEscape","throwError","scanUnicodeCodePointEscape","cu1","cu2","getEscapedIdentifier","substr","scanPunctuator","code2","ch2","ch3","ch4","ch1","scanNumericLiteral","scanHexLiteral","octal","scanOctalLiteral","parseFloat","advance","getIdentifier","scanIdentifier","scanStringLiteral","lex","finishBinaryExpression","operator","finishCallExpression","finishIdentifier","finishLiteral","regex","finishMemberExpression","computed","member","finishProperty","kind","messageFormat","msg","whole","throwUnexpected","expect","matchKeyword","keyword","parseObjectPropertyKey","parseObjectProperty","parseConditionalExpression","legalKeywords","parsePrimaryExpression","parseExpression","parseGroupExpression","finishArrayExpression","parseArrayInitialiser","finishObjectExpression","parseObjectInitialiser","body","classMarker","terminated","literal","scanRegExpBody","search","scanRegExpFlags","$0","$1","exception","testRegExp","scanRegExp","parseArguments","parseNonComputedProperty","isIdentifierName","parseComputedMember","parsePostfixExpression","parseLeftHandSideExpressionAllowCall","parseUnaryExpression","finishUnaryExpression","binaryPrecedence","prec","marker","markers","parseBinaryExpression","finishConditionalExpression","Constants","LN10","LOG2E","LOG10E","MIN_VALUE","Functions","codegen","cast","fncall","STRING","REGEXP","datetime","timezoneoffset","utcdate","utcday","utcyear","utcmonth","utchours","utcminutes","utcseconds","utcmilliseconds","upper","lower","regexp","if","allowed","forbidden","constants","functions","globalvar","fieldvar","outputGlobal","globals","memberDepth","ast","Generators","MemberExpression","stripQuotes","ArrayExpression","BinaryExpression","UnaryExpression","ConditionalExpression","LogicalExpression","ObjectExpression","Property","phi00","deltaSum","ranges","areaRing","dLambda","sdLambda","adLambda","W0","W1","z0","boundsLineStart","boundsLineEnd","boundsRingPoint","boundsRingStart","boundsRingEnd","inflection","phii","lambdai","rangeCompare","rangeContains","centroidPointCartesian","centroidLinePointFirst","centroidLinePoint","centroidRingPointFirst","centroidRingPoint","cz","SELECTION_GETTER","Intersect","Union","SelectionId","$selectionId","UNIT_INDEX","testPoint","dval","others","E_union","E_intersect","R_union","R_intersect","selectionVisitor","scope","indexName","dataName","getData","indataRef","tuplesRef","wrap","dateObj","setYear","ScalePrefix","SignalPrefix","dataVisitor","scaleVisitor","addScaleDependency","scaleName","scaleRef","getScale","nameOrFunction","maybeScale","geoMethod","methodName","globalMethod","geoArea","geoBounds","deltaMax","geoCentroid","channel_luminance_value","channelValue","luminance","equal","equalArray","equalObject","removePredicate","accessors","seq","treeNodes","_window","markname","functionContext","isDefined","indexof","_len2","_key2","lastindexof","_len3","_key3","repl","_len4","_key4","pluck","contrast","color1","color2","lum1","lum2","monthFormat","monthAbbrevFormat","dayFormat","dayAbbrevFormat","inScope","pinchDistance","touches","pinchAngle","screen","containerSize","container","clientWidth","clientHeight","windowSize","innerWidth","innerHeight","bandspace","setdata","pathShape","retval","toggle","predicate","_trigger","lassoAppend","lasso","lassoPath","_ref","intersectLasso","pixelLasso","bb","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","testx","testy","intersections","prevX","prevY","pointInPolygon","eventFunctions","thisPrefix","astVisitors","codegenParams","fnctx","visitors","__bandwidth","_bandwidth","_range","ref","internalScaleFunctions","codeGenerator","expressionFunction","signalName","getSignal","signalRef","$expr","$fields","$params","miss","unitIdx","isMulti","vl5","resUnit","resolved","multiRes","acc","Skip","Swap","canonicalType","expression","expressionCodegen","parameter","adjustSpatial","lt","gt","_compare","parseParameter","PARSERS","$ref","$key","$flat","parseParameters","parameterExpression","$field","$name","$encode","enc","encodeExpression","$output","$compare","$order","$tupleid","$subflow","subctx","operators","Context","Subcontext","ariaLabel","subcontext","$ingest","$format","$request","unresolved","signal","operatorExpression","eventExpression","handlerExpression","eventConfig","parseOperator","parseOperatorParameters","parseStream","updates","parseUpdate","srcid","getState","dataset","setState","substate","Default","setCursor","cursor","globalCursor","dataref","_runtime","_viewWidth","_viewHeight","VIEW","NO_TRAP","trap","trackEventListener","_eventListeners","permit","_eventConfig","itemFilter","markTarget","invoke","vega","RadioClass","Event","wrapper","checked","option","valuesEqual","selected","selectedIndex","prepend","initializeRenderer","querySelector","paddingObject","renderHeadless","module","_scenegraph","Width","Height","dataTest","signalTest","proxy","formatArray","formatTooltip","View","_elBind","_renderType","_renderer","_handler","_globalCursor","_preventDefault","_timers","_resizeListeners","defaults","unpack","initializeEventConfig","runtime","_bind","bindings","_resize","resetSize","_resizeWidth","_resizeHeight","resizePadding","initializeResize","_background","user","hover","lookupSignal","findOperatorHandler","addOperatorListener","removeOperatorListener","_desc","_resetRenderer","rerun","addResizeListener","removeResizeListener","addSignalListener","removeSignalListener","addDataListener","removeDataListener","total","_restart","elapsed","timestamp","prevent","allow","itemGroup","extension","eventExtend","finalize","timers","listeners","hoverSet","leaveSet","elBind","initializeAria","prevHandler","initializeHandler","binding","toImageURL","mime","blob","Blob","URL","createObjectURL","toBlobURL","toSVG","LBRACK","RBRACK","LBRACE","RBRACE","COLON","COMMA","NAME","GT","DEFAULT_MARKS","DEFAULT_SOURCE","MARKS","eventSelector","selector","parseMerge","parseSelector","endChar","pushChar","popChar","parseBetween","parseThrottle","parseAutosize","parsePadding","encoder","addEncode","addEncoders","extendEncode","MarkRole","AxisDomainRole","AxisGridRole","AxisLabelRole","AxisTickRole","AxisTitleRole","LegendBandRole","LegendEntryRole","LegendGradientRole","LegendLabelRole","LegendSymbolRole","LegendTitleRole","TitleTextRole","TitleSubtitleRole","applyDefault","entry$1","_color","resolveField","parseEncode","applyDefaults","parseBlock","block","parse$1","OUTER","OUTER_INVALID","outerError","parseSignal","addSignal","addBinding","Entry","refs","fieldRef$1","keyFieldRef","compareRef","aggrField","Scope$1","isSignal","hasSignal","specValue","deref","mergeStream","nestedStream","eventStream","streamParameters","addStream","markrole","filterMark","OP_VALUE_EXPR","mergeSources","FIELD_REF_ID","MULTIDOMAIN_SORT_OPS","parseScale","parseScaleDomain","parseScaleRange","parseLiteral","parseScaleInterpolate","parseScaleNice","parseArray","objectProperty","parseScaleBins","dataLookupError","explicitDomain","multipleDomain","singularDomain","valuesRef","parseSort","domainRef","extentRef","coll","addDataPipeline","fieldRef","ordinalMultipleDomain","quantileMultipleDomain","numericMultipleDomain","countsRef","sortRef","multidomain","parseParameter$1","Vertical","Index","Offset","Perc","Perc2","Value","GuideLabelStyle","GuideTitleStyle","GroupTitleStyle","GroupSubtitleStyle","Size","LegendScales","GroupMark","RectMark","RuleMark","SymbolMark","TextMark","guideGroup","isVertical","symbolDirection","gradientDirection","gradientLength","gradientWidth","gradientThickness","gradientHeight","entryColumns","getEncoding","anchorExpr","alignExpr$1","extendOffset","guideMark","extras","legendGradient","userEncode","thickness","legendGradientDiscrete","dataRef","vv","alignExpr","baselineExpr","legendGradientLabels","overlap","labelLimit","gradientLabelLimit","labelOffset","gradientLabelOffset","legendSymbolGroups","symbolOffset","valueRef","xSignal","yEncode","baseFill","baseStroke","symbolBaseFillColor","symbolBaseStrokeColor","facet","isL","isR","isLR","isVG","exprAlign","exprAnchor","exprAngle","exprBaseline","getRole","parseTransform","pdef","lookupRef","parseIndexParameter","parseSubParameter","parseSubParameters","projectionRef","parameterValue","isExpr","isField","isCompare","outerExpr","exprRef","outerField","isData","getDataRef","DataScope","aggregate","fieldKey","addSortField","ds","optype","sortKey","parseTrigger","trigger","parseMark","layoutRef","boundRef","keyRef","parseData$1","joinRef","$context","markpath","markRef","generates","encodeRef","pushState","subscope","addData","toRuntime","parseFacet","parseSubflow","popState","tol","parseOverlap","sieve","buildLegendEncode","getChannel","fromEntries","angleExpr","groupEncode","getSign","ifLeftTopExpr","ifX","ifXEnc","ifY","ifYEnc","ifTop","ifTopExpr","ifRight","ifRightExpr","$orient","ifEnc","ifExpr","isSimple","toExpr","ifOrient","fallback","axisConfig","styleProp","flushExpr","parseAxis","or","scaleType","axisBand","xyKeys","axisX","axisY","orientKeys","axisTop","axisBottom","axisLeft","axisRight","axisEncode","tickBand","ticksRef","tickMinStep","vscale","gridScale","tickPos","gridStart","gridEnd","axisGrid","tickSize","axisTicks","flushOffset","labelAlign","labelBaseline","flushOn","offsetExpr","axisLabels","pos0","pos1","axisDomain","titlePos","autoY","autoX","autoLayout","axisTitle","buildAxisEncode","parseScope","preprocessed","addProjection","parseProjection","addScale","initScale","upstream","analyze","parseData","isSubscope","addUpdate","streamSource","parseSignalUpdates","axes","legendEncode","entryLayout","scaleCount","legendType","entryRef","legendSymbolLayout","getStyle","getFontSize","sizeExpression","_anchor","legendTitle","parseLegend","buildTitle","titleEncode","buildSubTitle","parseTitle","parseLambdas","rootEncode","signalObject","Scope","lambdas","_id","_subid","_nextsub","_parent","_encode","_lookup","_markpath","Subscope","propertyLambda","arrayLambda","objectLambda","defaultFont","defaultColor","lightGray","square","subtitlePadding","bandPosition","domainWidth","domainColor","gridWidth","gridColor","labelAngle","labelPadding","tickColor","tickOffset","tickRound","tickWidth","gridAlign","columnPadding","rowPadding","gradientStrokeColor","gradientStrokeWidth","labelOverlap","symbolLimit","symbolType","symbolSize","symbolStrokeWidth","titleLimit","titleOrient","category","heatmap","ramp","pre","collectSignals","parseView","vref","annotate","check","isExpr$1","sig","hasOwnSignal","addScaleProj","projectionType","dataScope","version","Ops","Unary","ms","getTime","EventFunctions","DisallowedMethods","setImmediate","Visitors","interpret","isLogicalOr","isLogicalAnd","and","isLogicalNot","not","forEachLeaf","subop","normalizeLogicalComposition","normalizer","duplicate","structuredClone","never","omit","isNullOrFalse","mergeDeep","dest","deepMerge_","unique","isEqual","dict","dictKeys","otherKeys","setEqual","hasIntersection","prefixGenerator","wrappedWithAccessors","computedPrefixes","fieldIntersection","isEmpty","varName","alphanumericS","logicalExpr","deleteNestedProperty","orderedProps","titleCase","accessPathWithDatum","pieces","flatAccessWithDatum","escapePathAccess","replacePathInField","replaceAll","replacement","removePathFromField","accessPathDepth","getFirstDefined","idCounter","uniqueId","resetIdCounter","internalField","isInternalField","normalizeAngle","isNumeric","clonedProto","getPrototypeOf","deepEqual","ks","_stringify","seenIndex","ROW","COLUMN","FACET","XOFFSET","YOFFSET","RADIUS","RADIUS2","THETA","THETA2","LATITUDE","LONGITUDE","LATITUDE2","LONGITUDE2","COLOR","FILL","STROKE","SHAPE","ANGLE","OPACITY","FILLOPACITY","STROKEOPACITY","STROKEWIDTH","STROKEDASH","TEXT","ORDER","DETAIL","KEY","TOOLTIP","HREF","DESCRIPTION","POLAR_POSITION_CHANNEL_INDEX","radius2","isPolarPositionChannel","GEO_POSIITON_CHANNEL_INDEX","longitude2","latitude","latitude2","getPositionChannelFromLatLong","channel","isGeoPositionChannel","GEOPOSITION_CHANNELS","UNIT_CHANNEL_INDEX","detail","isColorChannel","FACET_CHANNEL_INDEX","FACET_CHANNELS","CHANNEL_INDEX","CHANNELS","_o","_d","_tt1","SINGLE_DEF_CHANNEL_INDEX","_r","_c","_f","SINGLE_DEF_UNIT_CHANNEL_INDEX","isChannel","SECONDARY_RANGE_CHANNEL","isSecondaryRangeChannel","getMainRangeChannel","getVgPositionChannel","getSecondaryRangeChannel","getSizeChannel","getOffsetChannel","getOffsetScaleChannel","getMainChannelFromOffsetChannel","UNIT_CHANNELS","_xo","_yo","_latitude","_longitude","_latitude2","_longitude2","_theta","_theta2","_radius2","NONPOSITION_CHANNEL_INDEX","NONPOSITION_CHANNELS","POSITION_SCALE_CHANNEL_INDEX","POSITION_SCALE_CHANNELS","isXorY","POLAR_POSITION_SCALE_CHANNEL_INDEX","POLAR_POSITION_SCALE_CHANNELS","getPositionScaleChannel","sizeType","OFFSET_SCALE_CHANNEL_INDEX","isXorYOffset","_tt","_hr","_u","_al","_dd","_oo","NONPOSITION_SCALE_CHANNEL_INDEX","NONPOSITION_SCALE_CHANNELS","SCALE_CHANNEL_INDEX","SCALE_CHANNELS","isScaleChannel","ALL_MARKS","bar","geoshape","_g","ALL_MARKS_EXCEPT_GEOSHAPE","rangeType","AGGREGATE_OP_INDEX","MULTIDOMAIN_SORT_OP_INDEX","isArgminDef","isArgmaxDef","isAggregateOp","COUNTING_OPS","isCountingAggregateOp","SUM_OPS","SHARED_DOMAIN_OPS","binToString","normalizeBin","isParameterExtent","isBinning","isBinParams","binned","isBinned","autoMaxBins","isExprRef","replaceExprRef","newIndex","signalRefOrValue","extractTitleConfig","titleConfig","subtitleColor","subtitleFont","subtitleFontSize","subtitleFontStyle","subtitleFontWeight","subtitleLineHeight","rest","nonMarkTitleProperties","titleMarkConfig","subtitleMarkConfig","isText","isSignalRef","isVgRangeStep","isDataRefDomain","VG_MARK_CONFIGS","VG_MARK_INDEX","VG_CORNERRADIUS_CHANNELS","signalOrValueRefWithCondition","conditionalSignalRefOrValue","signalOrValueRef","exprFromSignalRefOrValue","exprFromValueRefOrSignalRef","signalOrStringValue","applyMarkConfig","propsList","getMarkConfig","markDef","getStyles","getMarkPropOrConfig","vgChannel","ignoreVgConfig","getMarkStyleConfig","styleConfigIndex","getStyleConfig","styles","styleConfig","sortParams","orderDef","fieldRefOption","orderChannelDef","vgField","mergeTitleFieldDefs","f1","f2","fdToMerge","fieldDef1","mergeTitle","title1","title2","mergeTitleComponent","v1Val","v2Val","explicit","invalidSpec","FIT_NON_SINGLE","containerSizeNonSingle","containerSizeNotCompatibleWithAutosize","droppingFit","unknownField","cannotProjectOnChannelWithoutField","cannotProjectAggregate","selectionNotSupported","columnsNotSupportByRowCol","differentParse","local","customFormatTypeNotAllowed","offsetNestedInsideContinuousPositionScaleDropped","mainChannel","invalidFieldType","droppingColor","emptyFieldDef","fieldDef","incompatibleChannel","markOrFacet","when","channelShouldBeDiscrete","channelShouldBeDiscreteOrDiscretizing","discreteChannelCannotEncode","unaggregateDomainHasNoEffectForRawField","unaggregateDomainWithNonSharedDomainOp","unaggregatedDomainWithLogScale","scalePropertyNotWorkWithScaleType","propName","stepDropped","MORE_THAN_ONE_SORT","invalidTimeUnit","unitName","errorBand1DNotSupport","channelRequiredForBinned","main","isDateTime","part","TIMEUNIT_PARTS","MONTHS","SHORT_MONTHS","DAYS","SHORT_DAYS","dateTimeParts","lowerM","monthIndex","shortM","shortMonthIndex","normalizeMonth","normalizeQuarter","lowerD","dayIndex","shortD","shortDayIndex","normalizeDay","timeUnit","dateTimeToExpr","LOCAL_SINGLE_TIMEUNIT_INDEX","isBinnedTimeUnit","isBinnedTimeUnitString","isUTCTimeUnit","VEGALITE_TIMEFORMAT","getTimeUnitParts","containsTimeUnit","getSmallestTimeUnitPart","fullTimeUnit","timeUnitSpecifierExpression","normalizeTimeUnit","getLocalTimeUnitFromUTCTimeUnit","durationExpr","normalizedTimeUnit","smallestUnitPart","startDate","getDateTimePartAndStep","DATE_PARTS","isDatePart","isFieldEqualPredicate","isFieldLTPredicate","isFieldLTEPredicate","lte","isFieldGTPredicate","isFieldGTEPredicate","gte","isFieldRangePredicate","isFieldOneOfPredicate","oneOf","in","isFieldPredicate","predicateValueExpr","valueExpr","wrapTime","fieldFilterExpression","useInRange","rawFieldExpr","fieldExpr","lastTimeUnit","dateExpr","dateTimeExprToExpr","predicateValuesExpr","isFieldValidPredicate","fieldValidPredicate","exprs","normalizePredicate","Type","quantitative","temporal","nominal","QUANTITATIVE","ORDINAL","TEMPORAL","NOMINAL","GEOJSON","ScaleType","LINEAR","LOG","POW","SQRT","SYMLOG","IDENTITY","SEQUENTIAL","TIME","QUANTILE","QUANTIZE","THRESHOLD","BIN_ORDINAL","POINT","BAND","SCALE_CATEGORY_INDEX","scaleCompatible","scaleType1","scaleType2","scaleCategory1","scaleCategory2","SCALE_PRECEDENCE_INDEX","scaleTypePrecedence","QUANTITATIVE_SCALES","CONTINUOUS_TO_CONTINUOUS_SCALES","isQuantitative","CONTINUOUS_TO_DISCRETE_SCALES","CONTINUOUS_DOMAIN_SCALES","DISCRETE_DOMAIN_SCALES","hasDiscreteDomain","hasContinuousDomain","isContinuousToContinuous","isContinuousToDiscrete","isParameterDomain","SCALE_PROPERTY_INDEX","rangeMax","rangeMin","NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES","NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX","scaleTypeSupportProperty","channelScalePropertyIncompatability","ARC","AREA","BAR","IMAGE","LINE","RECT","RULE","TICK","TRAIL","CIRCLE","SQUARE","GEOSHAPE","isPathMark","isRectBasedMark","PRIMITIVE_MARKS","isMarkDef","FILL_STROKE_CONFIG","VL_ONLY_MARK_CONFIG_PROPERTIES","invalid","timeUnitBandSize","timeUnitBandPosition","MARK_CONFIGS","isRelativeBandSize","BAR_CORNER_RADIUS_INDEX","midPointRefWithPositionInvalidTest","channelDef","midPoint","isFieldDef","fieldInvalidTestValueRef","wrapPositionInvalidTest","fieldInvalidPredicate","valueRefForFieldOrDatumDef","isDatumDef","interpolatedSignalRef","fieldOrDatumDef","fieldOrDatumDef2","startSuffix","endSuffix","channel2Def","defaultRef","isFieldOrDatumDef","isTypedFieldDef","getBandPosition","fieldDef2","binSuffix","binRequiresRange","isValueDef","offsetMixins","widthHeightValueOrSignalRef","isCustomFormatType","customFormatExpr","formatSignalRef","normalizeStack","formatCustomType","fieldToFormat","channelDefType","customFormatTypes","normalizedNumberFormatType","normalizedNumberFormat","numberFormatType","timeFormatType","isFieldOrDatumDefForTimeFormat","rawTimeFormat","isUTCScale","formatExpression","timeFormatExpression","isScaleFieldDef","specifiedFormat","binFormatExpression","formatExpr","datumDef","datumDefToExpr","guideFormat","omitTimeFormatConfig","isPositionFieldOrDatumDef","guideFormatType","binNumberFormatExpr","startField","endField","DEFAULT_SORT_OP","SORT_BY_CHANNEL_INDEX","isSortByChannel","isSortByEncoding","isSortField","isSortArray","isFacetMapping","isFacetFieldDef","isFacetSpec","toFieldDefBase","isSortableFieldDef","getBandSize","useVlSizeChannel","sizeChannel","discreteBandSize","continuousBandSize","hasBandEnd","isOrderOnlyDef","isConditionalDef","hasConditionalFieldDef","hasConditionalFieldOrDatumDef","isContinuousFieldOrDatumDef","isNumericDataDef","isUnbinnedQuantitativeFieldOrDatumDef","isMarkPropFieldOrDatumDef","isStringFieldOrDatumDef","toStringFieldDef","argAccessor","isCount","nofn","isOpFieldDef","tu","timeUnitToString","forAs","defaultTitleFormatter","fieldTitle","timeUnitParams","functionalTitleFormatter","countTitle","verbalTitleFormatter","titleFormatter","setTitleFormatter","formatter","allowDisabling","includeDefault","guideTitle","getGuide","defaultTitle","getFormatMixins","guide","getFieldDef","getFieldOrDatumDef","initChannelDef","initFieldOrDatumDef","fd","guideType","newGuide","initFieldDef","initDatumDef","compositeMark","fullType","getFullName","newType","defaultType","compatible","warning","COMPATIBLE","channelCompatibility","encoding","sub","labelOrient","isTimeFieldDef","undefinedIfExprNotRequired","isTime","isLocalSingleTimeUnit","valueArray","CONDITIONAL_AXIS_PROP_INDEX","vgProp","labelColor","labelFont","labelFontSize","labelFontStyle","labelFontWeight","labelOpacity","gridDash","gridDashOffset","gridOpacity","tickDash","tickDashOffset","tickOpacity","isConditionalAxisValue","AXIS_PARTS","AXIS_PROPERTY_TYPE","gridCap","domainCap","domainDash","domainDashOffset","domainOpacity","labelBound","labelFlush","labelFlushOffset","labelLineHeight","labelSeparation","tickCap","titleAlign","titleAngle","titleBaseline","titleColor","titleFont","titleFontSize","titleFontStyle","titleFontWeight","titleLineHeight","titleOpacity","titleX","titleY","tickExtra","COMMON_AXIS_PROPERTIES_INDEX","AXIS_PROPERTIES_INDEX","labelExpr","isAxisProperty","AXIS_CONFIGS","axisDiscrete","axisPoint","axisQuantitative","axisTemporal","axisXBand","axisXDiscrete","axisXPoint","axisXQuantitative","axisXTemporal","axisYBand","axisYDiscrete","axisYPoint","axisYQuantitative","axisYTemporal","isUnitSpec","CompositeMarkNormalizer","hasMatchingType","getMarkType","channelHasField","channelHasFieldOrDatum","channelHasNestedOffsetScale","isAggregate","extractTransformsFromEncoding","oldEncoding","aggOp","remaining","isTitleDefined","newField","newFieldDef","aggregateEntry","secondaryChannel","isNonPositionScaleChannel","markChannelCompatible","markSupported","getSupportedMark","supportMark","primaryFieldDef","normalizeEncoding","normalizedEncoding","newChannelDef","mapping","thisArg","pathGroupingFields","details","getCompositeMarkTooltip","tooltipSummary","continuousAxisChannelDef","encodingWithoutContinuousAxis","withFieldName","fiveSummaryTooltip","fieldPrefix","titlePrefix","mainTitle","getTitle","escape","tooltipFieldDefs","channelDefArray","fieldDefs","makeCompositeAggregatePartFactory","compositeMarkDef","continuousAxis","sharedEncoding","compositeMarkConfig","partName","positionPrefix","endPositionPrefix","extraEncoding","partLayerMixins","partBaseSpec","compositeMarkContinuousAxis","continuousAxisChannelDef2","continuousAxisChannelDefError","continuousAxisChannelDefError2","filterAggregateFromChannelDef","continuousAxisWithoutAggregate","compositeMarkOrient","xAggregate","yAggregate","BOXPLOT","boxPlotNormalizer","normalizeBoxPlot","getBoxPlotType","_encoding","_p","outerSpec","boxplot","sizeValue","boxPlotType","ticksOrient","boxOrient","customTooltipWithoutAggregatedField","continuousFieldName","boxplotSpecificAggregate","boxParamsQuartiles","postAggregateCalculates","calculate","oldContinuousAxisChannelDef","oldEncodingWithoutContinuousAxis","filteredEncoding","customTooltipWithAggregatedField","filterTooltipWithAggregatedField","boxParams","encodingWithoutSizeColorAndContinuousAxis","makeBoxPlotPart","makeBoxPlotExtent","makeBoxPlotBox","makeBoxPlotMidTick","fiveSummaryTooltipEncoding","endTick","whiskerTooltipEncoding","whiskerLayers","boxLayers","layer","lowerBoxExpr","upperBoxExpr","iqrExpr","lowerWhiskerExpr","upperWhiskerExpr","joinaggregateTransform","joinaggregate","filteredWhiskerSpec","encodingWithoutSizeColorContinuousAxisAndTooltip","axisWithoutTitle","outlierLayersMixins","filteredLayersMixins","filteredLayersMixinsTransforms","continousAxisField","ERRORBAR","errorBarNormalizer","normalizeErrorBar","tooltipEncoding","errorBarParams","makeErrorBarPart","errorbar","inputType","xError","xError2","yError","yError2","errorBarIsInputTypeRaw","isTypeAggregatedUpperLower","errorBarIsInputTypeAggregatedUpperLower","isTypeAggregatedError","errorBarIsInputTypeAggregatedError","errorBarOrientAndInputType","errorBarSpecificAggregate","tooltipTitleWithFieldName","getTitlePrefix","centerOp","lowerExtentOp","upperExtentOp","postAggregateCalculate","errorBarAggregationAndCalculation","oldContinuousAxisChannelDef2","oldContinuousAxisChannelDefError","oldContinuousAxisChannelDefError2","oldAggregate","oldGroupBy","ERRORBAND","errorBandNormalizer","normalizeErrorBand","errorBandDef","makeErrorBandPart","errorband","is2D","bandMark","bordersMark","compositeMarkRegistry","VL_ONLY_LEGEND_CONFIG","HEADER_TITLE_PROPERTIES_MAP","HEADER_LABEL_PROPERTIES_MAP","labelAnchor","HEADER_TITLE_PROPERTIES","HEADER_LABEL_PROPERTIES","HEADER_CONFIGS","headerRow","headerColumn","headerFacet","LEGEND_SCALE_CHANNELS","COMMON_LEGEND_PROPERTY_INDEX","clipHeight","fillColor","gradientOpacity","legendX","legendY","strokeColor","symbolDash","symbolDashOffset","symbolFillColor","symbolOpacity","symbolStrokeColor","SELECTION_ID","defaultConfig","encodings","isLegendBinding","isLegendStreamBinding","isSelectionParameter","assembleParameterSignals","isConcatSpec","isVConcatSpec","isHConcatSpec","getStepFor","offsetIsDiscrete","for","isStep","isFrameMixins","COMPOSITION_LAYOUT_PROPERTIES","spacing","getViewConfigContinuousSize","viewConfig","getViewConfigDiscreteStep","getViewConfigDiscreteSize","DEFAULT_STEP","continuousWidth","continuousHeight","binSpacing","minBandSize","outliers","borders","pointPadding","barBandPaddingInner","rectBandPaddingInner","bandWithNestedOffsetPaddingInner","bandWithNestedOffsetPaddingOuter","minFontSize","maxFontSize","minOpacity","maxOpacity","minSize","minStrokeWidth","maxStrokeWidth","quantileCount","quantizeCount","gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity","selection","tab10","DEFAULT_FONT_SIZE","guideLabel","groupTitle","groupSubtitle","DEFAULT_COLOR","gray0","gray1","gray2","gray3","gray4","gray5","gray6","gray7","gray8","gray9","gray10","gray11","gray12","gray13","gray14","gray15","getAxisConfigInternal","axisConfigInternal","configPropsWithExpr","initConfig","specifiedConfig","restConfig","mergedConfig","fontConfig","colorSignalConfig","fontSizeSignalConfig","outputConfig","markConfigType","axisConfigType","headerConfigType","styleConfigInternal","getStyleConfigInternal","MARK_STYLES","VL_ONLY_CONFIG_PROPERTIES","VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX","redirectConfigToStyleConfig","toProp","compositeMarkPart","isLayerSpec","SpecMapper","mapFacet","isRepeatSpec","mapRepeat","mapHConcat","mapVConcat","mapConcat","mapLayerOrUnit","mapLayer","mapUnit","subspec","hconcat","vconcat","STACK_OFFSET_INDEX","STACKABLE_MARKS","STACK_BY_DEFAULT_MARKS","isUnbinnedQuantitative","potentialStackedChannel","isCartesianBarOrArea","xDef","yDef","fieldChannel","stackedFieldDef","stackedField","dimensionChannel","getDimensionChannel","groupbyChannels","groupbyFields","dimensionDef","dimensionField","dimensionOffsetChannel","dimensionOffsetDef","dimensionOffsetField","stackBy","cDef","initMarkdef","originalMarkDef","specifiedOrient","xIsMeasure","yIsMeasure","xIsTemporal","yIsTemporal","cornerRadiusEnd","newProps","newProp","dropLineAndPoint","dropLineAndPointFromConfig","getPointOverlay","markConfig","getLineOverlay","PathOverlayNormalizer","normParams","pointOverlay","lineOverlay","stackProps","overlayEncoding","stackFieldChannel","replaceRepeaterInFacet","repeater","replaceRepeaterInMapping","replaceRepeaterInFieldDef","replaceRepeaterInEncoding","replaceRepeatInProp","isRepeatRef","replaceRepeaterInFieldOrDatumDef","replaceRepeaterInChannelDef","channelDefWithoutCondition","RuleForRangedLineNormalizer","mainChannelDef","hasX2","hasY2","mergeEncoding","parentEncoding","parentChannelDef","mergedChannelDef","mergeProjection","parentProjection","isFilter","isImputeSequence","isLookup","isPivot","isDensity","isRegression","isLoess","isSample","isWindow","isJoinAggregate","isFlatten","isCalculate","isBin","isImpute","isTimeUnit","isStack","isFold","isExtent","normalizeTransforms","normalizeBinExtent","normalizeChannelDef","cond","normalizeSelectionComposition","_a","pred","emptySelections","selectionPredicates","TopLevelSelectionsNormalizer","selections","addSpecNameToParams","normalizedSpec","topLevelSelectionNormalizer","coreNormalizer","selectionCompatNormalizer","normalizeGenericSpec","sizeInfo","isFitCompatible","autosizeDefault","_normalizeAutoSize","normalizeAutoSize","nonFacetUnitNormalizers","hasRow","hasColumn","hasFacet","mapFacetedUnit","specWithReplacedEncoding","repeaterPrefix","mapUnitWithParentEncodingOrProjection","normalizeLayerOrUnit","unitNormalizer","isLayerRepeatSpec","mapLayerRepeat","mapNonLayerRepeat","childSpec","layerValue","childRepeater","childName","remainingProperties","repeatValues","repeatValue","rowValue","columnValue","mergedProjection","mergedEncoding","facetMapping","getFacetMappingAndLayout","newEncoding","facets","defWithoutLayout","otherParams","selDef","select","TOP_LEVEL_PROPERTIES","extractTopLevelProperties","includeParams","Split","combine","getWithExplicit","setWithExplicit","copyKeyFromSplit","copyKeyFromObject","copyAll","makeExplicit","makeImplicit","tieBreakByComparing","propertyOf","diff","defaultTieBreaker","mergeValuesWithExplicit","tieBreaker","AncestorParse","parseNothing","isUrlData","isInlineData","isNamedData","isGenerator","isSequenceGenerator","isSphereGenerator","isGraticuleGenerator","DataSourceType","assembleProjection","hasLegend","assembleInit","assembled","dateTimeToTimestamp","assembleUnitSelectionSignals","selCmpt","component","modifyExpr","TUPLE","selectionCompilers","MODIFY","STORE","cleanupEmptyOnArray","assembleFacetSignals","getName","assembleUnitSelectionMarks","DataFlowNode","debugName","_children","addChild","numChildren","oldChild","insertAsParentOf","swapWithParent","newParent","OutputNode","cloneObj","_source","_name","refCounts","dependentFields","producedFields","_hash","getSource","isRequired","setSource","isTimeUnitTransformComponent","timeUnitComponent","offsetAs","TimeUnitNode","makeFromEncoding","formula","reduceFieldDef","isUnitModel","rectBandPosition","makeFromTransform","removeFormulas","newFormula","fieldAs","assemble","startEnd","offsetedRectFormulas","escapedField","endAs","OFFSETTED_RECT_START_SUFFIX","OFFSETTED_RECT_END_SUFFIX","smallestUnit","startExpr","endExpr","interpolateExpr","TUPLE_FIELDS","SelectionProjectionComponent","hasChannel","hasField","hasSelectionId","sg","cfg","initVal","getScaleComponent","geoChannel","allSignals","scaleBindings","topLevelSignals","isTopLevelLayer","namedSg","VL_SELECTION_RESOLVE","isLayerModel","BRUSH","SCALE_TRIGGER","GEO_INIT_TICK","INIT","hasProjection","filterExpr","tupleSg","scaledInterval","vname","visual","projectionName","scaled","getSizeSignalRef","coord","von","hasScales","vinit","initIdx","initSg","channelSignals","centerSg","xvname","yvname","xinit","yinit","sizeSg","visualSignals","triggerSg","scaleTriggers","toNum","dataSignals","vgStroke","fieldsSg","brushes","cmpt","wrapCondition","refFn","vgConditions","conditionValueRef","isConditionalParameter","parseSelectionPredicate","textRef","tooltipRefForEncoding","reactiveGeom","tooltipRefFromChannelDef","markTooltip","tooltipData","formatConfig","tooltipFormat","toSkip","fDef","channel2","keyValues","enableAria","ariaRoleDesc","descriptionValue","nonPosition","transparentIfNeeded","defaultFill","defaultStroke","colorVgChannel","fillStrokeMarkDefAndConfig","positionOffset","baseChannel","offsetType","markDefOffsetValue","pointPosition","defaultPos","pointPositionDefaultRef","positionRef","definedValueOrConfig","domainDefinitelyIncludesZero","ALIGNED_X_CHANNEL","BASELINED_Y_CHANNEL","middle","vgAlignedPositionChannel","defaultAlign","alignChannel","alignExcludingSignal","pointOrRangePosition","defaultPos2","rangePosition","pos2Mixins","vgSizeChannel","position2Ref","position2orSize","pointPosition2OrSize","dimensionSize","rectPosition","channelDef2","hasSizeDef","offsetScaleChannel","isBarBand","offsetScaleName","offsetScale","sizeMixins","hasSizeFromMarkOrEncoding","bandSize","defaultSizeRef","posRef","vgChannel2","sizeRef","sizeOffset","positionAndSize","axisTranslate","offset2","bandSizeExpr","binSpacingOffset","getBinSpacing","binSpacingOffset2","bandPositionForBandSize","useRectOffsetField","rectBinRef","startRef","rectBinPosition","hasFieldDef","bandWidth","scaleRange","bandPaddingInner","isEnd","spacingOffset","reverseExpr","axisTranslateExpr","minBandSizeExpr","spacingAndSizeOffset","ALWAYS_IGNORE","baseEncodeEntry","markDefProperties","wrapAllFieldsInvalid","filterIndex","aggregator","scaleComponent","allFieldsInvalidPredicate","valueIfDefined","VORONOI","nearest","cellDef","isVoronoi","exists","inputBindings","disableDirectManipulation","sgname","TOGGLE","tpl","findIndex","addClear","vIdx","tIdx","legendBindings","projLen","selDef_","legendFilter","selName","markName","sgName","ANCHOR","DELTA","boundScales","onDelta","scaleCmpt","reversed","facetModel","isFacetModel","getFacetModel","requiresSelectionId","identifier","startsWithDatum","getDependentFields","dependents","FilterNode","_dependentFields","dfnode","getSelectionComponent","tunode","parseSelectionExtent","filterOp","isSelectionPredicate","setAxisEncode","vgRef","_b","assembleAxis","axisCmpt","disable","propType","propValue","valueOrSignalRef","conditions","propIndex","valueOrSignalCRef","mainExtracted","hasAxisPart","titleString","assembleTitle","assembleAxisSignals","getAxisConfigFromConfigTypes","configTypes","configType","orient1","orientConfig1","orientConfig2","conditionalOrientAxisConfig","getAxisConfigStyle","axisConfigTypes","toMerge","getAxisConfig","axisConfigs","configFrom","configValue","axisRules","defaultGrid","gridChannel","defaultLabelAlign","defaultLabelBaseline","defaultLabelFlush","hasTimeUnit","defaultLabelOverlap","defaultTickCount","fieldDefTitle","getFieldDefTitle","typedFieldDef","defaultZindex","normalizeAngleExpr","alwaysIncludeMiddle","mainOrient","CalculateNode","parseAllForSortIndex","forEachFieldDef","sortValue","sortArrayIndexField","getHeaderChannel","getHeaderProperty","headerSpecificConfig","getHeaderProperties","HEADER_CHANNELS","HEADER_TYPES","assembleTitleGroup","facetFieldDef","headerChannel","defaultHeaderGuideBaseline","defaultHeaderGuideAlign","assembleHeaderProperties","assembleHeaderGroups","layoutHeader","headerType","headerComponent","assembleHeaderGroup","getSort","assembleLabelTitle","titleTextExpr","isFacetWithoutRowCol","hasAxes","sizeSignal","LAYOUT_TITLE_BAND","getLayoutTitleBand","propertiesMap","assembleLayoutSignals","sizeSignals","layoutSize","stepSignal","sizeExpr","isWidth","safeExpr","cardinality","getSizeTypeFromLayoutSizeType","layoutSizeType","guideEncodeEntry","valueDef","defaultScaleResolve","isConcatModel","parseGuideResolve","channelScaleResolve","LEGEND_COMPONENT_PROPERTY_INDEX","LEGEND_COMPONENT_PROPERTIES","LegendComponent","legendEncodeRules","symbolsSpec","legendCmpt","getMaxValue","getFirstConditionValue","selectedCondition","gradientSpec","specifiedlabelsSpec","labelsSpec","entriesSpec","getConditionValue","conditionalDef","reducer","hasConditionalValueDef","legendRules","legendConfig","gradientLengthSignal","defaultGradientLength","shapeChannelDef","markShape","defaultSymbolType","getDirection","defaultDirection","legendComponent","parseLegendForChannel","parseUnitLegend","mergeLegendComponent","parseNonUnitLegend","isExplicit","getLegendDefWithScale","legendSelections","parseInteractiveLegend","getLegendType","ruleParams","legendEncoding","legendEncodeParams","legendEncodingPart","mergedLegend","childLegend","mergedOrient","childOrient","typeMerged","mergedValueWithExplicit","st1","st2","assembleLegends","legendComponentIndex","legendByDomain","domainHash","mergedLegendComponent","setLegendEncode","assembleLegend","assembleProjectionForModel","fits","lookupDataSource","PROJECTION_PROPERTIES","ProjectionComponent","specifiedProjection","isFit","posssiblePair","requestDataName","Main","gatherFitData","projComp","parseUnitProjection","nonUnitProjection","mergable","allPropertiesShared","mergeIfNoConflict","modelProjection","renameProjection","parseNonUnitProjections","rangeFormula","formulaAs","binKey","getBinSignalName","createBinComponent","isBinTransform","normalizedBin","extentSignal","getSignalsFromModel","binComponent","BinNode","binComponentIndex","renameSignal","flatMap","binAs","remainingAs","binTrans","AggregateNode","dimensions","groupBy","meas","argField","scaleDomain","posChannel","isFieldRange","addDimension","parentMeasures","childMeasures","mergeMeasures","addDimensions","alias","FacetNode","sortField","sortIndexField","childModel","depFields","getChildIndependentFieldsWithStep","childIndependentFieldsWithStep","childScaleComponent","getFieldFromDomain","assembleDomain","assembleRowColumnHeaderData","crossedDataName","childChannel","assembleFacetHeaderData","hasSharedAxis","facetData","unquote","getImplicitFromFilterTransform","ParseNode","_parse","ancestorParse","makeWithAncestors","parsedAs","assembleFormatParse","formatParse","assembleTransforms","onlyNested","IdentifierNode","GraticuleNode","SequenceNode","SourceNode","_data","defaultExtension","_generator","hasName","_Optimizer_modified","receiver","isDataSourceNode","Optimizer","setModified","modifiedFlag","BottomUpOptimizer","getNodeDepths","depths","optimize","topologicalSort","TopDownOptimizer","MergeIdenticalNodes","mergeNodes","mergedNode","hashes","buckets","RemoveUnnecessaryIdentifierNodes","RemoveDuplicateTimeUnits","timeUnitFields","RemoveUnnecessaryOutputNodes","MoveParseUp","MergeParse","originalChildren","parseChildren","commonParse","conflictingParse","parseNode","mergedParseNode","childNode","RemoveUnusedSubtrees","MergeTimeUnits","timeUnitChildren","combination","MergeAggregates","aggChildren","groupedAggregates","groupBys","mergeableAggs","mergedAggs","MergeBins","moveBinsUp","promotableBins","remainingBins","promotedBin","remainingBin","MergeOutputs","otherChildren","mainOutput","lastOutput","theChild","JoinAggregateTransformNode","getDefaultName","joinAggregateFieldDef","StackNode","_stack","stackTransform","sortFields","sortOrder","normalizedAs","isValidAsArray","dimensionFieldDefs","stackField","facetby","stackProperties","groupbyChannel","stackby","_field","getStackByFields","getGroupbyFields","dimensionFieldDef","binStart","binEnd","WindowTransformNode","windowFieldDef","moveFacetDown","facetMain","moveMainDownToFacet","cloner","newName","FACET_SCALE_PREFIX","outputNodes","MAX_OPTIMIZATION_RUNS","checkLinks","runOptimizer","optimizer","optimizationDataflowHelper","dataComponent","firstPass","roots","SignalRefWrapper","exprGenerator","fromName","rename","localScaleComponents","domains","parseDomainForChannel","parseSelectionDomain","isFaceted","facetParent","parseUnitScaleDomain","selectionExtent","childComponent","domainsTieBreaker","se","parseNonUnitScaleDomain","scaleConfig","reason","canUseUnaggregatedDomain","useUnaggregatedDomain","normalizeUnaggregatedDomain","specifiedScales","parseSingleChannelDomain","convertDomainIfItIsDateTime","mapDomainToDataSignal","isDomainUnionWith","defaultDomain","unionWith","stackDimensions","normalizeSortField","fieldDefToSortBy","isStackedMeasure","domainSort","Raw","binSignal","getSignalName","isRectWithOffset","isDataRefUnionedDomain","nonUnionDomain","isFieldRefUnionDomain","uniqueDomains","_s","domainWithoutSort","sorts","filteredSorts","unionDomainSorts","allData","mergeDomains","assembleScales","assembleScalesForModel","otherScaleProps","assembleScaleRange","parsedExtent","assembleSelectionScaleDomain","ScaleComponent","typeWithExplicit","RANGE_PROPERTIES","getBinStepSignal","binCount","updatedName","parseRangeForChannel","specifiedScale","supportedByScaleType","channelIncompatability","parseScheme","getPositionStep","positionChannel","getOffsetStep","positionSize","getDiscretePositionSize","fullWidthOrHeightRange","offsetScaleType","positionScaleCmpt","positionScaleType","positionScaleName","positionDef","bandPositionOffset","bandPositionOffsetExpr","getOffsetRange","sizeRangeMin","xyStepSignals","maxBandSize","minXYStep","pointStep","MAX_SIZE_RANGE_STEP_RATIO","sizeRangeMax","rMax","rMin","defaultContinuousToDiscreteCount","defaultRange","isExtendedScheme","mergedScaleCmpt","offsetChannel","offsetDef","offsetScaleCmpt","stepCount","widthStep","heightStep","parseScaleProperty","localScaleCmpt","specifiedValue","scalePadding","scalePaddingInner","scaleRules","hasNestedOffsetScale","hasSecondaryRangeChannel","parseUnitScaleProperty","parseNonUnitScaleProperty","specifiedDomain","barConfig","continuousPadding","paddingValue","offsetBandPaddingInner","paddingInnerValue","bandPaddingOuter","offsetBandPaddingOuter","xReverse","rangeWithExplicit","parseUnitScaleRange","valueWithExplicit","defaultScaleType","channelSupportScaleType","specifiedType","fieldDefType","parseScaleCore","scaleComponents","sType","parseUnitScaleCore","scaleTypeWithExplicitIndex","explicitScaleType","childScaleType","scaleTypeTieBreaker","childScale","renameScale","parseNonUnitScaleCore","NameMap","nameMap","oldName","Model","parentGivenName","correctDataNames","scaleNameMap","projectionNameMap","signalNameMap","specType","compositionConfig","spacingConfig","extractCompositionLayout","outputNodeRefCounts","parseLayoutSize","renameTopLevelLayoutSizeSignal","parseSelections","parseAxesAndHeaders","parseLegends","parseMarkGroup","ignoreRange","parseScales","assembleEncodeFromView","baseView","assembleGroupEncodeEntry","isTopLevel","encodeEntry","assembleLayout","headerComponentIndex","assembleLayoutTitleBand","assembleDefaultLayout","assembleHeaderMarks","headerMarks","assembleAxes","axisComponents","assembleProjections","assembleProjectionsForModelAndChildren","titleNoEncoding","assembleGroup","assembleSignals","assembleMarks","getDataName","fullName","oldSignalName","originalScaleName","localScaleComponent","variableName","origName","sel","hasAxisOrientSignalRef","hasOrientSignalRef","ModelWithField","getMapping","DensityTransformNode","specifiedAs","ExtentTransformNode","FilterInvalidNode","make","vegaFilters","FlattenTransformNode","FoldTransformNode","fold","GeoJSONNode","parseAll","geoJsonCounter","pair","GeoPointNode","ImputeNode","processSequence","imputeTransform","imputedChannel","keyChannel","LoessTransformNode","LookupNode","secondary","fromOutputNode","isLookupData","fromSource","findSource","fromOutputName","isLookupSelection","materialized","foreign","asName","QuantileTransformNode","RegressionTransformNode","regression","PivotTransformNode","pivot","SampleTransformNode","makeWalkTree","datasetIndex","walkTree","dataSource","parseFacetHeader","makeHeaderComponent","mergeChildAxis","axisComponent","mainAxis","parseChildrenLayoutSize","parseNonUnitLayoutSizeForChannel","layoutSizeCmpt","mergedSize","childSize","scaleResolve","defaultUnitSize","facetSortFieldName","FacetModel","buildModel","initFacet","initFacetFieldDef","normalizedFacet","parseFacetHeaders","assembleSelectionTopLevelSignals","assembleSelectionData","getHeaderLayoutMixins","layoutMixins","layoutHeaderComponent","bandType","columnDistinctSignal","assembleGroupStyle","getCardinalityAggregateForChild","assembleFacet","facetRoot","outputName","facetSortFields","facetSortOrder","ORTHOGONAL_ORIENT","assembleFacetData","otherData","formatMesh","otherFeature","formatFeature","otherMesh","head","existingSource","parseRoot","parentIsLayer","lookupCounter","derivedType","transformNode","parseTransformArray","implicitSelection","getImplicitFromSelection","implicitEncoding","mainFieldDef","dimensionChannelDef","getImplicitFromEncoding","rawName","mainName","lookupName","materializeSelections","facetName","makeJoinAggregateFromFacet","ConcatModel","getChildren","widthType","heightType","parseConcatLayoutSize","parseAxisGroup","layoutSignals","AXIS_COMPONENT_PROPERTIES_INDEX","AXIS_COMPONENT_PROPERTIES","AxisComponent","OPPOSITE_ORIENT","mergeAxisComponents","mergedAxisCmpts","childAxisCmpts","mergeAxisComponent","propsToAlwaysIncludeConfig","defaultOrient","typeBasedConfigTypes","axisChannel","axisOrient","vlOnlyConfigTypes","vgConfigTypes","vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle","getAxisConfigs","getLabelAngle","hasValue","hasConfigValue","axisEncoding","axisEncodingPart","specifiedLabelsSpec","fixedShape","shapeMixins","defaultSize","markPropOrConfig","markCompiler","vgMark","postEncodingTransform","shapeDef","vgThicknessChannel","FACETED_PATH_PREFIX","STACK_GROUP_PREFIX","getMarkGroup","fromPrefix","xScale","yScale","scaleClip","projectionClip","unitCount","parentCount","interactiveFlag","UnitModel","parentGivenSize","specifiedAxes","specifiedLegends","filledConfig","defaultFilled","initEncoding","initLayoutSize","initScales","initAxes","initLegends","isGeoShapeMark","hasGeoPosition","scaleInternal","_axis","axisSpec","initAxis","axisInternal","_legend","supportLegend","specifiedSize","parseUnitLayoutSize","selDefs","selCmpts","selectionConfig","def_","parseUnitSelection","getPathGroups","fieldScale","stackFieldGroup","groupUpdate","innerGroupUpdate","groupByField","getGroupsForStackedBarWithCornerRadius","parseMarkGroups","hasSelections","isPoint","assembleTopLevelSignals","dataCopy","assembleUnitSelectionData","LayerModel","axisCount","oppositeOrient","parseLayerAxes","uniqueStyles","assembleLayerSelectionMarks","unitSize","isAnyConcatSpec","compile","inputSpec","newLogger","firstPassCounter","secondPassCounter","optimizeDataflow","vgSpec","topLevelProperties","datasets","usermeta","vgConfig","vlOnlyMarkSpecificConfigs","redirectTitleConfig","stripAndRedirectConfig","sourceIndex","newData","whereTo","assembleRootData","otherTopLevelProps","$schema","assembleTopLevelModel","autoSizeType","inverseSizeType","getFitType","getTopLevelProperties","normalized","library","lightColor","medColor","darkTheme","markColor$7","excelTheme","markColor$6","axisColor$2","backgroundColor$2","blackTitle","fiveThirtyEightTheme","markColor$5","ggplot2Theme","labelFont$1","markColor$4","colorSchemes$1","latimesTheme","markColor$3","axisColor$1","quartzTheme","markColor$2","voxTheme","markColor$1","axisColor","colorSchemes","urbanInstituteTheme","markColor","defaultFont$1","googlechartsTheme","ptToPx","fontSmallPx","legendFontPx","fontLargePx","fontStandard","fontTitle","firstLevelElementColor","secondLevelElementColor","backgroundColor","paletteColor1","divergentColorMin","divergentPalette","powerbiTheme","darkCategories","lightCategories","genCarbonConfig","viewbg","textColor","carbonwhite","carbong10","carbong90","carbong100","replacer","EL_ID","DEFAULT_OPTIONS","offsetX","offsetY","styleId","theme","disableDefaultStyle","valueToHtml","elementId","tooltipHandler","getElementById","innerHTML","createDefaultStyle","classList","fullscreenElement","tooltipBox","calculatePosition","_typeof","_defineProperty","hint","prim","toPrimitive","_toPrimitive","_toPropertyKey","getDefaultExportFromCjs","__esModule","hasRequiredIterator","yallist","Yallist$1","self","tail","inserted","removeNode","unshiftNode","pushNode","thisp","walker","forEachReverse","getReverse","mapReverse","initial","reduceReverse","toArray","toArrayReverse","ret","sliceReverse","deleteCount","Yallist","er","MAX","LENGTH","LENGTH_CALCULATOR","ALLOW_STALE","MAX_AGE","DISPOSE","NO_DISPOSE_ON_SET","LRU_LIST","UPDATE_AGE_ON_GET","naiveLength","doUse","isStale","del","maxAge","forEachStep","stale","dispose","noDisposeOnSet","updateAgeOnGet","mL","allowStale","mA","lengthCalculator","lC","itemCount","rforEach","dump","dumpLru","expiresAt","prune","looseOption","freeze","loose","emptyOpts","parseOptions_1","re$1","exports","MAX_LENGTH","MAX_SAFE_COMPONENT_LENGTH","MAX_SAFE_BUILD_LENGTH","MAX_LENGTH$1","RELEASE_TYPES","SEMVER_SPEC_VERSION","FLAG_INCLUDE_PRERELEASE","FLAG_LOOSE","debug_1","env","NODE_DEBUG","safeRe","R","LETTERDASHNUMBER","safeRegexReplacements","createToken","isGlobal","safe","makeSafeRegex","NUMERICIDENTIFIER","NUMERICIDENTIFIERLOOSE","NONNUMERICIDENTIFIER","PRERELEASEIDENTIFIER","PRERELEASEIDENTIFIERLOOSE","BUILDIDENTIFIER","MAINVERSION","PRERELEASE","BUILD","FULLPLAIN","MAINVERSIONLOOSE","PRERELEASELOOSE","LOOSEPLAIN","XRANGEIDENTIFIER","XRANGEIDENTIFIERLOOSE","GTLT","XRANGEPLAIN","XRANGEPLAINLOOSE","COERCE","LONETILDE","tildeTrimReplace","LONECARET","caretTrimReplace","comparatorTrimReplace","reExports","numeric","compareIdentifiers$1","anum","bnum","identifiers","compareIdentifiers","rcompareIdentifiers","parseOptions","semver","SemVer","includePrerelease","LOOSE","FULL","major","minor","prerelease","build","compareMain","comparePre","compareBuild","release","identifierBase","compare_1","compare$5","compare$4","compare$3","compare$2","compare$1","eq","neq","hasRequiredComparator","hasRequiredRange","cmp_1","Range","requireRange","Comparator","parseRange","isNullSet","isAny","comps","memoKey","cached","hr","HYPHENRANGELOOSE","HYPHENRANGE","hyphenReplace","COMPARATORTRIM","TILDETRIM","CARETTRIM","rangeList","comp","parseComparator","replaceGTE0","COMPARATORLOOSE","rangeMap","comparators","thisComparators","isSatisfiable","rangeComparators","thisComparator","rangeComparator","testSet","ANY","COMPARATOR","requireComparator","remainingComparators","testComparator","otherComparator","replaceCarets","replaceTildes","replaceXRanges","replaceStars","replaceTilde","TILDELOOSE","TILDE","replaceCaret","CARETLOOSE","CARET","replaceXRange","XRANGELOOSE","XRANGE","gtlt","xM","anyX","STAR","GTE0PRE","GTE0","incPr","fM","fm","fp","fpr","fb","tM","tm","tp","tpr","tb","satisfies_1","satisfies$1","ownKeys","enumerableOnly","getOwnPropertySymbols","sym","getOwnPropertyDescriptor","_objectSpread","getOwnPropertyDescriptors","vegaLite","vl","DEFAULT_ACTIONS","export","png","compiled","editor","I18N","CLICK_TO_VIEW_ACTIONS","COMPILED_ACTION","EDITOR_ACTION","PNG_ACTION","SOURCE_ACTION","SVG_ACTION","NAMES","VERSION","PREPROCESSOR","vlSpec","viewSource","sourceHeader","sourceFooter","footer","win","write","createLoader","opts","loadOpts","none","matches","childMatcher","childFirst","firstElementChild","EnterNode","namespaceURI","bindIndex","groupLength","dataLength","bindKey","nodeByKeyValue","arraylike","xhtml","xlink","xml","namespaces","attrRemove","attrRemoveNS","fullname","attrConstant","attrConstantNS","attrFunction","attrFunctionNS","defaultView","styleRemove","styleConstant","styleFunction","styleValue","getPropertyValue","getComputedStyle","propertyRemove","propertyConstant","propertyFunction","classArray","ClassList","_node","_names","getAttribute","classedAdd","classedRemove","classedTrue","classedFalse","classedFunction","textRemove","textConstant","textFunction","htmlRemove","htmlConstant","htmlFunction","raise","creatorInherit","documentElement","creatorFixed","namespace","constantNull","selection_cloneShallow","cloneNode","selection_cloneDeep","onRemove","__on","contextListener","CustomEvent","createEvent","initEvent","bubbles","cancelable","dispatchConstant","dispatchFunction","Selection","parents","_groups","_parents","subgroups","subnode","subgroup","selectAll","arrayAll","selectorAll","selectChild","childFind","selectChildren","childrenFilter","matcher","enterGroup","updateGroup","_enter","_exit","sparse","onenter","onupdate","onexit","groups0","groups1","m0","merges","group0","group1","compareDocumentPosition","compareNode","sortgroups","sortgroup","getAttributeNS","classed","html","creator","before","deep","typenames","dispatch","emptyOn","emptyTween","CREATED","STARTED","timing","schedules","__transition","tween","ease","schedule","tweenRemove","tween0","tween1","tweenFunction","tweenValue","transition","string00","interpolate0","string1","string0","string10","attrTweenNS","attrInterpolateNS","_value","attrTween","attrInterpolate","delayFunction","delayConstant","durationFunction","durationConstant","Transition","newId","selection_prototype","inherit","id0","id1","on0","on1","sit","onFunction","styleTween","styleNull","listener0","styleMaybeRemove","styleInterpolate","textTween","textInterpolate","removeFunction","easeConstant","easeVarying","cancel","interrupt","defaultTiming","applyX","applyY","invertX","invertY","rescaleX","rescaleY","Vega","_Component","_inherits","_classCallCheck","getRef","_assertThisInitialized","divId","uuidv4","prevProps","svgRendererScaleFactor","signalsToObserve","className","_this2","parsedSpec","loadedEmbedOptions","embedOptions","defaultStyle","embedOptionsFromUsermeta","usermetaLoader","usermetaOpts","parsedOpts","mergedOpts","actions","i18n","Warn","downloadFileName","ID","rootContainer","possibleRoot","getRootNode","ShadowRoot","getRoot","providedMode","guessMode","chartWrapper","expressionFunctions","viewClass","expressionInterpreter","documentClickHandler","updateSet","forceActionsMenu","summary","ev","ctrl","i18nExportAction","exportLink","download","viewSourceLink","compileLink","editorUrl","editorLink","listen","postMessage","_embed","vegaEmbed","vegaView","vegaSignals","filteredSignals","setProps","signalData","wait","debounceWait","maxWait","signalHandler","cleanedValue","cleanJson","React","Component","defaultProps","propTypes","PropTypes","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","freeGlobal","freeSelf","objectToString","nativeMax","nativeMin","isObjectLike","isSymbol","isBinary","lastArgs","lastThis","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","invokeFunc","shouldInvoke","timeSinceLastCall","timerExpired","trailingEdge","remainingWait","debounced","isInvoking","leadingEdge","stringOrChar","passedObj","maxLength","currentIndent","reserved","keyPart","nextIndent","prettified","stringLiteral"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"async-Vega.js","mappings":";4pPAAA,MACA,GACEA,WAFmC,oBAAXC,QAA0BA,OAAOD,YAAcC,OAAOD,WAAWE,KAAKD,SCGhG,IAAIE,EACJ,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-browser/native.js","webpack:///./node_modules/uuid/dist/esm-browser/rng.js","webpack:///./node_modules/uuid/dist/esm-browser/stringify.js","webpack:///./node_modules/uuid/dist/esm-browser/v4.js","webpack:///./node_modules/fast-json-patch/module/helpers.mjs","webpack:///./node_modules/fast-json-patch/module/core.mjs","webpack:///./node_modules/fast-json-patch/module/duplex.mjs","webpack:///./node_modules/fast-json-patch/index.mjs","webpack:///./node_modules/vega-util/build/vega-util.module.js","webpack:///./node_modules/d3-dsv/src/dsv.js","webpack:///./node_modules/topojson-client/src/identity.js","webpack:///./node_modules/topojson-client/src/feature.js","webpack:///./node_modules/topojson-client/src/transform.js","webpack:///./node_modules/topojson-client/src/reverse.js","webpack:///./node_modules/topojson-client/src/stitch.js","webpack:///./node_modules/topojson-client/src/mesh.js","webpack:///./node_modules/d3-array/src/ticks.js","webpack:///./node_modules/d3-format/src/formatSpecifier.js","webpack:///./node_modules/d3-format/src/formatPrefixAuto.js","webpack:///./node_modules/d3-format/src/formatDecimal.js","webpack:///./node_modules/d3-format/src/exponent.js","webpack:///./node_modules/d3-format/src/precisionPrefix.js","webpack:///./node_modules/d3-format/src/precisionRound.js","webpack:///./node_modules/d3-format/src/precisionFixed.js","webpack:///./node_modules/d3-format/src/formatRounded.js","webpack:///./node_modules/d3-format/src/formatTypes.js","webpack:///./node_modules/d3-format/src/identity.js","webpack:///./node_modules/d3-format/src/locale.js","webpack:///./node_modules/d3-format/src/defaultLocale.js","webpack:///./node_modules/d3-format/src/formatGroup.js","webpack:///./node_modules/d3-format/src/formatNumerals.js","webpack:///./node_modules/d3-format/src/formatTrim.js","webpack:///./node_modules/d3-time/src/interval.js","webpack:///./node_modules/d3-time/src/duration.js","webpack:///./node_modules/d3-time/src/day.js","webpack:///./node_modules/d3-time/src/week.js","webpack:///./node_modules/d3-time/src/year.js","webpack:///./node_modules/d3-time/src/month.js","webpack:///./node_modules/d3-time/src/hour.js","webpack:///./node_modules/d3-time/src/minute.js","webpack:///./node_modules/d3-time/src/second.js","webpack:///./node_modules/d3-time/src/millisecond.js","webpack:///./node_modules/d3-array/src/ascending.js","webpack:///./node_modules/d3-array/src/descending.js","webpack:///./node_modules/d3-array/src/bisector.js","webpack:///./node_modules/vega-time/build/vega-time.module.js","webpack:///./node_modules/d3-time-format/src/locale.js","webpack:///./node_modules/d3-time-format/src/defaultLocale.js","webpack:///./node_modules/vega-format/build/vega-format.module.js","webpack:///./node_modules/vega-loader/build/vega-loader.browser.module.js","webpack:///./node_modules/vega-dataflow/build/vega-dataflow.module.js","webpack:///./node_modules/d3-array/src/max.js","webpack:///./node_modules/d3-array/src/min.js","webpack:///./node_modules/d3-array/src/sort.js","webpack:///./node_modules/d3-array/src/quickselect.js","webpack:///./node_modules/d3-array/src/number.js","webpack:///./node_modules/d3-array/src/quantile.js","webpack:///./node_modules/d3-array/src/median.js","webpack:///./node_modules/vega-statistics/build/vega-statistics.module.js","webpack:///./node_modules/d3-array/src/deviation.js","webpack:///./node_modules/d3-array/src/variance.js","webpack:///./node_modules/d3-array/src/range.js","webpack:///./node_modules/vega-transforms/build/vega-transforms.module.js","webpack:///./node_modules/d3-array/src/mean.js","webpack:///./node_modules/d3-shape/src/curve/basis.js","webpack:///./node_modules/d3-shape/src/noop.js","webpack:///./node_modules/d3-shape/src/curve/basisClosed.js","webpack:///./node_modules/d3-shape/src/curve/basisOpen.js","webpack:///./node_modules/d3-shape/src/curve/bundle.js","webpack:///./node_modules/d3-shape/src/curve/cardinal.js","webpack:///./node_modules/d3-shape/src/curve/cardinalOpen.js","webpack:///./node_modules/d3-shape/src/curve/cardinalClosed.js","webpack:///./node_modules/d3-shape/src/math.js","webpack:///./node_modules/d3-shape/src/curve/catmullRom.js","webpack:///./node_modules/d3-shape/src/curve/catmullRomClosed.js","webpack:///./node_modules/d3-shape/src/curve/catmullRomOpen.js","webpack:///./node_modules/d3-shape/src/curve/linear.js","webpack:///./node_modules/d3-shape/src/curve/linearClosed.js","webpack:///./node_modules/d3-shape/src/curve/monotone.js","webpack:///./node_modules/d3-shape/src/curve/natural.js","webpack:///./node_modules/d3-shape/src/curve/step.js","webpack:///./node_modules/d3-shape/src/constant.js","webpack:///./node_modules/d3-path/src/path.js","webpack:///./node_modules/d3-shape/src/path.js","webpack:///./node_modules/d3-shape/src/arc.js","webpack:///./node_modules/d3-shape/src/array.js","webpack:///./node_modules/d3-shape/src/point.js","webpack:///./node_modules/d3-shape/src/line.js","webpack:///./node_modules/d3-shape/src/area.js","webpack:///./node_modules/d3-shape/src/symbol/asterisk.js","webpack:///./node_modules/d3-shape/src/symbol/circle.js","webpack:///./node_modules/d3-shape/src/symbol/diamond.js","webpack:///./node_modules/d3-shape/src/symbol/star.js","webpack:///./node_modules/vega-canvas/build/vega-canvas.browser.module.js","webpack:///./node_modules/d3-shape/src/symbol/triangle.js","webpack:///./node_modules/d3-shape/src/symbol/triangle2.js","webpack:///./node_modules/d3-shape/src/symbol/wye.js","webpack:///./node_modules/d3-array/src/bisect.js","webpack:///./node_modules/d3-color/src/define.js","webpack:///./node_modules/d3-color/src/color.js","webpack:///./node_modules/d3-interpolate/src/basis.js","webpack:///./node_modules/d3-interpolate/src/basisClosed.js","webpack:///./node_modules/d3-interpolate/src/constant.js","webpack:///./node_modules/d3-interpolate/src/color.js","webpack:///./node_modules/d3-interpolate/src/rgb.js","webpack:///./node_modules/d3-interpolate/src/numberArray.js","webpack:///./node_modules/d3-interpolate/src/array.js","webpack:///./node_modules/d3-interpolate/src/date.js","webpack:///./node_modules/d3-interpolate/src/number.js","webpack:///./node_modules/d3-interpolate/src/object.js","webpack:///./node_modules/d3-interpolate/src/string.js","webpack:///./node_modules/d3-interpolate/src/value.js","webpack:///./node_modules/d3-interpolate/src/round.js","webpack:///./node_modules/d3-scale/src/number.js","webpack:///./node_modules/d3-scale/src/continuous.js","webpack:///./node_modules/d3-scale/src/constant.js","webpack:///./node_modules/d3-scale/src/init.js","webpack:///./node_modules/d3-scale/src/tickFormat.js","webpack:///./node_modules/d3-scale/src/linear.js","webpack:///./node_modules/d3-scale/src/nice.js","webpack:///./node_modules/d3-scale/src/log.js","webpack:///./node_modules/d3-scale/src/pow.js","webpack:///./node_modules/d3-scale/src/symlog.js","webpack:///./node_modules/d3-time/src/ticks.js","webpack:///./node_modules/d3-scale/src/time.js","webpack:///./node_modules/d3-scale/src/sequential.js","webpack:///./node_modules/d3-interpolate/src/piecewise.js","webpack:///./node_modules/d3-scale/src/diverging.js","webpack:///./node_modules/internmap/src/index.js","webpack:///./node_modules/d3-scale/src/ordinal.js","webpack:///./node_modules/d3-interpolate/src/discrete.js","webpack:///./node_modules/d3-interpolate/src/hue.js","webpack:///./node_modules/d3-interpolate/src/transform/decompose.js","webpack:///./node_modules/d3-interpolate/src/transform/parse.js","webpack:///./node_modules/d3-interpolate/src/transform/index.js","webpack:///./node_modules/d3-interpolate/src/zoom.js","webpack:///./node_modules/d3-interpolate/src/hsl.js","webpack:///./node_modules/d3-color/src/math.js","webpack:///./node_modules/d3-color/src/lab.js","webpack:///./node_modules/d3-interpolate/src/lab.js","webpack:///./node_modules/d3-interpolate/src/hcl.js","webpack:///./node_modules/d3-color/src/cubehelix.js","webpack:///./node_modules/d3-interpolate/src/cubehelix.js","webpack:///./node_modules/d3-interpolate/src/quantize.js","webpack:///./node_modules/vega-scale/build/vega-scale.module.js","webpack:///./node_modules/d3-scale/src/identity.js","webpack:///./node_modules/d3-scale/src/utcTime.js","webpack:///./node_modules/d3-scale/src/quantile.js","webpack:///./node_modules/d3-scale/src/quantize.js","webpack:///./node_modules/d3-scale/src/threshold.js","webpack:///./node_modules/vega-scenegraph/build/vega-scenegraph.module.js","webpack:///./node_modules/d3-shape/src/symbol.js","webpack:///./node_modules/vega-view-transforms/build/vega-view-transforms.module.js","webpack:///./node_modules/d3-array/src/sum.js","webpack:///./node_modules/vega-encode/build/vega-encode.module.js","webpack:///./node_modules/d3-geo/src/identity.js","webpack:///./node_modules/d3-geo/src/stream.js","webpack:///./node_modules/d3-array/src/fsum.js","webpack:///./node_modules/d3-geo/src/math.js","webpack:///./node_modules/d3-geo/src/noop.js","webpack:///./node_modules/d3-geo/src/path/area.js","webpack:///./node_modules/d3-geo/src/path/bounds.js","webpack:///./node_modules/d3-geo/src/path/centroid.js","webpack:///./node_modules/d3-geo/src/path/context.js","webpack:///./node_modules/d3-geo/src/path/measure.js","webpack:///./node_modules/d3-geo/src/path/string.js","webpack:///./node_modules/d3-geo/src/path/index.js","webpack:///./node_modules/d3-geo/src/clip/buffer.js","webpack:///./node_modules/d3-geo/src/pointEqual.js","webpack:///./node_modules/d3-geo/src/clip/rejoin.js","webpack:///./node_modules/d3-geo/src/cartesian.js","webpack:///./node_modules/d3-geo/src/polygonContains.js","webpack:///./node_modules/d3-array/src/merge.js","webpack:///./node_modules/d3-geo/src/clip/index.js","webpack:///./node_modules/d3-geo/src/clip/antimeridian.js","webpack:///./node_modules/d3-geo/src/circle.js","webpack:///./node_modules/d3-geo/src/clip/rectangle.js","webpack:///./node_modules/d3-geo/src/clip/line.js","webpack:///./node_modules/d3-geo/src/compose.js","webpack:///./node_modules/d3-geo/src/rotation.js","webpack:///./node_modules/d3-geo/src/transform.js","webpack:///./node_modules/d3-geo/src/projection/fit.js","webpack:///./node_modules/d3-geo/src/projection/resample.js","webpack:///./node_modules/d3-geo/src/projection/index.js","webpack:///./node_modules/d3-geo/src/clip/circle.js","webpack:///./node_modules/d3-geo/src/projection/conic.js","webpack:///./node_modules/d3-geo/src/projection/conicEqualArea.js","webpack:///./node_modules/d3-geo/src/projection/cylindricalEqualArea.js","webpack:///./node_modules/d3-geo/src/projection/albers.js","webpack:///./node_modules/d3-geo/src/projection/azimuthal.js","webpack:///./node_modules/d3-geo/src/projection/azimuthalEqualArea.js","webpack:///./node_modules/d3-geo/src/projection/azimuthalEquidistant.js","webpack:///./node_modules/d3-geo/src/projection/mercator.js","webpack:///./node_modules/d3-geo/src/projection/conicConformal.js","webpack:///./node_modules/d3-geo/src/projection/equirectangular.js","webpack:///./node_modules/d3-geo/src/projection/conicEquidistant.js","webpack:///./node_modules/d3-geo/src/projection/equalEarth.js","webpack:///./node_modules/d3-geo/src/projection/gnomonic.js","webpack:///./node_modules/d3-geo/src/projection/naturalEarth1.js","webpack:///./node_modules/d3-geo/src/projection/orthographic.js","webpack:///./node_modules/d3-geo/src/projection/stereographic.js","webpack:///./node_modules/d3-geo/src/projection/transverseMercator.js","webpack:///./node_modules/d3-geo-projection/src/math.js","webpack:///./node_modules/d3-geo-projection/src/mollweide.js","webpack:///./node_modules/vega-projection/build/vega-projection.module.js","webpack:///./node_modules/d3-geo/src/projection/albersUsa.js","webpack:///./node_modules/d3-geo/src/projection/identity.js","webpack:///./node_modules/d3-geo/src/graticule.js","webpack:///./node_modules/vega-geo/build/vega-geo.module.js","webpack:///./node_modules/d3-quadtree/src/add.js","webpack:///./node_modules/d3-quadtree/src/quad.js","webpack:///./node_modules/d3-quadtree/src/x.js","webpack:///./node_modules/d3-quadtree/src/y.js","webpack:///./node_modules/d3-quadtree/src/quadtree.js","webpack:///./node_modules/d3-force/src/constant.js","webpack:///./node_modules/d3-force/src/jiggle.js","webpack:///./node_modules/d3-force/src/collide.js","webpack:///./node_modules/d3-quadtree/src/cover.js","webpack:///./node_modules/d3-quadtree/src/data.js","webpack:///./node_modules/d3-quadtree/src/extent.js","webpack:///./node_modules/d3-quadtree/src/find.js","webpack:///./node_modules/d3-quadtree/src/remove.js","webpack:///./node_modules/d3-quadtree/src/root.js","webpack:///./node_modules/d3-quadtree/src/size.js","webpack:///./node_modules/d3-quadtree/src/visit.js","webpack:///./node_modules/d3-quadtree/src/visitAfter.js","webpack:///./node_modules/d3-dispatch/src/dispatch.js","webpack:///./node_modules/d3-timer/src/timer.js","webpack:///./node_modules/d3-force/src/lcg.js","webpack:///./node_modules/d3-force/src/simulation.js","webpack:///./node_modules/d3-force/src/link.js","webpack:///./node_modules/vega-force/build/vega-force.module.js","webpack:///./node_modules/d3-force/src/center.js","webpack:///./node_modules/d3-force/src/manyBody.js","webpack:///./node_modules/d3-force/src/x.js","webpack:///./node_modules/d3-force/src/y.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/count.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/index.js","webpack:///./node_modules/d3-hierarchy/src/accessors.js","webpack:///./node_modules/d3-hierarchy/src/constant.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/each.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/eachAfter.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/eachBefore.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/find.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/sum.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/sort.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/path.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/ancestors.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/descendants.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/leaves.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/links.js","webpack:///./node_modules/d3-hierarchy/src/hierarchy/iterator.js","webpack:///./node_modules/d3-hierarchy/src/lcg.js","webpack:///./node_modules/d3-hierarchy/src/pack/enclose.js","webpack:///./node_modules/d3-hierarchy/src/pack/siblings.js","webpack:///./node_modules/d3-hierarchy/src/array.js","webpack:///./node_modules/d3-hierarchy/src/pack/index.js","webpack:///./node_modules/d3-hierarchy/src/treemap/round.js","webpack:///./node_modules/d3-hierarchy/src/treemap/dice.js","webpack:///./node_modules/d3-hierarchy/src/stratify.js","webpack:///./node_modules/d3-hierarchy/src/tree.js","webpack:///./node_modules/d3-hierarchy/src/cluster.js","webpack:///./node_modules/d3-hierarchy/src/treemap/slice.js","webpack:///./node_modules/d3-hierarchy/src/treemap/squarify.js","webpack:///./node_modules/d3-hierarchy/src/treemap/resquarify.js","webpack:///./node_modules/vega-hierarchy/build/vega-hierarchy.module.js","webpack:///./node_modules/d3-hierarchy/src/partition.js","webpack:///./node_modules/d3-hierarchy/src/treemap/binary.js","webpack:///./node_modules/d3-hierarchy/src/treemap/sliceDice.js","webpack:///./node_modules/d3-hierarchy/src/treemap/index.js","webpack:///./node_modules/vega-label/build/vega-label.module.js","webpack:///./node_modules/vega-regression/build/vega-regression.module.js","webpack:///./node_modules/robust-predicates/esm/util.js","webpack:///./node_modules/robust-predicates/esm/orient2d.js","webpack:///./node_modules/robust-predicates/esm/orient3d.js","webpack:///./node_modules/robust-predicates/esm/incircle.js","webpack:///./node_modules/robust-predicates/esm/insphere.js","webpack:///./node_modules/delaunator/index.js","webpack:///./node_modules/d3-delaunay/src/path.js","webpack:///./node_modules/d3-delaunay/src/polygon.js","webpack:///./node_modules/d3-delaunay/src/voronoi.js","webpack:///./node_modules/d3-delaunay/src/delaunay.js","webpack:///./node_modules/vega-voronoi/build/vega-voronoi.module.js","webpack:///./node_modules/vega-wordcloud/build/vega-wordcloud.module.js","webpack:///./node_modules/vega-crossfilter/build/vega-crossfilter.module.js","webpack:///./node_modules/d3-array/src/permute.js","webpack:///./node_modules/vega-expression/build/vega-expression.module.js","webpack:///./node_modules/d3-geo/src/area.js","webpack:///./node_modules/d3-geo/src/bounds.js","webpack:///./node_modules/d3-geo/src/centroid.js","webpack:///./node_modules/d3-array/src/intersection.js","webpack:///./node_modules/vega-selections/build/vega-selection.module.js","webpack:///./node_modules/d3-array/src/union.js","webpack:///./node_modules/vega-functions/build/vega-functions.module.js","webpack:///./node_modules/vega-runtime/build/vega-runtime.module.js","webpack:///./node_modules/vega-view/build/vega-view.module.js","webpack:///./node_modules/d3-timer/src/interval.js","webpack:///./node_modules/vega-event-selector/build/vega-event-selector.module.js","webpack:///./node_modules/vega-parser/build/vega-parser.module.js","webpack:///./node_modules/vega/build/vega.module.js","webpack:///./node_modules/vega-interpreter/build/vega-interpreter.module.js","webpack:///./node_modules/vega-lite/build/src/logical.js","webpack:///./node_modules/vega-lite/build/src/util.js","webpack:///./node_modules/vega-lite/build/src/channel.js","webpack:///./node_modules/vega-lite/build/src/aggregate.js","webpack:///./node_modules/vega-lite/build/src/bin.js","webpack:///./node_modules/vega-lite/build/src/expr.js","webpack:///./node_modules/vega-lite/build/src/title.js","webpack:///./node_modules/vega-lite/build/src/vega.schema.js","webpack:///./node_modules/vega-lite/build/src/compile/common.js","webpack:///./node_modules/vega-lite/build/src/log/message.js","webpack:///./node_modules/vega-lite/build/src/log/index.js","webpack:///./node_modules/vega-lite/build/src/datetime.js","webpack:///./node_modules/vega-lite/build/src/timeunit.js","webpack:///./node_modules/vega-lite/build/src/predicate.js","webpack:///./node_modules/vega-lite/build/src/type.js","webpack:///./node_modules/vega-lite/build/src/scale.js","webpack:///./node_modules/vega-lite/build/src/mark.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/valueref.js","webpack:///./node_modules/vega-lite/build/src/compile/format.js","webpack:///./node_modules/vega-lite/build/src/sort.js","webpack:///./node_modules/vega-lite/build/src/spec/facet.js","webpack:///./node_modules/vega-lite/build/src/channeldef.js","webpack:///./node_modules/vega-lite/build/src/axis.js","webpack:///./node_modules/vega-lite/build/src/spec/unit.js","webpack:///./node_modules/vega-lite/build/src/compositemark/base.js","webpack:///./node_modules/vega-lite/build/src/encoding.js","webpack:///./node_modules/vega-lite/build/src/compositemark/common.js","webpack:///./node_modules/vega-lite/build/src/compositemark/boxplot.js","webpack:///./node_modules/vega-lite/build/src/compositemark/errorbar.js","webpack:///./node_modules/vega-lite/build/src/compositemark/errorband.js","webpack:///./node_modules/vega-lite/build/src/compositemark/index.js","webpack:///./node_modules/vega-lite/build/src/guide.js","webpack:///./node_modules/vega-lite/build/src/header.js","webpack:///./node_modules/vega-lite/build/src/legend.js","webpack:///./node_modules/vega-lite/build/src/selection.js","webpack:///./node_modules/vega-lite/build/src/parameter.js","webpack:///./node_modules/vega-lite/build/src/spec/concat.js","webpack:///./node_modules/vega-lite/build/src/spec/base.js","webpack:///./node_modules/vega-lite/build/src/config.js","webpack:///./node_modules/vega-lite/build/src/spec/layer.js","webpack:///./node_modules/vega-lite/build/src/spec/map.js","webpack:///./node_modules/vega-lite/build/src/spec/repeat.js","webpack:///./node_modules/vega-lite/build/src/stack.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/init.js","webpack:///./node_modules/vega-lite/build/src/normalize/pathoverlay.js","webpack:///./node_modules/vega-lite/build/src/normalize/repeater.js","webpack:///./node_modules/vega-lite/build/src/normalize/ruleforrangedline.js","webpack:///./node_modules/vega-lite/build/src/normalize/core.js","webpack:///./node_modules/vega-lite/build/src/transform.js","webpack:///./node_modules/vega-lite/build/src/normalize/selectioncompat.js","webpack:///./node_modules/vega-lite/build/src/normalize/toplevelselection.js","webpack:///./node_modules/vega-lite/build/src/normalize/index.js","webpack:///./node_modules/vega-lite/build/src/spec/toplevel.js","webpack:///./node_modules/vega-lite/build/src/compile/split.js","webpack:///./node_modules/vega-lite/build/src/compile/data/index.js","webpack:///./node_modules/vega-lite/build/src/data.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/data/dataflow.js","webpack:///./node_modules/vega-lite/build/src/compile/data/timeunit.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/project.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/scales.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/interval.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/point.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/conditional.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/text.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/tooltip.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/aria.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/nonposition.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/color.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/zindex.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/offset.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/position-point.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/position-align.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/position-range.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/position-rect.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/base.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/encode/defined.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/nearest.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/inputs.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/toggle.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/clear.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/legends.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/translate.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/zoom.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/index.js","webpack:///./node_modules/vega-lite/build/src/compile/data/expressions.js","webpack:///./node_modules/vega-lite/build/src/compile/data/filter.js","webpack:///./node_modules/vega-lite/build/src/compile/selection/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/predicate.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/config.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/properties.js","webpack:///./node_modules/vega-lite/build/src/compile/data/calculate.js","webpack:///./node_modules/vega-lite/build/src/compile/header/common.js","webpack:///./node_modules/vega-lite/build/src/compile/header/component.js","webpack:///./node_modules/vega-lite/build/src/compile/header/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/layoutsize/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/layoutsize/component.js","webpack:///./node_modules/vega-lite/build/src/compile/guide.js","webpack:///./node_modules/vega-lite/build/src/compile/resolve.js","webpack:///./node_modules/vega-lite/build/src/compile/legend/component.js","webpack:///./node_modules/vega-lite/build/src/compile/legend/encode.js","webpack:///./node_modules/vega-lite/build/src/compile/legend/properties.js","webpack:///./node_modules/vega-lite/build/src/compile/legend/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/legend/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/projection/assemble.js","webpack:///./node_modules/vega-lite/build/src/projection.js","webpack:///./node_modules/vega-lite/build/src/compile/projection/component.js","webpack:///./node_modules/vega-lite/build/src/compile/projection/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/data/bin.js","webpack:///./node_modules/vega-lite/build/src/compile/data/aggregate.js","webpack:///./node_modules/vega-lite/build/src/compile/data/facet.js","webpack:///./node_modules/vega-lite/build/src/compile/data/formatparse.js","webpack:///./node_modules/vega-lite/build/src/compile/data/identifier.js","webpack:///./node_modules/vega-lite/build/src/compile/data/graticule.js","webpack:///./node_modules/vega-lite/build/src/compile/data/sequence.js","webpack:///./node_modules/vega-lite/build/src/compile/data/source.js","webpack:///./node_modules/vega-lite/build/src/compile/data/optimizer.js","webpack:///./node_modules/vega-lite/build/src/compile/data/optimizers.js","webpack:///./node_modules/vega-lite/build/src/compile/data/joinaggregate.js","webpack:///./node_modules/vega-lite/build/src/compile/data/stack.js","webpack:///./node_modules/vega-lite/build/src/compile/data/window.js","webpack:///./node_modules/vega-lite/build/src/compile/data/subtree.js","webpack:///./node_modules/vega-lite/build/src/compile/data/optimize.js","webpack:///./node_modules/vega-lite/build/src/compile/signal.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/domain.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/component.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/range.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/properties.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/type.js","webpack:///./node_modules/vega-lite/build/src/compile/scale/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/model.js","webpack:///./node_modules/vega-lite/build/src/compile/data/density.js","webpack:///./node_modules/vega-lite/build/src/compile/data/extent.js","webpack:///./node_modules/vega-lite/build/src/compile/data/filterinvalid.js","webpack:///./node_modules/vega-lite/build/src/compile/data/flatten.js","webpack:///./node_modules/vega-lite/build/src/compile/data/fold.js","webpack:///./node_modules/vega-lite/build/src/compile/data/geojson.js","webpack:///./node_modules/vega-lite/build/src/compile/data/geopoint.js","webpack:///./node_modules/vega-lite/build/src/compile/data/impute.js","webpack:///./node_modules/vega-lite/build/src/compile/data/loess.js","webpack:///./node_modules/vega-lite/build/src/compile/data/lookup.js","webpack:///./node_modules/vega-lite/build/src/compile/data/quantile.js","webpack:///./node_modules/vega-lite/build/src/compile/data/regression.js","webpack:///./node_modules/vega-lite/build/src/compile/data/pivot.js","webpack:///./node_modules/vega-lite/build/src/compile/data/sample.js","webpack:///./node_modules/vega-lite/build/src/compile/data/assemble.js","webpack:///./node_modules/vega-lite/build/src/compile/header/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/layoutsize/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/facet.js","webpack:///./node_modules/vega-lite/build/src/compile/data/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.js","webpack:///./node_modules/vega-lite/build/src/compile/concat.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/component.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/parse.js","webpack:///./node_modules/vega-lite/build/src/compile/axis/encode.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/point.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/text.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/tick.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/mark.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/arc.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/area.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/bar.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/geoshape.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/image.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/line.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/rect.js","webpack:///./node_modules/vega-lite/build/src/compile/mark/rule.js","webpack:///./node_modules/vega-lite/build/src/compile/unit.js","webpack:///./node_modules/vega-lite/build/src/compile/layoutsize/init.js","webpack:///./node_modules/vega-lite/build/src/compile/layer.js","webpack:///./node_modules/vega-lite/build/src/compile/buildmodel.js","webpack:///./node_modules/vega-lite/build/src/compile/compile.js","webpack:///./node_modules/vega-lite/build/src/index.js","webpack:///./node_modules/vega-schema-url-parser/dist/parser.module.js","webpack:///./node_modules/vega-themes/build/vega-themes.module.js","webpack:///./node_modules/vega-tooltip/build/vega-tooltip.module.js","webpack:///./node_modules/vega-embed/build/vega-embed.module.js","webpack:///./node_modules/d3-selection/src/selector.js","webpack:///./node_modules/d3-selection/src/selectorAll.js","webpack:///./node_modules/d3-selection/src/matcher.js","webpack:///./node_modules/d3-selection/src/selection/selectChild.js","webpack:///./node_modules/d3-selection/src/selection/selectChildren.js","webpack:///./node_modules/d3-selection/src/selection/sparse.js","webpack:///./node_modules/d3-selection/src/selection/enter.js","webpack:///./node_modules/d3-selection/src/selection/data.js","webpack:///./node_modules/d3-selection/src/selection/sort.js","webpack:///./node_modules/d3-selection/src/namespaces.js","webpack:///./node_modules/d3-selection/src/namespace.js","webpack:///./node_modules/d3-selection/src/selection/attr.js","webpack:///./node_modules/d3-selection/src/window.js","webpack:///./node_modules/d3-selection/src/selection/style.js","webpack:///./node_modules/d3-selection/src/selection/property.js","webpack:///./node_modules/d3-selection/src/selection/classed.js","webpack:///./node_modules/d3-selection/src/selection/text.js","webpack:///./node_modules/d3-selection/src/selection/html.js","webpack:///./node_modules/d3-selection/src/selection/raise.js","webpack:///./node_modules/d3-selection/src/selection/lower.js","webpack:///./node_modules/d3-selection/src/creator.js","webpack:///./node_modules/d3-selection/src/selection/insert.js","webpack:///./node_modules/d3-selection/src/selection/remove.js","webpack:///./node_modules/d3-selection/src/selection/clone.js","webpack:///./node_modules/d3-selection/src/selection/on.js","webpack:///./node_modules/d3-selection/src/selection/dispatch.js","webpack:///./node_modules/d3-selection/src/selection/index.js","webpack:///./node_modules/d3-selection/src/selection/select.js","webpack:///./node_modules/d3-selection/src/selection/selectAll.js","webpack:///./node_modules/d3-selection/src/array.js","webpack:///./node_modules/d3-selection/src/selection/filter.js","webpack:///./node_modules/d3-selection/src/constant.js","webpack:///./node_modules/d3-selection/src/selection/exit.js","webpack:///./node_modules/d3-selection/src/selection/join.js","webpack:///./node_modules/d3-selection/src/selection/merge.js","webpack:///./node_modules/d3-selection/src/selection/order.js","webpack:///./node_modules/d3-selection/src/selection/call.js","webpack:///./node_modules/d3-selection/src/selection/nodes.js","webpack:///./node_modules/d3-selection/src/selection/node.js","webpack:///./node_modules/d3-selection/src/selection/size.js","webpack:///./node_modules/d3-selection/src/selection/empty.js","webpack:///./node_modules/d3-selection/src/selection/each.js","webpack:///./node_modules/d3-selection/src/selection/append.js","webpack:///./node_modules/d3-selection/src/selection/datum.js","webpack:///./node_modules/d3-selection/src/selection/iterator.js","webpack:///./node_modules/d3-timer/src/timeout.js","webpack:///./node_modules/d3-transition/src/transition/schedule.js","webpack:///./node_modules/d3-transition/src/transition/tween.js","webpack:///./node_modules/d3-transition/src/transition/interpolate.js","webpack:///./node_modules/d3-transition/src/transition/attr.js","webpack:///./node_modules/d3-transition/src/transition/attrTween.js","webpack:///./node_modules/d3-transition/src/transition/delay.js","webpack:///./node_modules/d3-transition/src/transition/duration.js","webpack:///./node_modules/d3-transition/src/transition/selection.js","webpack:///./node_modules/d3-transition/src/transition/style.js","webpack:///./node_modules/d3-transition/src/transition/index.js","webpack:///./node_modules/d3-transition/src/transition/select.js","webpack:///./node_modules/d3-transition/src/transition/selectAll.js","webpack:///./node_modules/d3-transition/src/transition/filter.js","webpack:///./node_modules/d3-transition/src/transition/merge.js","webpack:///./node_modules/d3-transition/src/transition/transition.js","webpack:///./node_modules/d3-transition/src/transition/on.js","webpack:///./node_modules/d3-transition/src/transition/styleTween.js","webpack:///./node_modules/d3-transition/src/transition/text.js","webpack:///./node_modules/d3-transition/src/transition/textTween.js","webpack:///./node_modules/d3-transition/src/transition/remove.js","webpack:///./node_modules/d3-transition/src/transition/ease.js","webpack:///./node_modules/d3-transition/src/transition/easeVarying.js","webpack:///./node_modules/d3-transition/src/transition/end.js","webpack:///./node_modules/d3-transition/src/selection/transition.js","webpack:///./node_modules/d3-ease/src/cubic.js","webpack:///./node_modules/d3-transition/src/selection/index.js","webpack:///./node_modules/d3-transition/src/selection/interrupt.js","webpack:///./node_modules/d3-transition/src/interrupt.js","webpack:///./node_modules/d3-brush/src/brush.js","webpack:///./node_modules/d3-zoom/src/transform.js","webpack:///./src/lib/fragments/Vega.react.js","webpack:///./node_modules/d3-selection/src/select.js","webpack:///./node_modules/lodash.debounce/index.js","webpack:///./node_modules/json-stringify-pretty-compact/index.js"],"sourcesContent":["const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","/*!\n * https://github.com/Starcounter-Jack/JSON-Patch\n * (c) 2017-2022 Joachim Wester\n * MIT licensed\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function hasOwnProperty(obj, key) {\n return _hasOwnProperty.call(obj, key);\n}\nexport function _objectKeys(obj) {\n if (Array.isArray(obj)) {\n var keys_1 = new Array(obj.length);\n for (var k = 0; k < keys_1.length; k++) {\n keys_1[k] = \"\" + k;\n }\n return keys_1;\n }\n if (Object.keys) {\n return Object.keys(obj);\n }\n var keys = [];\n for (var i in obj) {\n if (hasOwnProperty(obj, i)) {\n keys.push(i);\n }\n }\n return keys;\n}\n;\n/**\n* Deeply clone the object.\n* https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)\n* @param {any} obj value to clone\n* @return {any} cloned obj\n*/\nexport function _deepClone(obj) {\n switch (typeof obj) {\n case \"object\":\n return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n case \"undefined\":\n return null; //this is how JSON.stringify behaves for array items\n default:\n return obj; //no need to clone primitives\n }\n}\n//3x faster than cached /^\\d+$/.test(str)\nexport function isInteger(str) {\n var i = 0;\n var len = str.length;\n var charCode;\n while (i < len) {\n charCode = str.charCodeAt(i);\n if (charCode >= 48 && charCode <= 57) {\n i++;\n continue;\n }\n return false;\n }\n return true;\n}\n/**\n* Escapes a json pointer path\n* @param path The raw pointer\n* @return the Escaped path\n*/\nexport function escapePathComponent(path) {\n if (path.indexOf('/') === -1 && path.indexOf('~') === -1)\n return path;\n return path.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n/**\n * Unescapes a json pointer path\n * @param path The escaped pointer\n * @return The unescaped path\n */\nexport function unescapePathComponent(path) {\n return path.replace(/~1/g, '/').replace(/~0/g, '~');\n}\nexport function _getPathRecursive(root, obj) {\n var found;\n for (var key in root) {\n if (hasOwnProperty(root, key)) {\n if (root[key] === obj) {\n return escapePathComponent(key) + '/';\n }\n else if (typeof root[key] === 'object') {\n found = _getPathRecursive(root[key], obj);\n if (found != '') {\n return escapePathComponent(key) + '/' + found;\n }\n }\n }\n }\n return '';\n}\nexport function getPath(root, obj) {\n if (root === obj) {\n return '/';\n }\n var path = _getPathRecursive(root, obj);\n if (path === '') {\n throw new Error(\"Object not found in root\");\n }\n return \"/\" + path;\n}\n/**\n* Recursively checks whether an object has any undefined values inside.\n*/\nexport function hasUndefined(obj) {\n if (obj === undefined) {\n return true;\n }\n if (obj) {\n if (Array.isArray(obj)) {\n for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {\n if (hasUndefined(obj[i_1])) {\n return true;\n }\n }\n }\n else if (typeof obj === \"object\") {\n var objKeys = _objectKeys(obj);\n var objKeysLength = objKeys.length;\n for (var i = 0; i < objKeysLength; i++) {\n if (hasUndefined(obj[objKeys[i]])) {\n return true;\n }\n }\n }\n }\n return false;\n}\nfunction patchErrorMessageFormatter(message, args) {\n var messageParts = [message];\n for (var key in args) {\n var value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print\n if (typeof value !== 'undefined') {\n messageParts.push(key + \": \" + value);\n }\n }\n return messageParts.join('\\n');\n}\nvar PatchError = /** @class */ (function (_super) {\n __extends(PatchError, _super);\n function PatchError(message, name, index, operation, tree) {\n var _newTarget = this.constructor;\n var _this = _super.call(this, patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree })) || this;\n _this.name = name;\n _this.index = index;\n _this.operation = operation;\n _this.tree = tree;\n Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359\n _this.message = patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree });\n return _this;\n }\n return PatchError;\n}(Error));\nexport { PatchError };\n","import { PatchError, _deepClone, isInteger, unescapePathComponent, hasUndefined } from './helpers.mjs';\nexport var JsonPatchError = PatchError;\nexport var deepClone = _deepClone;\n/* We use a Javascript hash to store each\n function. Each hash entry (property) uses\n the operation identifiers specified in rfc6902.\n In this way, we can map each patch operation\n to its dedicated function in efficient way.\n */\n/* The operations applicable to an object */\nvar objOps = {\n add: function (obj, key, document) {\n obj[key] = this.value;\n return { newDocument: document };\n },\n remove: function (obj, key, document) {\n var removed = obj[key];\n delete obj[key];\n return { newDocument: document, removed: removed };\n },\n replace: function (obj, key, document) {\n var removed = obj[key];\n obj[key] = this.value;\n return { newDocument: document, removed: removed };\n },\n move: function (obj, key, document) {\n /* in case move target overwrites an existing value,\n return the removed value, this can be taxing performance-wise,\n and is potentially unneeded */\n var removed = getValueByPointer(document, this.path);\n if (removed) {\n removed = _deepClone(removed);\n }\n var originalValue = applyOperation(document, { op: \"remove\", path: this.from }).removed;\n applyOperation(document, { op: \"add\", path: this.path, value: originalValue });\n return { newDocument: document, removed: removed };\n },\n copy: function (obj, key, document) {\n var valueToCopy = getValueByPointer(document, this.from);\n // enforce copy by value so further operations don't affect source (see issue #177)\n applyOperation(document, { op: \"add\", path: this.path, value: _deepClone(valueToCopy) });\n return { newDocument: document };\n },\n test: function (obj, key, document) {\n return { newDocument: document, test: _areEquals(obj[key], this.value) };\n },\n _get: function (obj, key, document) {\n this.value = obj[key];\n return { newDocument: document };\n }\n};\n/* The operations applicable to an array. Many are the same as for the object */\nvar arrOps = {\n add: function (arr, i, document) {\n if (isInteger(i)) {\n arr.splice(i, 0, this.value);\n }\n else { // array props\n arr[i] = this.value;\n }\n // this may be needed when using '-' in an array\n return { newDocument: document, index: i };\n },\n remove: function (arr, i, document) {\n var removedList = arr.splice(i, 1);\n return { newDocument: document, removed: removedList[0] };\n },\n replace: function (arr, i, document) {\n var removed = arr[i];\n arr[i] = this.value;\n return { newDocument: document, removed: removed };\n },\n move: objOps.move,\n copy: objOps.copy,\n test: objOps.test,\n _get: objOps._get\n};\n/**\n * Retrieves a value from a JSON document by a JSON pointer.\n * Returns the value.\n *\n * @param document The document to get the value from\n * @param pointer an escaped JSON pointer\n * @return The retrieved value\n */\nexport function getValueByPointer(document, pointer) {\n if (pointer == '') {\n return document;\n }\n var getOriginalDestination = { op: \"_get\", path: pointer };\n applyOperation(document, getOriginalDestination);\n return getOriginalDestination.value;\n}\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the {newDocument, result} of the operation.\n * It modifies the `document` and `operation` objects - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return `{newDocument, result}` after the operation\n */\nexport function applyOperation(document, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {\n if (validateOperation === void 0) { validateOperation = false; }\n if (mutateDocument === void 0) { mutateDocument = true; }\n if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }\n if (index === void 0) { index = 0; }\n if (validateOperation) {\n if (typeof validateOperation == 'function') {\n validateOperation(operation, 0, document, operation.path);\n }\n else {\n validator(operation, 0);\n }\n }\n /* ROOT OPERATIONS */\n if (operation.path === \"\") {\n var returnValue = { newDocument: document };\n if (operation.op === 'add') {\n returnValue.newDocument = operation.value;\n return returnValue;\n }\n else if (operation.op === 'replace') {\n returnValue.newDocument = operation.value;\n returnValue.removed = document; //document we removed\n return returnValue;\n }\n else if (operation.op === 'move' || operation.op === 'copy') { // it's a move or copy to root\n returnValue.newDocument = getValueByPointer(document, operation.from); // get the value by json-pointer in `from` field\n if (operation.op === 'move') { // report removed item\n returnValue.removed = document;\n }\n return returnValue;\n }\n else if (operation.op === 'test') {\n returnValue.test = _areEquals(document, operation.value);\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n returnValue.newDocument = document;\n return returnValue;\n }\n else if (operation.op === 'remove') { // a remove on root\n returnValue.removed = document;\n returnValue.newDocument = null;\n return returnValue;\n }\n else if (operation.op === '_get') {\n operation.value = document;\n return returnValue;\n }\n else { /* bad operation */\n if (validateOperation) {\n throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);\n }\n else {\n return returnValue;\n }\n }\n } /* END ROOT OPERATIONS */\n else {\n if (!mutateDocument) {\n document = _deepClone(document);\n }\n var path = operation.path || \"\";\n var keys = path.split('/');\n var obj = document;\n var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift\n var len = keys.length;\n var existingPathFragment = undefined;\n var key = void 0;\n var validateFunction = void 0;\n if (typeof validateOperation == 'function') {\n validateFunction = validateOperation;\n }\n else {\n validateFunction = validator;\n }\n while (true) {\n key = keys[t];\n if (key && key.indexOf('~') != -1) {\n key = unescapePathComponent(key);\n }\n if (banPrototypeModifications &&\n (key == '__proto__' ||\n (key == 'prototype' && t > 0 && keys[t - 1] == 'constructor'))) {\n throw new TypeError('JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');\n }\n if (validateOperation) {\n if (existingPathFragment === undefined) {\n if (obj[key] === undefined) {\n existingPathFragment = keys.slice(0, t).join('/');\n }\n else if (t == len - 1) {\n existingPathFragment = operation.path;\n }\n if (existingPathFragment !== undefined) {\n validateFunction(operation, 0, document, existingPathFragment);\n }\n }\n }\n t++;\n if (Array.isArray(obj)) {\n if (key === '-') {\n key = obj.length;\n }\n else {\n if (validateOperation && !isInteger(key)) {\n throw new JsonPatchError(\"Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index\", \"OPERATION_PATH_ILLEGAL_ARRAY_INDEX\", index, operation, document);\n } // only parse key when it's an integer for `arr.prop` to work\n else if (isInteger(key)) {\n key = ~~key;\n }\n }\n if (t >= len) {\n if (validateOperation && operation.op === \"add\" && key > obj.length) {\n throw new JsonPatchError(\"The specified index MUST NOT be greater than the number of elements in the array\", \"OPERATION_VALUE_OUT_OF_BOUNDS\", index, operation, document);\n }\n var returnValue = arrOps[operation.op].call(operation, obj, key, document); // Apply patch\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return returnValue;\n }\n }\n else {\n if (t >= len) {\n var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return returnValue;\n }\n }\n obj = obj[key];\n // If we have more keys in the path, but the next value isn't a non-null object,\n // throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.\n if (validateOperation && t < len && (!obj || typeof obj !== \"object\")) {\n throw new JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);\n }\n }\n }\n}\n/**\n * Apply a full JSON Patch array on a JSON document.\n * Returns the {newDocument, result} of the patch.\n * It modifies the `document` object and `patch` - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.\n *\n * @param document The document to patch\n * @param patch The patch to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return An array of `{newDocument, result}` after the patch\n */\nexport function applyPatch(document, patch, validateOperation, mutateDocument, banPrototypeModifications) {\n if (mutateDocument === void 0) { mutateDocument = true; }\n if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }\n if (validateOperation) {\n if (!Array.isArray(patch)) {\n throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');\n }\n }\n if (!mutateDocument) {\n document = _deepClone(document);\n }\n var results = new Array(patch.length);\n for (var i = 0, length_1 = patch.length; i < length_1; i++) {\n // we don't need to pass mutateDocument argument because if it was true, we already deep cloned the object, we'll just pass `true`\n results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);\n document = results[i].newDocument; // in case root was replaced\n }\n results.newDocument = document;\n return results;\n}\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the updated document.\n * Suitable as a reducer.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @return The updated document\n */\nexport function applyReducer(document, operation, index) {\n var operationResult = applyOperation(document, operation);\n if (operationResult.test === false) { // failed test\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return operationResult.newDocument;\n}\n/**\n * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.\n * @param {object} operation - operation object (patch)\n * @param {number} index - index of operation in the sequence\n * @param {object} [document] - object where the operation is supposed to be applied\n * @param {string} [existingPathFragment] - comes along with `document`\n */\nexport function validator(operation, index, document, existingPathFragment) {\n if (typeof operation !== 'object' || operation === null || Array.isArray(operation)) {\n throw new JsonPatchError('Operation is not an object', 'OPERATION_NOT_AN_OBJECT', index, operation, document);\n }\n else if (!objOps[operation.op]) {\n throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);\n }\n else if (typeof operation.path !== 'string') {\n throw new JsonPatchError('Operation `path` property is not a string', 'OPERATION_PATH_INVALID', index, operation, document);\n }\n else if (operation.path.indexOf('/') !== 0 && operation.path.length > 0) {\n // paths that aren't empty string should start with \"/\"\n throw new JsonPatchError('Operation `path` property must start with \"/\"', 'OPERATION_PATH_INVALID', index, operation, document);\n }\n else if ((operation.op === 'move' || operation.op === 'copy') && typeof operation.from !== 'string') {\n throw new JsonPatchError('Operation `from` property is not present (applicable in `move` and `copy` operations)', 'OPERATION_FROM_REQUIRED', index, operation, document);\n }\n else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && operation.value === undefined) {\n throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_REQUIRED', index, operation, document);\n }\n else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && hasUndefined(operation.value)) {\n throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED', index, operation, document);\n }\n else if (document) {\n if (operation.op == \"add\") {\n var pathLen = operation.path.split(\"/\").length;\n var existingPathLen = existingPathFragment.split(\"/\").length;\n if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {\n throw new JsonPatchError('Cannot perform an `add` operation at the desired path', 'OPERATION_PATH_CANNOT_ADD', index, operation, document);\n }\n }\n else if (operation.op === 'replace' || operation.op === 'remove' || operation.op === '_get') {\n if (operation.path !== existingPathFragment) {\n throw new JsonPatchError('Cannot perform the operation at a path that does not exist', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);\n }\n }\n else if (operation.op === 'move' || operation.op === 'copy') {\n var existingValue = { op: \"_get\", path: operation.from, value: undefined };\n var error = validate([existingValue], document);\n if (error && error.name === 'OPERATION_PATH_UNRESOLVABLE') {\n throw new JsonPatchError('Cannot perform the operation from a path that does not exist', 'OPERATION_FROM_UNRESOLVABLE', index, operation, document);\n }\n }\n }\n}\n/**\n * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.\n * If error is encountered, returns a JsonPatchError object\n * @param sequence\n * @param document\n * @returns {JsonPatchError|undefined}\n */\nexport function validate(sequence, document, externalValidator) {\n try {\n if (!Array.isArray(sequence)) {\n throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');\n }\n if (document) {\n //clone document and sequence so that we can safely try applying operations\n applyPatch(_deepClone(document), _deepClone(sequence), externalValidator || true);\n }\n else {\n externalValidator = externalValidator || validator;\n for (var i = 0; i < sequence.length; i++) {\n externalValidator(sequence[i], i, document, undefined);\n }\n }\n }\n catch (e) {\n if (e instanceof JsonPatchError) {\n return e;\n }\n else {\n throw e;\n }\n }\n}\n// based on https://github.com/epoberezkin/fast-deep-equal\n// MIT License\n// Copyright (c) 2017 Evgeny Poberezkin\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\nexport function _areEquals(a, b) {\n if (a === b)\n return true;\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key;\n if (arrA && arrB) {\n length = a.length;\n if (length != b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (!_areEquals(a[i], b[i]))\n return false;\n return true;\n }\n if (arrA != arrB)\n return false;\n var keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length)\n return false;\n for (i = length; i-- !== 0;)\n if (!b.hasOwnProperty(keys[i]))\n return false;\n for (i = length; i-- !== 0;) {\n key = keys[i];\n if (!_areEquals(a[key], b[key]))\n return false;\n }\n return true;\n }\n return a !== a && b !== b;\n}\n;\n","/*!\n * https://github.com/Starcounter-Jack/JSON-Patch\n * (c) 2017-2021 Joachim Wester\n * MIT license\n */\nimport { _deepClone, _objectKeys, escapePathComponent, hasOwnProperty } from './helpers.mjs';\nimport { applyPatch } from './core.mjs';\nvar beforeDict = new WeakMap();\nvar Mirror = /** @class */ (function () {\n function Mirror(obj) {\n this.observers = new Map();\n this.obj = obj;\n }\n return Mirror;\n}());\nvar ObserverInfo = /** @class */ (function () {\n function ObserverInfo(callback, observer) {\n this.callback = callback;\n this.observer = observer;\n }\n return ObserverInfo;\n}());\nfunction getMirror(obj) {\n return beforeDict.get(obj);\n}\nfunction getObserverFromMirror(mirror, callback) {\n return mirror.observers.get(callback);\n}\nfunction removeObserverFromMirror(mirror, observer) {\n mirror.observers.delete(observer.callback);\n}\n/**\n * Detach an observer from an object\n */\nexport function unobserve(root, observer) {\n observer.unobserve();\n}\n/**\n * Observes changes made to an object, which can then be retrieved using generate\n */\nexport function observe(obj, callback) {\n var patches = [];\n var observer;\n var mirror = getMirror(obj);\n if (!mirror) {\n mirror = new Mirror(obj);\n beforeDict.set(obj, mirror);\n }\n else {\n var observerInfo = getObserverFromMirror(mirror, callback);\n observer = observerInfo && observerInfo.observer;\n }\n if (observer) {\n return observer;\n }\n observer = {};\n mirror.value = _deepClone(obj);\n if (callback) {\n observer.callback = callback;\n observer.next = null;\n var dirtyCheck = function () {\n generate(observer);\n };\n var fastCheck = function () {\n clearTimeout(observer.next);\n observer.next = setTimeout(dirtyCheck);\n };\n if (typeof window !== 'undefined') { //not Node\n window.addEventListener('mouseup', fastCheck);\n window.addEventListener('keyup', fastCheck);\n window.addEventListener('mousedown', fastCheck);\n window.addEventListener('keydown', fastCheck);\n window.addEventListener('change', fastCheck);\n }\n }\n observer.patches = patches;\n observer.object = obj;\n observer.unobserve = function () {\n generate(observer);\n clearTimeout(observer.next);\n removeObserverFromMirror(mirror, observer);\n if (typeof window !== 'undefined') {\n window.removeEventListener('mouseup', fastCheck);\n window.removeEventListener('keyup', fastCheck);\n window.removeEventListener('mousedown', fastCheck);\n window.removeEventListener('keydown', fastCheck);\n window.removeEventListener('change', fastCheck);\n }\n };\n mirror.observers.set(callback, new ObserverInfo(callback, observer));\n return observer;\n}\n/**\n * Generate an array of patches from an observer\n */\nexport function generate(observer, invertible) {\n if (invertible === void 0) { invertible = false; }\n var mirror = beforeDict.get(observer.object);\n _generate(mirror.value, observer.object, observer.patches, \"\", invertible);\n if (observer.patches.length) {\n applyPatch(mirror.value, observer.patches);\n }\n var temp = observer.patches;\n if (temp.length > 0) {\n observer.patches = [];\n if (observer.callback) {\n observer.callback(temp);\n }\n }\n return temp;\n}\n// Dirty check if obj is different from mirror, generate patches and update mirror\nfunction _generate(mirror, obj, patches, path, invertible) {\n if (obj === mirror) {\n return;\n }\n if (typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n var newKeys = _objectKeys(obj);\n var oldKeys = _objectKeys(mirror);\n var changed = false;\n var deleted = false;\n //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if (hasOwnProperty(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {\n var newVal = obj[key];\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {\n _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key), invertible);\n }\n else {\n if (oldVal !== newVal) {\n changed = true;\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(oldVal) });\n }\n patches.push({ op: \"replace\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(newVal) });\n }\n }\n }\n else if (Array.isArray(mirror) === Array.isArray(obj)) {\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(oldVal) });\n }\n patches.push({ op: \"remove\", path: path + \"/\" + escapePathComponent(key) });\n deleted = true; // property has been deleted\n }\n else {\n if (invertible) {\n patches.push({ op: \"test\", path: path, value: mirror });\n }\n patches.push({ op: \"replace\", path: path, value: obj });\n changed = true;\n }\n }\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!hasOwnProperty(mirror, key) && obj[key] !== undefined) {\n patches.push({ op: \"add\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(obj[key]) });\n }\n }\n}\n/**\n * Create an array of patches from the differences in two objects\n */\nexport function compare(tree1, tree2, invertible) {\n if (invertible === void 0) { invertible = false; }\n var patches = [];\n _generate(tree1, tree2, patches, '', invertible);\n return patches;\n}\n","export * from './module/core.mjs';\nexport * from './module/duplex.mjs';\nexport {\n PatchError as JsonPatchError,\n _deepClone as deepClone,\n escapePathComponent,\n unescapePathComponent\n} from './module/helpers.mjs';\n\n\n/**\n * Default export for backwards compat\n */\n\nimport * as core from './module/core.mjs';\nimport * as duplex from './module/duplex.mjs';\nimport {\n PatchError as JsonPatchError,\n _deepClone as deepClone,\n escapePathComponent,\n unescapePathComponent\n} from './module/helpers.mjs';\n\nexport default Object.assign({}, core, duplex, {\n JsonPatchError,\n deepClone,\n escapePathComponent,\n unescapePathComponent\n});","function accessor (fn, fields, name) {\n fn.fields = fields || [];\n fn.fname = name;\n return fn;\n}\nfunction accessorName(fn) {\n return fn == null ? null : fn.fname;\n}\nfunction accessorFields(fn) {\n return fn == null ? null : fn.fields;\n}\n\nfunction getter (path) {\n return path.length === 1 ? get1(path[0]) : getN(path);\n}\nconst get1 = field => function (obj) {\n return obj[field];\n};\nconst getN = path => {\n const len = path.length;\n return function (obj) {\n for (let i = 0; i < len; ++i) {\n obj = obj[path[i]];\n }\n return obj;\n };\n};\n\nfunction error (message) {\n throw Error(message);\n}\n\nfunction splitAccessPath (p) {\n const path = [],\n n = p.length;\n let q = null,\n b = 0,\n s = '',\n i,\n j,\n c;\n p = p + '';\n function push() {\n path.push(s + p.substring(i, j));\n s = '';\n i = j + 1;\n }\n for (i = j = 0; j < n; ++j) {\n c = p[j];\n if (c === '\\\\') {\n s += p.substring(i, j++);\n i = j;\n } else if (c === q) {\n push();\n q = null;\n b = -1;\n } else if (q) {\n continue;\n } else if (i === b && c === '\"') {\n i = j + 1;\n q = c;\n } else if (i === b && c === \"'\") {\n i = j + 1;\n q = c;\n } else if (c === '.' && !b) {\n if (j > i) {\n push();\n } else {\n i = j + 1;\n }\n } else if (c === '[') {\n if (j > i) push();\n b = i = j + 1;\n } else if (c === ']') {\n if (!b) error('Access path missing open bracket: ' + p);\n if (b > 0) push();\n b = 0;\n i = j + 1;\n }\n }\n if (b) error('Access path missing closing bracket: ' + p);\n if (q) error('Access path missing closing quote: ' + p);\n if (j > i) {\n j++;\n push();\n }\n return path;\n}\n\nfunction field (field, name, opt) {\n const path = splitAccessPath(field);\n field = path.length === 1 ? path[0] : field;\n return accessor((opt && opt.get || getter)(path), [field], name || field);\n}\n\nconst id = field('id');\nconst identity = accessor(_ => _, [], 'identity');\nconst zero = accessor(() => 0, [], 'zero');\nconst one = accessor(() => 1, [], 'one');\nconst truthy = accessor(() => true, [], 'true');\nconst falsy = accessor(() => false, [], 'false');\n\nfunction log$1(method, level, input) {\n const args = [level].concat([].slice.call(input));\n console[method].apply(console, args); // eslint-disable-line no-console\n}\n\nconst None = 0;\nconst Error$1 = 1;\nconst Warn = 2;\nconst Info = 3;\nconst Debug = 4;\nfunction logger (_, method) {\n let handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : log$1;\n let level = _ || None;\n return {\n level(_) {\n if (arguments.length) {\n level = +_;\n return this;\n } else {\n return level;\n }\n },\n error() {\n if (level >= Error$1) handler(method || 'error', 'ERROR', arguments);\n return this;\n },\n warn() {\n if (level >= Warn) handler(method || 'warn', 'WARN', arguments);\n return this;\n },\n info() {\n if (level >= Info) handler(method || 'log', 'INFO', arguments);\n return this;\n },\n debug() {\n if (level >= Debug) handler(method || 'log', 'DEBUG', arguments);\n return this;\n }\n };\n}\n\nvar isArray = Array.isArray;\n\nfunction isObject (_) {\n return _ === Object(_);\n}\n\nconst isLegalKey = key => key !== '__proto__';\nfunction mergeConfig() {\n for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) {\n configs[_key] = arguments[_key];\n }\n return configs.reduce((out, source) => {\n for (const key in source) {\n if (key === 'signals') {\n // for signals, we merge the signals arrays\n // source signals take precedence over\n // existing signals with the same name\n out.signals = mergeNamed(out.signals, source.signals);\n } else {\n // otherwise, merge objects subject to recursion constraints\n // for legend block, recurse for the layout entry only\n // for style block, recurse for all properties\n // otherwise, no recursion: objects overwrite, no merging\n const r = key === 'legend' ? {\n layout: 1\n } : key === 'style' ? true : null;\n writeConfig(out, key, source[key], r);\n }\n }\n return out;\n }, {});\n}\nfunction writeConfig(output, key, value, recurse) {\n if (!isLegalKey(key)) return;\n let k, o;\n if (isObject(value) && !isArray(value)) {\n o = isObject(output[key]) ? output[key] : output[key] = {};\n for (k in value) {\n if (recurse && (recurse === true || recurse[k])) {\n writeConfig(o, k, value[k]);\n } else if (isLegalKey(k)) {\n o[k] = value[k];\n }\n }\n } else {\n output[key] = value;\n }\n}\nfunction mergeNamed(a, b) {\n if (a == null) return b;\n const map = {},\n out = [];\n function add(_) {\n if (!map[_.name]) {\n map[_.name] = 1;\n out.push(_);\n }\n }\n b.forEach(add);\n a.forEach(add);\n return out;\n}\n\nfunction peek (array) {\n return array[array.length - 1];\n}\n\nfunction toNumber (_) {\n return _ == null || _ === '' ? null : +_;\n}\n\nconst exp = sign => x => sign * Math.exp(x);\nconst log = sign => x => Math.log(sign * x);\nconst symlog = c => x => Math.sign(x) * Math.log1p(Math.abs(x / c));\nconst symexp = c => x => Math.sign(x) * Math.expm1(Math.abs(x)) * c;\nconst pow = exponent => x => x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\nfunction pan(domain, delta, lift, ground) {\n const d0 = lift(domain[0]),\n d1 = lift(peek(domain)),\n dd = (d1 - d0) * delta;\n return [ground(d0 - dd), ground(d1 - dd)];\n}\nfunction panLinear(domain, delta) {\n return pan(domain, delta, toNumber, identity);\n}\nfunction panLog(domain, delta) {\n var sign = Math.sign(domain[0]);\n return pan(domain, delta, log(sign), exp(sign));\n}\nfunction panPow(domain, delta, exponent) {\n return pan(domain, delta, pow(exponent), pow(1 / exponent));\n}\nfunction panSymlog(domain, delta, constant) {\n return pan(domain, delta, symlog(constant), symexp(constant));\n}\nfunction zoom(domain, anchor, scale, lift, ground) {\n const d0 = lift(domain[0]),\n d1 = lift(peek(domain)),\n da = anchor != null ? lift(anchor) : (d0 + d1) / 2;\n return [ground(da + (d0 - da) * scale), ground(da + (d1 - da) * scale)];\n}\nfunction zoomLinear(domain, anchor, scale) {\n return zoom(domain, anchor, scale, toNumber, identity);\n}\nfunction zoomLog(domain, anchor, scale) {\n const sign = Math.sign(domain[0]);\n return zoom(domain, anchor, scale, log(sign), exp(sign));\n}\nfunction zoomPow(domain, anchor, scale, exponent) {\n return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent));\n}\nfunction zoomSymlog(domain, anchor, scale, constant) {\n return zoom(domain, anchor, scale, symlog(constant), symexp(constant));\n}\n\nfunction quarter(date) {\n return 1 + ~~(new Date(date).getMonth() / 3);\n}\nfunction utcquarter(date) {\n return 1 + ~~(new Date(date).getUTCMonth() / 3);\n}\n\nfunction array (_) {\n return _ != null ? isArray(_) ? _ : [_] : [];\n}\n\n/**\n * Span-preserving range clamp. If the span of the input range is less\n * than (max - min) and an endpoint exceeds either the min or max value,\n * the range is translated such that the span is preserved and one\n * endpoint touches the boundary of the min/max range.\n * If the span exceeds (max - min), the range [min, max] is returned.\n */\nfunction clampRange (range, min, max) {\n let lo = range[0],\n hi = range[1],\n span;\n if (hi < lo) {\n span = hi;\n hi = lo;\n lo = span;\n }\n span = hi - lo;\n return span >= max - min ? [min, max] : [lo = Math.min(Math.max(lo, min), max - span), lo + span];\n}\n\nfunction isFunction (_) {\n return typeof _ === 'function';\n}\n\nconst DESCENDING = 'descending';\nfunction compare (fields, orders, opt) {\n opt = opt || {};\n orders = array(orders) || [];\n const ord = [],\n get = [],\n fmap = {},\n gen = opt.comparator || comparator;\n array(fields).forEach((f, i) => {\n if (f == null) return;\n ord.push(orders[i] === DESCENDING ? -1 : 1);\n get.push(f = isFunction(f) ? f : field(f, null, opt));\n (accessorFields(f) || []).forEach(_ => fmap[_] = 1);\n });\n return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap));\n}\nconst ascending = (u, v) => (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0;\nconst comparator = (fields, orders) => fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length);\nconst compare1 = (field, order) => function (a, b) {\n return ascending(field(a), field(b)) * order;\n};\nconst compareN = (fields, orders, n) => {\n orders.push(0); // pad zero for convenient lookup\n return function (a, b) {\n let f,\n c = 0,\n i = -1;\n while (c === 0 && ++i < n) {\n f = fields[i];\n c = ascending(f(a), f(b));\n }\n return c * orders[i];\n };\n};\n\nfunction constant (_) {\n return isFunction(_) ? _ : () => _;\n}\n\nfunction debounce (delay, handler) {\n let tid;\n return e => {\n if (tid) clearTimeout(tid);\n tid = setTimeout(() => (handler(e), tid = null), delay);\n };\n}\n\nfunction extend (_) {\n for (let x, k, i = 1, len = arguments.length; i < len; ++i) {\n x = arguments[i];\n for (k in x) {\n _[k] = x[k];\n }\n }\n return _;\n}\n\n/**\n * Return an array with minimum and maximum values, in the\n * form [min, max]. Ignores null, undefined, and NaN values.\n */\nfunction extent (array, f) {\n let i = 0,\n n,\n v,\n min,\n max;\n if (array && (n = array.length)) {\n if (f == null) {\n // find first valid value\n for (v = array[i]; i < n && (v == null || v !== v); v = array[++i]);\n min = max = v;\n\n // visit all other values\n for (; i < n; ++i) {\n v = array[i];\n // skip null/undefined; NaN will fail all comparisons\n if (v != null) {\n if (v < min) min = v;\n if (v > max) max = v;\n }\n }\n } else {\n // find first valid value\n for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i]));\n min = max = v;\n\n // visit all other values\n for (; i < n; ++i) {\n v = f(array[i]);\n // skip null/undefined; NaN will fail all comparisons\n if (v != null) {\n if (v < min) min = v;\n if (v > max) max = v;\n }\n }\n }\n }\n return [min, max];\n}\n\nfunction extentIndex (array, f) {\n const n = array.length;\n let i = -1,\n a,\n b,\n c,\n u,\n v;\n if (f == null) {\n while (++i < n) {\n b = array[i];\n if (b != null && b >= b) {\n a = c = b;\n break;\n }\n }\n if (i === n) return [-1, -1];\n u = v = i;\n while (++i < n) {\n b = array[i];\n if (b != null) {\n if (a > b) {\n a = b;\n u = i;\n }\n if (c < b) {\n c = b;\n v = i;\n }\n }\n }\n } else {\n while (++i < n) {\n b = f(array[i], i, array);\n if (b != null && b >= b) {\n a = c = b;\n break;\n }\n }\n if (i === n) return [-1, -1];\n u = v = i;\n while (++i < n) {\n b = f(array[i], i, array);\n if (b != null) {\n if (a > b) {\n a = b;\n u = i;\n }\n if (c < b) {\n c = b;\n v = i;\n }\n }\n }\n }\n return [u, v];\n}\n\nconst hop = Object.prototype.hasOwnProperty;\nfunction has (object, property) {\n return hop.call(object, property);\n}\n\nconst NULL = {};\nfunction fastmap (input) {\n let obj = {},\n test;\n function has$1(key) {\n return has(obj, key) && obj[key] !== NULL;\n }\n const map = {\n size: 0,\n empty: 0,\n object: obj,\n has: has$1,\n get(key) {\n return has$1(key) ? obj[key] : undefined;\n },\n set(key, value) {\n if (!has$1(key)) {\n ++map.size;\n if (obj[key] === NULL) --map.empty;\n }\n obj[key] = value;\n return this;\n },\n delete(key) {\n if (has$1(key)) {\n --map.size;\n ++map.empty;\n obj[key] = NULL;\n }\n return this;\n },\n clear() {\n map.size = map.empty = 0;\n map.object = obj = {};\n },\n test(_) {\n if (arguments.length) {\n test = _;\n return map;\n } else {\n return test;\n }\n },\n clean() {\n const next = {};\n let size = 0;\n for (const key in obj) {\n const value = obj[key];\n if (value !== NULL && (!test || !test(value))) {\n next[key] = value;\n ++size;\n }\n }\n map.size = size;\n map.empty = 0;\n map.object = obj = next;\n }\n };\n if (input) Object.keys(input).forEach(key => {\n map.set(key, input[key]);\n });\n return map;\n}\n\nfunction flush (range, value, threshold, left, right, center) {\n if (!threshold && threshold !== 0) return center;\n const t = +threshold;\n let a = range[0],\n b = peek(range),\n l;\n\n // swap endpoints if range is reversed\n if (b < a) {\n l = a;\n a = b;\n b = l;\n }\n\n // compare value to endpoints\n l = Math.abs(value - a);\n const r = Math.abs(b - value);\n\n // adjust if value is within threshold distance of endpoint\n return l < r && l <= t ? left : r <= t ? right : center;\n}\n\nfunction inherits (child, parent, members) {\n const proto = child.prototype = Object.create(parent.prototype);\n Object.defineProperty(proto, 'constructor', {\n value: child,\n writable: true,\n enumerable: true,\n configurable: true\n });\n return extend(proto, members);\n}\n\n/**\n * Predicate that returns true if the value lies within the span\n * of the given range. The left and right flags control the use\n * of inclusive (true) or exclusive (false) comparisons.\n */\nfunction inrange (value, range, left, right) {\n let r0 = range[0],\n r1 = range[range.length - 1],\n t;\n if (r0 > r1) {\n t = r0;\n r0 = r1;\n r1 = t;\n }\n left = left === undefined || left;\n right = right === undefined || right;\n return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1);\n}\n\nfunction isBoolean (_) {\n return typeof _ === 'boolean';\n}\n\nfunction isDate (_) {\n return Object.prototype.toString.call(_) === '[object Date]';\n}\n\nfunction isIterable (_) {\n return _ && isFunction(_[Symbol.iterator]);\n}\n\nfunction isNumber (_) {\n return typeof _ === 'number';\n}\n\nfunction isRegExp (_) {\n return Object.prototype.toString.call(_) === '[object RegExp]';\n}\n\nfunction isString (_) {\n return typeof _ === 'string';\n}\n\nfunction key (fields, flat, opt) {\n if (fields) {\n fields = flat ? array(fields).map(f => f.replace(/\\\\(.)/g, '$1')) : array(fields);\n }\n const len = fields && fields.length,\n gen = opt && opt.get || getter,\n map = f => gen(flat ? [f] : splitAccessPath(f));\n let fn;\n if (!len) {\n fn = function () {\n return '';\n };\n } else if (len === 1) {\n const get = map(fields[0]);\n fn = function (_) {\n return '' + get(_);\n };\n } else {\n const get = fields.map(map);\n fn = function (_) {\n let s = '' + get[0](_),\n i = 0;\n while (++i < len) s += '|' + get[i](_);\n return s;\n };\n }\n return accessor(fn, fields, 'key');\n}\n\nfunction lerp (array, frac) {\n const lo = array[0],\n hi = peek(array),\n f = +frac;\n return !f ? lo : f === 1 ? hi : lo + f * (hi - lo);\n}\n\nconst DEFAULT_MAX_SIZE = 10000;\n\n// adapted from https://github.com/dominictarr/hashlru/ (MIT License)\nfunction lruCache (maxsize) {\n maxsize = +maxsize || DEFAULT_MAX_SIZE;\n let curr, prev, size;\n const clear = () => {\n curr = {};\n prev = {};\n size = 0;\n };\n const update = (key, value) => {\n if (++size > maxsize) {\n prev = curr;\n curr = {};\n size = 1;\n }\n return curr[key] = value;\n };\n clear();\n return {\n clear,\n has: key => has(curr, key) || has(prev, key),\n get: key => has(curr, key) ? curr[key] : has(prev, key) ? update(key, prev[key]) : undefined,\n set: (key, value) => has(curr, key) ? curr[key] = value : update(key, value)\n };\n}\n\nfunction merge (compare, array0, array1, output) {\n const n0 = array0.length,\n n1 = array1.length;\n if (!n1) return array0;\n if (!n0) return array1;\n const merged = output || new array0.constructor(n0 + n1);\n let i0 = 0,\n i1 = 0,\n i = 0;\n for (; i0 < n0 && i1 < n1; ++i) {\n merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++];\n }\n for (; i0 < n0; ++i0, ++i) {\n merged[i] = array0[i0];\n }\n for (; i1 < n1; ++i1, ++i) {\n merged[i] = array1[i1];\n }\n return merged;\n}\n\nfunction repeat (str, reps) {\n let s = '';\n while (--reps >= 0) s += str;\n return s;\n}\n\nfunction pad (str, length, padchar, align) {\n const c = padchar || ' ',\n s = str + '',\n n = length - s.length;\n return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n);\n}\n\n/**\n * Return the numerical span of an array: the difference between\n * the last and first values.\n */\nfunction span (array) {\n return array && peek(array) - array[0] || 0;\n}\n\nfunction $(x) {\n return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ?\n // Output valid JSON and JS source strings.\n // See http://timelessrepo.com/json-isnt-a-javascript-subset\n JSON.stringify(x).replace('\\u2028', '\\\\u2028').replace('\\u2029', '\\\\u2029') : x;\n}\n\nfunction toBoolean (_) {\n return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;\n}\n\nconst defaultParser = _ => isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_);\nfunction toDate (_, parser) {\n parser = parser || defaultParser;\n return _ == null || _ === '' ? null : parser(_);\n}\n\nfunction toString (_) {\n return _ == null || _ === '' ? null : _ + '';\n}\n\nfunction toSet (_) {\n const s = {},\n n = _.length;\n for (let i = 0; i < n; ++i) s[_[i]] = true;\n return s;\n}\n\nfunction truncate (str, length, align, ellipsis) {\n const e = ellipsis != null ? ellipsis : '\\u2026',\n s = str + '',\n n = s.length,\n l = Math.max(0, length - e.length);\n return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e;\n}\n\nfunction visitArray (array, filter, visitor) {\n if (array) {\n if (filter) {\n const n = array.length;\n for (let i = 0; i < n; ++i) {\n const t = filter(array[i]);\n if (t) visitor(t, i, array);\n }\n } else {\n array.forEach(visitor);\n }\n }\n}\n\nexport { Debug, Error$1 as Error, Info, None, Warn, accessor, accessorFields, accessorName, array, ascending, clampRange, compare, constant, debounce, error, extend, extent, extentIndex, falsy, fastmap, field, flush, has as hasOwnProperty, id, identity, inherits, inrange, isArray, isBoolean, isDate, isFunction, isIterable, isNumber, isObject, isRegExp, isString, key, lerp, logger, lruCache, merge, mergeConfig, one, pad, panLinear, panLog, panPow, panSymlog, peek, quarter, repeat, span, splitAccessPath, $ as stringValue, toBoolean, toDate, toNumber, toSet, toString, truncate, truthy, utcquarter, visitArray, writeConfig, zero, zoomLinear, zoomLog, zoomPow, zoomSymlog };\n","var EOL = {},\n EOF = {},\n QUOTE = 34,\n NEWLINE = 10,\n RETURN = 13;\n\nfunction objectConverter(columns) {\n return new Function(\"d\", \"return {\" + columns.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"] || \\\"\\\"\";\n }).join(\",\") + \"}\");\n}\n\nfunction customConverter(columns, f) {\n var object = objectConverter(columns);\n return function(row, i) {\n return f(object(row), i, columns);\n };\n}\n\n// Compute unique columns in order of discovery.\nfunction inferColumns(rows) {\n var columnSet = Object.create(null),\n columns = [];\n\n rows.forEach(function(row) {\n for (var column in row) {\n if (!(column in columnSet)) {\n columns.push(columnSet[column] = column);\n }\n }\n });\n\n return columns;\n}\n\nfunction pad(value, width) {\n var s = value + \"\", length = s.length;\n return length < width ? new Array(width - length + 1).join(0) + s : s;\n}\n\nfunction formatYear(year) {\n return year < 0 ? \"-\" + pad(-year, 6)\n : year > 9999 ? \"+\" + pad(year, 6)\n : pad(year, 4);\n}\n\nfunction formatDate(date) {\n var hours = date.getUTCHours(),\n minutes = date.getUTCMinutes(),\n seconds = date.getUTCSeconds(),\n milliseconds = date.getUTCMilliseconds();\n return isNaN(date) ? \"Invalid Date\"\n : formatYear(date.getUTCFullYear(), 4) + \"-\" + pad(date.getUTCMonth() + 1, 2) + \"-\" + pad(date.getUTCDate(), 2)\n + (milliseconds ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \":\" + pad(seconds, 2) + \".\" + pad(milliseconds, 3) + \"Z\"\n : seconds ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \":\" + pad(seconds, 2) + \"Z\"\n : minutes || hours ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \"Z\"\n : \"\");\n}\n\nexport default function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n\\r]\"),\n DELIMITER = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var convert, columns, rows = parseRows(text, function(row, i) {\n if (convert) return convert(row, i - 1);\n columns = row, convert = f ? customConverter(row, f) : objectConverter(row);\n });\n rows.columns = columns || [];\n return rows;\n }\n\n function parseRows(text, f) {\n var rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // current line number\n t, // current token\n eof = N <= 0, // current token followed by EOF?\n eol = false; // current token followed by EOL?\n\n // Strip the trailing newline.\n if (text.charCodeAt(N - 1) === NEWLINE) --N;\n if (text.charCodeAt(N - 1) === RETURN) --N;\n\n function token() {\n if (eof) return EOF;\n if (eol) return eol = false, EOL;\n\n // Unescape quotes.\n var i, j = I, c;\n if (text.charCodeAt(j) === QUOTE) {\n while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);\n if ((i = I) >= N) eof = true;\n else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n return text.slice(j + 1, i - 1).replace(/\"\"/g, \"\\\"\");\n }\n\n // Find next delimiter or newline.\n while (I < N) {\n if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n else if (c !== DELIMITER) continue;\n return text.slice(j, i);\n }\n\n // Return last token before EOF.\n return eof = true, text.slice(j, N);\n }\n\n while ((t = token()) !== EOF) {\n var row = [];\n while (t !== EOL && t !== EOF) row.push(t), t = token();\n if (f && (row = f(row, n++)) == null) continue;\n rows.push(row);\n }\n\n return rows;\n }\n\n function preformatBody(rows, columns) {\n return rows.map(function(row) {\n return columns.map(function(column) {\n return formatValue(row[column]);\n }).join(delimiter);\n });\n }\n\n function format(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join(\"\\n\");\n }\n\n function formatBody(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return preformatBody(rows, columns).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(value) {\n return value == null ? \"\"\n : value instanceof Date ? formatDate(value)\n : reFormat.test(value += \"\") ? \"\\\"\" + value.replace(/\"/g, \"\\\"\\\"\") + \"\\\"\"\n : value;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatBody: formatBody,\n formatRows: formatRows,\n formatRow: formatRow,\n formatValue: formatValue\n };\n}\n","export default function(x) {\n return x;\n}\n","import reverse from \"./reverse.js\";\nimport transform from \"./transform.js\";\n\nexport default function(topology, o) {\n if (typeof o === \"string\") o = topology.objects[o];\n return o.type === \"GeometryCollection\"\n ? {type: \"FeatureCollection\", features: o.geometries.map(function(o) { return feature(topology, o); })}\n : feature(topology, o);\n}\n\nfunction feature(topology, o) {\n var id = o.id,\n bbox = o.bbox,\n properties = o.properties == null ? {} : o.properties,\n geometry = object(topology, o);\n return id == null && bbox == null ? {type: \"Feature\", properties: properties, geometry: geometry}\n : bbox == null ? {type: \"Feature\", id: id, properties: properties, geometry: geometry}\n : {type: \"Feature\", id: id, bbox: bbox, properties: properties, geometry: geometry};\n}\n\nexport function object(topology, o) {\n var transformPoint = transform(topology.transform),\n arcs = topology.arcs;\n\n function arc(i, points) {\n if (points.length) points.pop();\n for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) {\n points.push(transformPoint(a[k], k));\n }\n if (i < 0) reverse(points, n);\n }\n\n function point(p) {\n return transformPoint(p);\n }\n\n function line(arcs) {\n var points = [];\n for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n if (points.length < 2) points.push(points[0]); // This should never happen per the specification.\n return points;\n }\n\n function ring(arcs) {\n var points = line(arcs);\n while (points.length < 4) points.push(points[0]); // This may happen if an arc has only two points.\n return points;\n }\n\n function polygon(arcs) {\n return arcs.map(ring);\n }\n\n function geometry(o) {\n var type = o.type, coordinates;\n switch (type) {\n case \"GeometryCollection\": return {type: type, geometries: o.geometries.map(geometry)};\n case \"Point\": coordinates = point(o.coordinates); break;\n case \"MultiPoint\": coordinates = o.coordinates.map(point); break;\n case \"LineString\": coordinates = line(o.arcs); break;\n case \"MultiLineString\": coordinates = o.arcs.map(line); break;\n case \"Polygon\": coordinates = polygon(o.arcs); break;\n case \"MultiPolygon\": coordinates = o.arcs.map(polygon); break;\n default: return null;\n }\n return {type: type, coordinates: coordinates};\n }\n\n return geometry(o);\n}\n","import identity from \"./identity.js\";\n\nexport default function(transform) {\n if (transform == null) return identity;\n var x0,\n y0,\n kx = transform.scale[0],\n ky = transform.scale[1],\n dx = transform.translate[0],\n dy = transform.translate[1];\n return function(input, i) {\n if (!i) x0 = y0 = 0;\n var j = 2, n = input.length, output = new Array(n);\n output[0] = (x0 += input[0]) * kx + dx;\n output[1] = (y0 += input[1]) * ky + dy;\n while (j < n) output[j] = input[j], ++j;\n return output;\n };\n}\n","export default function(array, n) {\n var t, j = array.length, i = j - n;\n while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n}\n","export default function(topology, arcs) {\n var stitchedArcs = {},\n fragmentByStart = {},\n fragmentByEnd = {},\n fragments = [],\n emptyIndex = -1;\n\n // Stitch empty arcs first, since they may be subsumed by other arcs.\n arcs.forEach(function(i, j) {\n var arc = topology.arcs[i < 0 ? ~i : i], t;\n if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n }\n });\n\n arcs.forEach(function(i) {\n var e = ends(i),\n start = e[0],\n end = e[1],\n f, g;\n\n if (f = fragmentByEnd[start]) {\n delete fragmentByEnd[f.end];\n f.push(i);\n f.end = end;\n if (g = fragmentByStart[end]) {\n delete fragmentByStart[g.start];\n var fg = g === f ? f : f.concat(g);\n fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else if (f = fragmentByStart[end]) {\n delete fragmentByStart[f.start];\n f.unshift(i);\n f.start = start;\n if (g = fragmentByEnd[start]) {\n delete fragmentByEnd[g.end];\n var gf = g === f ? f : g.concat(f);\n fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else {\n f = [i];\n fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n }\n });\n\n function ends(i) {\n var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });\n else p1 = arc[arc.length - 1];\n return i < 0 ? [p1, p0] : [p0, p1];\n }\n\n function flush(fragmentByEnd, fragmentByStart) {\n for (var k in fragmentByEnd) {\n var f = fragmentByEnd[k];\n delete fragmentByStart[f.start];\n delete f.start;\n delete f.end;\n f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });\n fragments.push(f);\n }\n }\n\n flush(fragmentByEnd, fragmentByStart);\n flush(fragmentByStart, fragmentByEnd);\n arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });\n\n return fragments;\n}\n","import {object} from \"./feature.js\";\nimport stitch from \"./stitch.js\";\n\nexport default function(topology) {\n return object(topology, meshArcs.apply(this, arguments));\n}\n\nexport function meshArcs(topology, object, filter) {\n var arcs, i, n;\n if (arguments.length > 1) arcs = extractArcs(topology, object, filter);\n else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i;\n return {type: \"MultiLineString\", arcs: stitch(topology, arcs)};\n}\n\nfunction extractArcs(topology, object, filter) {\n var arcs = [],\n geomsByArc = [],\n geom;\n\n function extract0(i) {\n var j = i < 0 ? ~i : i;\n (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});\n }\n\n function extract1(arcs) {\n arcs.forEach(extract0);\n }\n\n function extract2(arcs) {\n arcs.forEach(extract1);\n }\n\n function extract3(arcs) {\n arcs.forEach(extract2);\n }\n\n function geometry(o) {\n switch (geom = o, o.type) {\n case \"GeometryCollection\": o.geometries.forEach(geometry); break;\n case \"LineString\": extract1(o.arcs); break;\n case \"MultiLineString\": case \"Polygon\": extract2(o.arcs); break;\n case \"MultiPolygon\": extract3(o.arcs); break;\n }\n }\n\n geometry(object);\n\n geomsByArc.forEach(filter == null\n ? function(geoms) { arcs.push(geoms[0].i); }\n : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });\n\n return arcs;\n}\n","const e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction tickSpec(start, stop, count) {\n const step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log10(step)),\n error = step / Math.pow(10, power),\n factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n let i1, i2, inc;\n if (power < 0) {\n inc = Math.pow(10, -power) / factor;\n i1 = Math.round(start * inc);\n i2 = Math.round(stop * inc);\n if (i1 / inc < start) ++i1;\n if (i2 / inc > stop) --i2;\n inc = -inc;\n } else {\n inc = Math.pow(10, power) * factor;\n i1 = Math.round(start / inc);\n i2 = Math.round(stop / inc);\n if (i1 * inc < start) ++i1;\n if (i2 * inc > stop) --i2;\n }\n if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);\n return [i1, i2, inc];\n}\n\nexport default function ticks(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n if (!(count > 0)) return [];\n if (start === stop) return [start];\n const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);\n if (!(i2 >= i1)) return [];\n const n = i2 - i1 + 1, ticks = new Array(n);\n if (reverse) {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;\n } else {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;\n }\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n return tickSpec(start, stop, count)[2];\n}\n\nexport function tickStep(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);\n}\n","// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n","export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n","import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": (x, p) => (x * 100).toFixed(p),\n \"b\": (x) => Math.round(x).toString(2),\n \"c\": (x) => x + \"\",\n \"d\": formatDecimal,\n \"e\": (x, p) => x.toExponential(p),\n \"f\": (x, p) => x.toFixed(p),\n \"g\": (x, p) => x.toPrecision(p),\n \"o\": (x) => Math.round(x).toString(8),\n \"p\": (x, p) => formatRounded(x * 100, p),\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": (x) => Math.round(x).toString(16).toUpperCase(),\n \"x\": (x) => Math.round(x).toString(16)\n};\n","export default function(x) {\n return x;\n}\n","import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"−\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n","export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n","export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n","// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n","const t0 = new Date, t1 = new Date;\n\nexport function timeInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;\n }\n\n interval.floor = (date) => {\n return floori(date = new Date(+date)), date;\n };\n\n interval.ceil = (date) => {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = (date) => {\n const d0 = interval(date), d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = (date, step) => {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = (start, stop, step) => {\n const range = [];\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n let previous;\n do range.push(previous = new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n\n interval.filter = (test) => {\n return timeInterval((date) => {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, (date, step) => {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = (start, end) => {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n interval.every = (step) => {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? (d) => field(d) % step === 0\n : (d) => interval.count(0, d) % step === 0);\n };\n }\n\n return interval;\n}\n","export const durationSecond = 1000;\nexport const durationMinute = durationSecond * 60;\nexport const durationHour = durationMinute * 60;\nexport const durationDay = durationHour * 24;\nexport const durationWeek = durationDay * 7;\nexport const durationMonth = durationDay * 30;\nexport const durationYear = durationDay * 365;\n","import {timeInterval} from \"./interval.js\";\nimport {durationDay, durationMinute} from \"./duration.js\";\n\nexport const timeDay = timeInterval(\n date => date.setHours(0, 0, 0, 0),\n (date, step) => date.setDate(date.getDate() + step),\n (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,\n date => date.getDate() - 1\n);\n\nexport const timeDays = timeDay.range;\n\nexport const utcDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return date.getUTCDate() - 1;\n});\n\nexport const utcDays = utcDay.range;\n\nexport const unixDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return Math.floor(date / durationDay);\n});\n\nexport const unixDays = unixDay.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationWeek} from \"./duration.js\";\n\nfunction timeWeekday(i) {\n return timeInterval((date) => {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setDate(date.getDate() + step * 7);\n }, (start, end) => {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n}\n\nexport const timeSunday = timeWeekday(0);\nexport const timeMonday = timeWeekday(1);\nexport const timeTuesday = timeWeekday(2);\nexport const timeWednesday = timeWeekday(3);\nexport const timeThursday = timeWeekday(4);\nexport const timeFriday = timeWeekday(5);\nexport const timeSaturday = timeWeekday(6);\n\nexport const timeSundays = timeSunday.range;\nexport const timeMondays = timeMonday.range;\nexport const timeTuesdays = timeTuesday.range;\nexport const timeWednesdays = timeWednesday.range;\nexport const timeThursdays = timeThursday.range;\nexport const timeFridays = timeFriday.range;\nexport const timeSaturdays = timeSaturday.range;\n\nfunction utcWeekday(i) {\n return timeInterval((date) => {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, (start, end) => {\n return (end - start) / durationWeek;\n });\n}\n\nexport const utcSunday = utcWeekday(0);\nexport const utcMonday = utcWeekday(1);\nexport const utcTuesday = utcWeekday(2);\nexport const utcWednesday = utcWeekday(3);\nexport const utcThursday = utcWeekday(4);\nexport const utcFriday = utcWeekday(5);\nexport const utcSaturday = utcWeekday(6);\n\nexport const utcSundays = utcSunday.range;\nexport const utcMondays = utcMonday.range;\nexport const utcTuesdays = utcTuesday.range;\nexport const utcWednesdays = utcWednesday.range;\nexport const utcThursdays = utcThursday.range;\nexport const utcFridays = utcFriday.range;\nexport const utcSaturdays = utcSaturday.range;\n","import {timeInterval} from \"./interval.js\";\n\nexport const timeYear = timeInterval((date) => {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setFullYear(date.getFullYear() + step);\n}, (start, end) => {\n return end.getFullYear() - start.getFullYear();\n}, (date) => {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\ntimeYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nexport const timeYears = timeYear.range;\n\nexport const utcYear = timeInterval((date) => {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, (start, end) => {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, (date) => {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nexport const utcYears = utcYear.range;\n","import {timeInterval} from \"./interval.js\";\n\nexport const timeMonth = timeInterval((date) => {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setMonth(date.getMonth() + step);\n}, (start, end) => {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, (date) => {\n return date.getMonth();\n});\n\nexport const timeMonths = timeMonth.range;\n\nexport const utcMonth = timeInterval((date) => {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, (start, end) => {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, (date) => {\n return date.getUTCMonth();\n});\n\nexport const utcMonths = utcMonth.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationHour, durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeHour = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getHours();\n});\n\nexport const timeHours = timeHour.range;\n\nexport const utcHour = timeInterval((date) => {\n date.setUTCMinutes(0, 0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getUTCHours();\n});\n\nexport const utcHours = utcHour.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeMinute = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getMinutes();\n});\n\nexport const timeMinutes = timeMinute.range;\n\nexport const utcMinute = timeInterval((date) => {\n date.setUTCSeconds(0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getUTCMinutes();\n});\n\nexport const utcMinutes = utcMinute.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationSecond} from \"./duration.js\";\n\nexport const second = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds());\n}, (date, step) => {\n date.setTime(+date + step * durationSecond);\n}, (start, end) => {\n return (end - start) / durationSecond;\n}, (date) => {\n return date.getUTCSeconds();\n});\n\nexport const seconds = second.range;\n","import {timeInterval} from \"./interval.js\";\n\nexport const millisecond = timeInterval(() => {\n // noop\n}, (date, step) => {\n date.setTime(+date + step);\n}, (start, end) => {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = (k) => {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return timeInterval((date) => {\n date.setTime(Math.floor(date / k) * k);\n }, (date, step) => {\n date.setTime(+date + step * k);\n }, (start, end) => {\n return (end - start) / k;\n });\n};\n\nexport const milliseconds = millisecond.range;\n","export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n","import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can’t do this\n // for a comparator (except for specific, known comparators) because we can’t\n // tell if the comparator is symmetric, and an asymmetric comparator can’t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n","import { array, error, hasOwnProperty, extend, peek, toSet, constant, zero, one, span } from 'vega-util';\nimport { timeDay, timeWeek, utcDay, utcWeek, timeYear, timeMonth, timeHour, timeMinute, timeSecond, timeMillisecond, utcYear, utcMonth, utcHour, utcMinute, utcSecond, utcMillisecond } from 'd3-time';\nimport { bisector, tickStep } from 'd3-array';\n\nconst YEAR = 'year';\nconst QUARTER = 'quarter';\nconst MONTH = 'month';\nconst WEEK = 'week';\nconst DATE = 'date';\nconst DAY = 'day';\nconst DAYOFYEAR = 'dayofyear';\nconst HOURS = 'hours';\nconst MINUTES = 'minutes';\nconst SECONDS = 'seconds';\nconst MILLISECONDS = 'milliseconds';\nconst TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS];\nconst UNITS = TIME_UNITS.reduce((o, u, i) => (o[u] = 1 + i, o), {});\nfunction timeUnits(units) {\n const u = array(units).slice(),\n m = {};\n\n // check validity\n if (!u.length) error('Missing time unit.');\n u.forEach(unit => {\n if (hasOwnProperty(UNITS, unit)) {\n m[unit] = 1;\n } else {\n error(`Invalid time unit: ${unit}.`);\n }\n });\n const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0);\n if (numTypes > 1) {\n error(`Incompatible time units: ${units}`);\n }\n\n // ensure proper sort order\n u.sort((a, b) => UNITS[a] - UNITS[b]);\n return u;\n}\nconst defaultSpecifiers = {\n [YEAR]: '%Y ',\n [QUARTER]: 'Q%q ',\n [MONTH]: '%b ',\n [DATE]: '%d ',\n [WEEK]: 'W%U ',\n [DAY]: '%a ',\n [DAYOFYEAR]: '%j ',\n [HOURS]: '%H:00',\n [MINUTES]: '00:%M',\n [SECONDS]: ':%S',\n [MILLISECONDS]: '.%L',\n [`${YEAR}-${MONTH}`]: '%Y-%m ',\n [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ',\n [`${HOURS}-${MINUTES}`]: '%H:%M'\n};\nfunction timeUnitSpecifier(units, specifiers) {\n const s = extend({}, defaultSpecifiers, specifiers),\n u = timeUnits(units),\n n = u.length;\n let fmt = '',\n start = 0,\n end,\n key;\n for (start = 0; start < n;) {\n for (end = u.length; end > start; --end) {\n key = u.slice(start, end).join('-');\n if (s[key] != null) {\n fmt += s[key];\n start = end;\n break;\n }\n }\n }\n return fmt.trim();\n}\n\nconst t0 = new Date();\nfunction localYear(y) {\n t0.setFullYear(y);\n t0.setMonth(0);\n t0.setDate(1);\n t0.setHours(0, 0, 0, 0);\n return t0;\n}\nfunction dayofyear(d) {\n return localDayOfYear(new Date(d));\n}\nfunction week(d) {\n return localWeekNum(new Date(d));\n}\nfunction localDayOfYear(d) {\n return timeDay.count(localYear(d.getFullYear()) - 1, d);\n}\nfunction localWeekNum(d) {\n return timeWeek.count(localYear(d.getFullYear()) - 1, d);\n}\nfunction localFirst(y) {\n return localYear(y).getDay();\n}\nfunction localDate(y, m, d, H, M, S, L) {\n if (0 <= y && y < 100) {\n const date = new Date(-1, m, d, H, M, S, L);\n date.setFullYear(y);\n return date;\n }\n return new Date(y, m, d, H, M, S, L);\n}\nfunction utcdayofyear(d) {\n return utcDayOfYear(new Date(d));\n}\nfunction utcweek(d) {\n return utcWeekNum(new Date(d));\n}\nfunction utcDayOfYear(d) {\n const y = Date.UTC(d.getUTCFullYear(), 0, 1);\n return utcDay.count(y - 1, d);\n}\nfunction utcWeekNum(d) {\n const y = Date.UTC(d.getUTCFullYear(), 0, 1);\n return utcWeek.count(y - 1, d);\n}\nfunction utcFirst(y) {\n t0.setTime(Date.UTC(y, 0, 1));\n return t0.getUTCDay();\n}\nfunction utcDate(y, m, d, H, M, S, L) {\n if (0 <= y && y < 100) {\n const date = new Date(Date.UTC(-1, m, d, H, M, S, L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(y, m, d, H, M, S, L));\n}\n\nfunction floor(units, step, get, inv, newDate) {\n const s = step || 1,\n b = peek(units),\n _ = (unit, p, key) => {\n key = key || unit;\n return getUnit(get[key], inv[key], unit === b && s, p);\n };\n const t = new Date(),\n u = toSet(units),\n y = u[YEAR] ? _(YEAR) : constant(2012),\n m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : zero,\n d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one,\n H = u[HOURS] ? _(HOURS) : zero,\n M = u[MINUTES] ? _(MINUTES) : zero,\n S = u[SECONDS] ? _(SECONDS) : zero,\n L = u[MILLISECONDS] ? _(MILLISECONDS) : zero;\n return function (v) {\n t.setTime(+v);\n const year = y(t);\n return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t));\n };\n}\nfunction getUnit(f, inv, step, phase) {\n const u = step <= 1 ? f : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) : (d, y) => step * Math.floor(f(d, y) / step);\n return inv ? (d, y) => inv(u(d, y), y) : u;\n}\n\n// returns the day of the year based on week number, day of week,\n// and the day of the week for the first day of the year\nfunction weekday(week, day, firstDay) {\n return day + week * 7 - (firstDay + 6) % 7;\n}\n\n// -- LOCAL TIME --\n\nconst localGet = {\n [YEAR]: d => d.getFullYear(),\n [QUARTER]: d => Math.floor(d.getMonth() / 3),\n [MONTH]: d => d.getMonth(),\n [DATE]: d => d.getDate(),\n [HOURS]: d => d.getHours(),\n [MINUTES]: d => d.getMinutes(),\n [SECONDS]: d => d.getSeconds(),\n [MILLISECONDS]: d => d.getMilliseconds(),\n [DAYOFYEAR]: d => localDayOfYear(d),\n [WEEK]: d => localWeekNum(d),\n [WEEK + DAY]: (d, y) => weekday(localWeekNum(d), d.getDay(), localFirst(y)),\n [DAY]: (d, y) => weekday(1, d.getDay(), localFirst(y))\n};\nconst localInv = {\n [QUARTER]: q => 3 * q,\n [WEEK]: (w, y) => weekday(w, 0, localFirst(y))\n};\nfunction timeFloor(units, step) {\n return floor(units, step || 1, localGet, localInv, localDate);\n}\n\n// -- UTC TIME --\n\nconst utcGet = {\n [YEAR]: d => d.getUTCFullYear(),\n [QUARTER]: d => Math.floor(d.getUTCMonth() / 3),\n [MONTH]: d => d.getUTCMonth(),\n [DATE]: d => d.getUTCDate(),\n [HOURS]: d => d.getUTCHours(),\n [MINUTES]: d => d.getUTCMinutes(),\n [SECONDS]: d => d.getUTCSeconds(),\n [MILLISECONDS]: d => d.getUTCMilliseconds(),\n [DAYOFYEAR]: d => utcDayOfYear(d),\n [WEEK]: d => utcWeekNum(d),\n [DAY]: (d, y) => weekday(1, d.getUTCDay(), utcFirst(y)),\n [WEEK + DAY]: (d, y) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y))\n};\nconst utcInv = {\n [QUARTER]: q => 3 * q,\n [WEEK]: (w, y) => weekday(w, 0, utcFirst(y))\n};\nfunction utcFloor(units, step) {\n return floor(units, step || 1, utcGet, utcInv, utcDate);\n}\n\nconst timeIntervals = {\n [YEAR]: timeYear,\n [QUARTER]: timeMonth.every(3),\n [MONTH]: timeMonth,\n [WEEK]: timeWeek,\n [DATE]: timeDay,\n [DAY]: timeDay,\n [DAYOFYEAR]: timeDay,\n [HOURS]: timeHour,\n [MINUTES]: timeMinute,\n [SECONDS]: timeSecond,\n [MILLISECONDS]: timeMillisecond\n};\nconst utcIntervals = {\n [YEAR]: utcYear,\n [QUARTER]: utcMonth.every(3),\n [MONTH]: utcMonth,\n [WEEK]: utcWeek,\n [DATE]: utcDay,\n [DAY]: utcDay,\n [DAYOFYEAR]: utcDay,\n [HOURS]: utcHour,\n [MINUTES]: utcMinute,\n [SECONDS]: utcSecond,\n [MILLISECONDS]: utcMillisecond\n};\nfunction timeInterval(unit) {\n return timeIntervals[unit];\n}\nfunction utcInterval(unit) {\n return utcIntervals[unit];\n}\nfunction offset(ival, date, step) {\n return ival ? ival.offset(date, step) : undefined;\n}\nfunction timeOffset(unit, date, step) {\n return offset(timeInterval(unit), date, step);\n}\nfunction utcOffset(unit, date, step) {\n return offset(utcInterval(unit), date, step);\n}\nfunction sequence(ival, start, stop, step) {\n return ival ? ival.range(start, stop, step) : undefined;\n}\nfunction timeSequence(unit, start, stop, step) {\n return sequence(timeInterval(unit), start, stop, step);\n}\nfunction utcSequence(unit, start, stop, step) {\n return sequence(utcInterval(unit), start, stop, step);\n}\n\nconst durationSecond = 1000,\n durationMinute = durationSecond * 60,\n durationHour = durationMinute * 60,\n durationDay = durationHour * 24,\n durationWeek = durationDay * 7,\n durationMonth = durationDay * 30,\n durationYear = durationDay * 365;\nconst Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS],\n Seconds = Milli.slice(0, -1),\n Minutes = Seconds.slice(0, -1),\n Hours = Minutes.slice(0, -1),\n Day = Hours.slice(0, -1),\n Week = [YEAR, WEEK],\n Month = [YEAR, MONTH],\n Year = [YEAR];\nconst intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]];\nfunction bin (opt) {\n const ext = opt.extent,\n max = opt.maxbins || 40,\n target = Math.abs(span(ext)) / max;\n let i = bisector(i => i[2]).right(intervals, target),\n units,\n step;\n if (i === intervals.length) {\n units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max);\n } else if (i) {\n i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i];\n units = i[0];\n step = i[1];\n } else {\n units = Milli;\n step = Math.max(tickStep(ext[0], ext[1], max), 1);\n }\n return {\n units,\n step\n };\n}\n\nexport { DATE, DAY, DAYOFYEAR, HOURS, MILLISECONDS, MINUTES, MONTH, QUARTER, SECONDS, TIME_UNITS, WEEK, YEAR, dayofyear, bin as timeBin, timeFloor, timeInterval, timeOffset, timeSequence, timeUnitSpecifier, timeUnits, utcFloor, utcInterval, utcOffset, utcSequence, utcdayofyear, utcweek, week };\n","import {\n timeDay,\n timeSunday,\n timeMonday,\n timeThursday,\n timeYear,\n utcDay,\n utcSunday,\n utcMonday,\n utcThursday,\n utcYear\n} from \"d3-time\";\n\nfunction localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n}\n\nfunction utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n}\n\nfunction newDate(y, m, d) {\n return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};\n}\n\nexport default function formatLocale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodRe = formatRe(locale_periods),\n periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"f\": formatMicroseconds,\n \"g\": formatYearISO,\n \"G\": formatFullYearISO,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"q\": formatQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatSeconds,\n \"u\": formatWeekdayNumberMonday,\n \"U\": formatWeekNumberSunday,\n \"V\": formatWeekNumberISO,\n \"w\": formatWeekdayNumberSunday,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"f\": formatUTCMicroseconds,\n \"g\": formatUTCYearISO,\n \"G\": formatUTCFullYearISO,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"q\": formatUTCQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatUTCSeconds,\n \"u\": formatUTCWeekdayNumberMonday,\n \"U\": formatUTCWeekNumberSunday,\n \"V\": formatUTCWeekNumberISO,\n \"w\": formatUTCWeekdayNumberSunday,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"f\": parseMicroseconds,\n \"g\": parseYear,\n \"G\": parseFullYear,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"q\": parseQuarter,\n \"Q\": parseUnixTimestamp,\n \"s\": parseUnixTimestampSeconds,\n \"S\": parseSeconds,\n \"u\": parseWeekdayNumberMonday,\n \"U\": parseWeekNumberSunday,\n \"V\": parseWeekNumberISO,\n \"w\": parseWeekdayNumberSunday,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n if (!(date instanceof Date)) date = new Date(+date);\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad = c === \"e\" ? \" \" : \"0\";\n if (format = formats[c]) c = format(date, pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, Z) {\n return function(string) {\n var d = newDate(1900, undefined, 1),\n i = parseSpecifier(d, specifier, string += \"\", 0),\n week, day;\n if (i != string.length) return null;\n\n // If a UNIX timestamp is specified, return it.\n if (\"Q\" in d) return new Date(d.Q);\n if (\"s\" in d) return new Date(d.s * 1000 + (\"L\" in d ? d.L : 0));\n\n // If this is utcParse, never use the local timezone.\n if (Z && !(\"Z\" in d)) d.Z = 0;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If the month was not specified, inherit from the quarter.\n if (d.m === undefined) d.m = \"q\" in d ? d.q : 0;\n\n // Convert day-of-week and week-of-year to day-of-year.\n if (\"V\" in d) {\n if (d.V < 1 || d.V > 53) return null;\n if (!(\"w\" in d)) d.w = 1;\n if (\"Z\" in d) {\n week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();\n week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);\n week = utcDay.offset(week, (d.V - 1) * 7);\n d.y = week.getUTCFullYear();\n d.m = week.getUTCMonth();\n d.d = week.getUTCDate() + (d.w + 6) % 7;\n } else {\n week = localDate(newDate(d.y, 0, 1)), day = week.getDay();\n week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);\n week = timeDay.offset(week, (d.V - 1) * 7);\n d.y = week.getFullYear();\n d.m = week.getMonth();\n d.d = week.getDate() + (d.w + 6) % 7;\n }\n } else if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"u\" in d ? d.u % 7 : \"W\" in d ? 1 : 0;\n day = \"Z\" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;\n }\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n return localDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatQuarter(d) {\n return 1 + ~~(d.getMonth() / 3);\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n function formatUTCQuarter(d) {\n return 1 + ~~(d.getUTCMonth() / 3);\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() { return specifier; };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", false);\n p.toString = function() { return specifier; };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() { return specifier; };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier += \"\", true);\n p.toString = function() { return specifier; };\n return p;\n }\n };\n}\n\nvar pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"},\n numberRe = /^\\s*\\d+/, // note: ignores next directive\n percentRe = /^%/,\n requoteRe = /[\\\\^$*+?|[\\]().{}]/g;\n\nfunction pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n}\n\nfunction requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n}\n\nfunction formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n}\n\nfunction formatLookup(names) {\n return new Map(names.map((name, i) => [name.toLowerCase(), i]));\n}\n\nfunction parseWeekdayNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekdayNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.u = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberISO(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.V = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n}\n\nfunction parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n}\n\nfunction parseQuarter(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;\n}\n\nfunction parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n}\n\nfunction parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMicroseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 6));\n return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;\n}\n\nfunction parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n}\n\nfunction parseUnixTimestamp(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.Q = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseUnixTimestampSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.s = +n[0], i + n[0].length) : -1;\n}\n\nfunction formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n}\n\nfunction formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n}\n\nfunction formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n}\n\nfunction formatDayOfYear(d, p) {\n return pad(1 + timeDay.count(timeYear(d), d), p, 3);\n}\n\nfunction formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n}\n\nfunction formatMicroseconds(d, p) {\n return formatMilliseconds(d, p) + \"000\";\n}\n\nfunction formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n}\n\nfunction formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n}\n\nfunction formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n}\n\nfunction formatWeekdayNumberMonday(d) {\n var day = d.getDay();\n return day === 0 ? 7 : day;\n}\n\nfunction formatWeekNumberSunday(d, p) {\n return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction dISO(d) {\n var day = d.getDay();\n return (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n}\n\nfunction formatWeekNumberISO(d, p) {\n d = dISO(d);\n return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);\n}\n\nfunction formatWeekdayNumberSunday(d) {\n return d.getDay();\n}\n\nfunction formatWeekNumberMonday(d, p) {\n return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatYearISO(d, p) {\n d = dISO(d);\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatFullYearISO(d, p) {\n var day = d.getDay();\n d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n}\n\nfunction formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n}\n\nfunction formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n}\n\nfunction formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n}\n\nfunction formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n}\n\nfunction formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n}\n\nfunction formatUTCMicroseconds(d, p) {\n return formatUTCMilliseconds(d, p) + \"000\";\n}\n\nfunction formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n}\n\nfunction formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n}\n\nfunction formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n}\n\nfunction formatUTCWeekdayNumberMonday(d) {\n var dow = d.getUTCDay();\n return dow === 0 ? 7 : dow;\n}\n\nfunction formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction UTCdISO(d) {\n var day = d.getUTCDay();\n return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n}\n\nfunction formatUTCWeekNumberISO(d, p) {\n d = UTCdISO(d);\n return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);\n}\n\nfunction formatUTCWeekdayNumberSunday(d) {\n return d.getUTCDay();\n}\n\nfunction formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCYearISO(d, p) {\n d = UTCdISO(d);\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCFullYearISO(d, p) {\n var day = d.getUTCDay();\n d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCZone() {\n return \"+0000\";\n}\n\nfunction formatLiteralPercent() {\n return \"%\";\n}\n\nfunction formatUnixTimestamp(d) {\n return +d;\n}\n\nfunction formatUnixTimestampSeconds(d) {\n return Math.floor(+d / 1000);\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var timeFormat;\nexport var timeParse;\nexport var utcFormat;\nexport var utcParse;\n\ndefaultLocale({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n timeFormat = locale.format;\n timeParse = locale.parse;\n utcFormat = locale.utcFormat;\n utcParse = locale.utcParse;\n return locale;\n}\n","import { tickStep } from 'd3-array';\nimport { formatSpecifier, precisionFixed, precisionRound, precisionPrefix, format, formatPrefix, formatLocale } from 'd3-format';\nimport { SECONDS, MINUTES, HOURS, DATE, WEEK, MONTH, QUARTER, YEAR, MILLISECONDS, DAY, timeInterval, utcInterval } from 'vega-time';\nimport { isString, isObject, error, extend } from 'vega-util';\nimport { timeFormat, timeParse, utcFormat, utcParse, timeFormatLocale as timeFormatLocale$1 } from 'd3-time-format';\n\nfunction memoize (method) {\n const cache = {};\n return spec => cache[spec] || (cache[spec] = method(spec));\n}\n\nfunction trimZeroes(numberFormat, decimalChar) {\n return x => {\n const str = numberFormat(x),\n dec = str.indexOf(decimalChar);\n if (dec < 0) return str;\n let idx = rightmostDigit(str, dec);\n const end = idx < str.length ? str.slice(idx) : '';\n while (--idx > dec) if (str[idx] !== '0') {\n ++idx;\n break;\n }\n return str.slice(0, idx) + end;\n };\n}\nfunction rightmostDigit(str, dec) {\n let i = str.lastIndexOf('e'),\n c;\n if (i > 0) return i;\n for (i = str.length; --i > dec;) {\n c = str.charCodeAt(i);\n if (c >= 48 && c <= 57) return i + 1; // is digit\n }\n}\n\nfunction numberLocale(locale) {\n const format = memoize(locale.format),\n formatPrefix = locale.formatPrefix;\n return {\n format,\n formatPrefix,\n formatFloat(spec) {\n const s = formatSpecifier(spec || ',');\n if (s.precision == null) {\n s.precision = 12;\n switch (s.type) {\n case '%':\n s.precision -= 2;\n break;\n case 'e':\n s.precision -= 1;\n break;\n }\n return trimZeroes(format(s),\n // number format\n format('.1f')(1)[1] // decimal point character\n );\n } else {\n return format(s);\n }\n },\n formatSpan(start, stop, count, specifier) {\n specifier = formatSpecifier(specifier == null ? ',f' : specifier);\n const step = tickStep(start, stop, count),\n value = Math.max(Math.abs(start), Math.abs(stop));\n let precision;\n if (specifier.precision == null) {\n switch (specifier.type) {\n case 's':\n {\n if (!isNaN(precision = precisionPrefix(step, value))) {\n specifier.precision = precision;\n }\n return formatPrefix(specifier, value);\n }\n case '':\n case 'e':\n case 'g':\n case 'p':\n case 'r':\n {\n if (!isNaN(precision = precisionRound(step, value))) {\n specifier.precision = precision - (specifier.type === 'e');\n }\n break;\n }\n case 'f':\n case '%':\n {\n if (!isNaN(precision = precisionFixed(step))) {\n specifier.precision = precision - (specifier.type === '%') * 2;\n }\n break;\n }\n }\n }\n return format(specifier);\n }\n };\n}\nlet defaultNumberLocale;\nresetNumberFormatDefaultLocale();\nfunction resetNumberFormatDefaultLocale() {\n return defaultNumberLocale = numberLocale({\n format: format,\n formatPrefix: formatPrefix\n });\n}\nfunction numberFormatLocale(definition) {\n return numberLocale(formatLocale(definition));\n}\nfunction numberFormatDefaultLocale(definition) {\n return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale;\n}\n\nfunction timeMultiFormat(format, interval, spec) {\n spec = spec || {};\n if (!isObject(spec)) {\n error(`Invalid time multi-format specifier: ${spec}`);\n }\n const second = interval(SECONDS),\n minute = interval(MINUTES),\n hour = interval(HOURS),\n day = interval(DATE),\n week = interval(WEEK),\n month = interval(MONTH),\n quarter = interval(QUARTER),\n year = interval(YEAR),\n L = format(spec[MILLISECONDS] || '.%L'),\n S = format(spec[SECONDS] || ':%S'),\n M = format(spec[MINUTES] || '%I:%M'),\n H = format(spec[HOURS] || '%I %p'),\n d = format(spec[DATE] || spec[DAY] || '%a %d'),\n w = format(spec[WEEK] || '%b %d'),\n m = format(spec[MONTH] || '%B'),\n q = format(spec[QUARTER] || '%B'),\n y = format(spec[YEAR] || '%Y');\n return date => (second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date);\n}\nfunction timeLocale(locale) {\n const timeFormat = memoize(locale.format),\n utcFormat = memoize(locale.utcFormat);\n return {\n timeFormat: spec => isString(spec) ? timeFormat(spec) : timeMultiFormat(timeFormat, timeInterval, spec),\n utcFormat: spec => isString(spec) ? utcFormat(spec) : timeMultiFormat(utcFormat, utcInterval, spec),\n timeParse: memoize(locale.parse),\n utcParse: memoize(locale.utcParse)\n };\n}\nlet defaultTimeLocale;\nresetTimeFormatDefaultLocale();\nfunction resetTimeFormatDefaultLocale() {\n return defaultTimeLocale = timeLocale({\n format: timeFormat,\n parse: timeParse,\n utcFormat: utcFormat,\n utcParse: utcParse\n });\n}\nfunction timeFormatLocale(definition) {\n return timeLocale(timeFormatLocale$1(definition));\n}\nfunction timeFormatDefaultLocale(definition) {\n return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale;\n}\n\nconst createLocale = (number, time) => extend({}, number, time);\nfunction locale(numberSpec, timeSpec) {\n const number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale();\n const time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale();\n return createLocale(number, time);\n}\nfunction defaultLocale(numberSpec, timeSpec) {\n const args = arguments.length;\n if (args && args !== 2) {\n error('defaultLocale expects either zero or two arguments.');\n }\n return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale());\n}\nfunction resetDefaultLocale() {\n resetNumberFormatDefaultLocale();\n resetTimeFormatDefaultLocale();\n return defaultLocale();\n}\n\nexport { defaultLocale, locale, numberFormatDefaultLocale, numberFormatLocale, resetDefaultLocale, resetNumberFormatDefaultLocale, resetTimeFormatDefaultLocale, timeFormatDefaultLocale, timeFormatLocale };\n","import { extend, error, stringValue, isFunction, toBoolean, toNumber, toDate, toString, identity, field, isObject, isArray, isIterable, hasOwnProperty } from 'vega-util';\nimport { dsvFormat } from 'd3-dsv';\nimport { feature, mesh } from 'topojson-client';\nimport { timeFormatDefaultLocale } from 'vega-format';\n\n// Matches absolute URLs with optional protocol\n// https://... file://... //...\nconst protocol_re = /^(data:|([A-Za-z]+:)?\\/\\/)/;\n\n// Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file://\nconst allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i; // eslint-disable-line no-useless-escape\nconst whitespace_re = /[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205f\\u3000]/g; // eslint-disable-line no-control-regex\n\n// Special treatment in node.js for the file: protocol\nconst fileProtocol = 'file://';\n\n/**\n * Factory for a loader constructor that provides methods for requesting\n * files from either the network or disk, and for sanitizing request URIs.\n * @param {function} fetch - The Fetch API for HTTP network requests.\n * If null or undefined, HTTP loading will be disabled.\n * @param {object} fs - The file system interface for file loading.\n * If null or undefined, local file loading will be disabled.\n * @return {function} A loader constructor with the following signature:\n * param {object} [options] - Optional default loading options to use.\n * return {object} - A new loader instance.\n */\nfunction loaderFactory (fetch, fs) {\n return options => ({\n options: options || {},\n sanitize: sanitize,\n load: load,\n fileAccess: !!fs,\n file: fileLoader(fs),\n http: httpLoader(fetch)\n });\n}\n\n/**\n * Load an external resource, typically either from the web or from the local\n * filesystem. This function uses {@link sanitize} to first sanitize the uri,\n * then calls either {@link http} (for web requests) or {@link file} (for\n * filesystem loading).\n * @param {string} uri - The resource indicator (e.g., URL or filename).\n * @param {object} [options] - Optional loading options. These options will\n * override any existing default options.\n * @return {Promise} - A promise that resolves to the loaded content.\n */\nasync function load(uri, options) {\n const opt = await this.sanitize(uri, options),\n url = opt.href;\n return opt.localFile ? this.file(url) : this.http(url, options);\n}\n\n/**\n * URI sanitizer function.\n * @param {string} uri - The uri (url or filename) to check.\n * @param {object} options - An options hash.\n * @return {Promise} - A promise that resolves to an object containing\n * sanitized uri data, or rejects it the input uri is deemed invalid.\n * The properties of the resolved object are assumed to be\n * valid attributes for an HTML 'a' tag. The sanitized uri *must* be\n * provided by the 'href' property of the returned object.\n */\nasync function sanitize(uri, options) {\n options = extend({}, this.options, options);\n const fileAccess = this.fileAccess,\n result = {\n href: null\n };\n let isFile, loadFile, base;\n const isAllowed = allowed_re.test(uri.replace(whitespace_re, ''));\n if (uri == null || typeof uri !== 'string' || !isAllowed) {\n error('Sanitize failure, invalid URI: ' + stringValue(uri));\n }\n const hasProtocol = protocol_re.test(uri);\n\n // if relative url (no protocol/host), prepend baseURL\n if ((base = options.baseURL) && !hasProtocol) {\n // Ensure that there is a slash between the baseURL (e.g. hostname) and url\n if (!uri.startsWith('/') && !base.endsWith('/')) {\n uri = '/' + uri;\n }\n uri = base + uri;\n }\n\n // should we load from file system?\n loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess;\n if (isFile) {\n // strip file protocol\n uri = uri.slice(fileProtocol.length);\n } else if (uri.startsWith('//')) {\n if (options.defaultProtocol === 'file') {\n // if is file, strip protocol and set loadFile flag\n uri = uri.slice(2);\n loadFile = true;\n } else {\n // if relative protocol (starts with '//'), prepend default protocol\n uri = (options.defaultProtocol || 'http') + ':' + uri;\n }\n }\n\n // set non-enumerable mode flag to indicate local file load\n Object.defineProperty(result, 'localFile', {\n value: !!loadFile\n });\n\n // set uri\n result.href = uri;\n\n // set default result target, if specified\n if (options.target) {\n result.target = options.target + '';\n }\n\n // set default result rel, if specified (#1542)\n if (options.rel) {\n result.rel = options.rel + '';\n }\n\n // provide control over cross-origin image handling (#2238)\n // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image\n if (options.context === 'image' && options.crossOrigin) {\n result.crossOrigin = options.crossOrigin + '';\n }\n\n // return\n return result;\n}\n\n/**\n * File system loader factory.\n * @param {object} fs - The file system interface.\n * @return {function} - A file loader with the following signature:\n * param {string} filename - The file system path to load.\n * param {string} filename - The file system path to load.\n * return {Promise} A promise that resolves to the file contents.\n */\nfunction fileLoader(fs) {\n return fs ? filename => new Promise((accept, reject) => {\n fs.readFile(filename, (error, data) => {\n if (error) reject(error);else accept(data);\n });\n }) : fileReject;\n}\n\n/**\n * Default file system loader that simply rejects.\n */\nasync function fileReject() {\n error('No file system access.');\n}\n\n/**\n * HTTP request handler factory.\n * @param {function} fetch - The Fetch API method.\n * @return {function} - An http loader with the following signature:\n * param {string} url - The url to request.\n * param {object} options - An options hash.\n * return {Promise} - A promise that resolves to the file contents.\n */\nfunction httpLoader(fetch) {\n return fetch ? async function (url, options) {\n const opt = extend({}, this.options.http, options),\n type = options && options.response,\n response = await fetch(url, opt);\n return !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text();\n } : httpReject;\n}\n\n/**\n * Default http request handler that simply rejects.\n */\nasync function httpReject() {\n error('No HTTP fetch method available.');\n}\n\nconst isValid = _ => _ != null && _ === _;\nconst isBoolean = _ => _ === 'true' || _ === 'false' || _ === true || _ === false;\nconst isDate = _ => !Number.isNaN(Date.parse(_));\nconst isNumber = _ => !Number.isNaN(+_) && !(_ instanceof Date);\nconst isInteger = _ => isNumber(_) && Number.isInteger(+_);\nconst typeParsers = {\n boolean: toBoolean,\n integer: toNumber,\n number: toNumber,\n date: toDate,\n string: toString,\n unknown: identity\n};\nconst typeTests = [isBoolean, isInteger, isNumber, isDate];\nconst typeList = ['boolean', 'integer', 'number', 'date'];\nfunction inferType(values, field) {\n if (!values || !values.length) return 'unknown';\n const n = values.length,\n m = typeTests.length,\n a = typeTests.map((_, i) => i + 1);\n for (let i = 0, t = 0, j, value; i < n; ++i) {\n value = field ? values[i][field] : values[i];\n for (j = 0; j < m; ++j) {\n if (a[j] && isValid(value) && !typeTests[j](value)) {\n a[j] = 0;\n ++t;\n if (t === typeTests.length) return 'string';\n }\n }\n }\n return typeList[a.reduce((u, v) => u === 0 ? v : u, 0) - 1];\n}\nfunction inferTypes(data, fields) {\n return fields.reduce((types, field) => {\n types[field] = inferType(data, field);\n return types;\n }, {});\n}\n\nfunction delimitedFormat(delimiter) {\n const parse = function (data, format) {\n const delim = {\n delimiter: delimiter\n };\n return dsv(data, format ? extend(format, delim) : delim);\n };\n parse.responseType = 'text';\n return parse;\n}\nfunction dsv(data, format) {\n if (format.header) {\n data = format.header.map(stringValue).join(format.delimiter) + '\\n' + data;\n }\n return dsvFormat(format.delimiter).parse(data + '');\n}\ndsv.responseType = 'text';\n\nfunction isBuffer(_) {\n return typeof Buffer === 'function' && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false;\n}\nfunction json(data, format) {\n const prop = format && format.property ? field(format.property) : identity;\n return isObject(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data));\n}\njson.responseType = 'json';\nfunction parseJSON(data, format) {\n if (!isArray(data) && isIterable(data)) {\n data = [...data];\n }\n return format && format.copy ? JSON.parse(JSON.stringify(data)) : data;\n}\n\nconst filters = {\n interior: (a, b) => a !== b,\n exterior: (a, b) => a === b\n};\nfunction topojson(data, format) {\n let method, object, property, filter;\n data = json(data, format);\n if (format && format.feature) {\n method = feature;\n property = format.feature;\n } else if (format && format.mesh) {\n method = mesh;\n property = format.mesh;\n filter = filters[format.filter];\n } else {\n error('Missing TopoJSON feature or mesh parameter.');\n }\n object = (object = data.objects[property]) ? method(data, object, filter) : error('Invalid TopoJSON object: ' + property);\n return object && object.features || [object];\n}\ntopojson.responseType = 'json';\n\nconst format = {\n dsv: dsv,\n csv: delimitedFormat(','),\n tsv: delimitedFormat('\\t'),\n json: json,\n topojson: topojson\n};\nfunction formats(name, reader) {\n if (arguments.length > 1) {\n format[name] = reader;\n return this;\n } else {\n return hasOwnProperty(format, name) ? format[name] : null;\n }\n}\nfunction responseType(type) {\n const f = formats(type);\n return f && f.responseType || 'text';\n}\n\nfunction read (data, schema, timeParser, utcParser) {\n schema = schema || {};\n const reader = formats(schema.type || 'json');\n if (!reader) error('Unknown data format type: ' + schema.type);\n data = reader(data, schema);\n if (schema.parse) parse(data, schema.parse, timeParser, utcParser);\n if (hasOwnProperty(data, 'columns')) delete data.columns;\n return data;\n}\nfunction parse(data, types, timeParser, utcParser) {\n if (!data.length) return; // early exit for empty data\n\n const locale = timeFormatDefaultLocale();\n timeParser = timeParser || locale.timeParse;\n utcParser = utcParser || locale.utcParse;\n let fields = data.columns || Object.keys(data[0]),\n datum,\n field,\n i,\n j,\n n,\n m;\n if (types === 'auto') types = inferTypes(data, fields);\n fields = Object.keys(types);\n const parsers = fields.map(field => {\n const type = types[field];\n let parts, pattern;\n if (type && (type.startsWith('date:') || type.startsWith('utc:'))) {\n parts = type.split(/:(.+)?/, 2); // split on first :\n pattern = parts[1];\n if (pattern[0] === '\\'' && pattern[pattern.length - 1] === '\\'' || pattern[0] === '\"' && pattern[pattern.length - 1] === '\"') {\n pattern = pattern.slice(1, -1);\n }\n const parse = parts[0] === 'utc' ? utcParser : timeParser;\n return parse(pattern);\n }\n if (!typeParsers[type]) {\n throw Error('Illegal format pattern: ' + field + ':' + type);\n }\n return typeParsers[type];\n });\n for (i = 0, n = data.length, m = fields.length; i < n; ++i) {\n datum = data[i];\n for (j = 0; j < m; ++j) {\n field = fields[j];\n datum[field] = parsers[j](datum[field]);\n }\n }\n}\n\nconst loader = loaderFactory(typeof fetch !== 'undefined' && fetch,\n// use built-in fetch API\nnull // no file system access\n);\n\nexport { format, formats, inferType, inferTypes, loader, read, responseType, typeParsers };\n","import { identity, array, isFunction, constant, isArray, id, error, truthy, debounce, extend, visitArray, inherits, logger, Error, hasOwnProperty } from 'vega-util';\nimport { read, responseType, loader } from 'vega-loader';\nimport { defaultLocale } from 'vega-format';\n\nfunction UniqueList(idFunc) {\n const $ = idFunc || identity,\n list = [],\n ids = {};\n list.add = _ => {\n const id = $(_);\n if (!ids[id]) {\n ids[id] = 1;\n list.push(_);\n }\n return list;\n };\n list.remove = _ => {\n const id = $(_);\n if (ids[id]) {\n ids[id] = 0;\n const idx = list.indexOf(_);\n if (idx >= 0) list.splice(idx, 1);\n }\n return list;\n };\n return list;\n}\n\n/**\n * Invoke and await a potentially async callback function. If\n * an error occurs, trap it and route to Dataflow.error.\n * @param {Dataflow} df - The dataflow instance\n * @param {function} callback - A callback function to invoke\n * and then await. The dataflow will be passed as the single\n * argument to the function.\n */\nasync function asyncCallback (df, callback) {\n try {\n await callback(df);\n } catch (err) {\n df.error(err);\n }\n}\n\nconst TUPLE_ID_KEY = Symbol('vega_id');\nlet TUPLE_ID = 1;\n\n/**\n * Checks if an input value is a registered tuple.\n * @param {*} t - The value to check.\n * @return {boolean} True if the input is a tuple, false otherwise.\n */\nfunction isTuple(t) {\n return !!(t && tupleid(t));\n}\n\n/**\n * Returns the id of a tuple.\n * @param {object} t - The input tuple.\n * @return {*} the tuple id.\n */\nfunction tupleid(t) {\n return t[TUPLE_ID_KEY];\n}\n\n/**\n * Sets the id of a tuple.\n * @param {object} t - The input tuple.\n * @param {*} id - The id value to set.\n * @return {object} the input tuple.\n */\nfunction setid(t, id) {\n t[TUPLE_ID_KEY] = id;\n return t;\n}\n\n/**\n * Ingest an object or value as a data tuple.\n * If the input value is an object, an id field will be added to it. For\n * efficiency, the input object is modified directly. A copy is not made.\n * If the input value is a literal, it will be wrapped in a new object\n * instance, with the value accessible as the 'data' property.\n * @param datum - The value to ingest.\n * @return {object} The ingested data tuple.\n */\nfunction ingest$1(datum) {\n const t = datum === Object(datum) ? datum : {\n data: datum\n };\n return tupleid(t) ? t : setid(t, TUPLE_ID++);\n}\n\n/**\n * Given a source tuple, return a derived copy.\n * @param {object} t - The source tuple.\n * @return {object} The derived tuple.\n */\nfunction derive(t) {\n return rederive(t, ingest$1({}));\n}\n\n/**\n * Rederive a derived tuple by copying values from the source tuple.\n * @param {object} t - The source tuple.\n * @param {object} d - The derived tuple.\n * @return {object} The derived tuple.\n */\nfunction rederive(t, d) {\n for (const k in t) d[k] = t[k];\n return d;\n}\n\n/**\n * Replace an existing tuple with a new tuple.\n * @param {object} t - The existing data tuple.\n * @param {object} d - The new tuple that replaces the old.\n * @return {object} The new tuple.\n */\nfunction replace(t, d) {\n return setid(d, tupleid(t));\n}\n\n/**\n * Generate an augmented comparator function that provides stable\n * sorting by tuple id when the given comparator produces ties.\n * @param {function} cmp - The comparator to augment.\n * @param {function} [f] - Optional tuple accessor function.\n * @return {function} An augmented comparator function.\n */\nfunction stableCompare(cmp, f) {\n return !cmp ? null : f ? (a, b) => cmp(a, b) || tupleid(f(a)) - tupleid(f(b)) : (a, b) => cmp(a, b) || tupleid(a) - tupleid(b);\n}\n\nfunction isChangeSet(v) {\n return v && v.constructor === changeset;\n}\nfunction changeset() {\n const add = [],\n // insert tuples\n rem = [],\n // remove tuples\n mod = [],\n // modify tuples\n remp = [],\n // remove by predicate\n modp = []; // modify by predicate\n let clean = null,\n reflow = false;\n return {\n constructor: changeset,\n insert(t) {\n const d = array(t),\n n = d.length;\n for (let i = 0; i < n; ++i) add.push(d[i]);\n return this;\n },\n remove(t) {\n const a = isFunction(t) ? remp : rem,\n d = array(t),\n n = d.length;\n for (let i = 0; i < n; ++i) a.push(d[i]);\n return this;\n },\n modify(t, field, value) {\n const m = {\n field: field,\n value: constant(value)\n };\n if (isFunction(t)) {\n m.filter = t;\n modp.push(m);\n } else {\n m.tuple = t;\n mod.push(m);\n }\n return this;\n },\n encode(t, set) {\n if (isFunction(t)) modp.push({\n filter: t,\n field: set\n });else mod.push({\n tuple: t,\n field: set\n });\n return this;\n },\n clean(value) {\n clean = value;\n return this;\n },\n reflow() {\n reflow = true;\n return this;\n },\n pulse(pulse, tuples) {\n const cur = {},\n out = {};\n let i, n, m, f, t, id;\n\n // build lookup table of current tuples\n for (i = 0, n = tuples.length; i < n; ++i) {\n cur[tupleid(tuples[i])] = 1;\n }\n\n // process individual tuples to remove\n for (i = 0, n = rem.length; i < n; ++i) {\n t = rem[i];\n cur[tupleid(t)] = -1;\n }\n\n // process predicate-based removals\n for (i = 0, n = remp.length; i < n; ++i) {\n f = remp[i];\n tuples.forEach(t => {\n if (f(t)) cur[tupleid(t)] = -1;\n });\n }\n\n // process all add tuples\n for (i = 0, n = add.length; i < n; ++i) {\n t = add[i];\n id = tupleid(t);\n if (cur[id]) {\n // tuple already resides in dataset\n // if flagged for both add and remove, cancel\n cur[id] = 1;\n } else {\n // tuple does not reside in dataset, add\n pulse.add.push(ingest$1(add[i]));\n }\n }\n\n // populate pulse rem list\n for (i = 0, n = tuples.length; i < n; ++i) {\n t = tuples[i];\n if (cur[tupleid(t)] < 0) pulse.rem.push(t);\n }\n\n // modify helper method\n function modify(t, f, v) {\n if (v) {\n t[f] = v(t);\n } else {\n pulse.encode = f;\n }\n if (!reflow) out[tupleid(t)] = t;\n }\n\n // process individual tuples to modify\n for (i = 0, n = mod.length; i < n; ++i) {\n m = mod[i];\n t = m.tuple;\n f = m.field;\n id = cur[tupleid(t)];\n if (id > 0) {\n modify(t, f, m.value);\n pulse.modifies(f);\n }\n }\n\n // process predicate-based modifications\n for (i = 0, n = modp.length; i < n; ++i) {\n m = modp[i];\n f = m.filter;\n tuples.forEach(t => {\n if (f(t) && cur[tupleid(t)] > 0) {\n modify(t, m.field, m.value);\n }\n });\n pulse.modifies(m.field);\n }\n\n // upon reflow request, populate mod with all non-removed tuples\n // otherwise, populate mod with modified tuples only\n if (reflow) {\n pulse.mod = rem.length || remp.length ? tuples.filter(t => cur[tupleid(t)] > 0) : tuples.slice();\n } else {\n for (id in out) pulse.mod.push(out[id]);\n }\n\n // set pulse garbage collection request\n if (clean || clean == null && (rem.length || remp.length)) {\n pulse.clean(true);\n }\n return pulse;\n }\n };\n}\n\nconst CACHE = '_:mod:_';\n\n/**\n * Hash that tracks modifications to assigned values.\n * Callers *must* use the set method to update values.\n */\nfunction Parameters() {\n Object.defineProperty(this, CACHE, {\n writable: true,\n value: {}\n });\n}\nParameters.prototype = {\n /**\n * Set a parameter value. If the parameter value changes, the parameter\n * will be recorded as modified.\n * @param {string} name - The parameter name.\n * @param {number} index - The index into an array-value parameter. Ignored if\n * the argument is undefined, null or less than zero.\n * @param {*} value - The parameter value to set.\n * @param {boolean} [force=false] - If true, records the parameter as modified\n * even if the value is unchanged.\n * @return {Parameters} - This parameter object.\n */\n set(name, index, value, force) {\n const o = this,\n v = o[name],\n mod = o[CACHE];\n if (index != null && index >= 0) {\n if (v[index] !== value || force) {\n v[index] = value;\n mod[index + ':' + name] = -1;\n mod[name] = -1;\n }\n } else if (v !== value || force) {\n o[name] = value;\n mod[name] = isArray(value) ? 1 + value.length : -1;\n }\n return o;\n },\n /**\n * Tests if one or more parameters has been modified. If invoked with no\n * arguments, returns true if any parameter value has changed. If the first\n * argument is array, returns trues if any parameter name in the array has\n * changed. Otherwise, tests if the given name and optional array index has\n * changed.\n * @param {string} name - The parameter name to test.\n * @param {number} [index=undefined] - The parameter array index to test.\n * @return {boolean} - Returns true if a queried parameter was modified.\n */\n modified(name, index) {\n const mod = this[CACHE];\n if (!arguments.length) {\n for (const k in mod) {\n if (mod[k]) return true;\n }\n return false;\n } else if (isArray(name)) {\n for (let k = 0; k < name.length; ++k) {\n if (mod[name[k]]) return true;\n }\n return false;\n }\n return index != null && index >= 0 ? index + 1 < mod[name] || !!mod[index + ':' + name] : !!mod[name];\n },\n /**\n * Clears the modification records. After calling this method,\n * all parameters are considered unmodified.\n */\n clear() {\n this[CACHE] = {};\n return this;\n }\n};\n\nlet OP_ID = 0;\nconst PULSE = 'pulse',\n NO_PARAMS = new Parameters();\n\n// Boolean Flags\nconst SKIP$1 = 1,\n MODIFIED = 2;\n\n/**\n * An Operator is a processing node in a dataflow graph.\n * Each operator stores a value and an optional value update function.\n * Operators can accept a hash of named parameters. Parameter values can\n * either be direct (JavaScript literals, arrays, objects) or indirect\n * (other operators whose values will be pulled dynamically). Operators\n * included as parameters will have this operator added as a dependency.\n * @constructor\n * @param {*} [init] - The initial value for this operator.\n * @param {function(object, Pulse)} [update] - An update function. Upon\n * evaluation of this operator, the update function will be invoked and the\n * return value will be used as the new value of this operator.\n * @param {object} [params] - The parameters for this operator.\n * @param {boolean} [react=true] - Flag indicating if this operator should\n * listen for changes to upstream operators included as parameters.\n * @see parameters\n */\nfunction Operator(init, update, params, react) {\n this.id = ++OP_ID;\n this.value = init;\n this.stamp = -1;\n this.rank = -1;\n this.qrank = -1;\n this.flags = 0;\n if (update) {\n this._update = update;\n }\n if (params) this.parameters(params, react);\n}\nfunction flag(bit) {\n return function (state) {\n const f = this.flags;\n if (arguments.length === 0) return !!(f & bit);\n this.flags = state ? f | bit : f & ~bit;\n return this;\n };\n}\nOperator.prototype = {\n /**\n * Returns a list of target operators dependent on this operator.\n * If this list does not exist, it is created and then returned.\n * @return {UniqueList}\n */\n targets() {\n return this._targets || (this._targets = UniqueList(id));\n },\n /**\n * Sets the value of this operator.\n * @param {*} value - the value to set.\n * @return {Number} Returns 1 if the operator value has changed\n * according to strict equality, returns 0 otherwise.\n */\n set(value) {\n if (this.value !== value) {\n this.value = value;\n return 1;\n } else {\n return 0;\n }\n },\n /**\n * Indicates that operator evaluation should be skipped on the next pulse.\n * This operator will still propagate incoming pulses, but its update function\n * will not be invoked. The skip flag is reset after every pulse, so calling\n * this method will affect processing of the next pulse only.\n */\n skip: flag(SKIP$1),\n /**\n * Indicates that this operator's value has been modified on its most recent\n * pulse. Normally modification is checked via strict equality; however, in\n * some cases it is more efficient to update the internal state of an object.\n * In those cases, the modified flag can be used to trigger propagation. Once\n * set, the modification flag persists across pulses until unset. The flag can\n * be used with the last timestamp to test if a modification is recent.\n */\n modified: flag(MODIFIED),\n /**\n * Sets the parameters for this operator. The parameter values are analyzed for\n * operator instances. If found, this operator will be added as a dependency\n * of the parameterizing operator. Operator values are dynamically marshalled\n * from each operator parameter prior to evaluation. If a parameter value is\n * an array, the array will also be searched for Operator instances. However,\n * the search does not recurse into sub-arrays or object properties.\n * @param {object} params - A hash of operator parameters.\n * @param {boolean} [react=true] - A flag indicating if this operator should\n * automatically update (react) when parameter values change. In other words,\n * this flag determines if the operator registers itself as a listener on\n * any upstream operators included in the parameters.\n * @param {boolean} [initonly=false] - A flag indicating if this operator\n * should calculate an update only upon its initial evaluation, then\n * deregister dependencies and suppress all future update invocations.\n * @return {Operator[]} - An array of upstream dependencies.\n */\n parameters(params, react, initonly) {\n react = react !== false;\n const argval = this._argval = this._argval || new Parameters(),\n argops = this._argops = this._argops || [],\n deps = [];\n let name, value, n, i;\n const add = (name, index, value) => {\n if (value instanceof Operator) {\n if (value !== this) {\n if (react) value.targets().add(this);\n deps.push(value);\n }\n argops.push({\n op: value,\n name: name,\n index: index\n });\n } else {\n argval.set(name, index, value);\n }\n };\n for (name in params) {\n value = params[name];\n if (name === PULSE) {\n array(value).forEach(op => {\n if (!(op instanceof Operator)) {\n error('Pulse parameters must be operator instances.');\n } else if (op !== this) {\n op.targets().add(this);\n deps.push(op);\n }\n });\n this.source = value;\n } else if (isArray(value)) {\n argval.set(name, -1, Array(n = value.length));\n for (i = 0; i < n; ++i) add(name, i, value[i]);\n } else {\n add(name, -1, value);\n }\n }\n this.marshall().clear(); // initialize values\n if (initonly) argops.initonly = true;\n return deps;\n },\n /**\n * Internal method for marshalling parameter values.\n * Visits each operator dependency to pull the latest value.\n * @return {Parameters} A Parameters object to pass to the update function.\n */\n marshall(stamp) {\n const argval = this._argval || NO_PARAMS,\n argops = this._argops;\n let item, i, op, mod;\n if (argops) {\n const n = argops.length;\n for (i = 0; i < n; ++i) {\n item = argops[i];\n op = item.op;\n mod = op.modified() && op.stamp === stamp;\n argval.set(item.name, item.index, op.value, mod);\n }\n if (argops.initonly) {\n for (i = 0; i < n; ++i) {\n item = argops[i];\n item.op.targets().remove(this);\n }\n this._argops = null;\n this._update = null;\n }\n }\n return argval;\n },\n /**\n * Detach this operator from the dataflow.\n * Unregisters listeners on upstream dependencies.\n */\n detach() {\n const argops = this._argops;\n let i, n, item, op;\n if (argops) {\n for (i = 0, n = argops.length; i < n; ++i) {\n item = argops[i];\n op = item.op;\n if (op._targets) {\n op._targets.remove(this);\n }\n }\n }\n\n // remove references to the source and pulse object,\n // if present, to prevent memory leaks of old data.\n this.pulse = null;\n this.source = null;\n },\n /**\n * Delegate method to perform operator processing.\n * Subclasses can override this method to perform custom processing.\n * By default, it marshalls parameters and calls the update function\n * if that function is defined. If the update function does not\n * change the operator value then StopPropagation is returned.\n * If no update function is defined, this method does nothing.\n * @param {Pulse} pulse - the current dataflow pulse.\n * @return The output pulse or StopPropagation. A falsy return value\n * (including undefined) will let the input pulse pass through.\n */\n evaluate(pulse) {\n const update = this._update;\n if (update) {\n const params = this.marshall(pulse.stamp),\n v = update.call(this, params, pulse);\n params.clear();\n if (v !== this.value) {\n this.value = v;\n } else if (!this.modified()) {\n return pulse.StopPropagation;\n }\n }\n },\n /**\n * Run this operator for the current pulse. If this operator has already\n * been run at (or after) the pulse timestamp, returns StopPropagation.\n * Internally, this method calls {@link evaluate} to perform processing.\n * If {@link evaluate} returns a falsy value, the input pulse is returned.\n * This method should NOT be overridden, instead overrride {@link evaluate}.\n * @param {Pulse} pulse - the current dataflow pulse.\n * @return the output pulse for this operator (or StopPropagation)\n */\n run(pulse) {\n if (pulse.stamp < this.stamp) return pulse.StopPropagation;\n let rv;\n if (this.skip()) {\n this.skip(false);\n rv = 0;\n } else {\n rv = this.evaluate(pulse);\n }\n return this.pulse = rv || pulse;\n }\n};\n\n/**\n * Add an operator to the dataflow graph. This function accepts a\n * variety of input argument types. The basic signature supports an\n * initial value, update function and parameters. If the first parameter\n * is an Operator instance, it will be added directly. If it is a\n * constructor for an Operator subclass, a new instance will be instantiated.\n * Otherwise, if the first parameter is a function instance, it will be used\n * as the update function and a null initial value is assumed.\n * @param {*} init - One of: the operator to add, the initial value of\n * the operator, an operator class to instantiate, or an update function.\n * @param {function} [update] - The operator update function.\n * @param {object} [params] - The operator parameters.\n * @param {boolean} [react=true] - Flag indicating if this operator should\n * listen for changes to upstream operators included as parameters.\n * @return {Operator} - The added operator.\n */\nfunction add (init, update, params, react) {\n let shift = 1,\n op;\n if (init instanceof Operator) {\n op = init;\n } else if (init && init.prototype instanceof Operator) {\n op = new init();\n } else if (isFunction(init)) {\n op = new Operator(null, init);\n } else {\n shift = 0;\n op = new Operator(init, update);\n }\n this.rank(op);\n if (shift) {\n react = params;\n params = update;\n }\n if (params) this.connect(op, op.parameters(params, react));\n this.touch(op);\n return op;\n}\n\n/**\n * Connect a target operator as a dependent of source operators.\n * If necessary, this method will rerank the target operator and its\n * dependents to ensure propagation proceeds in a topologically sorted order.\n * @param {Operator} target - The target operator.\n * @param {Array} - The source operators that should propagate\n * to the target operator.\n */\nfunction connect (target, sources) {\n const targetRank = target.rank,\n n = sources.length;\n for (let i = 0; i < n; ++i) {\n if (targetRank < sources[i].rank) {\n this.rerank(target);\n return;\n }\n }\n}\n\nlet STREAM_ID = 0;\n\n/**\n * Models an event stream.\n * @constructor\n * @param {function(Object, number): boolean} [filter] - Filter predicate.\n * Events pass through when truthy, events are suppressed when falsy.\n * @param {function(Object): *} [apply] - Applied to input events to produce\n * new event values.\n * @param {function(Object)} [receive] - Event callback function to invoke\n * upon receipt of a new event. Use to override standard event processing.\n */\nfunction EventStream(filter, apply, receive) {\n this.id = ++STREAM_ID;\n this.value = null;\n if (receive) this.receive = receive;\n if (filter) this._filter = filter;\n if (apply) this._apply = apply;\n}\n\n/**\n * Creates a new event stream instance with the provided\n * (optional) filter, apply and receive functions.\n * @param {function(Object, number): boolean} [filter] - Filter predicate.\n * Events pass through when truthy, events are suppressed when falsy.\n * @param {function(Object): *} [apply] - Applied to input events to produce\n * new event values.\n * @see EventStream\n */\nfunction stream(filter, apply, receive) {\n return new EventStream(filter, apply, receive);\n}\nEventStream.prototype = {\n _filter: truthy,\n _apply: identity,\n targets() {\n return this._targets || (this._targets = UniqueList(id));\n },\n consume(_) {\n if (!arguments.length) return !!this._consume;\n this._consume = !!_;\n return this;\n },\n receive(evt) {\n if (this._filter(evt)) {\n const val = this.value = this._apply(evt),\n trg = this._targets,\n n = trg ? trg.length : 0;\n for (let i = 0; i < n; ++i) trg[i].receive(val);\n if (this._consume) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n }\n },\n filter(filter) {\n const s = stream(filter);\n this.targets().add(s);\n return s;\n },\n apply(apply) {\n const s = stream(null, apply);\n this.targets().add(s);\n return s;\n },\n merge() {\n const s = stream();\n this.targets().add(s);\n for (let i = 0, n = arguments.length; i < n; ++i) {\n arguments[i].targets().add(s);\n }\n return s;\n },\n throttle(pause) {\n let t = -1;\n return this.filter(() => {\n const now = Date.now();\n if (now - t > pause) {\n t = now;\n return 1;\n } else {\n return 0;\n }\n });\n },\n debounce(delay) {\n const s = stream();\n this.targets().add(stream(null, null, debounce(delay, e => {\n const df = e.dataflow;\n s.receive(e);\n if (df && df.run) df.run();\n })));\n return s;\n },\n between(a, b) {\n let active = false;\n a.targets().add(stream(null, null, () => active = true));\n b.targets().add(stream(null, null, () => active = false));\n return this.filter(() => active);\n },\n detach() {\n // ensures compatibility with operators (#2753)\n // remove references to other streams and filter functions that may\n // be bound to subcontexts that need to be garbage collected.\n this._filter = truthy;\n this._targets = null;\n }\n};\n\n/**\n * Create a new event stream from an event source.\n * @param {object} source - The event source to monitor. The input must\n * support the addEventListener method.\n * @param {string} type - The event type.\n * @param {function(object): boolean} [filter] - Event filter function.\n * @param {function(object): *} [apply] - Event application function.\n * If provided, this function will be invoked and the result will be\n * used as the downstream event value.\n * @return {EventStream}\n */\nfunction events (source, type, filter, apply) {\n const df = this,\n s = stream(filter, apply),\n send = function (e) {\n e.dataflow = df;\n try {\n s.receive(e);\n } catch (error) {\n df.error(error);\n } finally {\n df.run();\n }\n };\n let sources;\n if (typeof source === 'string' && typeof document !== 'undefined') {\n sources = document.querySelectorAll(source);\n } else {\n sources = array(source);\n }\n const n = sources.length;\n for (let i = 0; i < n; ++i) {\n sources[i].addEventListener(type, send);\n }\n return s;\n}\n\nfunction parse(data, format) {\n const locale = this.locale();\n return read(data, format, locale.timeParse, locale.utcParse);\n}\n\n/**\n * Ingests new data into the dataflow. First parses the data using the\n * vega-loader read method, then pulses a changeset to the target operator.\n * @param {Operator} target - The Operator to target with ingested data,\n * typically a Collect transform instance.\n * @param {*} data - The input data, prior to parsing. For JSON this may\n * be a string or an object. For CSV, TSV, etc should be a string.\n * @param {object} format - The data format description for parsing\n * loaded data. This object is passed to the vega-loader read method.\n * @returns {Dataflow}\n */\nfunction ingest(target, data, format) {\n data = this.parse(data, format);\n return this.pulse(target, this.changeset().insert(data));\n}\n\n/**\n * Request data from an external source, parse it, and return a Promise.\n * @param {string} url - The URL from which to load the data. This string\n * is passed to the vega-loader load method.\n * @param {object} [format] - The data format description for parsing\n * loaded data. This object is passed to the vega-loader read method.\n * @return {Promise} A Promise that resolves upon completion of the request.\n * The resolved object contains the following properties:\n * - data: an array of parsed data (or null upon error)\n * - status: a code for success (0), load fail (-1), or parse fail (-2)\n */\nasync function request(url, format) {\n const df = this;\n let status = 0,\n data;\n try {\n data = await df.loader().load(url, {\n context: 'dataflow',\n response: responseType(format && format.type)\n });\n try {\n data = df.parse(data, format);\n } catch (err) {\n status = -2;\n df.warn('Data ingestion failed', url, err);\n }\n } catch (err) {\n status = -1;\n df.warn('Loading failed', url, err);\n }\n return {\n data,\n status\n };\n}\nasync function preload(target, url, format) {\n const df = this,\n pending = df._pending || loadPending(df);\n pending.requests += 1;\n const res = await df.request(url, format);\n df.pulse(target, df.changeset().remove(truthy).insert(res.data || []));\n pending.done();\n return res;\n}\nfunction loadPending(df) {\n let accept;\n const pending = new Promise(a => accept = a);\n pending.requests = 0;\n pending.done = () => {\n if (--pending.requests === 0) {\n df._pending = null;\n accept(df);\n }\n };\n return df._pending = pending;\n}\n\nconst SKIP = {\n skip: true\n};\n\n/**\n * Perform operator updates in response to events. Applies an\n * update function to compute a new operator value. If the update function\n * returns a {@link ChangeSet}, the operator will be pulsed with those tuple\n * changes. Otherwise, the operator value will be updated to the return value.\n * @param {EventStream|Operator} source - The event source to react to.\n * This argument can be either an EventStream or an Operator.\n * @param {Operator|function(object):Operator} target - The operator to update.\n * This argument can either be an Operator instance or (if the source\n * argument is an EventStream), a function that accepts an event object as\n * input and returns an Operator to target.\n * @param {function(Parameters,Event): *} [update] - Optional update function\n * to compute the new operator value, or a literal value to set. Update\n * functions expect to receive a parameter object and event as arguments.\n * This function can either return a new operator value or (if the source\n * argument is an EventStream) a {@link ChangeSet} instance to pulse\n * the target operator with tuple changes.\n * @param {object} [params] - The update function parameters.\n * @param {object} [options] - Additional options hash. If not overridden,\n * updated operators will be skipped by default.\n * @param {boolean} [options.skip] - If true, the operator will\n * be skipped: it will not be evaluated, but its dependents will be.\n * @param {boolean} [options.force] - If true, the operator will\n * be re-evaluated even if its value has not changed.\n * @return {Dataflow}\n */\nfunction on (source, target, update, params, options) {\n const fn = source instanceof Operator ? onOperator : onStream;\n fn(this, source, target, update, params, options);\n return this;\n}\nfunction onStream(df, stream, target, update, params, options) {\n const opt = extend({}, options, SKIP);\n let func, op;\n if (!isFunction(target)) target = constant(target);\n if (update === undefined) {\n func = e => df.touch(target(e));\n } else if (isFunction(update)) {\n op = new Operator(null, update, params, false);\n func = e => {\n op.evaluate(e);\n const t = target(e),\n v = op.value;\n isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt);\n };\n } else {\n func = e => df.update(target(e), update, opt);\n }\n stream.apply(func);\n}\nfunction onOperator(df, source, target, update, params, options) {\n if (update === undefined) {\n source.targets().add(target);\n } else {\n const opt = options || {},\n op = new Operator(null, updater(target, update), params, false);\n op.modified(opt.force);\n op.rank = source.rank; // immediately follow source\n source.targets().add(op); // add dependency\n\n if (target) {\n op.skip(true); // skip first invocation\n op.value = target.value; // initialize value\n op.targets().add(target); // chain dependencies\n df.connect(target, [op]); // rerank as needed, #1672\n }\n }\n}\n\nfunction updater(target, update) {\n update = isFunction(update) ? update : constant(update);\n return target ? function (_, pulse) {\n const value = update(_, pulse);\n if (!target.skip()) {\n target.skip(value !== this.value).value = value;\n }\n return value;\n } : update;\n}\n\n/**\n * Assigns a rank to an operator. Ranks are assigned in increasing order\n * by incrementing an internal rank counter.\n * @param {Operator} op - The operator to assign a rank.\n */\nfunction rank(op) {\n op.rank = ++this._rank;\n}\n\n/**\n * Re-ranks an operator and all downstream target dependencies. This\n * is necessary when upstream dependencies of higher rank are added to\n * a target operator.\n * @param {Operator} op - The operator to re-rank.\n */\nfunction rerank(op) {\n const queue = [op];\n let cur, list, i;\n while (queue.length) {\n this.rank(cur = queue.pop());\n if (list = cur._targets) {\n for (i = list.length; --i >= 0;) {\n queue.push(cur = list[i]);\n if (cur === op) error('Cycle detected in dataflow graph.');\n }\n }\n }\n}\n\n/**\n * Sentinel value indicating pulse propagation should stop.\n */\nconst StopPropagation = {};\n\n// Pulse visit type flags\nconst ADD = 1 << 0,\n REM = 1 << 1,\n MOD = 1 << 2,\n ADD_REM = ADD | REM,\n ADD_MOD = ADD | MOD,\n ALL = ADD | REM | MOD,\n REFLOW = 1 << 3,\n SOURCE = 1 << 4,\n NO_SOURCE = 1 << 5,\n NO_FIELDS = 1 << 6;\n\n/**\n * A Pulse enables inter-operator communication during a run of the\n * dataflow graph. In addition to the current timestamp, a pulse may also\n * contain a change-set of added, removed or modified data tuples, as well as\n * a pointer to a full backing data source. Tuple change sets may not\n * be fully materialized; for example, to prevent needless array creation\n * a change set may include larger arrays and corresponding filter functions.\n * The pulse provides a {@link visit} method to enable proper and efficient\n * iteration over requested data tuples.\n *\n * In addition, each pulse can track modification flags for data tuple fields.\n * Responsible transform operators should call the {@link modifies} method to\n * indicate changes to data fields. The {@link modified} method enables\n * querying of this modification state.\n *\n * @constructor\n * @param {Dataflow} dataflow - The backing dataflow instance.\n * @param {number} stamp - The current propagation timestamp.\n * @param {string} [encode] - An optional encoding set name, which is then\n * accessible as Pulse.encode. Operators can respond to (or ignore) this\n * setting as appropriate. This parameter can be used in conjunction with\n * the Encode transform in the vega-encode module.\n */\nfunction Pulse(dataflow, stamp, encode) {\n this.dataflow = dataflow;\n this.stamp = stamp == null ? -1 : stamp;\n this.add = [];\n this.rem = [];\n this.mod = [];\n this.fields = null;\n this.encode = encode || null;\n}\nfunction materialize(data, filter) {\n const out = [];\n visitArray(data, filter, _ => out.push(_));\n return out;\n}\nfunction filter(pulse, flags) {\n const map = {};\n pulse.visit(flags, t => {\n map[tupleid(t)] = 1;\n });\n return t => map[tupleid(t)] ? null : t;\n}\nfunction addFilter(a, b) {\n return a ? (t, i) => a(t, i) && b(t, i) : b;\n}\nPulse.prototype = {\n /**\n * Sentinel value indicating pulse propagation should stop.\n */\n StopPropagation,\n /**\n * Boolean flag indicating ADD (added) tuples.\n */\n ADD,\n /**\n * Boolean flag indicating REM (removed) tuples.\n */\n REM,\n /**\n * Boolean flag indicating MOD (modified) tuples.\n */\n MOD,\n /**\n * Boolean flag indicating ADD (added) and REM (removed) tuples.\n */\n ADD_REM,\n /**\n * Boolean flag indicating ADD (added) and MOD (modified) tuples.\n */\n ADD_MOD,\n /**\n * Boolean flag indicating ADD, REM and MOD tuples.\n */\n ALL,\n /**\n * Boolean flag indicating all tuples in a data source\n * except for the ADD, REM and MOD tuples.\n */\n REFLOW,\n /**\n * Boolean flag indicating a 'pass-through' to a\n * backing data source, ignoring ADD, REM and MOD tuples.\n */\n SOURCE,\n /**\n * Boolean flag indicating that source data should be\n * suppressed when creating a forked pulse.\n */\n NO_SOURCE,\n /**\n * Boolean flag indicating that field modifications should be\n * suppressed when creating a forked pulse.\n */\n NO_FIELDS,\n /**\n * Creates a new pulse based on the values of this pulse.\n * The dataflow, time stamp and field modification values are copied over.\n * By default, new empty ADD, REM and MOD arrays are created.\n * @param {number} flags - Integer of boolean flags indicating which (if any)\n * tuple arrays should be copied to the new pulse. The supported flag values\n * are ADD, REM and MOD. Array references are copied directly: new array\n * instances are not created.\n * @return {Pulse} - The forked pulse instance.\n * @see init\n */\n fork(flags) {\n return new Pulse(this.dataflow).init(this, flags);\n },\n /**\n * Creates a copy of this pulse with new materialized array\n * instances for the ADD, REM, MOD, and SOURCE arrays.\n * The dataflow, time stamp and field modification values are copied over.\n * @return {Pulse} - The cloned pulse instance.\n * @see init\n */\n clone() {\n const p = this.fork(ALL);\n p.add = p.add.slice();\n p.rem = p.rem.slice();\n p.mod = p.mod.slice();\n if (p.source) p.source = p.source.slice();\n return p.materialize(ALL | SOURCE);\n },\n /**\n * Returns a pulse that adds all tuples from a backing source. This is\n * useful for cases where operators are added to a dataflow after an\n * upstream data pipeline has already been processed, ensuring that\n * new operators can observe all tuples within a stream.\n * @return {Pulse} - A pulse instance with all source tuples included\n * in the add array. If the current pulse already has all source\n * tuples in its add array, it is returned directly. If the current\n * pulse does not have a backing source, it is returned directly.\n */\n addAll() {\n let p = this;\n const reuse = !p.source || p.add === p.rem // special case for indexed set (e.g., crossfilter)\n || !p.rem.length && p.source.length === p.add.length;\n if (reuse) {\n return p;\n } else {\n p = new Pulse(this.dataflow).init(this);\n p.add = p.source;\n p.rem = []; // new operators can ignore rem #2769\n return p;\n }\n },\n /**\n * Initialize this pulse based on the values of another pulse. This method\n * is used internally by {@link fork} to initialize a new forked tuple.\n * The dataflow, time stamp and field modification values are copied over.\n * By default, new empty ADD, REM and MOD arrays are created.\n * @param {Pulse} src - The source pulse to copy from.\n * @param {number} flags - Integer of boolean flags indicating which (if any)\n * tuple arrays should be copied to the new pulse. The supported flag values\n * are ADD, REM and MOD. Array references are copied directly: new array\n * instances are not created. By default, source data arrays are copied\n * to the new pulse. Use the NO_SOURCE flag to enforce a null source.\n * @return {Pulse} - Returns this Pulse instance.\n */\n init(src, flags) {\n const p = this;\n p.stamp = src.stamp;\n p.encode = src.encode;\n if (src.fields && !(flags & NO_FIELDS)) {\n p.fields = src.fields;\n }\n if (flags & ADD) {\n p.addF = src.addF;\n p.add = src.add;\n } else {\n p.addF = null;\n p.add = [];\n }\n if (flags & REM) {\n p.remF = src.remF;\n p.rem = src.rem;\n } else {\n p.remF = null;\n p.rem = [];\n }\n if (flags & MOD) {\n p.modF = src.modF;\n p.mod = src.mod;\n } else {\n p.modF = null;\n p.mod = [];\n }\n if (flags & NO_SOURCE) {\n p.srcF = null;\n p.source = null;\n } else {\n p.srcF = src.srcF;\n p.source = src.source;\n if (src.cleans) p.cleans = src.cleans;\n }\n return p;\n },\n /**\n * Schedules a function to run after pulse propagation completes.\n * @param {function} func - The function to run.\n */\n runAfter(func) {\n this.dataflow.runAfter(func);\n },\n /**\n * Indicates if tuples have been added, removed or modified.\n * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query.\n * Defaults to ALL, returning true if any tuple type has changed.\n * @return {boolean} - Returns true if one or more queried tuple types have\n * changed, false otherwise.\n */\n changed(flags) {\n const f = flags || ALL;\n return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length;\n },\n /**\n * Forces a \"reflow\" of tuple values, such that all tuples in the backing\n * source are added to the MOD set, unless already present in the ADD set.\n * @param {boolean} [fork=false] - If true, returns a forked copy of this\n * pulse, and invokes reflow on that derived pulse.\n * @return {Pulse} - The reflowed pulse instance.\n */\n reflow(fork) {\n if (fork) return this.fork(ALL).reflow();\n const len = this.add.length,\n src = this.source && this.source.length;\n if (src && src !== len) {\n this.mod = this.source;\n if (len) this.filter(MOD, filter(this, ADD));\n }\n return this;\n },\n /**\n * Get/set metadata to pulse requesting garbage collection\n * to reclaim currently unused resources.\n */\n clean(value) {\n if (arguments.length) {\n this.cleans = !!value;\n return this;\n } else {\n return this.cleans;\n }\n },\n /**\n * Marks one or more data field names as modified to assist dependency\n * tracking and incremental processing by transform operators.\n * @param {string|Array} _ - The field(s) to mark as modified.\n * @return {Pulse} - This pulse instance.\n */\n modifies(_) {\n const hash = this.fields || (this.fields = {});\n if (isArray(_)) {\n _.forEach(f => hash[f] = true);\n } else {\n hash[_] = true;\n }\n return this;\n },\n /**\n * Checks if one or more data fields have been modified during this pulse\n * propagation timestamp.\n * @param {string|Array} _ - The field(s) to check for modified.\n * @param {boolean} nomod - If true, will check the modified flag even if\n * no mod tuples exist. If false (default), mod tuples must be present.\n * @return {boolean} - Returns true if any of the provided fields has been\n * marked as modified, false otherwise.\n */\n modified(_, nomod) {\n const fields = this.fields;\n return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : isArray(_) ? _.some(f => fields[f]) : fields[_];\n },\n /**\n * Adds a filter function to one more tuple sets. Filters are applied to\n * backing tuple arrays, to determine the actual set of tuples considered\n * added, removed or modified. They can be used to delay materialization of\n * a tuple set in order to avoid expensive array copies. In addition, the\n * filter functions can serve as value transformers: unlike standard predicate\n * function (which return boolean values), Pulse filters should return the\n * actual tuple value to process. If a tuple set is already filtered, the\n * new filter function will be appended into a conjuntive ('and') query.\n * @param {number} flags - Flags indicating the tuple set(s) to filter.\n * @param {function(*):object} filter - Filter function that will be applied\n * to the tuple set array, and should return a data tuple if the value\n * should be included in the tuple set, and falsy (or null) otherwise.\n * @return {Pulse} - Returns this pulse instance.\n */\n filter(flags, filter) {\n const p = this;\n if (flags & ADD) p.addF = addFilter(p.addF, filter);\n if (flags & REM) p.remF = addFilter(p.remF, filter);\n if (flags & MOD) p.modF = addFilter(p.modF, filter);\n if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter);\n return p;\n },\n /**\n * Materialize one or more tuple sets in this pulse. If the tuple set(s) have\n * a registered filter function, it will be applied and the tuple set(s) will\n * be replaced with materialized tuple arrays.\n * @param {number} flags - Flags indicating the tuple set(s) to materialize.\n * @return {Pulse} - Returns this pulse instance.\n */\n materialize(flags) {\n flags = flags || ALL;\n const p = this;\n if (flags & ADD && p.addF) {\n p.add = materialize(p.add, p.addF);\n p.addF = null;\n }\n if (flags & REM && p.remF) {\n p.rem = materialize(p.rem, p.remF);\n p.remF = null;\n }\n if (flags & MOD && p.modF) {\n p.mod = materialize(p.mod, p.modF);\n p.modF = null;\n }\n if (flags & SOURCE && p.srcF) {\n p.source = p.source.filter(p.srcF);\n p.srcF = null;\n }\n return p;\n },\n /**\n * Visit one or more tuple sets in this pulse.\n * @param {number} flags - Flags indicating the tuple set(s) to visit.\n * Legal values are ADD, REM, MOD and SOURCE (if a backing data source\n * has been set).\n * @param {function(object):*} - Visitor function invoked per-tuple.\n * @return {Pulse} - Returns this pulse instance.\n */\n visit(flags, visitor) {\n const p = this,\n v = visitor;\n if (flags & SOURCE) {\n visitArray(p.source, p.srcF, v);\n return p;\n }\n if (flags & ADD) visitArray(p.add, p.addF, v);\n if (flags & REM) visitArray(p.rem, p.remF, v);\n if (flags & MOD) visitArray(p.mod, p.modF, v);\n const src = p.source;\n if (flags & REFLOW && src) {\n const sum = p.add.length + p.mod.length;\n if (sum === src.length) ; else if (sum) {\n visitArray(src, filter(p, ADD_MOD), v);\n } else {\n // if no add/rem/mod tuples, visit source\n visitArray(src, p.srcF, v);\n }\n }\n return p;\n }\n};\n\n/**\n * Represents a set of multiple pulses. Used as input for operators\n * that accept multiple pulses at a time. Contained pulses are\n * accessible via the public \"pulses\" array property. This pulse doe\n * not carry added, removed or modified tuples directly. However,\n * the visit method can be used to traverse all such tuples contained\n * in sub-pulses with a timestamp matching this parent multi-pulse.\n * @constructor\n * @param {Dataflow} dataflow - The backing dataflow instance.\n * @param {number} stamp - The timestamp.\n * @param {Array} pulses - The sub-pulses for this multi-pulse.\n */\nfunction MultiPulse(dataflow, stamp, pulses, encode) {\n const p = this;\n let c = 0;\n this.dataflow = dataflow;\n this.stamp = stamp;\n this.fields = null;\n this.encode = encode || null;\n this.pulses = pulses;\n for (const pulse of pulses) {\n if (pulse.stamp !== stamp) continue;\n if (pulse.fields) {\n const hash = p.fields || (p.fields = {});\n for (const f in pulse.fields) {\n hash[f] = 1;\n }\n }\n if (pulse.changed(p.ADD)) c |= p.ADD;\n if (pulse.changed(p.REM)) c |= p.REM;\n if (pulse.changed(p.MOD)) c |= p.MOD;\n }\n this.changes = c;\n}\ninherits(MultiPulse, Pulse, {\n /**\n * Creates a new pulse based on the values of this pulse.\n * The dataflow, time stamp and field modification values are copied over.\n * @return {Pulse}\n */\n fork(flags) {\n const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS);\n if (flags !== undefined) {\n if (flags & p.ADD) this.visit(p.ADD, t => p.add.push(t));\n if (flags & p.REM) this.visit(p.REM, t => p.rem.push(t));\n if (flags & p.MOD) this.visit(p.MOD, t => p.mod.push(t));\n }\n return p;\n },\n changed(flags) {\n return this.changes & flags;\n },\n modified(_) {\n const p = this,\n fields = p.fields;\n return !(fields && p.changes & p.MOD) ? 0 : isArray(_) ? _.some(f => fields[f]) : fields[_];\n },\n filter() {\n error('MultiPulse does not support filtering.');\n },\n materialize() {\n error('MultiPulse does not support materialization.');\n },\n visit(flags, visitor) {\n const p = this,\n pulses = p.pulses,\n n = pulses.length;\n let i = 0;\n if (flags & p.SOURCE) {\n for (; i < n; ++i) {\n pulses[i].visit(flags, visitor);\n }\n } else {\n for (; i < n; ++i) {\n if (pulses[i].stamp === p.stamp) {\n pulses[i].visit(flags, visitor);\n }\n }\n }\n return p;\n }\n});\n\n/* eslint-disable require-atomic-updates */\n\n/**\n * Evaluates the dataflow and returns a Promise that resolves when pulse\n * propagation completes. This method will increment the current timestamp\n * and process all updated, pulsed and touched operators. When invoked for\n * the first time, all registered operators will be processed. This method\n * should not be invoked by third-party clients, use {@link runAsync} or\n * {@link run} instead.\n * @param {string} [encode] - The name of an encoding set to invoke during\n * propagation. This value is added to generated Pulse instances;\n * operators can then respond to (or ignore) this setting as appropriate.\n * This parameter can be used in conjunction with the Encode transform in\n * the vega-encode package.\n * @param {function} [prerun] - An optional callback function to invoke\n * immediately before dataflow evaluation commences.\n * @param {function} [postrun] - An optional callback function to invoke\n * after dataflow evaluation completes. The callback will be invoked\n * after those registered via {@link runAfter}.\n * @return {Promise} - A promise that resolves to this dataflow after\n * evaluation completes.\n */\nasync function evaluate(encode, prerun, postrun) {\n const df = this,\n async = [];\n\n // if the pulse value is set, this is a re-entrant call\n if (df._pulse) return reentrant(df);\n\n // wait for pending datasets to load\n if (df._pending) await df._pending;\n\n // invoke prerun function, if provided\n if (prerun) await asyncCallback(df, prerun);\n\n // exit early if there are no updates\n if (!df._touched.length) {\n df.debug('Dataflow invoked, but nothing to do.');\n return df;\n }\n\n // increment timestamp clock\n const stamp = ++df._clock;\n\n // set the current pulse\n df._pulse = new Pulse(df, stamp, encode);\n\n // initialize priority queue, reset touched operators\n df._touched.forEach(op => df._enqueue(op, true));\n df._touched = UniqueList(id);\n let count = 0,\n op,\n next,\n error;\n try {\n while (df._heap.size() > 0) {\n // dequeue operator with highest priority\n op = df._heap.pop();\n\n // re-queue if rank changed\n if (op.rank !== op.qrank) {\n df._enqueue(op, true);\n continue;\n }\n\n // otherwise, evaluate the operator\n next = op.run(df._getPulse(op, encode));\n if (next.then) {\n // await if operator returns a promise directly\n next = await next;\n } else if (next.async) {\n // queue parallel asynchronous execution\n async.push(next.async);\n next = StopPropagation;\n }\n\n // propagate evaluation, enqueue dependent operators\n if (next !== StopPropagation) {\n if (op._targets) op._targets.forEach(op => df._enqueue(op));\n }\n\n // increment visit counter\n ++count;\n }\n } catch (err) {\n df._heap.clear();\n error = err;\n }\n\n // reset pulse map\n df._input = {};\n df._pulse = null;\n df.debug(`Pulse ${stamp}: ${count} operators`);\n if (error) {\n df._postrun = [];\n df.error(error);\n }\n\n // invoke callbacks queued via runAfter\n if (df._postrun.length) {\n const pr = df._postrun.sort((a, b) => b.priority - a.priority);\n df._postrun = [];\n for (let i = 0; i < pr.length; ++i) {\n await asyncCallback(df, pr[i].callback);\n }\n }\n\n // invoke postrun function, if provided\n if (postrun) await asyncCallback(df, postrun);\n\n // handle non-blocking asynchronous callbacks\n if (async.length) {\n Promise.all(async).then(cb => df.runAsync(null, () => {\n cb.forEach(f => {\n try {\n f(df);\n } catch (err) {\n df.error(err);\n }\n });\n }));\n }\n return df;\n}\n\n/**\n * Queues dataflow evaluation to run once any other queued evaluations have\n * completed and returns a Promise that resolves when the queued pulse\n * propagation completes. If provided, a callback function will be invoked\n * immediately before evaluation commences. This method will ensure a\n * separate evaluation is invoked for each time it is called.\n * @param {string} [encode] - The name of an encoding set to invoke during\n * propagation. This value is added to generated Pulse instances;\n * operators can then respond to (or ignore) this setting as appropriate.\n * This parameter can be used in conjunction with the Encode transform in\n * the vega-encode package.\n * @param {function} [prerun] - An optional callback function to invoke\n * immediately before dataflow evaluation commences.\n * @param {function} [postrun] - An optional callback function to invoke\n * after dataflow evaluation completes. The callback will be invoked\n * after those registered via {@link runAfter}.\n * @return {Promise} - A promise that resolves to this dataflow after\n * evaluation completes.\n */\nasync function runAsync(encode, prerun, postrun) {\n // await previously queued functions\n while (this._running) await this._running;\n\n // run dataflow, manage running promise\n const clear = () => this._running = null;\n (this._running = this.evaluate(encode, prerun, postrun)).then(clear, clear);\n return this._running;\n}\n\n/**\n * Requests dataflow evaluation and the immediately returns this dataflow\n * instance. If there are pending data loading or other asynchronous\n * operations, the dataflow will evaluate asynchronously after this method\n * has been invoked. To track when dataflow evaluation completes, use the\n * {@link runAsync} method instead. This method will raise an error if\n * invoked while the dataflow is already in the midst of evaluation.\n * @param {string} [encode] - The name of an encoding set to invoke during\n * propagation. This value is added to generated Pulse instances;\n * operators can then respond to (or ignore) this setting as appropriate.\n * This parameter can be used in conjunction with the Encode transform in\n * the vega-encode module.\n * @param {function} [prerun] - An optional callback function to invoke\n * immediately before dataflow evaluation commences.\n * @param {function} [postrun] - An optional callback function to invoke\n * after dataflow evaluation completes. The callback will be invoked\n * after those registered via {@link runAfter}.\n * @return {Dataflow} - This dataflow instance.\n */\nfunction run(encode, prerun, postrun) {\n return this._pulse ? reentrant(this) : (this.evaluate(encode, prerun, postrun), this);\n}\n\n/**\n * Schedules a callback function to be invoked after the current pulse\n * propagation completes. If no propagation is currently occurring,\n * the function is invoked immediately. Callbacks scheduled via runAfter\n * are invoked immediately upon completion of the current cycle, before\n * any request queued via runAsync. This method is primarily intended for\n * internal use. Third-party callers using runAfter to schedule a callback\n * that invokes {@link run} or {@link runAsync} should not use this method,\n * but instead use {@link runAsync} with prerun or postrun arguments.\n * @param {function(Dataflow)} callback - The callback function to run.\n * The callback will be invoked with this Dataflow instance as its\n * sole argument.\n * @param {boolean} enqueue - A boolean flag indicating that the\n * callback should be queued up to run after the next propagation\n * cycle, suppressing immediate invocation when propagation is not\n * currently occurring.\n * @param {number} [priority] - A priority value used to sort registered\n * callbacks to determine execution order. This argument is intended\n * for internal Vega use only.\n */\nfunction runAfter(callback, enqueue, priority) {\n if (this._pulse || enqueue) {\n // pulse propagation is currently running, queue to run after\n this._postrun.push({\n priority: priority || 0,\n callback: callback\n });\n } else {\n // pulse propagation already complete, invoke immediately\n try {\n callback(this);\n } catch (err) {\n this.error(err);\n }\n }\n}\n\n/**\n * Raise an error for re-entrant dataflow evaluation.\n */\nfunction reentrant(df) {\n df.error('Dataflow already running. Use runAsync() to chain invocations.');\n return df;\n}\n\n/**\n * Enqueue an operator into the priority queue for evaluation. The operator\n * will be enqueued if it has no registered pulse for the current cycle, or if\n * the force argument is true. Upon enqueue, this method also sets the\n * operator's qrank to the current rank value.\n * @param {Operator} op - The operator to enqueue.\n * @param {boolean} [force] - A flag indicating if the operator should be\n * forceably added to the queue, even if it has already been previously\n * enqueued during the current pulse propagation. This is useful when the\n * dataflow graph is dynamically modified and the operator rank changes.\n */\nfunction enqueue(op, force) {\n const q = op.stamp < this._clock;\n if (q) op.stamp = this._clock;\n if (q || force) {\n op.qrank = op.rank;\n this._heap.push(op);\n }\n}\n\n/**\n * Provide a correct pulse for evaluating an operator. If the operator has an\n * explicit source operator, we will try to pull the pulse(s) from it.\n * If there is an array of source operators, we build a multi-pulse.\n * Otherwise, we return a current pulse with correct source data.\n * If the pulse is the pulse map has an explicit target set, we use that.\n * Else if the pulse on the upstream source operator is current, we use that.\n * Else we use the pulse from the pulse map, but copy the source tuple array.\n * @param {Operator} op - The operator for which to get an input pulse.\n * @param {string} [encode] - An (optional) encoding set name with which to\n * annotate the returned pulse. See {@link run} for more information.\n */\nfunction getPulse(op, encode) {\n const s = op.source,\n stamp = this._clock;\n return s && isArray(s) ? new MultiPulse(this, stamp, s.map(_ => _.pulse), encode) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse);\n}\nfunction singlePulse(p, s) {\n if (s && s.stamp === p.stamp) {\n return s;\n }\n p = p.fork();\n if (s && s !== StopPropagation) {\n p.source = s.source;\n }\n return p;\n}\n\nconst NO_OPT = {\n skip: false,\n force: false\n};\n\n/**\n * Touches an operator, scheduling it to be evaluated. If invoked outside of\n * a pulse propagation, the operator will be evaluated the next time this\n * dataflow is run. If invoked in the midst of pulse propagation, the operator\n * will be queued for evaluation if and only if the operator has not yet been\n * evaluated on the current propagation timestamp.\n * @param {Operator} op - The operator to touch.\n * @param {object} [options] - Additional options hash.\n * @param {boolean} [options.skip] - If true, the operator will\n * be skipped: it will not be evaluated, but its dependents will be.\n * @return {Dataflow}\n */\nfunction touch(op, options) {\n const opt = options || NO_OPT;\n if (this._pulse) {\n // if in midst of propagation, add to priority queue\n this._enqueue(op);\n } else {\n // otherwise, queue for next propagation\n this._touched.add(op);\n }\n if (opt.skip) op.skip(true);\n return this;\n}\n\n/**\n * Updates the value of the given operator.\n * @param {Operator} op - The operator to update.\n * @param {*} value - The value to set.\n * @param {object} [options] - Additional options hash.\n * @param {boolean} [options.force] - If true, the operator will\n * be re-evaluated even if its value has not changed.\n * @param {boolean} [options.skip] - If true, the operator will\n * be skipped: it will not be evaluated, but its dependents will be.\n * @return {Dataflow}\n */\nfunction update(op, value, options) {\n const opt = options || NO_OPT;\n if (op.set(value) || opt.force) {\n this.touch(op, opt);\n }\n return this;\n}\n\n/**\n * Pulses an operator with a changeset of tuples. If invoked outside of\n * a pulse propagation, the pulse will be applied the next time this\n * dataflow is run. If invoked in the midst of pulse propagation, the pulse\n * will be added to the set of active pulses and will be applied if and\n * only if the target operator has not yet been evaluated on the current\n * propagation timestamp.\n * @param {Operator} op - The operator to pulse.\n * @param {ChangeSet} value - The tuple changeset to apply.\n * @param {object} [options] - Additional options hash.\n * @param {boolean} [options.skip] - If true, the operator will\n * be skipped: it will not be evaluated, but its dependents will be.\n * @return {Dataflow}\n */\nfunction pulse(op, changeset, options) {\n this.touch(op, options || NO_OPT);\n const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)),\n t = op.pulse && op.pulse.source || [];\n p.target = op;\n this._input[op.id] = changeset.pulse(p, t);\n return this;\n}\n\nfunction Heap(cmp) {\n let nodes = [];\n return {\n clear: () => nodes = [],\n size: () => nodes.length,\n peek: () => nodes[0],\n push: x => {\n nodes.push(x);\n return siftdown(nodes, 0, nodes.length - 1, cmp);\n },\n pop: () => {\n const last = nodes.pop();\n let item;\n if (nodes.length) {\n item = nodes[0];\n nodes[0] = last;\n siftup(nodes, 0, cmp);\n } else {\n item = last;\n }\n return item;\n }\n };\n}\nfunction siftdown(array, start, idx, cmp) {\n let parent, pidx;\n const item = array[idx];\n while (idx > start) {\n pidx = idx - 1 >> 1;\n parent = array[pidx];\n if (cmp(item, parent) < 0) {\n array[idx] = parent;\n idx = pidx;\n continue;\n }\n break;\n }\n return array[idx] = item;\n}\nfunction siftup(array, idx, cmp) {\n const start = idx,\n end = array.length,\n item = array[idx];\n let cidx = (idx << 1) + 1,\n ridx;\n while (cidx < end) {\n ridx = cidx + 1;\n if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) {\n cidx = ridx;\n }\n array[idx] = array[cidx];\n idx = cidx;\n cidx = (idx << 1) + 1;\n }\n array[idx] = item;\n return siftdown(array, start, idx, cmp);\n}\n\n/**\n * A dataflow graph for reactive processing of data streams.\n * @constructor\n */\nfunction Dataflow() {\n this.logger(logger());\n this.logLevel(Error);\n this._clock = 0;\n this._rank = 0;\n this._locale = defaultLocale();\n try {\n this._loader = loader();\n } catch (e) {\n // do nothing if loader module is unavailable\n }\n this._touched = UniqueList(id);\n this._input = {};\n this._pulse = null;\n this._heap = Heap((a, b) => a.qrank - b.qrank);\n this._postrun = [];\n}\nfunction logMethod(method) {\n return function () {\n return this._log[method].apply(this, arguments);\n };\n}\nDataflow.prototype = {\n /**\n * The current timestamp of this dataflow. This value reflects the\n * timestamp of the previous dataflow run. The dataflow is initialized\n * with a stamp value of 0. The initial run of the dataflow will have\n * a timestap of 1, and so on. This value will match the\n * {@link Pulse.stamp} property.\n * @return {number} - The current timestamp value.\n */\n stamp() {\n return this._clock;\n },\n /**\n * Gets or sets the loader instance to use for data file loading. A\n * loader object must provide a \"load\" method for loading files and a\n * \"sanitize\" method for checking URL/filename validity. Both methods\n * should accept a URI and options hash as arguments, and return a Promise\n * that resolves to the loaded file contents (load) or a hash containing\n * sanitized URI data with the sanitized url assigned to the \"href\" property\n * (sanitize).\n * @param {object} _ - The loader instance to use.\n * @return {object|Dataflow} - If no arguments are provided, returns\n * the current loader instance. Otherwise returns this Dataflow instance.\n */\n loader(_) {\n if (arguments.length) {\n this._loader = _;\n return this;\n } else {\n return this._loader;\n }\n },\n /**\n * Gets or sets the locale instance to use for formatting and parsing\n * string values. The locale object should be provided by the\n * vega-format library, and include methods such as format, timeFormat,\n * utcFormat, timeParse, and utcParse.\n * @param {object} _ - The locale instance to use.\n * @return {object|Dataflow} - If no arguments are provided, returns\n * the current locale instance. Otherwise returns this Dataflow instance.\n */\n locale(_) {\n if (arguments.length) {\n this._locale = _;\n return this;\n } else {\n return this._locale;\n }\n },\n /**\n * Get or set the logger instance used to log messages. If no arguments are\n * provided, returns the current logger instance. Otherwise, sets the logger\n * and return this Dataflow instance. Provided loggers must support the full\n * API of logger objects generated by the vega-util logger method. Note that\n * by default the log level of the new logger will be used; use the logLevel\n * method to adjust the log level as needed.\n */\n logger(logger) {\n if (arguments.length) {\n this._log = logger;\n return this;\n } else {\n return this._log;\n }\n },\n /**\n * Logs an error message. By default, logged messages are written to console\n * output. The message will only be logged if the current log level is high\n * enough to permit error messages.\n */\n error: logMethod('error'),\n /**\n * Logs a warning message. By default, logged messages are written to console\n * output. The message will only be logged if the current log level is high\n * enough to permit warning messages.\n */\n warn: logMethod('warn'),\n /**\n * Logs a information message. By default, logged messages are written to\n * console output. The message will only be logged if the current log level is\n * high enough to permit information messages.\n */\n info: logMethod('info'),\n /**\n * Logs a debug message. By default, logged messages are written to console\n * output. The message will only be logged if the current log level is high\n * enough to permit debug messages.\n */\n debug: logMethod('debug'),\n /**\n * Get or set the current log level. If an argument is provided, it\n * will be used as the new log level.\n * @param {number} [level] - Should be one of None, Warn, Info\n * @return {number} - The current log level.\n */\n logLevel: logMethod('level'),\n /**\n * Empty entry threshold for garbage cleaning. Map data structures will\n * perform cleaning once the number of empty entries exceeds this value.\n */\n cleanThreshold: 1e4,\n // OPERATOR REGISTRATION\n add,\n connect,\n rank,\n rerank,\n // OPERATOR UPDATES\n pulse,\n touch,\n update,\n changeset,\n // DATA LOADING\n ingest,\n parse,\n preload,\n request,\n // EVENT HANDLING\n events,\n on,\n // PULSE PROPAGATION\n evaluate,\n run,\n runAsync,\n runAfter,\n _enqueue: enqueue,\n _getPulse: getPulse\n};\n\n/**\n * Abstract class for operators that process data tuples.\n * Subclasses must provide a {@link transform} method for operator processing.\n * @constructor\n * @param {*} [init] - The initial value for this operator.\n * @param {object} [params] - The parameters for this operator.\n * @param {Operator} [source] - The operator from which to receive pulses.\n */\nfunction Transform(init, params) {\n Operator.call(this, init, null, params);\n}\ninherits(Transform, Operator, {\n /**\n * Overrides {@link Operator.evaluate} for transform operators.\n * Internally, this method calls {@link evaluate} to perform processing.\n * If {@link evaluate} returns a falsy value, the input pulse is returned.\n * This method should NOT be overridden, instead overrride {@link evaluate}.\n * @param {Pulse} pulse - the current dataflow pulse.\n * @return the output pulse for this operator (or StopPropagation)\n */\n run(pulse) {\n if (pulse.stamp < this.stamp) return pulse.StopPropagation;\n let rv;\n if (this.skip()) {\n this.skip(false);\n } else {\n rv = this.evaluate(pulse);\n }\n rv = rv || pulse;\n if (rv.then) {\n rv = rv.then(_ => this.pulse = _);\n } else if (rv !== pulse.StopPropagation) {\n this.pulse = rv;\n }\n return rv;\n },\n /**\n * Overrides {@link Operator.evaluate} for transform operators.\n * Marshalls parameter values and then invokes {@link transform}.\n * @param {Pulse} pulse - the current dataflow pulse.\n * @return {Pulse} The output pulse (or StopPropagation). A falsy return\n value (including undefined) will let the input pulse pass through.\n */\n evaluate(pulse) {\n const params = this.marshall(pulse.stamp),\n out = this.transform(params, pulse);\n params.clear();\n return out;\n },\n /**\n * Process incoming pulses.\n * Subclasses should override this method to implement transforms.\n * @param {Parameters} _ - The operator parameter values.\n * @param {Pulse} pulse - The current dataflow pulse.\n * @return {Pulse} The output pulse (or StopPropagation). A falsy return\n * value (including undefined) will let the input pulse pass through.\n */\n transform() {}\n});\n\nconst transforms = {};\nfunction definition(type) {\n const t = transform(type);\n return t && t.Definition || null;\n}\nfunction transform(type) {\n type = type && type.toLowerCase();\n return hasOwnProperty(transforms, type) ? transforms[type] : null;\n}\n\nexport { Dataflow, EventStream, MultiPulse, Operator, Parameters, Pulse, Transform, UniqueList, asyncCallback, changeset, definition, derive, ingest$1 as ingest, isChangeSet, isTuple, rederive, replace, stableCompare, transform, transforms, tupleid };\n","export default function max(values, valueof) {\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n }\n return max;\n}\n","export default function min(values, valueof) {\n let min;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n }\n return min;\n}\n","import ascending from \"./ascending.js\";\nimport permute from \"./permute.js\";\n\nexport default function sort(values, ...F) {\n if (typeof values[Symbol.iterator] !== \"function\") throw new TypeError(\"values is not iterable\");\n values = Array.from(values);\n let [f] = F;\n if ((f && f.length !== 2) || F.length > 1) {\n const index = Uint32Array.from(values, (d, i) => i);\n if (F.length > 1) {\n F = F.map(f => values.map(f));\n index.sort((i, j) => {\n for (const f of F) {\n const c = ascendingDefined(f[i], f[j]);\n if (c) return c;\n }\n });\n } else {\n f = values.map(f);\n index.sort((i, j) => ascendingDefined(f[i], f[j]));\n }\n return permute(values, index);\n }\n return values.sort(compareDefined(f));\n}\n\nexport function compareDefined(compare = ascending) {\n if (compare === ascending) return ascendingDefined;\n if (typeof compare !== \"function\") throw new TypeError(\"compare is not a function\");\n return (a, b) => {\n const x = compare(a, b);\n if (x || x === 0) return x;\n return (compare(b, b) === 0) - (compare(a, a) === 0);\n };\n}\n\nexport function ascendingDefined(a, b) {\n return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);\n}\n","import {ascendingDefined, compareDefined} from \"./sort.js\";\n\n// Based on https://github.com/mourner/quickselect\n// ISC license, Copyright 2018 Vladimir Agafonkin.\nexport default function quickselect(array, k, left = 0, right = Infinity, compare) {\n k = Math.floor(k);\n left = Math.floor(Math.max(0, left));\n right = Math.floor(Math.min(array.length - 1, right));\n\n if (!(left <= k && k <= right)) return array;\n\n compare = compare === undefined ? ascendingDefined : compareDefined(compare);\n\n while (right > left) {\n if (right - left > 600) {\n const n = right - left + 1;\n const m = k - left + 1;\n const z = Math.log(n);\n const s = 0.5 * Math.exp(2 * z / 3);\n const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselect(array, k, newLeft, newRight, compare);\n }\n\n const t = array[k];\n let i = left;\n let j = right;\n\n swap(array, left, k);\n if (compare(array[right], t) > 0) swap(array, left, right);\n\n while (i < j) {\n swap(array, i, j), ++i, --j;\n while (compare(array[i], t) < 0) ++i;\n while (compare(array[j], t) > 0) --j;\n }\n\n if (compare(array[left], t) === 0) swap(array, left, j);\n else ++j, swap(array, j, right);\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n\n return array;\n}\n\nfunction swap(array, i, j) {\n const t = array[i];\n array[i] = array[j];\n array[j] = t;\n}\n","export default function number(x) {\n return x === null ? NaN : +x;\n}\n\nexport function* numbers(values, valueof) {\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n","import max from \"./max.js\";\nimport maxIndex from \"./maxIndex.js\";\nimport min from \"./min.js\";\nimport minIndex from \"./minIndex.js\";\nimport quickselect from \"./quickselect.js\";\nimport number, {numbers} from \"./number.js\";\nimport {ascendingDefined} from \"./sort.js\";\nimport greatest from \"./greatest.js\";\n\nexport default function quantile(values, p, valueof) {\n values = Float64Array.from(numbers(values, valueof));\n if (!(n = values.length) || isNaN(p = +p)) return;\n if (p <= 0 || n < 2) return min(values);\n if (p >= 1) return max(values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = max(quickselect(values, i0).subarray(0, i0 + 1)),\n value1 = min(values.subarray(i0 + 1));\n return value0 + (value1 - value0) * (i - i0);\n}\n\nexport function quantileSorted(values, p, valueof = number) {\n if (!(n = values.length) || isNaN(p = +p)) return;\n if (p <= 0 || n < 2) return +valueof(values[0], 0, values);\n if (p >= 1) return +valueof(values[n - 1], n - 1, values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = +valueof(values[i0], i0, values),\n value1 = +valueof(values[i0 + 1], i0 + 1, values);\n return value0 + (value1 - value0) * (i - i0);\n}\n\nexport function quantileIndex(values, p, valueof = number) {\n if (isNaN(p = +p)) return;\n numbers = Float64Array.from(values, (_, i) => number(valueof(values[i], i, values)));\n if (p <= 0) return minIndex(numbers);\n if (p >= 1) return maxIndex(numbers);\n var numbers,\n index = Uint32Array.from(values, (_, i) => i),\n j = numbers.length - 1,\n i = Math.floor(j * p);\n quickselect(index, i, 0, j, (i, j) => ascendingDefined(numbers[i], numbers[j]));\n i = greatest(index.subarray(0, i + 1), (i) => numbers[i]);\n return i >= 0 ? i : -1;\n}\n","import quantile, {quantileIndex} from \"./quantile.js\";\n\nexport default function median(values, valueof) {\n return quantile(values, 0.5, valueof);\n}\n\nexport function medianIndex(values, valueof) {\n return quantileIndex(values, 0.5, valueof);\n}\n","import { ascending, quantileSorted, deviation, quantile, median } from 'd3-array';\n\nfunction* numbers (values, valueof) {\n if (valueof == null) {\n for (let value of values) {\n if (value != null && value !== '' && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n value = valueof(value, ++index, values);\n if (value != null && value !== '' && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n\nfunction quantiles (array, p, f) {\n const values = Float64Array.from(numbers(array, f));\n\n // don't depend on return value from typed array sort call\n // protects against undefined sort results in Safari (vega/vega-lite#4964)\n values.sort(ascending);\n return p.map(_ => quantileSorted(values, _));\n}\n\nfunction quartiles (array, f) {\n return quantiles(array, [0.25, 0.50, 0.75], f);\n}\n\n// Scott, D. W. (1992) Multivariate Density Estimation:\n// Theory, Practice, and Visualization. Wiley.\nfunction estimateBandwidth (array, f) {\n const n = array.length,\n d = deviation(array, f),\n q = quartiles(array, f),\n h = (q[2] - q[0]) / 1.34,\n v = Math.min(d, h) || d || Math.abs(q[0]) || 1;\n return 1.06 * v * Math.pow(n, -0.2);\n}\n\nfunction bin (_) {\n // determine range\n const maxb = _.maxbins || 20,\n base = _.base || 10,\n logb = Math.log(base),\n div = _.divide || [5, 2];\n let min = _.extent[0],\n max = _.extent[1],\n step,\n level,\n minstep,\n v,\n i,\n n;\n const span = _.span || max - min || Math.abs(min) || 1;\n if (_.step) {\n // if step size is explicitly given, use that\n step = _.step;\n } else if (_.steps) {\n // if provided, limit choice to acceptable step sizes\n v = span / maxb;\n for (i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i);\n step = _.steps[Math.max(0, i - 1)];\n } else {\n // else use span to determine step size\n level = Math.ceil(Math.log(maxb) / logb);\n minstep = _.minstep || 0;\n step = Math.max(minstep, Math.pow(base, Math.round(Math.log(span) / logb) - level));\n\n // increase step size if too many bins\n while (Math.ceil(span / step) > maxb) {\n step *= base;\n }\n\n // decrease step size if allowed\n for (i = 0, n = div.length; i < n; ++i) {\n v = step / div[i];\n if (v >= minstep && span / v <= maxb) step = v;\n }\n }\n\n // update precision, min and max\n v = Math.log(step);\n const precision = v >= 0 ? 0 : ~~(-v / logb) + 1,\n eps = Math.pow(base, -precision - 1);\n if (_.nice || _.nice === undefined) {\n v = Math.floor(min / step + eps) * step;\n min = min < v ? v - step : v;\n max = Math.ceil(max / step) * step;\n }\n return {\n start: min,\n stop: max === min ? min + step : max,\n step: step\n };\n}\n\nvar random = Math.random;\nfunction setRandom(r) {\n random = r;\n}\n\nfunction bootstrapCI (array, samples, alpha, f) {\n if (!array.length) return [undefined, undefined];\n const values = Float64Array.from(numbers(array, f)),\n n = values.length,\n m = samples;\n let a, i, j, mu;\n for (j = 0, mu = Array(m); j < m; ++j) {\n for (a = 0, i = 0; i < n; ++i) {\n a += values[~~(random() * n)];\n }\n mu[j] = a / n;\n }\n mu.sort(ascending);\n return [quantile(mu, alpha / 2), quantile(mu, 1 - alpha / 2)];\n}\n\n// Dot density binning for dot plot construction.\n// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999.\n// https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf\nfunction dotbin (array, step, smooth, f) {\n f = f || (_ => _);\n const n = array.length,\n v = new Float64Array(n);\n let i = 0,\n j = 1,\n a = f(array[0]),\n b = a,\n w = a + step,\n x;\n for (; j < n; ++j) {\n x = f(array[j]);\n if (x >= w) {\n b = (a + b) / 2;\n for (; i < j; ++i) v[i] = b;\n w = x + step;\n a = x;\n }\n b = x;\n }\n b = (a + b) / 2;\n for (; i < j; ++i) v[i] = b;\n return smooth ? smoothing(v, step + step / 4) : v;\n}\n\n// perform smoothing to reduce variance\n// swap points between \"adjacent\" stacks\n// Wilkinson defines adjacent as within step/4 units\nfunction smoothing(v, thresh) {\n const n = v.length;\n let a = 0,\n b = 1,\n c,\n d;\n\n // get left stack\n while (v[a] === v[b]) ++b;\n while (b < n) {\n // get right stack\n c = b + 1;\n while (v[b] === v[c]) ++c;\n\n // are stacks adjacent?\n // if so, compare sizes and swap as needed\n if (v[b] - v[b - 1] < thresh) {\n d = b + (a + c - b - b >> 1);\n while (d < b) v[d++] = v[b];\n while (d > b) v[d--] = v[a];\n }\n\n // update left stack indices\n a = b;\n b = c;\n }\n return v;\n}\n\nfunction lcg (seed) {\n // Random numbers using a Linear Congruential Generator with seed value\n // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator\n return function () {\n seed = (1103515245 * seed + 12345) % 2147483647;\n return seed / 2147483647;\n };\n}\n\nfunction integer (min, max) {\n if (max == null) {\n max = min;\n min = 0;\n }\n let a, b, d;\n const dist = {\n min(_) {\n if (arguments.length) {\n a = _ || 0;\n d = b - a;\n return dist;\n } else {\n return a;\n }\n },\n max(_) {\n if (arguments.length) {\n b = _ || 0;\n d = b - a;\n return dist;\n } else {\n return b;\n }\n },\n sample() {\n return a + Math.floor(d * random());\n },\n pdf(x) {\n return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0;\n },\n cdf(x) {\n const v = Math.floor(x);\n return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d;\n },\n icdf(p) {\n return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN;\n }\n };\n return dist.min(min).max(max);\n}\n\nconst SQRT2PI = Math.sqrt(2 * Math.PI);\nconst SQRT2 = Math.SQRT2;\n\nlet nextSample = NaN;\nfunction sampleNormal(mean, stdev) {\n mean = mean || 0;\n stdev = stdev == null ? 1 : stdev;\n let x = 0,\n y = 0,\n rds,\n c;\n if (nextSample === nextSample) {\n x = nextSample;\n nextSample = NaN;\n } else {\n do {\n x = random() * 2 - 1;\n y = random() * 2 - 1;\n rds = x * x + y * y;\n } while (rds === 0 || rds > 1);\n c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform\n x *= c;\n nextSample = y * c;\n }\n return mean + x * stdev;\n}\nfunction densityNormal(value, mean, stdev) {\n stdev = stdev == null ? 1 : stdev;\n const z = (value - (mean || 0)) / stdev;\n return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI);\n}\n\n// Approximation from West (2009)\n// Better Approximations to Cumulative Normal Functions\nfunction cumulativeNormal(value, mean, stdev) {\n mean = mean || 0;\n stdev = stdev == null ? 1 : stdev;\n const z = (value - mean) / stdev,\n Z = Math.abs(z);\n let cd;\n if (Z > 37) {\n cd = 0;\n } else {\n const exp = Math.exp(-Z * Z / 2);\n let sum;\n if (Z < 7.07106781186547) {\n sum = 3.52624965998911e-02 * Z + 0.700383064443688;\n sum = sum * Z + 6.37396220353165;\n sum = sum * Z + 33.912866078383;\n sum = sum * Z + 112.079291497871;\n sum = sum * Z + 221.213596169931;\n sum = sum * Z + 220.206867912376;\n cd = exp * sum;\n sum = 8.83883476483184e-02 * Z + 1.75566716318264;\n sum = sum * Z + 16.064177579207;\n sum = sum * Z + 86.7807322029461;\n sum = sum * Z + 296.564248779674;\n sum = sum * Z + 637.333633378831;\n sum = sum * Z + 793.826512519948;\n sum = sum * Z + 440.413735824752;\n cd = cd / sum;\n } else {\n sum = Z + 0.65;\n sum = Z + 4 / sum;\n sum = Z + 3 / sum;\n sum = Z + 2 / sum;\n sum = Z + 1 / sum;\n cd = exp / sum / 2.506628274631;\n }\n }\n return z > 0 ? 1 - cd : cd;\n}\n\n// Approximation of Probit function using inverse error function.\nfunction quantileNormal(p, mean, stdev) {\n if (p < 0 || p > 1) return NaN;\n return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1);\n}\n\n// Approximate inverse error function. Implementation from \"Approximating\n// the erfinv function\" by Mike Giles, GPU Computing Gems, volume 2, 2010.\n// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0\nfunction erfinv(x) {\n // beware that the logarithm argument must be\n // commputed as (1.0 - x) * (1.0 + x),\n // it must NOT be simplified as 1.0 - x * x as this\n // would induce rounding errors near the boundaries +/-1\n let w = -Math.log((1 - x) * (1 + x)),\n p;\n if (w < 6.25) {\n w -= 3.125;\n p = -3.6444120640178196996e-21;\n p = -1.685059138182016589e-19 + p * w;\n p = 1.2858480715256400167e-18 + p * w;\n p = 1.115787767802518096e-17 + p * w;\n p = -1.333171662854620906e-16 + p * w;\n p = 2.0972767875968561637e-17 + p * w;\n p = 6.6376381343583238325e-15 + p * w;\n p = -4.0545662729752068639e-14 + p * w;\n p = -8.1519341976054721522e-14 + p * w;\n p = 2.6335093153082322977e-12 + p * w;\n p = -1.2975133253453532498e-11 + p * w;\n p = -5.4154120542946279317e-11 + p * w;\n p = 1.051212273321532285e-09 + p * w;\n p = -4.1126339803469836976e-09 + p * w;\n p = -2.9070369957882005086e-08 + p * w;\n p = 4.2347877827932403518e-07 + p * w;\n p = -1.3654692000834678645e-06 + p * w;\n p = -1.3882523362786468719e-05 + p * w;\n p = 0.0001867342080340571352 + p * w;\n p = -0.00074070253416626697512 + p * w;\n p = -0.0060336708714301490533 + p * w;\n p = 0.24015818242558961693 + p * w;\n p = 1.6536545626831027356 + p * w;\n } else if (w < 16.0) {\n w = Math.sqrt(w) - 3.25;\n p = 2.2137376921775787049e-09;\n p = 9.0756561938885390979e-08 + p * w;\n p = -2.7517406297064545428e-07 + p * w;\n p = 1.8239629214389227755e-08 + p * w;\n p = 1.5027403968909827627e-06 + p * w;\n p = -4.013867526981545969e-06 + p * w;\n p = 2.9234449089955446044e-06 + p * w;\n p = 1.2475304481671778723e-05 + p * w;\n p = -4.7318229009055733981e-05 + p * w;\n p = 6.8284851459573175448e-05 + p * w;\n p = 2.4031110387097893999e-05 + p * w;\n p = -0.0003550375203628474796 + p * w;\n p = 0.00095328937973738049703 + p * w;\n p = -0.0016882755560235047313 + p * w;\n p = 0.0024914420961078508066 + p * w;\n p = -0.0037512085075692412107 + p * w;\n p = 0.005370914553590063617 + p * w;\n p = 1.0052589676941592334 + p * w;\n p = 3.0838856104922207635 + p * w;\n } else if (Number.isFinite(w)) {\n w = Math.sqrt(w) - 5.0;\n p = -2.7109920616438573243e-11;\n p = -2.5556418169965252055e-10 + p * w;\n p = 1.5076572693500548083e-09 + p * w;\n p = -3.7894654401267369937e-09 + p * w;\n p = 7.6157012080783393804e-09 + p * w;\n p = -1.4960026627149240478e-08 + p * w;\n p = 2.9147953450901080826e-08 + p * w;\n p = -6.7711997758452339498e-08 + p * w;\n p = 2.2900482228026654717e-07 + p * w;\n p = -9.9298272942317002539e-07 + p * w;\n p = 4.5260625972231537039e-06 + p * w;\n p = -1.9681778105531670567e-05 + p * w;\n p = 7.5995277030017761139e-05 + p * w;\n p = -0.00021503011930044477347 + p * w;\n p = -0.00013871931833623122026 + p * w;\n p = 1.0103004648645343977 + p * w;\n p = 4.8499064014085844221 + p * w;\n } else {\n p = Infinity;\n }\n return p * x;\n}\nfunction gaussian (mean, stdev) {\n let mu, sigma;\n const dist = {\n mean(_) {\n if (arguments.length) {\n mu = _ || 0;\n return dist;\n } else {\n return mu;\n }\n },\n stdev(_) {\n if (arguments.length) {\n sigma = _ == null ? 1 : _;\n return dist;\n } else {\n return sigma;\n }\n },\n sample: () => sampleNormal(mu, sigma),\n pdf: value => densityNormal(value, mu, sigma),\n cdf: value => cumulativeNormal(value, mu, sigma),\n icdf: p => quantileNormal(p, mu, sigma)\n };\n return dist.mean(mean).stdev(stdev);\n}\n\nfunction kde (support, bandwidth) {\n const kernel = gaussian();\n let n = 0;\n const dist = {\n data(_) {\n if (arguments.length) {\n support = _;\n n = _ ? _.length : 0;\n return dist.bandwidth(bandwidth);\n } else {\n return support;\n }\n },\n bandwidth(_) {\n if (!arguments.length) return bandwidth;\n bandwidth = _;\n if (!bandwidth && support) bandwidth = estimateBandwidth(support);\n return dist;\n },\n sample() {\n return support[~~(random() * n)] + bandwidth * kernel.sample();\n },\n pdf(x) {\n let y = 0,\n i = 0;\n for (; i < n; ++i) {\n y += kernel.pdf((x - support[i]) / bandwidth);\n }\n return y / bandwidth / n;\n },\n cdf(x) {\n let y = 0,\n i = 0;\n for (; i < n; ++i) {\n y += kernel.cdf((x - support[i]) / bandwidth);\n }\n return y / n;\n },\n icdf() {\n throw Error('KDE icdf not supported.');\n }\n };\n return dist.data(support);\n}\n\nfunction sampleLogNormal(mean, stdev) {\n mean = mean || 0;\n stdev = stdev == null ? 1 : stdev;\n return Math.exp(mean + sampleNormal() * stdev);\n}\nfunction densityLogNormal(value, mean, stdev) {\n if (value <= 0) return 0;\n mean = mean || 0;\n stdev = stdev == null ? 1 : stdev;\n const z = (Math.log(value) - mean) / stdev;\n return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value);\n}\nfunction cumulativeLogNormal(value, mean, stdev) {\n return cumulativeNormal(Math.log(value), mean, stdev);\n}\nfunction quantileLogNormal(p, mean, stdev) {\n return Math.exp(quantileNormal(p, mean, stdev));\n}\nfunction lognormal (mean, stdev) {\n let mu, sigma;\n const dist = {\n mean(_) {\n if (arguments.length) {\n mu = _ || 0;\n return dist;\n } else {\n return mu;\n }\n },\n stdev(_) {\n if (arguments.length) {\n sigma = _ == null ? 1 : _;\n return dist;\n } else {\n return sigma;\n }\n },\n sample: () => sampleLogNormal(mu, sigma),\n pdf: value => densityLogNormal(value, mu, sigma),\n cdf: value => cumulativeLogNormal(value, mu, sigma),\n icdf: p => quantileLogNormal(p, mu, sigma)\n };\n return dist.mean(mean).stdev(stdev);\n}\n\nfunction mixture (dists, weights) {\n let m = 0,\n w;\n function normalize(x) {\n const w = [];\n let sum = 0,\n i;\n for (i = 0; i < m; ++i) {\n sum += w[i] = x[i] == null ? 1 : +x[i];\n }\n for (i = 0; i < m; ++i) {\n w[i] /= sum;\n }\n return w;\n }\n const dist = {\n weights(_) {\n if (arguments.length) {\n w = normalize(weights = _ || []);\n return dist;\n }\n return weights;\n },\n distributions(_) {\n if (arguments.length) {\n if (_) {\n m = _.length;\n dists = _;\n } else {\n m = 0;\n dists = [];\n }\n return dist.weights(weights);\n }\n return dists;\n },\n sample() {\n const r = random();\n let d = dists[m - 1],\n v = w[0],\n i = 0;\n\n // first select distribution\n for (; i < m - 1; v += w[++i]) {\n if (r < v) {\n d = dists[i];\n break;\n }\n }\n // then sample from it\n return d.sample();\n },\n pdf(x) {\n let p = 0,\n i = 0;\n for (; i < m; ++i) {\n p += w[i] * dists[i].pdf(x);\n }\n return p;\n },\n cdf(x) {\n let p = 0,\n i = 0;\n for (; i < m; ++i) {\n p += w[i] * dists[i].cdf(x);\n }\n return p;\n },\n icdf() {\n throw Error('Mixture icdf not supported.');\n }\n };\n return dist.distributions(dists).weights(weights);\n}\n\nfunction sampleUniform(min, max) {\n if (max == null) {\n max = min == null ? 1 : min;\n min = 0;\n }\n return min + (max - min) * random();\n}\nfunction densityUniform(value, min, max) {\n if (max == null) {\n max = min == null ? 1 : min;\n min = 0;\n }\n return value >= min && value <= max ? 1 / (max - min) : 0;\n}\nfunction cumulativeUniform(value, min, max) {\n if (max == null) {\n max = min == null ? 1 : min;\n min = 0;\n }\n return value < min ? 0 : value > max ? 1 : (value - min) / (max - min);\n}\nfunction quantileUniform(p, min, max) {\n if (max == null) {\n max = min == null ? 1 : min;\n min = 0;\n }\n return p >= 0 && p <= 1 ? min + p * (max - min) : NaN;\n}\nfunction uniform (min, max) {\n let a, b;\n const dist = {\n min(_) {\n if (arguments.length) {\n a = _ || 0;\n return dist;\n } else {\n return a;\n }\n },\n max(_) {\n if (arguments.length) {\n b = _ == null ? 1 : _;\n return dist;\n } else {\n return b;\n }\n },\n sample: () => sampleUniform(a, b),\n pdf: value => densityUniform(value, a, b),\n cdf: value => cumulativeUniform(value, a, b),\n icdf: p => quantileUniform(p, a, b)\n };\n if (max == null) {\n max = min == null ? 1 : min;\n min = 0;\n }\n return dist.min(min).max(max);\n}\n\nfunction constant (data, x, y) {\n let mean = 0,\n n = 0;\n for (const d of data) {\n const val = y(d);\n if (x(d) == null || val == null || isNaN(val)) continue;\n mean += (val - mean) / ++n;\n }\n return {\n coef: [mean],\n predict: () => mean,\n rSquared: 0\n };\n}\n\n// Ordinary Least Squares\nfunction ols (uX, uY, uXY, uX2) {\n const delta = uX2 - uX * uX,\n slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta,\n intercept = uY - slope * uX;\n return [intercept, slope];\n}\n\nfunction points(data, x, y, sort) {\n data = data.filter(d => {\n let u = x(d),\n v = y(d);\n return u != null && (u = +u) >= u && v != null && (v = +v) >= v;\n });\n if (sort) {\n data.sort((a, b) => x(a) - x(b));\n }\n const n = data.length,\n X = new Float64Array(n),\n Y = new Float64Array(n);\n\n // extract values, calculate means\n let i = 0,\n ux = 0,\n uy = 0,\n xv,\n yv,\n d;\n for (d of data) {\n X[i] = xv = +x(d);\n Y[i] = yv = +y(d);\n ++i;\n ux += (xv - ux) / i;\n uy += (yv - uy) / i;\n }\n\n // mean center the data\n for (i = 0; i < n; ++i) {\n X[i] -= ux;\n Y[i] -= uy;\n }\n return [X, Y, ux, uy];\n}\nfunction visitPoints(data, x, y, callback) {\n let i = -1,\n u,\n v;\n for (const d of data) {\n u = x(d);\n v = y(d);\n if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) {\n callback(u, v, ++i);\n }\n }\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nfunction rSquared (data, x, y, uY, predict) {\n let SSE = 0,\n SST = 0;\n visitPoints(data, x, y, (dx, dy) => {\n const sse = dy - predict(dx),\n sst = dy - uY;\n SSE += sse * sse;\n SST += sst * sst;\n });\n return 1 - SSE / SST;\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nfunction linear (data, x, y) {\n let X = 0,\n Y = 0,\n XY = 0,\n X2 = 0,\n n = 0;\n visitPoints(data, x, y, (dx, dy) => {\n ++n;\n X += (dx - X) / n;\n Y += (dy - Y) / n;\n XY += (dx * dy - XY) / n;\n X2 += (dx * dx - X2) / n;\n });\n const coef = ols(X, Y, XY, X2),\n predict = x => coef[0] + coef[1] * x;\n return {\n coef: coef,\n predict: predict,\n rSquared: rSquared(data, x, y, Y, predict)\n };\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nfunction log (data, x, y) {\n let X = 0,\n Y = 0,\n XY = 0,\n X2 = 0,\n n = 0;\n visitPoints(data, x, y, (dx, dy) => {\n ++n;\n dx = Math.log(dx);\n X += (dx - X) / n;\n Y += (dy - Y) / n;\n XY += (dx * dy - XY) / n;\n X2 += (dx * dx - X2) / n;\n });\n const coef = ols(X, Y, XY, X2),\n predict = x => coef[0] + coef[1] * Math.log(x);\n return {\n coef: coef,\n predict: predict,\n rSquared: rSquared(data, x, y, Y, predict)\n };\n}\n\nfunction exp (data, x, y) {\n // eslint-disable-next-line no-unused-vars\n const [xv, yv, ux, uy] = points(data, x, y);\n let YL = 0,\n XY = 0,\n XYL = 0,\n X2Y = 0,\n n = 0,\n dx,\n ly,\n xy;\n visitPoints(data, x, y, (_, dy) => {\n dx = xv[n++];\n ly = Math.log(dy);\n xy = dx * dy;\n YL += (dy * ly - YL) / n;\n XY += (xy - XY) / n;\n XYL += (xy * ly - XYL) / n;\n X2Y += (dx * xy - X2Y) / n;\n });\n const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy),\n predict = x => Math.exp(c0 + c1 * (x - ux));\n return {\n coef: [Math.exp(c0 - c1 * ux), c1],\n predict: predict,\n rSquared: rSquared(data, x, y, uy, predict)\n };\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nfunction pow (data, x, y) {\n let X = 0,\n Y = 0,\n XY = 0,\n X2 = 0,\n YS = 0,\n n = 0;\n visitPoints(data, x, y, (dx, dy) => {\n const lx = Math.log(dx),\n ly = Math.log(dy);\n ++n;\n X += (lx - X) / n;\n Y += (ly - Y) / n;\n XY += (lx * ly - XY) / n;\n X2 += (lx * lx - X2) / n;\n YS += (dy - YS) / n;\n });\n const coef = ols(X, Y, XY, X2),\n predict = x => coef[0] * Math.pow(x, coef[1]);\n coef[0] = Math.exp(coef[0]);\n return {\n coef: coef,\n predict: predict,\n rSquared: rSquared(data, x, y, YS, predict)\n };\n}\n\nfunction quad (data, x, y) {\n const [xv, yv, ux, uy] = points(data, x, y),\n n = xv.length;\n let X2 = 0,\n X3 = 0,\n X4 = 0,\n XY = 0,\n X2Y = 0,\n i,\n dx,\n dy,\n x2;\n for (i = 0; i < n;) {\n dx = xv[i];\n dy = yv[i++];\n x2 = dx * dx;\n X2 += (x2 - X2) / i;\n X3 += (x2 * dx - X3) / i;\n X4 += (x2 * x2 - X4) / i;\n XY += (dx * dy - XY) / i;\n X2Y += (x2 * dy - X2Y) / i;\n }\n const X2X2 = X4 - X2 * X2,\n d = X2 * X2X2 - X3 * X3,\n a = (X2Y * X2 - XY * X3) / d,\n b = (XY * X2X2 - X2Y * X3) / d,\n c = -a * X2,\n predict = x => {\n x = x - ux;\n return a * x * x + b * x + c + uy;\n };\n\n // transform coefficients back from mean-centered space\n return {\n coef: [c - b * ux + a * ux * ux + uy, b - 2 * a * ux, a],\n predict: predict,\n rSquared: rSquared(data, x, y, uy, predict)\n };\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\n// ... which was adapted from regression-js by Tom Alexander\n// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246\n// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE\nfunction poly (data, x, y, order) {\n // use more efficient methods for lower orders\n if (order === 0) return constant(data, x, y);\n if (order === 1) return linear(data, x, y);\n if (order === 2) return quad(data, x, y);\n const [xv, yv, ux, uy] = points(data, x, y),\n n = xv.length,\n lhs = [],\n rhs = [],\n k = order + 1;\n let i, j, l, v, c;\n for (i = 0; i < k; ++i) {\n for (l = 0, v = 0; l < n; ++l) {\n v += Math.pow(xv[l], i) * yv[l];\n }\n lhs.push(v);\n c = new Float64Array(k);\n for (j = 0; j < k; ++j) {\n for (l = 0, v = 0; l < n; ++l) {\n v += Math.pow(xv[l], i + j);\n }\n c[j] = v;\n }\n rhs.push(c);\n }\n rhs.push(lhs);\n const coef = gaussianElimination(rhs),\n predict = x => {\n x -= ux;\n let y = uy + coef[0] + coef[1] * x + coef[2] * x * x;\n for (i = 3; i < k; ++i) y += coef[i] * Math.pow(x, i);\n return y;\n };\n return {\n coef: uncenter(k, coef, -ux, uy),\n predict: predict,\n rSquared: rSquared(data, x, y, uy, predict)\n };\n}\nfunction uncenter(k, a, x, y) {\n const z = Array(k);\n let i, j, v, c;\n\n // initialize to zero\n for (i = 0; i < k; ++i) z[i] = 0;\n\n // polynomial expansion\n for (i = k - 1; i >= 0; --i) {\n v = a[i];\n c = 1;\n z[i] += v;\n for (j = 1; j <= i; ++j) {\n c *= (i + 1 - j) / j; // binomial coefficent\n z[i - j] += v * Math.pow(x, j) * c;\n }\n }\n\n // bias term\n z[0] += y;\n return z;\n}\n\n// Given an array for a two-dimensional matrix and the polynomial order,\n// solve A * x = b using Gaussian elimination.\nfunction gaussianElimination(matrix) {\n const n = matrix.length - 1,\n coef = [];\n let i, j, k, r, t;\n for (i = 0; i < n; ++i) {\n r = i; // max row\n for (j = i + 1; j < n; ++j) {\n if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) {\n r = j;\n }\n }\n for (k = i; k < n + 1; ++k) {\n t = matrix[k][i];\n matrix[k][i] = matrix[k][r];\n matrix[k][r] = t;\n }\n for (j = i + 1; j < n; ++j) {\n for (k = n; k >= i; k--) {\n matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i];\n }\n }\n }\n for (j = n - 1; j >= 0; --j) {\n t = 0;\n for (k = j + 1; k < n; ++k) {\n t += matrix[k][j] * coef[k];\n }\n coef[j] = (matrix[n][j] - t) / matrix[j][j];\n }\n return coef;\n}\n\nconst maxiters = 2,\n epsilon = 1e-12;\n\n// Adapted from science.js by Jason Davies\n// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js\n// License: https://github.com/jasondavies/science.js/blob/master/LICENSE\nfunction loess (data, x, y, bandwidth) {\n const [xv, yv, ux, uy] = points(data, x, y, true),\n n = xv.length,\n bw = Math.max(2, ~~(bandwidth * n)),\n // # nearest neighbors\n yhat = new Float64Array(n),\n residuals = new Float64Array(n),\n robustWeights = new Float64Array(n).fill(1);\n for (let iter = -1; ++iter <= maxiters;) {\n const interval = [0, bw - 1];\n for (let i = 0; i < n; ++i) {\n const dx = xv[i],\n i0 = interval[0],\n i1 = interval[1],\n edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1;\n let W = 0,\n X = 0,\n Y = 0,\n XY = 0,\n X2 = 0;\n const denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity!\n\n for (let k = i0; k <= i1; ++k) {\n const xk = xv[k],\n yk = yv[k],\n w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k],\n xkw = xk * w;\n W += w;\n X += xkw;\n Y += yk * w;\n XY += yk * xkw;\n X2 += xk * xkw;\n }\n\n // linear regression fit\n const [a, b] = ols(X / W, Y / W, XY / W, X2 / W);\n yhat[i] = a + b * dx;\n residuals[i] = Math.abs(yv[i] - yhat[i]);\n updateInterval(xv, i + 1, interval);\n }\n if (iter === maxiters) {\n break;\n }\n const medianResidual = median(residuals);\n if (Math.abs(medianResidual) < epsilon) break;\n for (let i = 0, arg, w; i < n; ++i) {\n arg = residuals[i] / (6 * medianResidual);\n // default to epsilon (rather than zero) for large deviations\n // keeping weights tiny but non-zero prevents singularites\n robustWeights[i] = arg >= 1 ? epsilon : (w = 1 - arg * arg) * w;\n }\n }\n return output(xv, yhat, ux, uy);\n}\n\n// weighting kernel for local regression\nfunction tricube(x) {\n return (x = 1 - x * x * x) * x * x;\n}\n\n// advance sliding window interval of nearest neighbors\nfunction updateInterval(xv, i, interval) {\n const val = xv[i];\n let left = interval[0],\n right = interval[1] + 1;\n if (right >= xv.length) return;\n\n // step right if distance to new right edge is <= distance to old left edge\n // step when distance is equal to ensure movement over duplicate x values\n while (i > left && xv[right] - val <= val - xv[left]) {\n interval[0] = ++left;\n interval[1] = right;\n ++right;\n }\n}\n\n// generate smoothed output points\n// average points with repeated x values\nfunction output(xv, yhat, ux, uy) {\n const n = xv.length,\n out = [];\n let i = 0,\n cnt = 0,\n prev = [],\n v;\n for (; i < n; ++i) {\n v = xv[i] + ux;\n if (prev[0] === v) {\n // average output values via online update\n prev[1] += (yhat[i] - prev[1]) / ++cnt;\n } else {\n // add new output point\n cnt = 0;\n prev[1] += uy;\n prev = [v, yhat[i]];\n out.push(prev);\n }\n }\n prev[1] += uy;\n return out;\n}\n\n// subdivide up to accuracy of 0.5 degrees\nconst MIN_RADIANS = 0.5 * Math.PI / 180;\n\n// Adaptively sample an interpolated function over a domain extent\nfunction sampleCurve (f, extent, minSteps, maxSteps) {\n minSteps = minSteps || 25;\n maxSteps = Math.max(minSteps, maxSteps || 200);\n const point = x => [x, f(x)],\n minX = extent[0],\n maxX = extent[1],\n span = maxX - minX,\n stop = span / maxSteps,\n prev = [point(minX)],\n next = [];\n if (minSteps === maxSteps) {\n // no adaptation, sample uniform grid directly and return\n for (let i = 1; i < maxSteps; ++i) {\n prev.push(point(minX + i / minSteps * span));\n }\n prev.push(point(maxX));\n return prev;\n } else {\n // sample minimum points on uniform grid\n // then move on to perform adaptive refinement\n next.push(point(maxX));\n for (let i = minSteps; --i > 0;) {\n next.push(point(minX + i / minSteps * span));\n }\n }\n let p0 = prev[0];\n let p1 = next[next.length - 1];\n const sx = 1 / span;\n const sy = scaleY(p0[1], next);\n while (p1) {\n // midpoint for potential curve subdivision\n const pm = point((p0[0] + p1[0]) / 2);\n const dx = pm[0] - p0[0] >= stop;\n if (dx && angleDelta(p0, pm, p1, sx, sy) > MIN_RADIANS) {\n // maximum resolution has not yet been met, and\n // subdivision midpoint is sufficiently different from endpoint\n // save subdivision, push midpoint onto the visitation stack\n next.push(pm);\n } else {\n // subdivision midpoint sufficiently similar to endpoint\n // skip subdivision, store endpoint, move to next point on the stack\n p0 = p1;\n prev.push(p1);\n next.pop();\n }\n p1 = next[next.length - 1];\n }\n return prev;\n}\nfunction scaleY(init, points) {\n let ymin = init;\n let ymax = init;\n const n = points.length;\n for (let i = 0; i < n; ++i) {\n const y = points[i][1];\n if (y < ymin) ymin = y;\n if (y > ymax) ymax = y;\n }\n return 1 / (ymax - ymin);\n}\nfunction angleDelta(p, q, r, sx, sy) {\n const a0 = Math.atan2(sy * (r[1] - p[1]), sx * (r[0] - p[0])),\n a1 = Math.atan2(sy * (q[1] - p[1]), sx * (q[0] - p[0]));\n return Math.abs(a0 - a1);\n}\n\nexport { estimateBandwidth as bandwidthNRD, bin, bootstrapCI, cumulativeLogNormal, cumulativeNormal, cumulativeUniform, densityLogNormal, densityNormal, densityUniform, dotbin, quantileLogNormal, quantileNormal, quantileUniform, quantiles, quartiles, random, integer as randomInteger, kde as randomKDE, lcg as randomLCG, lognormal as randomLogNormal, mixture as randomMixture, gaussian as randomNormal, uniform as randomUniform, constant as regressionConstant, exp as regressionExp, linear as regressionLinear, loess as regressionLoess, log as regressionLog, poly as regressionPoly, pow as regressionPow, quad as regressionQuad, sampleCurve, sampleLogNormal, sampleNormal, sampleUniform, setRandom };\n","import variance from \"./variance.js\";\n\nexport default function deviation(values, valueof) {\n const v = variance(values, valueof);\n return v ? Math.sqrt(v) : v;\n}\n","export default function variance(values, valueof) {\n let count = 0;\n let delta;\n let mean = 0;\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n delta = value - mean;\n mean += delta / ++count;\n sum += delta * (value - mean);\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n delta = value - mean;\n mean += delta / ++count;\n sum += delta * (value - mean);\n }\n }\n }\n if (count > 1) return sum / (count - 1);\n}\n","export default function range(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n}\n","import { extend, identity, field, hasOwnProperty, extentIndex, inherits, array, accessorName, error, accessorFields, accessor, toNumber, merge, compare, truthy, extent, span, fastmap, isArray, key, ascending, peek, zero, constant } from 'vega-util';\nimport { tupleid, Transform, replace, ingest, stableCompare, Operator, derive, rederive } from 'vega-dataflow';\nimport { quartiles, bootstrapCI, bin, randomKDE, randomMixture, randomNormal, randomLogNormal, randomUniform, sampleCurve, dotbin, quantiles, random } from 'vega-statistics';\nimport { median, mean, min, max, range, bisector } from 'd3-array';\nimport { TIME_UNITS, utcInterval, timeInterval, timeBin, timeUnits, utcFloor, timeFloor } from 'vega-time';\n\nfunction multikey(f) {\n return x => {\n const n = f.length;\n let i = 1,\n k = String(f[0](x));\n for (; i < n; ++i) {\n k += '|' + f[i](x);\n }\n return k;\n };\n}\nfunction groupkey(fields) {\n return !fields || !fields.length ? function () {\n return '';\n } : fields.length === 1 ? fields[0] : multikey(fields);\n}\n\nfunction measureName(op, field, as) {\n return as || op + (!field ? '' : '_' + field);\n}\nconst noop = () => {};\nconst base_op = {\n init: noop,\n add: noop,\n rem: noop,\n idx: 0\n};\nconst AggregateOps = {\n values: {\n init: m => m.cell.store = true,\n value: m => m.cell.data.values(),\n idx: -1\n },\n count: {\n value: m => m.cell.num\n },\n __count__: {\n value: m => m.missing + m.valid\n },\n missing: {\n value: m => m.missing\n },\n valid: {\n value: m => m.valid\n },\n sum: {\n init: m => m.sum = 0,\n value: m => m.sum,\n add: (m, v) => m.sum += +v,\n rem: (m, v) => m.sum -= v\n },\n product: {\n init: m => m.product = 1,\n value: m => m.valid ? m.product : undefined,\n add: (m, v) => m.product *= v,\n rem: (m, v) => m.product /= v\n },\n mean: {\n init: m => m.mean = 0,\n value: m => m.valid ? m.mean : undefined,\n add: (m, v) => (m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid),\n rem: (m, v) => (m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean)\n },\n average: {\n value: m => m.valid ? m.mean : undefined,\n req: ['mean'],\n idx: 1\n },\n variance: {\n init: m => m.dev = 0,\n value: m => m.valid > 1 ? m.dev / (m.valid - 1) : undefined,\n add: (m, v) => m.dev += m.mean_d * (v - m.mean),\n rem: (m, v) => m.dev -= m.mean_d * (v - m.mean),\n req: ['mean'],\n idx: 1\n },\n variancep: {\n value: m => m.valid > 1 ? m.dev / m.valid : undefined,\n req: ['variance'],\n idx: 2\n },\n stdev: {\n value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined,\n req: ['variance'],\n idx: 2\n },\n stdevp: {\n value: m => m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined,\n req: ['variance'],\n idx: 2\n },\n stderr: {\n value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined,\n req: ['variance'],\n idx: 2\n },\n distinct: {\n value: m => m.cell.data.distinct(m.get),\n req: ['values'],\n idx: 3\n },\n ci0: {\n value: m => m.cell.data.ci0(m.get),\n req: ['values'],\n idx: 3\n },\n ci1: {\n value: m => m.cell.data.ci1(m.get),\n req: ['values'],\n idx: 3\n },\n median: {\n value: m => m.cell.data.q2(m.get),\n req: ['values'],\n idx: 3\n },\n q1: {\n value: m => m.cell.data.q1(m.get),\n req: ['values'],\n idx: 3\n },\n q3: {\n value: m => m.cell.data.q3(m.get),\n req: ['values'],\n idx: 3\n },\n min: {\n init: m => m.min = undefined,\n value: m => m.min = Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min,\n add: (m, v) => {\n if (v < m.min || m.min === undefined) m.min = v;\n },\n rem: (m, v) => {\n if (v <= m.min) m.min = NaN;\n },\n req: ['values'],\n idx: 4\n },\n max: {\n init: m => m.max = undefined,\n value: m => m.max = Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max,\n add: (m, v) => {\n if (v > m.max || m.max === undefined) m.max = v;\n },\n rem: (m, v) => {\n if (v >= m.max) m.max = NaN;\n },\n req: ['values'],\n idx: 4\n },\n argmin: {\n init: m => m.argmin = undefined,\n value: m => m.argmin || m.cell.data.argmin(m.get),\n add: (m, v, t) => {\n if (v < m.min) m.argmin = t;\n },\n rem: (m, v) => {\n if (v <= m.min) m.argmin = undefined;\n },\n req: ['min', 'values'],\n idx: 3\n },\n argmax: {\n init: m => m.argmax = undefined,\n value: m => m.argmax || m.cell.data.argmax(m.get),\n add: (m, v, t) => {\n if (v > m.max) m.argmax = t;\n },\n rem: (m, v) => {\n if (v >= m.max) m.argmax = undefined;\n },\n req: ['max', 'values'],\n idx: 3\n },\n exponential: {\n init: (m, r) => {\n m.exp = 0;\n m.exp_r = r;\n },\n value: m => m.valid ? m.exp * (1 - m.exp_r) / (1 - m.exp_r ** m.valid) : undefined,\n add: (m, v) => m.exp = m.exp_r * m.exp + v,\n rem: (m, v) => m.exp = (m.exp - v / m.exp_r ** (m.valid - 1)) / m.exp_r\n },\n exponentialb: {\n value: m => m.valid ? m.exp * (1 - m.exp_r) : undefined,\n req: ['exponential'],\n idx: 1\n }\n};\nconst ValidAggregateOps = Object.keys(AggregateOps).filter(d => d !== '__count__');\nfunction measure(key, value) {\n return (out, aggregate_param) => extend({\n name: key,\n aggregate_param: aggregate_param,\n out: out || key\n }, base_op, value);\n}\n[...ValidAggregateOps, '__count__'].forEach(key => {\n AggregateOps[key] = measure(key, AggregateOps[key]);\n});\nfunction createMeasure(op, param, name) {\n return AggregateOps[op](name, param);\n}\nfunction compareIndex(a, b) {\n return a.idx - b.idx;\n}\nfunction resolve(agg) {\n const map = {};\n agg.forEach(a => map[a.name] = a);\n const getreqs = a => {\n if (!a.req) return;\n a.req.forEach(key => {\n if (!map[key]) getreqs(map[key] = AggregateOps[key]());\n });\n };\n agg.forEach(getreqs);\n return Object.values(map).sort(compareIndex);\n}\nfunction init() {\n this.valid = 0;\n this.missing = 0;\n this._ops.forEach(op => op.aggregate_param == null ? op.init(this) : op.init(this, op.aggregate_param));\n}\nfunction add(v, t) {\n if (v == null || v === '') {\n ++this.missing;\n return;\n }\n if (v !== v) return;\n ++this.valid;\n this._ops.forEach(op => op.add(this, v, t));\n}\nfunction rem(v, t) {\n if (v == null || v === '') {\n --this.missing;\n return;\n }\n if (v !== v) return;\n --this.valid;\n this._ops.forEach(op => op.rem(this, v, t));\n}\nfunction set(t) {\n this._out.forEach(op => t[op.out] = op.value(this));\n return t;\n}\nfunction compileMeasures(agg, field) {\n const get = field || identity,\n ops = resolve(agg),\n out = agg.slice().sort(compareIndex);\n function ctr(cell) {\n this._ops = ops;\n this._out = out;\n this.cell = cell;\n this.init();\n }\n ctr.prototype.init = init;\n ctr.prototype.add = add;\n ctr.prototype.rem = rem;\n ctr.prototype.set = set;\n ctr.prototype.get = get;\n ctr.fields = agg.map(op => op.out);\n return ctr;\n}\n\nfunction TupleStore(key) {\n this._key = key ? field(key) : tupleid;\n this.reset();\n}\nconst prototype$1 = TupleStore.prototype;\nprototype$1.reset = function () {\n this._add = [];\n this._rem = [];\n this._ext = null;\n this._get = null;\n this._q = null;\n};\nprototype$1.add = function (v) {\n this._add.push(v);\n};\nprototype$1.rem = function (v) {\n this._rem.push(v);\n};\nprototype$1.values = function () {\n this._get = null;\n if (this._rem.length === 0) return this._add;\n const a = this._add,\n r = this._rem,\n k = this._key,\n n = a.length,\n m = r.length,\n x = Array(n - m),\n map = {};\n let i, j, v;\n\n // use unique key field to clear removed values\n for (i = 0; i < m; ++i) {\n map[k(r[i])] = 1;\n }\n for (i = 0, j = 0; i < n; ++i) {\n if (map[k(v = a[i])]) {\n map[k(v)] = 0;\n } else {\n x[j++] = v;\n }\n }\n this._rem = [];\n return this._add = x;\n};\n\n// memoizing statistics methods\n\nprototype$1.distinct = function (get) {\n const v = this.values(),\n map = {};\n let n = v.length,\n count = 0,\n s;\n while (--n >= 0) {\n s = get(v[n]) + '';\n if (!hasOwnProperty(map, s)) {\n map[s] = 1;\n ++count;\n }\n }\n return count;\n};\nprototype$1.extent = function (get) {\n if (this._get !== get || !this._ext) {\n const v = this.values(),\n i = extentIndex(v, get);\n this._ext = [v[i[0]], v[i[1]]];\n this._get = get;\n }\n return this._ext;\n};\nprototype$1.argmin = function (get) {\n return this.extent(get)[0] || {};\n};\nprototype$1.argmax = function (get) {\n return this.extent(get)[1] || {};\n};\nprototype$1.min = function (get) {\n const m = this.extent(get)[0];\n return m != null ? get(m) : undefined;\n};\nprototype$1.max = function (get) {\n const m = this.extent(get)[1];\n return m != null ? get(m) : undefined;\n};\nprototype$1.quartile = function (get) {\n if (this._get !== get || !this._q) {\n this._q = quartiles(this.values(), get);\n this._get = get;\n }\n return this._q;\n};\nprototype$1.q1 = function (get) {\n return this.quartile(get)[0];\n};\nprototype$1.q2 = function (get) {\n return this.quartile(get)[1];\n};\nprototype$1.q3 = function (get) {\n return this.quartile(get)[2];\n};\nprototype$1.ci = function (get) {\n if (this._get !== get || !this._ci) {\n this._ci = bootstrapCI(this.values(), 1000, 0.05, get);\n this._get = get;\n }\n return this._ci;\n};\nprototype$1.ci0 = function (get) {\n return this.ci(get)[0];\n};\nprototype$1.ci1 = function (get) {\n return this.ci(get)[1];\n};\n\n/**\n * Group-by aggregation operator.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} [params.groupby] - An array of accessors to groupby.\n * @param {Array} [params.fields] - An array of accessors to aggregate.\n * @param {Array} [params.ops] - An array of strings indicating aggregation operations.\n * @param {Array} [params.aggregate_params=[null]] - An optional array of parameters for aggregation operations.\n * @param {Array} [params.as] - An array of output field names for aggregated values.\n * @param {boolean} [params.cross=false] - A flag indicating that the full\n * cross-product of groupby values should be generated, including empty cells.\n * If true, the drop parameter is ignored and empty cells are retained.\n * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed.\n */\nfunction Aggregate(params) {\n Transform.call(this, null, params);\n this._adds = []; // array of added output tuples\n this._mods = []; // array of modified output tuples\n this._alen = 0; // number of active added tuples\n this._mlen = 0; // number of active modified tuples\n this._drop = true; // should empty aggregation cells be removed\n this._cross = false; // produce full cross-product of group-by values\n\n this._dims = []; // group-by dimension accessors\n this._dnames = []; // group-by dimension names\n\n this._measures = []; // collection of aggregation monoids\n this._countOnly = false; // flag indicating only count aggregation\n this._counts = null; // collection of count fields\n this._prev = null; // previous aggregation cells\n\n this._inputs = null; // array of dependent input tuple field names\n this._outputs = null; // array of output tuple field names\n}\n\nAggregate.Definition = {\n 'type': 'Aggregate',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'ops',\n 'type': 'enum',\n 'array': true,\n 'values': ValidAggregateOps\n }, {\n 'name': 'aggregate_params',\n 'type': 'field',\n 'null': true,\n 'array': true,\n 'default': [null]\n }, {\n 'name': 'fields',\n 'type': 'field',\n 'null': true,\n 'array': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'null': true,\n 'array': true\n }, {\n 'name': 'drop',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'cross',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'key',\n 'type': 'field'\n }]\n};\ninherits(Aggregate, Transform, {\n transform(_, pulse) {\n const aggr = this,\n out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n mod = _.modified();\n aggr.stamp = out.stamp;\n if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) {\n aggr._prev = aggr.value;\n aggr.value = mod ? aggr.init(_) : Object.create(null);\n pulse.visit(pulse.SOURCE, t => aggr.add(t));\n } else {\n aggr.value = aggr.value || aggr.init(_);\n pulse.visit(pulse.REM, t => aggr.rem(t));\n pulse.visit(pulse.ADD, t => aggr.add(t));\n }\n\n // Indicate output fields and return aggregate tuples.\n out.modifies(aggr._outputs);\n\n // Should empty cells be dropped?\n aggr._drop = _.drop !== false;\n\n // If domain cross-product requested, generate empty cells as needed\n // and ensure that empty cells are not dropped\n if (_.cross && aggr._dims.length > 1) {\n aggr._drop = false;\n aggr.cross();\n }\n if (pulse.clean() && aggr._drop) {\n out.clean(true).runAfter(() => this.clean());\n }\n return aggr.changes(out);\n },\n cross() {\n const aggr = this,\n curr = aggr.value,\n dims = aggr._dnames,\n vals = dims.map(() => ({})),\n n = dims.length;\n\n // collect all group-by domain values\n function collect(cells) {\n let key, i, t, v;\n for (key in cells) {\n t = cells[key].tuple;\n for (i = 0; i < n; ++i) {\n vals[i][v = t[dims[i]]] = v;\n }\n }\n }\n collect(aggr._prev);\n collect(curr);\n\n // iterate over key cross-product, create cells as needed\n function generate(base, tuple, index) {\n const name = dims[index],\n v = vals[index++];\n for (const k in v) {\n const key = base ? base + '|' + k : k;\n tuple[name] = v[k];\n if (index < n) generate(key, tuple, index);else if (!curr[key]) aggr.cell(key, tuple);\n }\n }\n generate('', {}, 0);\n },\n init(_) {\n // initialize input and output fields\n const inputs = this._inputs = [],\n outputs = this._outputs = [],\n inputMap = {};\n function inputVisit(get) {\n const fields = array(accessorFields(get)),\n n = fields.length;\n let i = 0,\n f;\n for (; i < n; ++i) {\n if (!inputMap[f = fields[i]]) {\n inputMap[f] = 1;\n inputs.push(f);\n }\n }\n }\n\n // initialize group-by dimensions\n this._dims = array(_.groupby);\n this._dnames = this._dims.map(d => {\n const dname = accessorName(d);\n inputVisit(d);\n outputs.push(dname);\n return dname;\n });\n this.cellkey = _.key ? _.key : groupkey(this._dims);\n\n // initialize aggregate measures\n this._countOnly = true;\n this._counts = [];\n this._measures = [];\n const fields = _.fields || [null],\n ops = _.ops || ['count'],\n aggregate_params = _.aggregate_params || [null],\n as = _.as || [],\n n = fields.length,\n map = {};\n let field, op, aggregate_param, m, mname, outname, i;\n if (n !== ops.length) {\n error('Unmatched number of fields and aggregate ops.');\n }\n for (i = 0; i < n; ++i) {\n field = fields[i];\n op = ops[i];\n aggregate_param = aggregate_params[i] || null;\n if (field == null && op !== 'count') {\n error('Null aggregate field specified.');\n }\n mname = accessorName(field);\n outname = measureName(op, mname, as[i]);\n outputs.push(outname);\n if (op === 'count') {\n this._counts.push(outname);\n continue;\n }\n m = map[mname];\n if (!m) {\n inputVisit(field);\n m = map[mname] = [];\n m.field = field;\n this._measures.push(m);\n }\n if (op !== 'count') this._countOnly = false;\n m.push(createMeasure(op, aggregate_param, outname));\n }\n this._measures = this._measures.map(m => compileMeasures(m, m.field));\n return Object.create(null); // aggregation cells (this.value)\n },\n\n // -- Cell Management -----\n\n cellkey: groupkey(),\n cell(key, t) {\n let cell = this.value[key];\n if (!cell) {\n cell = this.value[key] = this.newcell(key, t);\n this._adds[this._alen++] = cell;\n } else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) {\n cell.stamp = this.stamp;\n this._adds[this._alen++] = cell;\n } else if (cell.stamp < this.stamp) {\n cell.stamp = this.stamp;\n this._mods[this._mlen++] = cell;\n }\n return cell;\n },\n newcell(key, t) {\n const cell = {\n key: key,\n num: 0,\n agg: null,\n tuple: this.newtuple(t, this._prev && this._prev[key]),\n stamp: this.stamp,\n store: false\n };\n if (!this._countOnly) {\n const measures = this._measures,\n n = measures.length;\n cell.agg = Array(n);\n for (let i = 0; i < n; ++i) {\n cell.agg[i] = new measures[i](cell);\n }\n }\n if (cell.store) {\n cell.data = new TupleStore();\n }\n return cell;\n },\n newtuple(t, p) {\n const names = this._dnames,\n dims = this._dims,\n n = dims.length,\n x = {};\n for (let i = 0; i < n; ++i) {\n x[names[i]] = dims[i](t);\n }\n return p ? replace(p.tuple, x) : ingest(x);\n },\n clean() {\n const cells = this.value;\n for (const key in cells) {\n if (cells[key].num === 0) {\n delete cells[key];\n }\n }\n },\n // -- Process Tuples -----\n\n add(t) {\n const key = this.cellkey(t),\n cell = this.cell(key, t);\n cell.num += 1;\n if (this._countOnly) return;\n if (cell.store) cell.data.add(t);\n const agg = cell.agg;\n for (let i = 0, n = agg.length; i < n; ++i) {\n agg[i].add(agg[i].get(t), t);\n }\n },\n rem(t) {\n const key = this.cellkey(t),\n cell = this.cell(key, t);\n cell.num -= 1;\n if (this._countOnly) return;\n if (cell.store) cell.data.rem(t);\n const agg = cell.agg;\n for (let i = 0, n = agg.length; i < n; ++i) {\n agg[i].rem(agg[i].get(t), t);\n }\n },\n celltuple(cell) {\n const tuple = cell.tuple,\n counts = this._counts;\n\n // consolidate stored values\n if (cell.store) {\n cell.data.values();\n }\n\n // update tuple properties\n for (let i = 0, n = counts.length; i < n; ++i) {\n tuple[counts[i]] = cell.num;\n }\n if (!this._countOnly) {\n const agg = cell.agg;\n for (let i = 0, n = agg.length; i < n; ++i) {\n agg[i].set(tuple);\n }\n }\n return tuple;\n },\n changes(out) {\n const adds = this._adds,\n mods = this._mods,\n prev = this._prev,\n drop = this._drop,\n add = out.add,\n rem = out.rem,\n mod = out.mod;\n let cell, key, i, n;\n if (prev) for (key in prev) {\n cell = prev[key];\n if (!drop || cell.num) rem.push(cell.tuple);\n }\n for (i = 0, n = this._alen; i < n; ++i) {\n add.push(this.celltuple(adds[i]));\n adds[i] = null; // for garbage collection\n }\n\n for (i = 0, n = this._mlen; i < n; ++i) {\n cell = mods[i];\n (cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell));\n mods[i] = null; // for garbage collection\n }\n\n this._alen = this._mlen = 0; // reset list of active cells\n this._prev = null;\n return out;\n }\n});\n\n// epsilon bias to offset floating point error (#1737)\nconst EPSILON$1 = 1e-14;\n\n/**\n * Generates a binning function for discretizing data.\n * @constructor\n * @param {object} params - The parameters for this operator. The\n * provided values should be valid options for the {@link bin} function.\n * @param {function(object): *} params.field - The data field to bin.\n */\nfunction Bin(params) {\n Transform.call(this, null, params);\n}\nBin.Definition = {\n 'type': 'Bin',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'interval',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'anchor',\n 'type': 'number'\n }, {\n 'name': 'maxbins',\n 'type': 'number',\n 'default': 20\n }, {\n 'name': 'base',\n 'type': 'number',\n 'default': 10\n }, {\n 'name': 'divide',\n 'type': 'number',\n 'array': true,\n 'default': [5, 2]\n }, {\n 'name': 'extent',\n 'type': 'number',\n 'array': true,\n 'length': 2,\n 'required': true\n }, {\n 'name': 'span',\n 'type': 'number'\n }, {\n 'name': 'step',\n 'type': 'number'\n }, {\n 'name': 'steps',\n 'type': 'number',\n 'array': true\n }, {\n 'name': 'minstep',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'nice',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'name',\n 'type': 'string'\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['bin0', 'bin1']\n }]\n};\ninherits(Bin, Transform, {\n transform(_, pulse) {\n const band = _.interval !== false,\n bins = this._bins(_),\n start = bins.start,\n step = bins.step,\n as = _.as || ['bin0', 'bin1'],\n b0 = as[0],\n b1 = as[1];\n let flag;\n if (_.modified()) {\n pulse = pulse.reflow(true);\n flag = pulse.SOURCE;\n } else {\n flag = pulse.modified(accessorFields(_.field)) ? pulse.ADD_MOD : pulse.ADD;\n }\n pulse.visit(flag, band ? t => {\n const v = bins(t);\n // minimum bin value (inclusive)\n t[b0] = v;\n // maximum bin value (exclusive)\n // use convoluted math for better floating point agreement\n // see https://github.com/vega/vega/issues/830\n // infinite values propagate through this formula! #2227\n t[b1] = v == null ? null : start + step * (1 + (v - start) / step);\n } : t => t[b0] = bins(t));\n return pulse.modifies(band ? as : b0);\n },\n _bins(_) {\n if (this.value && !_.modified()) {\n return this.value;\n }\n const field = _.field,\n bins = bin(_),\n step = bins.step;\n let start = bins.start,\n stop = start + Math.ceil((bins.stop - start) / step) * step,\n a,\n d;\n if ((a = _.anchor) != null) {\n d = a - (start + step * Math.floor((a - start) / step));\n start += d;\n stop += d;\n }\n const f = function (t) {\n let v = toNumber(field(t));\n return v == null ? null : v < start ? -Infinity : v > stop ? +Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON$1 + (v - start) / step));\n };\n f.start = start;\n f.stop = bins.stop;\n f.step = step;\n return this.value = accessor(f, accessorFields(field), _.name || 'bin_' + accessorName(field));\n }\n});\n\nfunction SortedList (idFunc, source, input) {\n const $ = idFunc;\n let data = source || [],\n add = input || [],\n rem = {},\n cnt = 0;\n return {\n add: t => add.push(t),\n remove: t => rem[$(t)] = ++cnt,\n size: () => data.length,\n data: (compare, resort) => {\n if (cnt) {\n data = data.filter(t => !rem[$(t)]);\n rem = {};\n cnt = 0;\n }\n if (resort && compare) {\n data.sort(compare);\n }\n if (add.length) {\n data = compare ? merge(compare, data, add.sort(compare)) : data.concat(add);\n add = [];\n }\n return data;\n }\n };\n}\n\n/**\n * Collects all data tuples that pass through this operator.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(*,*): number} [params.sort] - An optional\n * comparator function for additionally sorting the collected tuples.\n */\nfunction Collect(params) {\n Transform.call(this, [], params);\n}\nCollect.Definition = {\n 'type': 'Collect',\n 'metadata': {\n 'source': true\n },\n 'params': [{\n 'name': 'sort',\n 'type': 'compare'\n }]\n};\ninherits(Collect, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.ALL),\n list = SortedList(tupleid, this.value, out.materialize(out.ADD).add),\n sort = _.sort,\n mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields));\n out.visit(out.REM, list.remove);\n this.modified(mod);\n this.value = out.source = list.data(stableCompare(sort), mod);\n\n // propagate tree root if defined\n if (pulse.source && pulse.source.root) {\n this.value.root = pulse.source.root;\n }\n return out;\n }\n});\n\n/**\n * Generates a comparator function.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.fields - The fields to compare.\n * @param {Array} [params.orders] - The sort orders.\n * Each entry should be one of \"ascending\" (default) or \"descending\".\n */\nfunction Compare(params) {\n Operator.call(this, null, update$5, params);\n}\ninherits(Compare, Operator);\nfunction update$5(_) {\n return this.value && !_.modified() ? this.value : compare(_.fields, _.orders);\n}\n\n/**\n * Count regexp-defined pattern occurrences in a text field.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - An accessor for the text field.\n * @param {string} [params.pattern] - RegExp string defining the text pattern.\n * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case.\n * @param {string} [params.stopwords] - RegExp string of words to ignore.\n */\nfunction CountPattern(params) {\n Transform.call(this, null, params);\n}\nCountPattern.Definition = {\n 'type': 'CountPattern',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'case',\n 'type': 'enum',\n 'values': ['upper', 'lower', 'mixed'],\n 'default': 'mixed'\n }, {\n 'name': 'pattern',\n 'type': 'string',\n 'default': '[\\\\w\"]+'\n }, {\n 'name': 'stopwords',\n 'type': 'string',\n 'default': ''\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['text', 'count']\n }]\n};\nfunction tokenize(text, tcase, match) {\n switch (tcase) {\n case 'upper':\n text = text.toUpperCase();\n break;\n case 'lower':\n text = text.toLowerCase();\n break;\n }\n return text.match(match);\n}\ninherits(CountPattern, Transform, {\n transform(_, pulse) {\n const process = update => tuple => {\n var tokens = tokenize(get(tuple), _.case, match) || [],\n t;\n for (var i = 0, n = tokens.length; i < n; ++i) {\n if (!stop.test(t = tokens[i])) update(t);\n }\n };\n const init = this._parameterCheck(_, pulse),\n counts = this._counts,\n match = this._match,\n stop = this._stop,\n get = _.field,\n as = _.as || ['text', 'count'],\n add = process(t => counts[t] = 1 + (counts[t] || 0)),\n rem = process(t => counts[t] -= 1);\n if (init) {\n pulse.visit(pulse.SOURCE, add);\n } else {\n pulse.visit(pulse.ADD, add);\n pulse.visit(pulse.REM, rem);\n }\n return this._finish(pulse, as); // generate output tuples\n },\n\n _parameterCheck(_, pulse) {\n let init = false;\n if (_.modified('stopwords') || !this._stop) {\n this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i');\n init = true;\n }\n if (_.modified('pattern') || !this._match) {\n this._match = new RegExp(_.pattern || '[\\\\w\\']+', 'g');\n init = true;\n }\n if (_.modified('field') || pulse.modified(_.field.fields)) {\n init = true;\n }\n if (init) this._counts = {};\n return init;\n },\n _finish(pulse, as) {\n const counts = this._counts,\n tuples = this._tuples || (this._tuples = {}),\n text = as[0],\n count = as[1],\n out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n let w, t, c;\n for (w in counts) {\n t = tuples[w];\n c = counts[w] || 0;\n if (!t && c) {\n tuples[w] = t = ingest({});\n t[text] = w;\n t[count] = c;\n out.add.push(t);\n } else if (c === 0) {\n if (t) out.rem.push(t);\n counts[w] = null;\n tuples[w] = null;\n } else if (t[count] !== c) {\n t[count] = c;\n out.mod.push(t);\n }\n }\n return out.modifies(as);\n }\n});\n\n/**\n * Perform a cross-product of a tuple stream with itself.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object):boolean} [params.filter] - An optional filter\n * function for selectively including tuples in the cross product.\n * @param {Array} [params.as] - The names of the output fields.\n */\nfunction Cross(params) {\n Transform.call(this, null, params);\n}\nCross.Definition = {\n 'type': 'Cross',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'filter',\n 'type': 'expr'\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['a', 'b']\n }]\n};\ninherits(Cross, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE),\n as = _.as || ['a', 'b'],\n a = as[0],\n b = as[1],\n reset = !this.value || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter');\n let data = this.value;\n if (reset) {\n if (data) out.rem = data;\n data = pulse.materialize(pulse.SOURCE).source;\n out.add = this.value = cross(data, a, b, _.filter || truthy);\n } else {\n out.mod = data;\n }\n out.source = this.value;\n return out.modifies(as);\n }\n});\nfunction cross(input, a, b, filter) {\n var data = [],\n t = {},\n n = input.length,\n i = 0,\n j,\n left;\n for (; i < n; ++i) {\n t[a] = left = input[i];\n for (j = 0; j < n; ++j) {\n t[b] = input[j];\n if (filter(t)) {\n data.push(ingest(t));\n t = {};\n t[a] = left;\n }\n }\n }\n return data;\n}\n\nconst Distributions = {\n kde: randomKDE,\n mixture: randomMixture,\n normal: randomNormal,\n lognormal: randomLogNormal,\n uniform: randomUniform\n};\nconst DISTRIBUTIONS = 'distributions',\n FUNCTION = 'function',\n FIELD = 'field';\n\n/**\n * Parse a parameter object for a probability distribution.\n * @param {object} def - The distribution parameter object.\n * @param {function():Array} - A method for requesting\n * source data. Used for distributions (such as KDE) that\n * require sample data points. This method will only be\n * invoked if the 'from' parameter for a target data source\n * is not provided. Typically this method returns backing\n * source data for a Pulse object.\n * @return {object} - The output distribution object.\n */\nfunction parse(def, data) {\n const func = def[FUNCTION];\n if (!hasOwnProperty(Distributions, func)) {\n error('Unknown distribution function: ' + func);\n }\n const d = Distributions[func]();\n for (const name in def) {\n // if data field, extract values\n if (name === FIELD) {\n d.data((def.from || data()).map(def[name]));\n }\n\n // if distribution mixture, recurse to parse each definition\n else if (name === DISTRIBUTIONS) {\n d[name](def[name].map(_ => parse(_, data)));\n }\n\n // otherwise, simply set the parameter\n else if (typeof d[name] === FUNCTION) {\n d[name](def[name]);\n }\n }\n return d;\n}\n\n/**\n * Grid sample points for a probability density. Given a distribution and\n * a sampling extent, will generate points suitable for plotting either\n * PDF (probability density function) or CDF (cumulative distribution\n * function) curves.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {object} params.distribution - The probability distribution. This\n * is an object parameter dependent on the distribution type.\n * @param {string} [params.method='pdf'] - The distribution method to sample.\n * One of 'pdf' or 'cdf'.\n * @param {Array} [params.extent] - The [min, max] extent over which\n * to sample the distribution. This argument is required in most cases, but\n * can be omitted if the distribution (e.g., 'kde') supports a 'data' method\n * that returns numerical sample points from which the extent can be deduced.\n * @param {number} [params.minsteps=25] - The minimum number of curve samples\n * for plotting the density.\n * @param {number} [params.maxsteps=200] - The maximum number of curve samples\n * for plotting the density.\n * @param {number} [params.steps] - The exact number of curve samples for\n * plotting the density. If specified, overrides both minsteps and maxsteps\n * to set an exact number of uniform samples. Useful in conjunction with\n * a fixed extent to ensure consistent sample points for stacked densities.\n */\nfunction Density(params) {\n Transform.call(this, null, params);\n}\nconst distributions = [{\n 'key': {\n 'function': 'normal'\n },\n 'params': [{\n 'name': 'mean',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'stdev',\n 'type': 'number',\n 'default': 1\n }]\n}, {\n 'key': {\n 'function': 'lognormal'\n },\n 'params': [{\n 'name': 'mean',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'stdev',\n 'type': 'number',\n 'default': 1\n }]\n}, {\n 'key': {\n 'function': 'uniform'\n },\n 'params': [{\n 'name': 'min',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'max',\n 'type': 'number',\n 'default': 1\n }]\n}, {\n 'key': {\n 'function': 'kde'\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'from',\n 'type': 'data'\n }, {\n 'name': 'bandwidth',\n 'type': 'number',\n 'default': 0\n }]\n}];\nconst mixture = {\n 'key': {\n 'function': 'mixture'\n },\n 'params': [{\n 'name': 'distributions',\n 'type': 'param',\n 'array': true,\n 'params': distributions\n }, {\n 'name': 'weights',\n 'type': 'number',\n 'array': true\n }]\n};\nDensity.Definition = {\n 'type': 'Density',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'extent',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'steps',\n 'type': 'number'\n }, {\n 'name': 'minsteps',\n 'type': 'number',\n 'default': 25\n }, {\n 'name': 'maxsteps',\n 'type': 'number',\n 'default': 200\n }, {\n 'name': 'method',\n 'type': 'string',\n 'default': 'pdf',\n 'values': ['pdf', 'cdf']\n }, {\n 'name': 'distribution',\n 'type': 'param',\n 'params': distributions.concat(mixture)\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'default': ['value', 'density']\n }]\n};\ninherits(Density, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n if (!this.value || pulse.changed() || _.modified()) {\n const dist = parse(_.distribution, source(pulse)),\n minsteps = _.steps || _.minsteps || 25,\n maxsteps = _.steps || _.maxsteps || 200;\n let method = _.method || 'pdf';\n if (method !== 'pdf' && method !== 'cdf') {\n error('Invalid density method: ' + method);\n }\n if (!_.extent && !dist.data) {\n error('Missing density extent parameter.');\n }\n method = dist[method];\n const as = _.as || ['value', 'density'],\n domain = _.extent || extent(dist.data()),\n values = sampleCurve(method, domain, minsteps, maxsteps).map(v => {\n const tuple = {};\n tuple[as[0]] = v[0];\n tuple[as[1]] = v[1];\n return ingest(tuple);\n });\n if (this.value) out.rem = this.value;\n this.value = out.add = out.source = values;\n }\n return out;\n }\n});\nfunction source(pulse) {\n return () => pulse.materialize(pulse.SOURCE).source;\n}\n\n// use either provided alias or accessor field name\nfunction fieldNames(fields, as) {\n if (!fields) return null;\n return fields.map((f, i) => as[i] || accessorName(f));\n}\nfunction partition$1(data, groupby, field) {\n const groups = [],\n get = f => f(t);\n let map, i, n, t, k, g;\n\n // partition data points into groups\n if (groupby == null) {\n groups.push(data.map(field));\n } else {\n for (map = {}, i = 0, n = data.length; i < n; ++i) {\n t = data[i];\n k = groupby.map(get);\n g = map[k];\n if (!g) {\n map[k] = g = [];\n g.dims = k;\n groups.push(g);\n }\n g.push(field(t));\n }\n }\n return groups;\n}\n\nconst Output = 'bin';\n\n/**\n * Dot density binning for dot plot construction.\n * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999.\n * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to bin.\n * @param {Array} [params.groupby] - An array of accessors to groupby.\n * @param {number} [params.step] - The step size (bin width) within which dots should be\n * stacked. Defaults to 1/30 of the extent of the data *field*.\n * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density\n * stacks should be smoothed to reduce variance.\n */\nfunction DotBin(params) {\n Transform.call(this, null, params);\n}\nDotBin.Definition = {\n 'type': 'DotBin',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'step',\n 'type': 'number'\n }, {\n 'name': 'smooth',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': Output\n }]\n};\nconst autostep = (data, field) => span(extent(data, field)) / 30;\ninherits(DotBin, Transform, {\n transform(_, pulse) {\n if (this.value && !(_.modified() || pulse.changed())) {\n return pulse; // early exit\n }\n\n const source = pulse.materialize(pulse.SOURCE).source,\n groups = partition$1(pulse.source, _.groupby, identity),\n smooth = _.smooth || false,\n field = _.field,\n step = _.step || autostep(source, field),\n sort = stableCompare((a, b) => field(a) - field(b)),\n as = _.as || Output,\n n = groups.length;\n\n // compute dotplot bins per group\n let min = Infinity,\n max = -Infinity,\n i = 0,\n j;\n for (; i < n; ++i) {\n const g = groups[i].sort(sort);\n j = -1;\n for (const v of dotbin(g, step, smooth, field)) {\n if (v < min) min = v;\n if (v > max) max = v;\n g[++j][as] = v;\n }\n }\n this.value = {\n start: min,\n stop: max,\n step: step\n };\n return pulse.reflow(true).modifies(as);\n }\n});\n\n/**\n * Wraps an expression function with access to external parameters.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function} params.expr - The expression function. The\n * function should accept both a datum and a parameter object.\n * This operator's value will be a new function that wraps the\n * expression function with access to this operator's parameters.\n */\nfunction Expression(params) {\n Operator.call(this, null, update$4, params);\n this.modified(true);\n}\ninherits(Expression, Operator);\nfunction update$4(_) {\n const expr = _.expr;\n return this.value && !_.modified('expr') ? this.value : accessor(datum => expr(datum, _), accessorFields(expr), accessorName(expr));\n}\n\n/**\n * Computes extents (min/max) for a data field.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The field over which to compute extends.\n */\nfunction Extent(params) {\n Transform.call(this, [undefined, undefined], params);\n}\nExtent.Definition = {\n 'type': 'Extent',\n 'metadata': {},\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }]\n};\ninherits(Extent, Transform, {\n transform(_, pulse) {\n const extent = this.value,\n field = _.field,\n mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field');\n let min = extent[0],\n max = extent[1];\n if (mod || min == null) {\n min = +Infinity;\n max = -Infinity;\n }\n pulse.visit(mod ? pulse.SOURCE : pulse.ADD, t => {\n const v = toNumber(field(t));\n if (v != null) {\n // NaNs will fail all comparisons!\n if (v < min) min = v;\n if (v > max) max = v;\n }\n });\n if (!Number.isFinite(min) || !Number.isFinite(max)) {\n let name = accessorName(field);\n if (name) name = ` for field \"${name}\"`;\n pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`);\n min = max = undefined;\n }\n this.value = [min, max];\n }\n});\n\n/**\n * Provides a bridge between a parent transform and a target subflow that\n * consumes only a subset of the tuples that pass through the parent.\n * @constructor\n * @param {Pulse} pulse - A pulse to use as the value of this operator.\n * @param {Transform} parent - The parent transform (typically a Facet instance).\n */\nfunction Subflow(pulse, parent) {\n Operator.call(this, pulse);\n this.parent = parent;\n this.count = 0;\n}\ninherits(Subflow, Operator, {\n /**\n * Routes pulses from this subflow to a target transform.\n * @param {Transform} target - A transform that receives the subflow of tuples.\n */\n connect(target) {\n this.detachSubflow = target.detachSubflow;\n this.targets().add(target);\n return target.source = this;\n },\n /**\n * Add an 'add' tuple to the subflow pulse.\n * @param {Tuple} t - The tuple being added.\n */\n add(t) {\n this.count += 1;\n this.value.add.push(t);\n },\n /**\n * Add a 'rem' tuple to the subflow pulse.\n * @param {Tuple} t - The tuple being removed.\n */\n rem(t) {\n this.count -= 1;\n this.value.rem.push(t);\n },\n /**\n * Add a 'mod' tuple to the subflow pulse.\n * @param {Tuple} t - The tuple being modified.\n */\n mod(t) {\n this.value.mod.push(t);\n },\n /**\n * Re-initialize this operator's pulse value.\n * @param {Pulse} pulse - The pulse to copy from.\n * @see Pulse.init\n */\n init(pulse) {\n this.value.init(pulse, pulse.NO_SOURCE);\n },\n /**\n * Evaluate this operator. This method overrides the\n * default behavior to simply return the contained pulse value.\n * @return {Pulse}\n */\n evaluate() {\n // assert: this.value.stamp === pulse.stamp\n return this.value;\n }\n});\n\n/**\n * Facets a dataflow into a set of subflows based on a key.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(Dataflow, string): Operator} params.subflow - A function\n * that generates a subflow of operators and returns its root operator.\n * @param {function(object): *} params.key - The key field to facet by.\n */\nfunction Facet(params) {\n Transform.call(this, {}, params);\n this._keys = fastmap(); // cache previously calculated key values\n\n // keep track of active subflows, use as targets array for listeners\n // this allows us to limit propagation to only updated subflows\n const a = this._targets = [];\n a.active = 0;\n a.forEach = f => {\n for (let i = 0, n = a.active; i < n; ++i) {\n f(a[i], i, a);\n }\n };\n}\ninherits(Facet, Transform, {\n activate(flow) {\n this._targets[this._targets.active++] = flow;\n },\n // parent argument provided by PreFacet subclass\n subflow(key, flow, pulse, parent) {\n const flows = this.value;\n let sf = hasOwnProperty(flows, key) && flows[key],\n df,\n p;\n if (!sf) {\n p = parent || (p = this._group[key]) && p.tuple;\n df = pulse.dataflow;\n sf = new Subflow(pulse.fork(pulse.NO_SOURCE), this);\n df.add(sf).connect(flow(df, key, p));\n flows[key] = sf;\n this.activate(sf);\n } else if (sf.value.stamp < pulse.stamp) {\n sf.init(pulse);\n this.activate(sf);\n }\n return sf;\n },\n clean() {\n const flows = this.value;\n let detached = 0;\n for (const key in flows) {\n if (flows[key].count === 0) {\n const detach = flows[key].detachSubflow;\n if (detach) detach();\n delete flows[key];\n ++detached;\n }\n }\n\n // remove inactive targets from the active targets array\n if (detached) {\n const active = this._targets.filter(sf => sf && sf.count > 0);\n this.initTargets(active);\n }\n },\n initTargets(act) {\n const a = this._targets,\n n = a.length,\n m = act ? act.length : 0;\n let i = 0;\n for (; i < m; ++i) {\n a[i] = act[i];\n }\n for (; i < n && a[i] != null; ++i) {\n a[i] = null; // ensure old flows can be garbage collected\n }\n\n a.active = m;\n },\n transform(_, pulse) {\n const df = pulse.dataflow,\n key = _.key,\n flow = _.subflow,\n cache = this._keys,\n rekey = _.modified('key'),\n subflow = key => this.subflow(key, flow, pulse);\n this._group = _.group || {};\n this.initTargets(); // reset list of active subflows\n\n pulse.visit(pulse.REM, t => {\n const id = tupleid(t),\n k = cache.get(id);\n if (k !== undefined) {\n cache.delete(id);\n subflow(k).rem(t);\n }\n });\n pulse.visit(pulse.ADD, t => {\n const k = key(t);\n cache.set(tupleid(t), k);\n subflow(k).add(t);\n });\n if (rekey || pulse.modified(key.fields)) {\n pulse.visit(pulse.MOD, t => {\n const id = tupleid(t),\n k0 = cache.get(id),\n k1 = key(t);\n if (k0 === k1) {\n subflow(k1).mod(t);\n } else {\n cache.set(id, k1);\n subflow(k0).rem(t);\n subflow(k1).add(t);\n }\n });\n } else if (pulse.changed(pulse.MOD)) {\n pulse.visit(pulse.MOD, t => {\n subflow(cache.get(tupleid(t))).mod(t);\n });\n }\n if (rekey) {\n pulse.visit(pulse.REFLOW, t => {\n const id = tupleid(t),\n k0 = cache.get(id),\n k1 = key(t);\n if (k0 !== k1) {\n cache.set(id, k1);\n subflow(k0).rem(t);\n subflow(k1).add(t);\n }\n });\n }\n if (pulse.clean()) {\n df.runAfter(() => {\n this.clean();\n cache.clean();\n });\n } else if (cache.empty > df.cleanThreshold) {\n df.runAfter(cache.clean);\n }\n return pulse;\n }\n});\n\n/**\n * Generates one or more field accessor functions.\n * If the 'name' parameter is an array, an array of field accessors\n * will be created and the 'as' parameter will be ignored.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {string} params.name - The field name(s) to access.\n * @param {string} params.as - The accessor function name.\n */\nfunction Field(params) {\n Operator.call(this, null, update$3, params);\n}\ninherits(Field, Operator);\nfunction update$3(_) {\n return this.value && !_.modified() ? this.value : isArray(_.name) ? array(_.name).map(f => field(f)) : field(_.name, _.as);\n}\n\n/**\n * Filters data tuples according to a predicate function.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.expr - The predicate expression function\n * that determines a tuple's filter status. Truthy values pass the filter.\n */\nfunction Filter(params) {\n Transform.call(this, fastmap(), params);\n}\nFilter.Definition = {\n 'type': 'Filter',\n 'metadata': {\n 'changes': true\n },\n 'params': [{\n 'name': 'expr',\n 'type': 'expr',\n 'required': true\n }]\n};\ninherits(Filter, Transform, {\n transform(_, pulse) {\n const df = pulse.dataflow,\n cache = this.value,\n // cache ids of filtered tuples\n output = pulse.fork(),\n add = output.add,\n rem = output.rem,\n mod = output.mod,\n test = _.expr;\n let isMod = true;\n pulse.visit(pulse.REM, t => {\n const id = tupleid(t);\n if (!cache.has(id)) rem.push(t);else cache.delete(id);\n });\n pulse.visit(pulse.ADD, t => {\n if (test(t, _)) add.push(t);else cache.set(tupleid(t), 1);\n });\n function revisit(t) {\n const id = tupleid(t),\n b = test(t, _),\n s = cache.get(id);\n if (b && s) {\n cache.delete(id);\n add.push(t);\n } else if (!b && !s) {\n cache.set(id, 1);\n rem.push(t);\n } else if (isMod && b && !s) {\n mod.push(t);\n }\n }\n pulse.visit(pulse.MOD, revisit);\n if (_.modified()) {\n isMod = false;\n pulse.visit(pulse.REFLOW, revisit);\n }\n if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean);\n return output;\n }\n});\n\n/**\n * Flattens array-typed field values into new data objects.\n * If multiple fields are specified, they are treated as parallel arrays,\n * with output values included for each matching index (or null if missing).\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.fields - An array of field\n * accessors for the tuple fields that should be flattened.\n * @param {string} [params.index] - Optional output field name for index\n * value. If unspecified, no index field is included in the output.\n * @param {Array} [params.as] - Output field names for flattened\n * array fields. Any unspecified fields will use the field name provided\n * by the fields accessors.\n */\nfunction Flatten(params) {\n Transform.call(this, [], params);\n}\nFlatten.Definition = {\n 'type': 'Flatten',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'required': true\n }, {\n 'name': 'index',\n 'type': 'string'\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true\n }]\n};\ninherits(Flatten, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE),\n fields = _.fields,\n as = fieldNames(fields, _.as || []),\n index = _.index || null,\n m = as.length;\n\n // remove any previous results\n out.rem = this.value;\n\n // generate flattened tuples\n pulse.visit(pulse.SOURCE, t => {\n const arrays = fields.map(f => f(t)),\n maxlen = arrays.reduce((l, a) => Math.max(l, a.length), 0);\n let i = 0,\n j,\n d,\n v;\n for (; i < maxlen; ++i) {\n d = derive(t);\n for (j = 0; j < m; ++j) {\n d[as[j]] = (v = arrays[j][i]) == null ? null : v;\n }\n if (index) {\n d[index] = i;\n }\n out.add.push(d);\n }\n });\n this.value = out.source = out.add;\n if (index) out.modifies(index);\n return out.modifies(as);\n }\n});\n\n/**\n * Folds one more tuple fields into multiple tuples in which the field\n * name and values are available under new 'key' and 'value' fields.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.fields - An array of field accessors\n * for the tuple fields that should be folded.\n * @param {Array} [params.as] - Output field names for folded key\n * and value fields, defaults to ['key', 'value'].\n */\nfunction Fold(params) {\n Transform.call(this, [], params);\n}\nFold.Definition = {\n 'type': 'Fold',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'required': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['key', 'value']\n }]\n};\ninherits(Fold, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE),\n fields = _.fields,\n fnames = fields.map(accessorName),\n as = _.as || ['key', 'value'],\n k = as[0],\n v = as[1],\n n = fields.length;\n out.rem = this.value;\n pulse.visit(pulse.SOURCE, t => {\n for (let i = 0, d; i < n; ++i) {\n d = derive(t);\n d[k] = fnames[i];\n d[v] = fields[i](t);\n out.add.push(d);\n }\n });\n this.value = out.source = out.add;\n return out.modifies(as);\n }\n});\n\n/**\n * Invokes a function for each data tuple and saves the results as a new field.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.expr - The formula function to invoke for each tuple.\n * @param {string} params.as - The field name under which to save the result.\n * @param {boolean} [params.initonly=false] - If true, the formula is applied to\n * added tuples only, and does not update in response to modifications.\n */\nfunction Formula(params) {\n Transform.call(this, null, params);\n}\nFormula.Definition = {\n 'type': 'Formula',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'expr',\n 'type': 'expr',\n 'required': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'required': true\n }, {\n 'name': 'initonly',\n 'type': 'boolean'\n }]\n};\ninherits(Formula, Transform, {\n transform(_, pulse) {\n const func = _.expr,\n as = _.as,\n mod = _.modified(),\n flag = _.initonly ? pulse.ADD : mod ? pulse.SOURCE : pulse.modified(func.fields) || pulse.modified(as) ? pulse.ADD_MOD : pulse.ADD;\n if (mod) {\n // parameters updated, need to reflow\n pulse = pulse.materialize().reflow(true);\n }\n if (!_.initonly) {\n pulse.modifies(as);\n }\n return pulse.visit(flag, t => t[as] = func(t, _));\n }\n});\n\n/**\n * Generates data tuples using a provided generator function.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(Parameters): object} params.generator - A tuple generator\n * function. This function is given the operator parameters as input.\n * Changes to any additional parameters will not trigger re-calculation\n * of previously generated tuples. Only future tuples are affected.\n * @param {number} params.size - The number of tuples to produce.\n */\nfunction Generate(params) {\n Transform.call(this, [], params);\n}\ninherits(Generate, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.ALL),\n gen = _.generator;\n let data = this.value,\n num = _.size - data.length,\n add,\n rem,\n t;\n if (num > 0) {\n // need more tuples, generate and add\n for (add = []; --num >= 0;) {\n add.push(t = ingest(gen(_)));\n data.push(t);\n }\n out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add;\n } else {\n // need fewer tuples, remove\n rem = data.slice(0, -num);\n out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem) : rem;\n data = data.slice(-num);\n }\n out.source = this.value = data;\n return out;\n }\n});\n\nconst Methods = {\n value: 'value',\n median: median,\n mean: mean,\n min: min,\n max: max\n};\nconst Empty = [];\n\n/**\n * Impute missing values.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to impute.\n * @param {Array} [params.groupby] - An array of\n * accessors to determine series within which to perform imputation.\n * @param {function(object): *} params.key - An accessor for a key value.\n * Each key value should be unique within a group. New tuples will be\n * imputed for any key values that are not found within a group.\n * @param {Array<*>} [params.keyvals] - Optional array of required key\n * values. New tuples will be imputed for any key values that are not\n * found within a group. In addition, these values will be automatically\n * augmented with the key values observed in the input data.\n * @param {string} [method='value'] - The imputation method to use. One of\n * 'value', 'mean', 'median', 'max', 'min'.\n * @param {*} [value=0] - The constant value to use for imputation\n * when using method 'value'.\n */\nfunction Impute(params) {\n Transform.call(this, [], params);\n}\nImpute.Definition = {\n 'type': 'Impute',\n 'metadata': {\n 'changes': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'key',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'keyvals',\n 'array': true\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'method',\n 'type': 'enum',\n 'default': 'value',\n 'values': ['value', 'mean', 'median', 'max', 'min']\n }, {\n 'name': 'value',\n 'default': 0\n }]\n};\nfunction getValue(_) {\n var m = _.method || Methods.value,\n v;\n if (Methods[m] == null) {\n error('Unrecognized imputation method: ' + m);\n } else if (m === Methods.value) {\n v = _.value !== undefined ? _.value : 0;\n return () => v;\n } else {\n return Methods[m];\n }\n}\nfunction getField(_) {\n const f = _.field;\n return t => t ? f(t) : NaN;\n}\ninherits(Impute, Transform, {\n transform(_, pulse) {\n var out = pulse.fork(pulse.ALL),\n impute = getValue(_),\n field = getField(_),\n fName = accessorName(_.field),\n kName = accessorName(_.key),\n gNames = (_.groupby || []).map(accessorName),\n groups = partition(pulse.source, _.groupby, _.key, _.keyvals),\n curr = [],\n prev = this.value,\n m = groups.domain.length,\n group,\n value,\n gVals,\n kVal,\n g,\n i,\n j,\n l,\n n,\n t;\n for (g = 0, l = groups.length; g < l; ++g) {\n group = groups[g];\n gVals = group.values;\n value = NaN;\n\n // add tuples for missing values\n for (j = 0; j < m; ++j) {\n if (group[j] != null) continue;\n kVal = groups.domain[j];\n t = {\n _impute: true\n };\n for (i = 0, n = gVals.length; i < n; ++i) t[gNames[i]] = gVals[i];\n t[kName] = kVal;\n t[fName] = Number.isNaN(value) ? value = impute(group, field) : value;\n curr.push(ingest(t));\n }\n }\n\n // update pulse with imputed tuples\n if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr);\n if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev);\n this.value = curr;\n return out;\n }\n});\nfunction partition(data, groupby, key, keyvals) {\n var get = f => f(t),\n groups = [],\n domain = keyvals ? keyvals.slice() : [],\n kMap = {},\n gMap = {},\n gVals,\n gKey,\n group,\n i,\n j,\n k,\n n,\n t;\n domain.forEach((k, i) => kMap[k] = i + 1);\n for (i = 0, n = data.length; i < n; ++i) {\n t = data[i];\n k = key(t);\n j = kMap[k] || (kMap[k] = domain.push(k));\n gKey = (gVals = groupby ? groupby.map(get) : Empty) + '';\n if (!(group = gMap[gKey])) {\n group = gMap[gKey] = [];\n groups.push(group);\n group.values = gVals;\n }\n group[j - 1] = t;\n }\n groups.domain = domain;\n return groups;\n}\n\n/**\n * Extend input tuples with aggregate values.\n * Calcuates aggregate values and joins them with the input stream.\n * @constructor\n */\nfunction JoinAggregate(params) {\n Aggregate.call(this, params);\n}\nJoinAggregate.Definition = {\n 'type': 'JoinAggregate',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'fields',\n 'type': 'field',\n 'null': true,\n 'array': true\n }, {\n 'name': 'ops',\n 'type': 'enum',\n 'array': true,\n 'values': ValidAggregateOps\n }, {\n 'name': 'as',\n 'type': 'string',\n 'null': true,\n 'array': true\n }, {\n 'name': 'key',\n 'type': 'field'\n }]\n};\ninherits(JoinAggregate, Aggregate, {\n transform(_, pulse) {\n const aggr = this,\n mod = _.modified();\n let cells;\n\n // process all input tuples to calculate aggregates\n if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) {\n cells = aggr.value = mod ? aggr.init(_) : {};\n pulse.visit(pulse.SOURCE, t => aggr.add(t));\n } else {\n cells = aggr.value = aggr.value || this.init(_);\n pulse.visit(pulse.REM, t => aggr.rem(t));\n pulse.visit(pulse.ADD, t => aggr.add(t));\n }\n\n // update aggregation cells\n aggr.changes();\n\n // write aggregate values to input tuples\n pulse.visit(pulse.SOURCE, t => {\n extend(t, cells[aggr.cellkey(t)].tuple);\n });\n return pulse.reflow(mod).modifies(this._outputs);\n },\n changes() {\n const adds = this._adds,\n mods = this._mods;\n let i, n;\n for (i = 0, n = this._alen; i < n; ++i) {\n this.celltuple(adds[i]);\n adds[i] = null; // for garbage collection\n }\n\n for (i = 0, n = this._mlen; i < n; ++i) {\n this.celltuple(mods[i]);\n mods[i] = null; // for garbage collection\n }\n\n this._alen = this._mlen = 0; // reset list of active cells\n }\n});\n\n/**\n * Compute kernel density estimates (KDE) for one or more data groups.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} [params.groupby] - An array of accessors\n * to groupby.\n * @param {function(object): *} params.field - An accessor for the data field\n * to estimate.\n * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth.\n * If zero or unspecified, the bandwidth is automatically determined.\n * @param {boolean} [params.counts=false] - A boolean flag indicating if the\n * output values should be probability estimates (false, default) or\n * smoothed counts (true).\n * @param {string} [params.cumulative=false] - A boolean flag indicating if a\n * density (false) or cumulative distribution (true) should be generated.\n * @param {Array} [params.extent] - The domain extent over which to\n * plot the density. If unspecified, the [min, max] data extent is used.\n * @param {string} [params.resolve='independent'] - Indicates how parameters for\n * multiple densities should be resolved. If \"independent\" (the default), each\n * density may have its own domain extent and dynamic number of curve sample\n * steps. If \"shared\", the KDE transform will ensure that all densities are\n * defined over a shared domain and curve steps, enabling stacking.\n * @param {number} [params.minsteps=25] - The minimum number of curve samples\n * for plotting the density.\n * @param {number} [params.maxsteps=200] - The maximum number of curve samples\n * for plotting the density.\n * @param {number} [params.steps] - The exact number of curve samples for\n * plotting the density. If specified, overrides both minsteps and maxsteps\n * to set an exact number of uniform samples. Useful in conjunction with\n * a fixed extent to ensure consistent sample points for stacked densities.\n */\nfunction KDE(params) {\n Transform.call(this, null, params);\n}\nKDE.Definition = {\n 'type': 'KDE',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'cumulative',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'counts',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'bandwidth',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'extent',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'resolve',\n 'type': 'enum',\n 'values': ['shared', 'independent'],\n 'default': 'independent'\n }, {\n 'name': 'steps',\n 'type': 'number'\n }, {\n 'name': 'minsteps',\n 'type': 'number',\n 'default': 25\n }, {\n 'name': 'maxsteps',\n 'type': 'number',\n 'default': 200\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'default': ['value', 'density']\n }]\n};\ninherits(KDE, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n if (!this.value || pulse.changed() || _.modified()) {\n const source = pulse.materialize(pulse.SOURCE).source,\n groups = partition$1(source, _.groupby, _.field),\n names = (_.groupby || []).map(accessorName),\n bandwidth = _.bandwidth,\n method = _.cumulative ? 'cdf' : 'pdf',\n as = _.as || ['value', 'density'],\n values = [];\n let domain = _.extent,\n minsteps = _.steps || _.minsteps || 25,\n maxsteps = _.steps || _.maxsteps || 200;\n if (method !== 'pdf' && method !== 'cdf') {\n error('Invalid density method: ' + method);\n }\n if (_.resolve === 'shared') {\n if (!domain) domain = extent(source, _.field);\n minsteps = maxsteps = _.steps || maxsteps;\n }\n groups.forEach(g => {\n const density = randomKDE(g, bandwidth)[method],\n scale = _.counts ? g.length : 1,\n local = domain || extent(g);\n sampleCurve(density, local, minsteps, maxsteps).forEach(v => {\n const t = {};\n for (let i = 0; i < names.length; ++i) {\n t[names[i]] = g.dims[i];\n }\n t[as[0]] = v[0];\n t[as[1]] = v[1] * scale;\n values.push(ingest(t));\n });\n });\n if (this.value) out.rem = this.value;\n this.value = out.add = out.source = values;\n }\n return out;\n }\n});\n\n/**\n * Generates a key function.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.fields - The field name(s) for the key function.\n * @param {boolean} params.flat - A boolean flag indicating if the field names\n * should be treated as flat property names, side-stepping nested field\n * lookups normally indicated by dot or bracket notation.\n */\nfunction Key(params) {\n Operator.call(this, null, update$2, params);\n}\ninherits(Key, Operator);\nfunction update$2(_) {\n return this.value && !_.modified() ? this.value : key(_.fields, _.flat);\n}\n\n/**\n * Load and parse data from an external source. Marshalls parameter\n * values and then invokes the Dataflow request method.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {string} params.url - The URL to load from.\n * @param {object} params.format - The data format options.\n */\nfunction Load(params) {\n Transform.call(this, [], params);\n this._pending = null;\n}\ninherits(Load, Transform, {\n transform(_, pulse) {\n const df = pulse.dataflow;\n if (this._pending) {\n // update state and return pulse\n return output(this, pulse, this._pending);\n }\n if (stop(_)) return pulse.StopPropagation;\n if (_.values) {\n // parse and ingest values, return output pulse\n return output(this, pulse, df.parse(_.values, _.format));\n } else if (_.async) {\n // return promise for non-blocking async loading\n const p = df.request(_.url, _.format).then(res => {\n this._pending = array(res.data);\n return df => df.touch(this);\n });\n return {\n async: p\n };\n } else {\n // return promise for synchronous loading\n return df.request(_.url, _.format).then(res => output(this, pulse, array(res.data)));\n }\n }\n});\nfunction stop(_) {\n return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format'));\n}\nfunction output(op, pulse, data) {\n data.forEach(ingest);\n const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE);\n out.rem = op.value;\n op.value = out.source = out.add = data;\n op._pending = null;\n if (out.rem.length) out.clean(true);\n return out;\n}\n\n/**\n * Extend tuples by joining them with values from a lookup table.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Map} params.index - The lookup table map.\n * @param {Array} params.as - Output field names for each lookup value.\n * @param {*} [params.default] - A default value to use if lookup fails.\n */\nfunction Lookup(params) {\n Transform.call(this, {}, params);\n}\nLookup.Definition = {\n 'type': 'Lookup',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'index',\n 'type': 'index',\n 'params': [{\n 'name': 'from',\n 'type': 'data',\n 'required': true\n }, {\n 'name': 'key',\n 'type': 'field',\n 'required': true\n }]\n }, {\n 'name': 'values',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'required': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true\n }, {\n 'name': 'default',\n 'default': null\n }]\n};\ninherits(Lookup, Transform, {\n transform(_, pulse) {\n const keys = _.fields,\n index = _.index,\n values = _.values,\n defaultValue = _.default == null ? null : _.default,\n reset = _.modified(),\n n = keys.length;\n let flag = reset ? pulse.SOURCE : pulse.ADD,\n out = pulse,\n as = _.as,\n set,\n m,\n mods;\n if (values) {\n m = values.length;\n if (n > 1 && !as) {\n error('Multi-field lookup requires explicit \"as\" parameter.');\n }\n if (as && as.length !== n * m) {\n error('The \"as\" parameter has too few output field names.');\n }\n as = as || values.map(accessorName);\n set = function (t) {\n for (var i = 0, k = 0, j, v; i < n; ++i) {\n v = index.get(keys[i](t));\n if (v == null) for (j = 0; j < m; ++j, ++k) t[as[k]] = defaultValue;else for (j = 0; j < m; ++j, ++k) t[as[k]] = values[j](v);\n }\n };\n } else {\n if (!as) {\n error('Missing output field names.');\n }\n set = function (t) {\n for (var i = 0, v; i < n; ++i) {\n v = index.get(keys[i](t));\n t[as[i]] = v == null ? defaultValue : v;\n }\n };\n }\n if (reset) {\n out = pulse.reflow(true);\n } else {\n mods = keys.some(k => pulse.modified(k.fields));\n flag |= mods ? pulse.MOD : 0;\n }\n pulse.visit(flag, set);\n return out.modifies(as);\n }\n});\n\n/**\n * Computes global min/max extents over a collection of extents.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array>} params.extents - The input extents.\n */\nfunction MultiExtent(params) {\n Operator.call(this, null, update$1, params);\n}\ninherits(MultiExtent, Operator);\nfunction update$1(_) {\n if (this.value && !_.modified()) {\n return this.value;\n }\n const ext = _.extents,\n n = ext.length;\n let min = +Infinity,\n max = -Infinity,\n i,\n e;\n for (i = 0; i < n; ++i) {\n e = ext[i];\n if (e[0] < min) min = e[0];\n if (e[1] > max) max = e[1];\n }\n return [min, max];\n}\n\n/**\n * Merge a collection of value arrays.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array>} params.values - The input value arrrays.\n */\nfunction MultiValues(params) {\n Operator.call(this, null, update, params);\n}\ninherits(MultiValues, Operator);\nfunction update(_) {\n return this.value && !_.modified() ? this.value : _.values.reduce((data, _) => data.concat(_), []);\n}\n\n/**\n * Operator whose value is simply its parameter hash. This operator is\n * useful for enabling reactive updates to values of nested objects.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction Params(params) {\n Transform.call(this, null, params);\n}\ninherits(Params, Transform, {\n transform(_, pulse) {\n this.modified(_.modified());\n this.value = _;\n return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples\n }\n});\n\n/**\n * Aggregate and pivot selected field values to become new fields.\n * This operator is useful to construction cross-tabulations.\n * @constructor\n * @param {Array} [params.groupby] - An array of accessors\n * to groupby. These fields act just like groupby fields of an Aggregate transform.\n * @param {function(object): *} params.field - The field to pivot on. The unique\n * values of this field become new field names in the output stream.\n * @param {function(object): *} params.value - The field to populate pivoted fields.\n * The aggregate values of this field become the values of the new pivoted fields.\n * @param {string} [params.op] - The aggregation operation for the value field,\n * applied per cell in the output stream. The default is \"sum\".\n * @param {number} [params.limit] - An optional parameter indicating the maximum\n * number of pivoted fields to generate. The pivoted field names are sorted in\n * ascending order prior to enforcing the limit.\n */\nfunction Pivot(params) {\n Aggregate.call(this, params);\n}\nPivot.Definition = {\n 'type': 'Pivot',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'value',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'op',\n 'type': 'enum',\n 'values': ValidAggregateOps,\n 'default': 'sum'\n }, {\n 'name': 'limit',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'key',\n 'type': 'field'\n }]\n};\ninherits(Pivot, Aggregate, {\n _transform: Aggregate.prototype.transform,\n transform(_, pulse) {\n return this._transform(aggregateParams(_, pulse), pulse);\n }\n});\n\n// Shoehorn a pivot transform into an aggregate transform!\n// First collect all unique pivot field values.\n// Then generate aggregate fields for each output pivot field.\nfunction aggregateParams(_, pulse) {\n const key = _.field,\n value = _.value,\n op = (_.op === 'count' ? '__count__' : _.op) || 'sum',\n fields = accessorFields(key).concat(accessorFields(value)),\n keys = pivotKeys(key, _.limit || 0, pulse);\n\n // if data stream content changes, pivot fields may change\n // flag parameter modification to ensure re-initialization\n if (pulse.changed()) _.set('__pivot__', null, null, true);\n return {\n key: _.key,\n groupby: _.groupby,\n ops: keys.map(() => op),\n fields: keys.map(k => get(k, key, value, fields)),\n as: keys.map(k => k + ''),\n modified: _.modified.bind(_)\n };\n}\n\n// Generate aggregate field accessor.\n// Output NaN for non-existent values; aggregator will ignore!\nfunction get(k, key, value, fields) {\n return accessor(d => key(d) === k ? value(d) : NaN, fields, k + '');\n}\n\n// Collect (and optionally limit) all unique pivot values.\nfunction pivotKeys(key, limit, pulse) {\n const map = {},\n list = [];\n pulse.visit(pulse.SOURCE, t => {\n const k = key(t);\n if (!map[k]) {\n map[k] = 1;\n list.push(k);\n }\n });\n list.sort(ascending);\n return limit ? list.slice(0, limit) : list;\n}\n\n/**\n * Partitions pre-faceted data into tuple subflows.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(Dataflow, string): Operator} params.subflow - A function\n * that generates a subflow of operators and returns its root operator.\n * @param {function(object): Array} params.field - The field\n * accessor for an array of subflow tuple objects.\n */\nfunction PreFacet(params) {\n Facet.call(this, params);\n}\ninherits(PreFacet, Facet, {\n transform(_, pulse) {\n const flow = _.subflow,\n field = _.field,\n subflow = t => this.subflow(tupleid(t), flow, pulse, t);\n if (_.modified('field') || field && pulse.modified(accessorFields(field))) {\n error('PreFacet does not support field modification.');\n }\n this.initTargets(); // reset list of active subflows\n\n if (field) {\n pulse.visit(pulse.MOD, t => {\n const sf = subflow(t);\n field(t).forEach(_ => sf.mod(_));\n });\n pulse.visit(pulse.ADD, t => {\n const sf = subflow(t);\n field(t).forEach(_ => sf.add(ingest(_)));\n });\n pulse.visit(pulse.REM, t => {\n const sf = subflow(t);\n field(t).forEach(_ => sf.rem(_));\n });\n } else {\n pulse.visit(pulse.MOD, t => subflow(t).mod(t));\n pulse.visit(pulse.ADD, t => subflow(t).add(t));\n pulse.visit(pulse.REM, t => subflow(t).rem(t));\n }\n if (pulse.clean()) {\n pulse.runAfter(() => this.clean());\n }\n return pulse;\n }\n});\n\n/**\n * Performs a relational projection, copying selected fields from source\n * tuples to a new set of derived tuples.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} [params.as] - Output field names for each projected\n * field. Any unspecified fields will use the field name provided by\n * the field accessor.\n */\nfunction Project(params) {\n Transform.call(this, null, params);\n}\nProject.Definition = {\n 'type': 'Project',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'fields',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'null': true,\n 'array': true\n }]\n};\ninherits(Project, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE),\n fields = _.fields,\n as = fieldNames(_.fields, _.as || []),\n derive = fields ? (s, t) => project(s, t, fields, as) : rederive;\n let lut;\n if (this.value) {\n lut = this.value;\n } else {\n pulse = pulse.addAll();\n lut = this.value = {};\n }\n pulse.visit(pulse.REM, t => {\n const id = tupleid(t);\n out.rem.push(lut[id]);\n lut[id] = null;\n });\n pulse.visit(pulse.ADD, t => {\n const dt = derive(t, ingest({}));\n lut[tupleid(t)] = dt;\n out.add.push(dt);\n });\n pulse.visit(pulse.MOD, t => {\n out.mod.push(derive(t, lut[tupleid(t)]));\n });\n return out;\n }\n});\nfunction project(s, t, fields, as) {\n for (let i = 0, n = fields.length; i < n; ++i) {\n t[as[i]] = fields[i](s);\n }\n return t;\n}\n\n/**\n * Proxy the value of another operator as a pure signal value.\n * Ensures no tuples are propagated.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {*} params.value - The value to proxy, becomes the value of this operator.\n */\nfunction Proxy(params) {\n Transform.call(this, null, params);\n}\ninherits(Proxy, Transform, {\n transform(_, pulse) {\n this.value = _.value;\n return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation;\n }\n});\n\n/**\n * Generates sample quantile values from an input data stream.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - An accessor for the data field\n * over which to calculate quantile values.\n * @param {Array} [params.groupby] - An array of accessors\n * to groupby.\n * @param {Array} [params.probs] - An array of probabilities in\n * the range (0, 1) for which to compute quantile values. If not specified,\n * the *step* parameter will be used.\n * @param {Array} [params.step=0.01] - A probability step size for\n * sampling quantile values. All values from one-half the step size up to\n * 1 (exclusive) will be sampled. This parameter is only used if the\n * *quantiles* parameter is not provided.\n */\nfunction Quantile(params) {\n Transform.call(this, null, params);\n}\nQuantile.Definition = {\n 'type': 'Quantile',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'probs',\n 'type': 'number',\n 'array': true\n }, {\n 'name': 'step',\n 'type': 'number',\n 'default': 0.01\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'default': ['prob', 'value']\n }]\n};\nconst EPSILON = 1e-14;\ninherits(Quantile, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n as = _.as || ['prob', 'value'];\n if (this.value && !_.modified() && !pulse.changed()) {\n out.source = this.value;\n return out;\n }\n const source = pulse.materialize(pulse.SOURCE).source,\n groups = partition$1(source, _.groupby, _.field),\n names = (_.groupby || []).map(accessorName),\n values = [],\n step = _.step || 0.01,\n p = _.probs || range(step / 2, 1 - EPSILON, step),\n n = p.length;\n groups.forEach(g => {\n const q = quantiles(g, p);\n for (let i = 0; i < n; ++i) {\n const t = {};\n for (let i = 0; i < names.length; ++i) {\n t[names[i]] = g.dims[i];\n }\n t[as[0]] = p[i];\n t[as[1]] = q[i];\n values.push(ingest(t));\n }\n });\n if (this.value) out.rem = this.value;\n this.value = out.add = out.source = values;\n return out;\n }\n});\n\n/**\n * Relays a data stream between data processing pipelines.\n * If the derive parameter is set, this transform will create derived\n * copies of observed tuples. This provides derived data streams in which\n * modifications to the tuples do not pollute an upstream data source.\n * @param {object} params - The parameters for this operator.\n * @param {number} [params.derive=false] - Boolean flag indicating if\n * the transform should make derived copies of incoming tuples.\n * @constructor\n */\nfunction Relay(params) {\n Transform.call(this, null, params);\n}\ninherits(Relay, Transform, {\n transform(_, pulse) {\n let out, lut;\n if (this.value) {\n lut = this.value;\n } else {\n out = pulse = pulse.addAll();\n lut = this.value = {};\n }\n if (_.derive) {\n out = pulse.fork(pulse.NO_SOURCE);\n pulse.visit(pulse.REM, t => {\n const id = tupleid(t);\n out.rem.push(lut[id]);\n lut[id] = null;\n });\n pulse.visit(pulse.ADD, t => {\n const dt = derive(t);\n lut[tupleid(t)] = dt;\n out.add.push(dt);\n });\n pulse.visit(pulse.MOD, t => {\n const dt = lut[tupleid(t)];\n for (const k in t) {\n dt[k] = t[k];\n // down stream writes may overwrite re-derived tuples\n // conservatively mark all source fields as modified\n out.modifies(k);\n }\n out.mod.push(dt);\n });\n }\n return out;\n }\n});\n\n/**\n * Samples tuples passing through this operator.\n * Uses reservoir sampling to maintain a representative sample.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {number} [params.size=1000] - The maximum number of samples.\n */\nfunction Sample(params) {\n Transform.call(this, [], params);\n this.count = 0;\n}\nSample.Definition = {\n 'type': 'Sample',\n 'metadata': {},\n 'params': [{\n 'name': 'size',\n 'type': 'number',\n 'default': 1000\n }]\n};\ninherits(Sample, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE),\n mod = _.modified('size'),\n num = _.size,\n map = this.value.reduce((m, t) => (m[tupleid(t)] = 1, m), {});\n let res = this.value,\n cnt = this.count,\n cap = 0;\n\n // sample reservoir update function\n function update(t) {\n let p, idx;\n if (res.length < num) {\n res.push(t);\n } else {\n idx = ~~((cnt + 1) * random());\n if (idx < res.length && idx >= cap) {\n p = res[idx];\n if (map[tupleid(p)]) out.rem.push(p); // eviction\n res[idx] = t;\n }\n }\n ++cnt;\n }\n if (pulse.rem.length) {\n // find all tuples that should be removed, add to output\n pulse.visit(pulse.REM, t => {\n const id = tupleid(t);\n if (map[id]) {\n map[id] = -1;\n out.rem.push(t);\n }\n --cnt;\n });\n\n // filter removed tuples out of the sample reservoir\n res = res.filter(t => map[tupleid(t)] !== -1);\n }\n if ((pulse.rem.length || mod) && res.length < num && pulse.source) {\n // replenish sample if backing data source is available\n cap = cnt = res.length;\n pulse.visit(pulse.SOURCE, t => {\n // update, but skip previously sampled tuples\n if (!map[tupleid(t)]) update(t);\n });\n cap = -1;\n }\n if (mod && res.length > num) {\n const n = res.length - num;\n for (let i = 0; i < n; ++i) {\n map[tupleid(res[i])] = -1;\n out.rem.push(res[i]);\n }\n res = res.slice(n);\n }\n if (pulse.mod.length) {\n // propagate modified tuples in the sample reservoir\n pulse.visit(pulse.MOD, t => {\n if (map[tupleid(t)]) out.mod.push(t);\n });\n }\n if (pulse.add.length) {\n // update sample reservoir\n pulse.visit(pulse.ADD, update);\n }\n if (pulse.add.length || cap < 0) {\n // output newly added tuples\n out.add = res.filter(t => !map[tupleid(t)]);\n }\n this.count = cnt;\n this.value = out.source = res;\n return out;\n }\n});\n\n/**\n * Generates data tuples for a specified sequence range of numbers.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {number} params.start - The first number in the sequence.\n * @param {number} params.stop - The last number (exclusive) in the sequence.\n * @param {number} [params.step=1] - The step size between numbers in the sequence.\n */\nfunction Sequence(params) {\n Transform.call(this, null, params);\n}\nSequence.Definition = {\n 'type': 'Sequence',\n 'metadata': {\n 'generates': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'start',\n 'type': 'number',\n 'required': true\n }, {\n 'name': 'stop',\n 'type': 'number',\n 'required': true\n }, {\n 'name': 'step',\n 'type': 'number',\n 'default': 1\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'data'\n }]\n};\ninherits(Sequence, Transform, {\n transform(_, pulse) {\n if (this.value && !_.modified()) return;\n const out = pulse.materialize().fork(pulse.MOD),\n as = _.as || 'data';\n out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem;\n this.value = range(_.start, _.stop, _.step || 1).map(v => {\n const t = {};\n t[as] = v;\n return ingest(t);\n });\n out.add = pulse.add.concat(this.value);\n return out;\n }\n});\n\n/**\n * Propagates a new pulse without any tuples so long as the input\n * pulse contains some added, removed or modified tuples.\n * @param {object} params - The parameters for this operator.\n * @constructor\n */\nfunction Sieve(params) {\n Transform.call(this, null, params);\n this.modified(true); // always treat as modified\n}\n\ninherits(Sieve, Transform, {\n transform(_, pulse) {\n this.value = pulse.source;\n return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation;\n }\n});\n\n/**\n * Discretize dates to specific time units.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The data field containing date/time values.\n */\nfunction TimeUnit(params) {\n Transform.call(this, null, params);\n}\nconst OUTPUT = ['unit0', 'unit1'];\nTimeUnit.Definition = {\n 'type': 'TimeUnit',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'interval',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'units',\n 'type': 'enum',\n 'values': TIME_UNITS,\n 'array': true\n }, {\n 'name': 'step',\n 'type': 'number',\n 'default': 1\n }, {\n 'name': 'maxbins',\n 'type': 'number',\n 'default': 40\n }, {\n 'name': 'extent',\n 'type': 'date',\n 'array': true\n }, {\n 'name': 'timezone',\n 'type': 'enum',\n 'default': 'local',\n 'values': ['local', 'utc']\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': OUTPUT\n }]\n};\ninherits(TimeUnit, Transform, {\n transform(_, pulse) {\n const field = _.field,\n band = _.interval !== false,\n utc = _.timezone === 'utc',\n floor = this._floor(_, pulse),\n offset = (utc ? utcInterval : timeInterval)(floor.unit).offset,\n as = _.as || OUTPUT,\n u0 = as[0],\n u1 = as[1],\n step = floor.step;\n let min = floor.start || Infinity,\n max = floor.stop || -Infinity,\n flag = pulse.ADD;\n if (_.modified() || pulse.changed(pulse.REM) || pulse.modified(accessorFields(field))) {\n pulse = pulse.reflow(true);\n flag = pulse.SOURCE;\n min = Infinity;\n max = -Infinity;\n }\n pulse.visit(flag, t => {\n const v = field(t);\n let a, b;\n if (v == null) {\n t[u0] = null;\n if (band) t[u1] = null;\n } else {\n t[u0] = a = b = floor(v);\n if (band) t[u1] = b = offset(a, step);\n if (a < min) min = a;\n if (b > max) max = b;\n }\n });\n floor.start = min;\n floor.stop = max;\n return pulse.modifies(band ? as : u0);\n },\n _floor(_, pulse) {\n const utc = _.timezone === 'utc';\n\n // get parameters\n const {\n units,\n step\n } = _.units ? {\n units: _.units,\n step: _.step || 1\n } : timeBin({\n extent: _.extent || extent(pulse.materialize(pulse.SOURCE).source, _.field),\n maxbins: _.maxbins\n });\n\n // check / standardize time units\n const tunits = timeUnits(units),\n prev = this.value || {},\n floor = (utc ? utcFloor : timeFloor)(tunits, step);\n floor.unit = peek(tunits);\n floor.units = tunits;\n floor.step = step;\n floor.start = prev.start;\n floor.stop = prev.stop;\n return this.value = floor;\n }\n});\n\n/**\n * An index that maps from unique, string-coerced, field values to tuples.\n * Assumes that the field serves as a unique key with no duplicate values.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The field accessor to index.\n */\nfunction TupleIndex(params) {\n Transform.call(this, fastmap(), params);\n}\ninherits(TupleIndex, Transform, {\n transform(_, pulse) {\n const df = pulse.dataflow,\n field = _.field,\n index = this.value,\n set = t => index.set(field(t), t);\n let mod = true;\n if (_.modified('field') || pulse.modified(field.fields)) {\n index.clear();\n pulse.visit(pulse.SOURCE, set);\n } else if (pulse.changed()) {\n pulse.visit(pulse.REM, t => index.delete(field(t)));\n pulse.visit(pulse.ADD, set);\n } else {\n mod = false;\n }\n this.modified(mod);\n if (index.empty > df.cleanThreshold) df.runAfter(index.clean);\n return pulse.fork();\n }\n});\n\n/**\n * Extracts an array of values. Assumes the source data has already been\n * reduced as needed (e.g., by an upstream Aggregate transform).\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The domain field to extract.\n * @param {function(*,*): number} [params.sort] - An optional\n * comparator function for sorting the values. The comparator will be\n * applied to backing tuples prior to value extraction.\n */\nfunction Values(params) {\n Transform.call(this, null, params);\n}\ninherits(Values, Transform, {\n transform(_, pulse) {\n const run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields);\n if (run) {\n this.value = (_.sort ? pulse.source.slice().sort(stableCompare(_.sort)) : pulse.source).map(_.field);\n }\n }\n});\n\nfunction WindowOp(op, field, param, as) {\n const fn = WindowOps[op](field, param);\n return {\n init: fn.init || zero,\n update: function (w, t) {\n t[as] = fn.next(w);\n }\n };\n}\nconst WindowOps = {\n row_number: function () {\n return {\n next: w => w.index + 1\n };\n },\n rank: function () {\n let rank;\n return {\n init: () => rank = 1,\n next: w => {\n const i = w.index,\n data = w.data;\n return i && w.compare(data[i - 1], data[i]) ? rank = i + 1 : rank;\n }\n };\n },\n dense_rank: function () {\n let drank;\n return {\n init: () => drank = 1,\n next: w => {\n const i = w.index,\n d = w.data;\n return i && w.compare(d[i - 1], d[i]) ? ++drank : drank;\n }\n };\n },\n percent_rank: function () {\n const rank = WindowOps.rank(),\n next = rank.next;\n return {\n init: rank.init,\n next: w => (next(w) - 1) / (w.data.length - 1)\n };\n },\n cume_dist: function () {\n let cume;\n return {\n init: () => cume = 0,\n next: w => {\n const d = w.data,\n c = w.compare;\n let i = w.index;\n if (cume < i) {\n while (i + 1 < d.length && !c(d[i], d[i + 1])) ++i;\n cume = i;\n }\n return (1 + cume) / d.length;\n }\n };\n },\n ntile: function (field, num) {\n num = +num;\n if (!(num > 0)) error('ntile num must be greater than zero.');\n const cume = WindowOps.cume_dist(),\n next = cume.next;\n return {\n init: cume.init,\n next: w => Math.ceil(num * next(w))\n };\n },\n lag: function (field, offset) {\n offset = +offset || 1;\n return {\n next: w => {\n const i = w.index - offset;\n return i >= 0 ? field(w.data[i]) : null;\n }\n };\n },\n lead: function (field, offset) {\n offset = +offset || 1;\n return {\n next: w => {\n const i = w.index + offset,\n d = w.data;\n return i < d.length ? field(d[i]) : null;\n }\n };\n },\n first_value: function (field) {\n return {\n next: w => field(w.data[w.i0])\n };\n },\n last_value: function (field) {\n return {\n next: w => field(w.data[w.i1 - 1])\n };\n },\n nth_value: function (field, nth) {\n nth = +nth;\n if (!(nth > 0)) error('nth_value nth must be greater than zero.');\n return {\n next: w => {\n const i = w.i0 + (nth - 1);\n return i < w.i1 ? field(w.data[i]) : null;\n }\n };\n },\n prev_value: function (field) {\n let prev;\n return {\n init: () => prev = null,\n next: w => {\n const v = field(w.data[w.index]);\n return v != null ? prev = v : prev;\n }\n };\n },\n next_value: function (field) {\n let v, i;\n return {\n init: () => (v = null, i = -1),\n next: w => {\n const d = w.data;\n return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]);\n }\n };\n }\n};\nfunction find(field, data, index) {\n for (let n = data.length; index < n; ++index) {\n const v = field(data[index]);\n if (v != null) return index;\n }\n return -1;\n}\nconst ValidWindowOps = Object.keys(WindowOps);\n\nfunction WindowState(_) {\n const ops = array(_.ops),\n fields = array(_.fields),\n params = array(_.params),\n aggregate_params = array(_.aggregate_params),\n as = array(_.as),\n outputs = this.outputs = [],\n windows = this.windows = [],\n inputs = {},\n map = {},\n counts = [],\n measures = [];\n let countOnly = true;\n function visitInputs(f) {\n array(accessorFields(f)).forEach(_ => inputs[_] = 1);\n }\n visitInputs(_.sort);\n ops.forEach((op, i) => {\n const field = fields[i],\n param = params[i],\n aggregate_param = aggregate_params[i] || null,\n mname = accessorName(field),\n name = measureName(op, mname, as[i]);\n visitInputs(field);\n outputs.push(name);\n\n // Window operation\n if (hasOwnProperty(WindowOps, op)) {\n windows.push(WindowOp(op, field, param, name));\n }\n\n // Aggregate operation\n else {\n if (field == null && op !== 'count') {\n error('Null aggregate field specified.');\n }\n if (op === 'count') {\n counts.push(name);\n return;\n }\n countOnly = false;\n let m = map[mname];\n if (!m) {\n m = map[mname] = [];\n m.field = field;\n measures.push(m);\n }\n m.push(createMeasure(op, aggregate_param, name));\n }\n });\n if (counts.length || measures.length) {\n this.cell = cell(measures, counts, countOnly);\n }\n this.inputs = Object.keys(inputs);\n}\nconst prototype = WindowState.prototype;\nprototype.init = function () {\n this.windows.forEach(_ => _.init());\n if (this.cell) this.cell.init();\n};\nprototype.update = function (w, t) {\n const cell = this.cell,\n wind = this.windows,\n data = w.data,\n m = wind && wind.length;\n let j;\n if (cell) {\n for (j = w.p0; j < w.i0; ++j) cell.rem(data[j]);\n for (j = w.p1; j < w.i1; ++j) cell.add(data[j]);\n cell.set(t);\n }\n for (j = 0; j < m; ++j) wind[j].update(w, t);\n};\nfunction cell(measures, counts, countOnly) {\n measures = measures.map(m => compileMeasures(m, m.field));\n const cell = {\n num: 0,\n agg: null,\n store: false,\n count: counts\n };\n if (!countOnly) {\n var n = measures.length,\n a = cell.agg = Array(n),\n i = 0;\n for (; i < n; ++i) a[i] = new measures[i](cell);\n }\n if (cell.store) {\n var store = cell.data = new TupleStore();\n }\n cell.add = function (t) {\n cell.num += 1;\n if (countOnly) return;\n if (store) store.add(t);\n for (let i = 0; i < n; ++i) {\n a[i].add(a[i].get(t), t);\n }\n };\n cell.rem = function (t) {\n cell.num -= 1;\n if (countOnly) return;\n if (store) store.rem(t);\n for (let i = 0; i < n; ++i) {\n a[i].rem(a[i].get(t), t);\n }\n };\n cell.set = function (t) {\n let i, n;\n\n // consolidate stored values\n if (store) store.values();\n\n // update tuple properties\n for (i = 0, n = counts.length; i < n; ++i) t[counts[i]] = cell.num;\n if (!countOnly) for (i = 0, n = a.length; i < n; ++i) a[i].set(t);\n };\n cell.init = function () {\n cell.num = 0;\n if (store) store.reset();\n for (let i = 0; i < n; ++i) a[i].init();\n };\n return cell;\n}\n\n/**\n * Perform window calculations and write results to the input stream.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window.\n * @param {Array} [params.groupby] - An array of accessors by which to partition tuples into separate windows.\n * @param {Array} params.ops - An array of strings indicating window operations to perform.\n * @param {Array} [params.fields] - An array of accessors\n * for data fields to use as inputs to window operations.\n * @param {Array<*>} [params.params] - An array of parameter values for window operations.\n * @param {Array} [params.aggregate_params] - An optional array of parameter values for aggregation operations.\n * @param {Array} [params.as] - An array of output field names for window operations.\n * @param {Array} [params.frame] - Window frame definition as two-element array.\n * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row\n * number alone, ignoring peers with identical sort values. If false (default),\n * the window boundaries will be adjusted to include peer values.\n */\nfunction Window(params) {\n Transform.call(this, {}, params);\n this._mlen = 0;\n this._mods = [];\n}\nWindow.Definition = {\n 'type': 'Window',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'ops',\n 'type': 'enum',\n 'array': true,\n 'values': ValidWindowOps.concat(ValidAggregateOps)\n }, {\n 'name': 'params',\n 'type': 'number',\n 'null': true,\n 'array': true\n }, {\n 'name': 'aggregate_params',\n 'type': 'field',\n 'null': true,\n 'array': true,\n 'default': [null]\n }, {\n 'name': 'fields',\n 'type': 'field',\n 'null': true,\n 'array': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'null': true,\n 'array': true\n }, {\n 'name': 'frame',\n 'type': 'number',\n 'null': true,\n 'array': true,\n 'length': 2,\n 'default': [null, 0]\n }, {\n 'name': 'ignorePeers',\n 'type': 'boolean',\n 'default': false\n }]\n};\ninherits(Window, Transform, {\n transform(_, pulse) {\n this.stamp = pulse.stamp;\n const mod = _.modified(),\n cmp = stableCompare(_.sort),\n key = groupkey(_.groupby),\n group = t => this.group(key(t));\n\n // initialize window state\n let state = this.state;\n if (!state || mod) {\n state = this.state = new WindowState(_);\n }\n\n // partition input tuples\n if (mod || pulse.modified(state.inputs)) {\n this.value = {};\n pulse.visit(pulse.SOURCE, t => group(t).add(t));\n } else {\n pulse.visit(pulse.REM, t => group(t).remove(t));\n pulse.visit(pulse.ADD, t => group(t).add(t));\n }\n\n // perform window calculations for each modified partition\n for (let i = 0, n = this._mlen; i < n; ++i) {\n processPartition(this._mods[i], state, cmp, _);\n }\n this._mlen = 0;\n this._mods = [];\n\n // TODO don't reflow everything?\n return pulse.reflow(mod).modifies(state.outputs);\n },\n group(key) {\n let group = this.value[key];\n if (!group) {\n group = this.value[key] = SortedList(tupleid);\n group.stamp = -1;\n }\n if (group.stamp < this.stamp) {\n group.stamp = this.stamp;\n this._mods[this._mlen++] = group;\n }\n return group;\n }\n});\nfunction processPartition(list, state, cmp, _) {\n const sort = _.sort,\n range = sort && !_.ignorePeers,\n frame = _.frame || [null, 0],\n data = list.data(cmp),\n // use cmp for stable sort\n n = data.length,\n b = range ? bisector(sort) : null,\n w = {\n i0: 0,\n i1: 0,\n p0: 0,\n p1: 0,\n index: 0,\n data: data,\n compare: sort || constant(-1)\n };\n state.init();\n for (let i = 0; i < n; ++i) {\n setWindow(w, frame, i, n);\n if (range) adjustRange(w, b);\n state.update(w, data[i]);\n }\n}\nfunction setWindow(w, f, i, n) {\n w.p0 = w.i0;\n w.p1 = w.i1;\n w.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0]));\n w.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1);\n w.index = i;\n}\n\n// if frame type is 'range', adjust window for peer values\nfunction adjustRange(w, bisect) {\n const r0 = w.i0,\n r1 = w.i1 - 1,\n c = w.compare,\n d = w.data,\n n = d.length - 1;\n if (r0 > 0 && !c(d[r0], d[r0 - 1])) w.i0 = bisect.left(d, d[r0]);\n if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]);\n}\n\nexport { Aggregate as aggregate, Bin as bin, Collect as collect, Compare as compare, CountPattern as countpattern, Cross as cross, Density as density, DotBin as dotbin, Expression as expression, Extent as extent, Facet as facet, Field as field, Filter as filter, Flatten as flatten, Fold as fold, Formula as formula, Generate as generate, Impute as impute, JoinAggregate as joinaggregate, KDE as kde, Key as key, Load as load, Lookup as lookup, MultiExtent as multiextent, MultiValues as multivalues, Params as params, Pivot as pivot, PreFacet as prefacet, Project as project, Proxy as proxy, Quantile as quantile, Relay as relay, Sample as sample, Sequence as sequence, Sieve as sieve, Subflow as subflow, TimeUnit as timeunit, TupleIndex as tupleindex, Values as values, Window as window };\n","export default function mean(values, valueof) {\n let count = 0;\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n ++count, sum += value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n ++count, sum += value;\n }\n }\n }\n if (count) return sum / count;\n}\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x) / 6,\n (that._y0 + 4 * that._y1 + y) / 6\n );\n}\n\nexport function Basis(context) {\n this._context = context;\n}\n\nBasis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3: point(this, this._x1, this._y1); // falls through\n case 2: this._context.lineTo(this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new Basis(context);\n}\n","export default function() {}\n","import noop from \"../noop.js\";\nimport {point} from \"./basis.js\";\n\nfunction BasisClosed(context) {\n this._context = context;\n}\n\nBasisClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisClosed(context);\n}\n","import {point} from \"./basis.js\";\n\nfunction BasisOpen(context) {\n this._context = context;\n}\n\nBasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisOpen(context);\n}\n","import {Basis} from \"./basis.js\";\n\nfunction Bundle(context, beta) {\n this._basis = new Basis(context);\n this._beta = beta;\n}\n\nBundle.prototype = {\n lineStart: function() {\n this._x = [];\n this._y = [];\n this._basis.lineStart();\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n j = x.length - 1;\n\n if (j > 0) {\n var x0 = x[0],\n y0 = y[0],\n dx = x[j] - x0,\n dy = y[j] - y0,\n i = -1,\n t;\n\n while (++i <= j) {\n t = i / j;\n this._basis.point(\n this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n );\n }\n }\n\n this._x = this._y = null;\n this._basis.lineEnd();\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\nexport default (function custom(beta) {\n\n function bundle(context) {\n return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n }\n\n bundle.beta = function(beta) {\n return custom(+beta);\n };\n\n return bundle;\n})(0.85);\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import {point} from \"./cardinal.js\";\n\nexport function CardinalOpen(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalOpen(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","import {epsilon} from \"../math.js\";\nimport {Cardinal} from \"./cardinal.js\";\n\nexport function point(that, x, y) {\n var x1 = that._x1,\n y1 = that._y1,\n x2 = that._x2,\n y2 = that._y2;\n\n if (that._l01_a > epsilon) {\n var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n }\n\n if (that._l23_a > epsilon) {\n var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n }\n\n that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: this.point(this._x2, this._y2); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","import {CardinalClosed} from \"./cardinalClosed.js\";\nimport noop from \"../noop.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomClosed(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","import {CardinalOpen} from \"./cardinalOpen.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomOpen(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","function Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nexport default function(context) {\n return new Linear(context);\n}\n","import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n","function sign(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n}\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n return new MonotoneY(context);\n}\n","function Natural(context) {\n this._context = context;\n}\n\nNatural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n n = x.length;\n\n if (n) {\n this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n if (n === 2) {\n this._context.lineTo(x[1], y[1]);\n } else {\n var px = controlPoints(x),\n py = controlPoints(y);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n }\n }\n }\n\n if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n var i,\n n = x.length - 1,\n m,\n a = new Array(n),\n b = new Array(n),\n r = new Array(n);\n a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n b[n - 1] = (x[n] + a[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n return [a, b];\n}\n\nexport default function(context) {\n return new Natural(context);\n}\n","function Step(context, t) {\n this._context = context;\n this._t = t;\n}\n\nStep.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y);\n this._context.lineTo(x, y);\n } else {\n var x1 = this._x * (1 - this._t) + x * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y);\n }\n break;\n }\n }\n this._x = x, this._y = y;\n }\n};\n\nexport default function(context) {\n return new Step(context, 0.5);\n}\n\nexport function stepBefore(context) {\n return new Step(context, 0);\n}\n\nexport function stepAfter(context) {\n return new Step(context, 1);\n}\n","export default function(x) {\n return function constant() {\n return x;\n };\n}\n","const pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction append(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n let d = Math.floor(digits);\n if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);\n if (d > 15) return append;\n const k = 10 ** d;\n return function(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n}\n\nexport class Path {\n constructor(digits) {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n this._append = digits == null ? append : appendRound(digits);\n }\n moveTo(x, y) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._append`Z`;\n }\n }\n lineTo(x, y) {\n this._append`L${this._x1 = +x},${this._y1 = +y}`;\n }\n quadraticCurveTo(x1, y1, x, y) {\n this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;\n }\n bezierCurveTo(x1, y1, x2, y2, x, y) {\n this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;\n }\n arcTo(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._append`M${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._append`L${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Otherwise, draw an arc!\n else {\n let x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;\n }\n\n this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;\n }\n }\n arc(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._append`M${x0},${y0}`;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._append`L${x0},${y0}`;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;\n }\n }\n rect(x, y, w, h) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;\n }\n toString() {\n return this._;\n }\n}\n\nexport function path() {\n return new Path;\n}\n\n// Allow instanceof d3.path\npath.prototype = Path.prototype;\n\nexport function pathRound(digits = 3) {\n return new Path(+digits);\n}\n","import {Path} from \"d3-path\";\n\nexport function withPath(shape) {\n let digits = 3;\n\n shape.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) {\n digits = null;\n } else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n return shape;\n };\n\n return () => new Path(digits);\n}\n","import constant from \"./constant.js\";\nimport {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from \"./math.js\";\nimport {withPath} from \"./path.js\";\n\nfunction arcInnerRadius(d) {\n return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0,\n x32 = x3 - x2, y32 = y3 - y2,\n t = y32 * x10 - x32 * y10;\n if (t * t < epsilon) return;\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1,\n y01 = y0 - y1,\n lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),\n ox = lo * y01,\n oy = -lo * x01,\n x11 = x0 + ox,\n y11 = y0 + oy,\n x10 = x1 + ox,\n y10 = y1 + oy,\n x00 = (x11 + x10) / 2,\n y00 = (y11 + y10) / 2,\n dx = x10 - x11,\n dy = y10 - y11,\n d2 = dx * dx + dy * dy,\n r = r1 - rc,\n D = x11 * y10 - x10 * y11,\n d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),\n cx0 = (D * dy - dx * d) / d2,\n cy0 = (-D * dx - dy * d) / d2,\n cx1 = (D * dy + dx * d) / d2,\n cy1 = (-D * dx + dy * d) / d2,\n dx0 = cx0 - x00,\n dy0 = cy0 - y00,\n dx1 = cx1 - x00,\n dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points.\n // TODO Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n}\n\nexport default function() {\n var innerRadius = arcInnerRadius,\n outerRadius = arcOuterRadius,\n cornerRadius = constant(0),\n padRadius = null,\n startAngle = arcStartAngle,\n endAngle = arcEndAngle,\n padAngle = arcPadAngle,\n context = null,\n path = withPath(arc);\n\n function arc() {\n var buffer,\n r,\n r0 = +innerRadius.apply(this, arguments),\n r1 = +outerRadius.apply(this, arguments),\n a0 = startAngle.apply(this, arguments) - halfPi,\n a1 = endAngle.apply(this, arguments) - halfPi,\n da = abs(a1 - a0),\n cw = a1 > a0;\n\n if (!context) context = buffer = path();\n\n // Ensure that the outer radius is always larger than the inner radius.\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n // Is it a point?\n if (!(r1 > epsilon)) context.moveTo(0, 0);\n\n // Or is it a circle or annulus?\n else if (da > tau - epsilon) {\n context.moveTo(r1 * cos(a0), r1 * sin(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon) {\n context.moveTo(r0 * cos(a1), r0 * sin(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n }\n\n // Or is it a circular or annular sector?\n else {\n var a01 = a0,\n a11 = a1,\n a00 = a0,\n a10 = a1,\n da0 = da,\n da1 = da,\n ap = padAngle.apply(this, arguments) / 2,\n rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),\n rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n rc0 = rc,\n rc1 = rc,\n t0,\n t1;\n\n // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n if (rp > epsilon) {\n var p0 = asin(rp / r0 * sin(ap)),\n p1 = asin(rp / r1 * sin(ap));\n if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n\n var x01 = r1 * cos(a01),\n y01 = r1 * sin(a01),\n x10 = r0 * cos(a10),\n y10 = r0 * sin(a10);\n\n // Apply rounded corners?\n if (rc > epsilon) {\n var x11 = r1 * cos(a11),\n y11 = r1 * sin(a11),\n x00 = r0 * cos(a00),\n y00 = r0 * sin(a00),\n oc;\n\n // Restrict the corner radius according to the sector angle. If this\n // intersection fails, it’s probably because the arc is too small, so\n // disable the corner radius entirely.\n if (da < pi) {\n if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {\n var ax = x01 - oc[0],\n ay = y01 - oc[1],\n bx = x11 - oc[0],\n by = y11 - oc[1],\n kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),\n lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min(rc, (r0 - lc) / (kc - 1));\n rc1 = min(rc, (r1 - lc) / (kc + 1));\n } else {\n rc0 = rc1 = 0;\n }\n }\n }\n\n // Is the sector collapsed to a line?\n if (!(da1 > epsilon)) context.moveTo(x01, y01);\n\n // Does the sector’s outer ring have rounded corners?\n else if (rc1 > epsilon) {\n t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the outer ring just a circular arc?\n else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n // Is there no inner ring, and it’s a circular sector?\n // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n\n // Does the sector’s inner ring (or point) have rounded corners?\n else if (rc0 > epsilon) {\n t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the inner ring just a circular arc?\n else context.arc(0, 0, r0, a10, a00, cw);\n }\n\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n return [cos(a) * r, sin(a) * r];\n };\n\n arc.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : innerRadius;\n };\n\n arc.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : outerRadius;\n };\n\n arc.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : cornerRadius;\n };\n\n arc.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc) : padRadius;\n };\n\n arc.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : startAngle;\n };\n\n arc.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : endAngle;\n };\n\n arc.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : padAngle;\n };\n\n arc.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n };\n\n return arc;\n}\n","export var slice = Array.prototype.slice;\n\nexport default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n","export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x, y) {\n var defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(line);\n\n x = typeof x === \"function\" ? x : (x === undefined) ? pointX : constant(x);\n y = typeof y === \"function\" ? y : (y === undefined) ? pointY : constant(y);\n\n function line(data) {\n var i,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x(d, i, data), +y(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), line) : x;\n };\n\n line.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), line) : y;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport line from \"./line.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x0, y0, y1) {\n var x1 = null,\n defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(area);\n\n x0 = typeof x0 === \"function\" ? x0 : (x0 === undefined) ? pointX : constant(+x0);\n y0 = typeof y0 === \"function\" ? y0 : (y0 === undefined) ? constant(0) : constant(+y0);\n y1 = typeof y1 === \"function\" ? y1 : (y1 === undefined) ? pointY : constant(+y1);\n\n function area(data) {\n var i,\n j,\n k,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer,\n x0z = new Array(n),\n y0z = new Array(n);\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k = i - 1; k >= j; --k) {\n output.point(x0z[k], y0z[k]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n\n area.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), x1 = null, area) : x0;\n };\n\n area.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), area) : x0;\n };\n\n area.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : x1;\n };\n\n area.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), y1 = null, area) : y0;\n };\n\n area.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), area) : y0;\n };\n\n area.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : y1;\n };\n\n area.lineX0 =\n area.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n\n area.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n\n area.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n\n area.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), area) : defined;\n };\n\n area.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;\n };\n\n area.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;\n };\n\n return area;\n}\n","import {min, sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const r = sqrt(size + min(size / 28, 0.75)) * 0.59436;\n const t = r / 2;\n const u = t * sqrt3;\n context.moveTo(0, r);\n context.lineTo(0, -r);\n context.moveTo(-u, -t);\n context.lineTo(u, t);\n context.moveTo(-u, t);\n context.lineTo(u, -t);\n }\n};\n","import {pi, sqrt, tau} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / pi);\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, tau);\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst tan30 = sqrt(1 / 3);\nconst tan30_2 = tan30 * 2;\n\nexport default {\n draw(context, size) {\n const y = sqrt(size / tan30_2);\n const x = y * tan30;\n context.moveTo(0, -y);\n context.lineTo(x, 0);\n context.lineTo(0, y);\n context.lineTo(-x, 0);\n context.closePath();\n }\n};\n","import {sin, cos, sqrt, pi, tau} from \"../math.js\";\n\nconst ka = 0.89081309152928522810;\nconst kr = sin(pi / 10) / sin(7 * pi / 10);\nconst kx = sin(tau / 10) * kr;\nconst ky = -cos(tau / 10) * kr;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size * ka);\n const x = kx * r;\n const y = ky * r;\n context.moveTo(0, -r);\n context.lineTo(x, y);\n for (let i = 1; i < 5; ++i) {\n const a = tau * i / 5;\n const c = cos(a);\n const s = sin(a);\n context.lineTo(s * r, -c * r);\n context.lineTo(c * x - s * y, s * x + c * y);\n }\n context.closePath();\n }\n};\n","function domCanvas(w, h) {\n if (typeof document !== 'undefined' && document.createElement) {\n const c = document.createElement('canvas');\n if (c && c.getContext) {\n c.width = w;\n c.height = h;\n return c;\n }\n }\n return null;\n}\nconst domImage = () => typeof Image !== 'undefined' ? Image : null;\n\nexport { domCanvas as canvas, domCanvas, domImage as image };\n","import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const y = -sqrt(size / (sqrt3 * 3));\n context.moveTo(0, y * 2);\n context.lineTo(-sqrt3 * y, -y);\n context.lineTo(sqrt3 * y, -y);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const s = sqrt(size) * 0.6824;\n const t = s / 2;\n const u = (s * sqrt3) / 2; // cos(Math.PI / 6)\n context.moveTo(0, -s);\n context.lineTo(u, t);\n context.lineTo(-u, t);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst c = -0.5;\nconst s = sqrt(3) / 2;\nconst k = 1 / sqrt(12);\nconst a = (k / 2 + 1) * 3;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / a);\n const x0 = r / 2, y0 = r * k;\n const x1 = x0, y1 = r * k + r;\n const x2 = -x1, y2 = y1;\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n context.closePath();\n }\n};\n","import ascending from \"./ascending.js\";\nimport bisector from \"./bisector.js\";\nimport number from \"./number.js\";\n\nconst ascendingBisect = bisector(ascending);\nexport const bisectRight = ascendingBisect.right;\nexport const bisectLeft = ascendingBisect.left;\nexport const bisectCenter = bisector(number).center;\nexport default bisectRight;\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","export default x => () => x;\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n","import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n","export default function number(x) {\n return +x;\n}\n","import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateNumber, interpolateRound} from \"d3-interpolate\";\nimport constant from \"./constant.js\";\nimport number from \"./number.js\";\n\nvar unit = [0, 1];\n\nexport function identity(x) {\n return x;\n}\n\nfunction normalize(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(isNaN(b) ? NaN : 0.5);\n}\n\nfunction clamper(a, b) {\n var t;\n if (a > b) t = a, a = b, b = t;\n return function(x) { return Math.max(a, Math.min(b, x)); };\n}\n\n// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].\nfunction bimap(domain, range, interpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);\n else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, interpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = normalize(domain[i], domain[i + 1]);\n r[i] = interpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport function transformer() {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n transform,\n untransform,\n unknown,\n clamp = identity,\n piecewise,\n output,\n input;\n\n function rescale() {\n var n = Math.min(domain.length, range.length);\n if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);\n piecewise = n > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));\n }\n\n scale.invert = function(y) {\n return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = Array.from(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t, u) {\n transform = t, untransform = u;\n return rescale();\n };\n}\n\nexport default function continuous() {\n return transformer()(identity, identity);\n}\n","export default function constants(x) {\n return function() {\n return x;\n };\n}\n","export function initRange(domain, range) {\n switch (arguments.length) {\n case 0: break;\n case 1: this.range(domain); break;\n default: this.range(range).domain(domain); break;\n }\n return this;\n}\n\nexport function initInterpolator(domain, interpolator) {\n switch (arguments.length) {\n case 0: break;\n case 1: {\n if (typeof domain === \"function\") this.interpolator(domain);\n else this.range(domain);\n break;\n }\n default: {\n this.domain(domain);\n if (typeof interpolator === \"function\") this.interpolator(interpolator);\n else this.range(interpolator);\n break;\n }\n }\n return this;\n}\n","import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function tickFormat(start, stop, count, specifier) {\n var step = tickStep(start, stop, count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n","import {ticks, tickIncrement} from \"d3-array\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport tickFormat from \"./tickFormat.js\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n var d = domain();\n return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain();\n var i0 = 0;\n var i1 = d.length - 1;\n var start = d[i0];\n var stop = d[i1];\n var prestep;\n var step;\n var maxIter = 10;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n \n while (maxIter-- > 0) {\n step = tickIncrement(start, stop, count);\n if (step === prestep) {\n d[i0] = start\n d[i1] = stop\n return domain(d);\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n } else {\n break;\n }\n prestep = step;\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous();\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n","export default function nice(domain, interval) {\n domain = domain.slice();\n\n var i0 = 0,\n i1 = domain.length - 1,\n x0 = domain[i0],\n x1 = domain[i1],\n t;\n\n if (x1 < x0) {\n t = i0, i0 = i1, i1 = t;\n t = x0, x0 = x1, x1 = t;\n }\n\n domain[i0] = interval.floor(x0);\n domain[i1] = interval.ceil(x1);\n return domain;\n}\n","import {ticks} from \"d3-array\";\nimport {format, formatSpecifier} from \"d3-format\";\nimport nice from \"./nice.js\";\nimport {copy, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformLog(x) {\n return Math.log(x);\n}\n\nfunction transformExp(x) {\n return Math.exp(x);\n}\n\nfunction transformLogn(x) {\n return -Math.log(-x);\n}\n\nfunction transformExpn(x) {\n return -Math.exp(-x);\n}\n\nfunction pow10(x) {\n return isFinite(x) ? +(\"1e\" + x) : x < 0 ? 0 : x;\n}\n\nfunction powp(base) {\n return base === 10 ? pow10\n : base === Math.E ? Math.exp\n : x => Math.pow(base, x);\n}\n\nfunction logp(base) {\n return base === Math.E ? Math.log\n : base === 10 && Math.log10\n || base === 2 && Math.log2\n || (base = Math.log(base), x => Math.log(x) / base);\n}\n\nfunction reflect(f) {\n return (x, k) => -f(-x, k);\n}\n\nexport function loggish(transform) {\n const scale = transform(transformLog, transformExp);\n const domain = scale.domain;\n let base = 10;\n let logs;\n let pows;\n\n function rescale() {\n logs = logp(base), pows = powp(base);\n if (domain()[0] < 0) {\n logs = reflect(logs), pows = reflect(pows);\n transform(transformLogn, transformExpn);\n } else {\n transform(transformLog, transformExp);\n }\n return scale;\n }\n\n scale.base = function(_) {\n return arguments.length ? (base = +_, rescale()) : base;\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.ticks = count => {\n const d = domain();\n let u = d[0];\n let v = d[d.length - 1];\n const r = v < u;\n\n if (r) ([u, v] = [v, u]);\n\n let i = logs(u);\n let j = logs(v);\n let k;\n let t;\n const n = count == null ? 10 : +count;\n let z = [];\n\n if (!(base % 1) && j - i < n) {\n i = Math.floor(i), j = Math.ceil(j);\n if (u > 0) for (; i <= j; ++i) {\n for (k = 1; k < base; ++k) {\n t = i < 0 ? k / pows(-i) : k * pows(i);\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n } else for (; i <= j; ++i) {\n for (k = base - 1; k >= 1; --k) {\n t = i > 0 ? k / pows(-i) : k * pows(i);\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n }\n if (z.length * 2 < n) z = ticks(u, v, n);\n } else {\n z = ticks(i, j, Math.min(j - i, n)).map(pows);\n }\n return r ? z.reverse() : z;\n };\n\n scale.tickFormat = (count, specifier) => {\n if (count == null) count = 10;\n if (specifier == null) specifier = base === 10 ? \"s\" : \",\";\n if (typeof specifier !== \"function\") {\n if (!(base % 1) && (specifier = formatSpecifier(specifier)).precision == null) specifier.trim = true;\n specifier = format(specifier);\n }\n if (count === Infinity) return specifier;\n const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?\n return d => {\n let i = d / pows(Math.round(logs(d)));\n if (i * base < base - 0.5) i *= base;\n return i <= k ? specifier(d) : \"\";\n };\n };\n\n scale.nice = () => {\n return domain(nice(domain(), {\n floor: x => pows(Math.floor(logs(x))),\n ceil: x => pows(Math.ceil(logs(x)))\n }));\n };\n\n return scale;\n}\n\nexport default function log() {\n const scale = loggish(transformer()).domain([1, 10]);\n scale.copy = () => copy(scale, log()).base(scale.base());\n initRange.apply(scale, arguments);\n return scale;\n}\n","import {linearish} from \"./linear.js\";\nimport {copy, identity, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformPow(exponent) {\n return function(x) {\n return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\n };\n}\n\nfunction transformSqrt(x) {\n return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);\n}\n\nfunction transformSquare(x) {\n return x < 0 ? -x * x : x * x;\n}\n\nexport function powish(transform) {\n var scale = transform(identity, identity),\n exponent = 1;\n\n function rescale() {\n return exponent === 1 ? transform(identity, identity)\n : exponent === 0.5 ? transform(transformSqrt, transformSquare)\n : transform(transformPow(exponent), transformPow(1 / exponent));\n }\n\n scale.exponent = function(_) {\n return arguments.length ? (exponent = +_, rescale()) : exponent;\n };\n\n return linearish(scale);\n}\n\nexport default function pow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, pow()).exponent(scale.exponent());\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n\nexport function sqrt() {\n return pow.apply(null, arguments).exponent(0.5);\n}\n","import {linearish} from \"./linear.js\";\nimport {copy, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformSymlog(c) {\n return function(x) {\n return Math.sign(x) * Math.log1p(Math.abs(x / c));\n };\n}\n\nfunction transformSymexp(c) {\n return function(x) {\n return Math.sign(x) * Math.expm1(Math.abs(x)) * c;\n };\n}\n\nexport function symlogish(transform) {\n var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));\n\n scale.constant = function(_) {\n return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;\n };\n\n return linearish(scale);\n}\n\nexport default function symlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, symlog()).constant(scale.constant());\n };\n\n return initRange.apply(scale, arguments);\n}\n","import {bisector, tickStep} from \"d3-array\";\nimport {durationDay, durationHour, durationMinute, durationMonth, durationSecond, durationWeek, durationYear} from \"./duration.js\";\nimport {millisecond} from \"./millisecond.js\";\nimport {second} from \"./second.js\";\nimport {timeMinute, utcMinute} from \"./minute.js\";\nimport {timeHour, utcHour} from \"./hour.js\";\nimport {timeDay, unixDay} from \"./day.js\";\nimport {timeSunday, utcSunday} from \"./week.js\";\nimport {timeMonth, utcMonth} from \"./month.js\";\nimport {timeYear, utcYear} from \"./year.js\";\n\nfunction ticker(year, month, week, day, hour, minute) {\n\n const tickIntervals = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [ hour, 1, durationHour ],\n [ hour, 3, 3 * durationHour ],\n [ hour, 6, 6 * durationHour ],\n [ hour, 12, 12 * durationHour ],\n [ day, 1, durationDay ],\n [ day, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month, 1, durationMonth ],\n [ month, 3, 3 * durationMonth ],\n [ year, 1, durationYear ]\n ];\n\n function ticks(start, stop, count) {\n const reverse = stop < start;\n if (reverse) [start, stop] = [stop, start];\n const interval = count && typeof count.range === \"function\" ? count : tickInterval(start, stop, count);\n const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop\n return reverse ? ticks.reverse() : ticks;\n }\n\n function tickInterval(start, stop, count) {\n const target = Math.abs(stop - start) / count;\n const i = bisector(([,, step]) => step).right(tickIntervals, target);\n if (i === tickIntervals.length) return year.every(tickStep(start / durationYear, stop / durationYear, count));\n if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));\n const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n return t.every(step);\n }\n\n return [ticks, tickInterval];\n}\n\nconst [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);\nconst [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);\n\nexport {utcTicks, utcTickInterval, timeTicks, timeTickInterval};\n","import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeTicks, timeTickInterval} from \"d3-time\";\nimport {timeFormat} from \"d3-time-format\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport nice from \"./nice.js\";\n\nfunction date(t) {\n return new Date(t);\n}\n\nfunction number(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nexport function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {\n var scale = continuous(),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n function tickFormat(date) {\n return (second(date) < date ? formatMillisecond\n : minute(date) < date ? formatSecond\n : hour(date) < date ? formatMinute\n : day(date) < date ? formatHour\n : month(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(Array.from(_, number)) : domain().map(date);\n };\n\n scale.ticks = function(interval) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval) {\n var d = domain();\n if (!interval || typeof interval.range !== \"function\") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);\n return interval ? domain(nice(d, interval)) : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));\n };\n\n return scale;\n}\n\nexport default function time() {\n return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);\n}\n","import {interpolate, interpolateRound} from \"d3-interpolate\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport {loggish} from \"./log.js\";\nimport {symlogish} from \"./symlog.js\";\nimport {powish} from \"./pow.js\";\n\nfunction transformer() {\n var x0 = 0,\n x1 = 1,\n t0,\n t1,\n k10,\n transform,\n interpolator = identity,\n clamp = false,\n unknown;\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n function range(interpolate) {\n return function(_) {\n var r0, r1;\n return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)];\n };\n }\n\n scale.range = range(interpolate);\n\n scale.rangeRound = range(interpolateRound);\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t) {\n transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);\n return scale;\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .interpolator(source.interpolator())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport default function sequential() {\n var scale = linearish(transformer()(identity));\n\n scale.copy = function() {\n return copy(scale, sequential());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialLog() {\n var scale = loggish(transformer()).domain([1, 10]);\n\n scale.copy = function() {\n return copy(scale, sequentialLog()).base(scale.base());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialSymlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, sequentialSymlog()).constant(scale.constant());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialPow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, sequentialPow()).exponent(scale.exponent());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialSqrt() {\n return sequentialPow.apply(null, arguments).exponent(0.5);\n}\n","import {default as value} from \"./value.js\";\n\nexport default function piecewise(interpolate, values) {\n if (values === undefined) values = interpolate, interpolate = value;\n var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);\n while (i < n) I[i] = interpolate(v, v = values[++i]);\n return function(t) {\n var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));\n return I[i](t - i);\n };\n}\n","import {interpolate, interpolateRound, piecewise} from \"d3-interpolate\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport {loggish} from \"./log.js\";\nimport {copy} from \"./sequential.js\";\nimport {symlogish} from \"./symlog.js\";\nimport {powish} from \"./pow.js\";\n\nfunction transformer() {\n var x0 = 0,\n x1 = 0.5,\n x2 = 1,\n s = 1,\n t0,\n t1,\n t2,\n k10,\n k21,\n interpolator = identity,\n transform,\n clamp = false,\n unknown;\n\n function scale(x) {\n return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n function range(interpolate) {\n return function(_) {\n var r0, r1, r2;\n return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)];\n };\n }\n\n scale.range = range(interpolate);\n\n scale.rangeRound = range(interpolateRound);\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t) {\n transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1;\n return scale;\n };\n}\n\nexport default function diverging() {\n var scale = linearish(transformer()(identity));\n\n scale.copy = function() {\n return copy(scale, diverging());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingLog() {\n var scale = loggish(transformer()).domain([0.1, 1, 10]);\n\n scale.copy = function() {\n return copy(scale, divergingLog()).base(scale.base());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingSymlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, divergingSymlog()).constant(scale.constant());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingPow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, divergingPow()).exponent(scale.exponent());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingSqrt() {\n return divergingPow.apply(null, arguments).exponent(0.5);\n}\n","export class InternMap extends Map {\n constructor(entries, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (entries != null) for (const [key, value] of entries) this.set(key, value);\n }\n get(key) {\n return super.get(intern_get(this, key));\n }\n has(key) {\n return super.has(intern_get(this, key));\n }\n set(key, value) {\n return super.set(intern_set(this, key), value);\n }\n delete(key) {\n return super.delete(intern_delete(this, key));\n }\n}\n\nexport class InternSet extends Set {\n constructor(values, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (values != null) for (const value of values) this.add(value);\n }\n has(value) {\n return super.has(intern_get(this, value));\n }\n add(value) {\n return super.add(intern_set(this, value));\n }\n delete(value) {\n return super.delete(intern_delete(this, value));\n }\n}\n\nfunction intern_get({_intern, _key}, value) {\n const key = _key(value);\n return _intern.has(key) ? _intern.get(key) : value;\n}\n\nfunction intern_set({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) return _intern.get(key);\n _intern.set(key, value);\n return value;\n}\n\nfunction intern_delete({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) {\n value = _intern.get(key);\n _intern.delete(key);\n }\n return value;\n}\n\nfunction keyof(value) {\n return value !== null && typeof value === \"object\" ? value.valueOf() : value;\n}\n","import {InternMap} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport const implicit = Symbol(\"implicit\");\n\nexport default function ordinal() {\n var index = new InternMap(),\n domain = [],\n range = [],\n unknown = implicit;\n\n function scale(d) {\n let i = index.get(d);\n if (i === undefined) {\n if (unknown !== implicit) return unknown;\n index.set(d, i = domain.push(d) - 1);\n }\n return range[i % range.length];\n }\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [], index = new InternMap();\n for (const value of _) {\n if (index.has(value)) continue;\n index.set(value, domain.push(value) - 1);\n }\n return scale;\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), scale) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return ordinal(domain, range).unknown(unknown);\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n","export default function(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n","import {hue} from \"./color.js\";\n\nexport default function(a, b) {\n var i = hue(+a, +b);\n return function(t) {\n var x = i(t);\n return x - 360 * Math.floor(x / 360);\n };\n}\n","var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n","import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n","import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n","var epsilon2 = 1e-12;\n\nfunction cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n}\n\nfunction sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n}\n\nfunction tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n}\n\nexport default (function zoomRho(rho, rho2, rho4) {\n\n // p0 = [ux0, uy0, w0]\n // p1 = [ux1, uy1, w1]\n function zoom(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],\n ux1 = p1[0], uy1 = p1[1], w1 = p1[2],\n dx = ux1 - ux0,\n dy = uy1 - uy0,\n d2 = dx * dx + dy * dy,\n i,\n S;\n\n // Special case for u0 ≅ u1.\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n }\n }\n\n // General case.\n else {\n var d1 = Math.sqrt(d2),\n b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),\n b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),\n r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),\n r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S,\n coshr0 = cosh(r0),\n u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n }\n }\n\n i.duration = S * 1000 * rho / Math.SQRT2;\n\n return i;\n }\n\n zoom.rho = function(_) {\n var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;\n return zoomRho(_1, _2, _4);\n };\n\n return zoom;\n})(Math.SQRT2, 2, 4);\n","import {hsl as colorHsl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hsl(hue) {\n return function(start, end) {\n var h = hue((start = colorHsl(start)).h, (end = colorHsl(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hsl(hue);\nexport var hslLong = hsl(color);\n","export const radians = Math.PI / 180;\nexport const degrees = 180 / Math.PI;\n","import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\n// https://observablehq.com/@mbostock/lab-and-rgb\nconst K = 18,\n Xn = 0.96422,\n Yn = 1,\n Zn = 0.82521,\n t0 = 4 / 29,\n t1 = 6 / 29,\n t2 = 3 * t1 * t1,\n t3 = t1 * t1 * t1;\n\nfunction labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) return hcl2lab(o);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = rgb2lrgb(o.r),\n g = rgb2lrgb(o.g),\n b = rgb2lrgb(o.b),\n y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;\n if (r === g && g === b) x = z = y; else {\n x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n }\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n}\n\nexport function gray(l, opacity) {\n return new Lab(l, 0, 0, opacity == null ? 1 : opacity);\n}\n\nexport default function lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n}\n\nexport function Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Lab, lab, extend(Color, {\n brighter(k) {\n return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker(k) {\n return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n x = Xn * lab2xyz(x);\n y = Yn * lab2xyz(y);\n z = Zn * lab2xyz(z);\n return new Rgb(\n lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),\n lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),\n lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n this.opacity\n );\n }\n}));\n\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction lrgb2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2lrgb(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\nfunction hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);\n var h = Math.atan2(o.b, o.a) * degrees;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n}\n\nexport function lch(l, c, h, opacity) {\n return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n}\n\nfunction hcl2lab(o) {\n if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);\n var h = o.h * radians;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n}\n\ndefine(Hcl, hcl, extend(Color, {\n brighter(k) {\n return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);\n },\n darker(k) {\n return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);\n },\n rgb() {\n return hcl2lab(this).rgb();\n }\n}));\n","import {lab as colorLab} from \"d3-color\";\nimport color from \"./color.js\";\n\nexport default function lab(start, end) {\n var l = color((start = colorLab(start)).l, (end = colorLab(end)).l),\n a = color(start.a, end.a),\n b = color(start.b, end.b),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.l = l(t);\n start.a = a(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n}\n","import {hcl as colorHcl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hcl(hue) {\n return function(start, end) {\n var h = hue((start = colorHcl(start)).h, (end = colorHcl(end)).h),\n c = color(start.c, end.c),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hcl(hue);\nexport var hclLong = hcl(color);\n","import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb, darker, brighter} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\nvar A = -0.14861,\n B = +1.78277,\n C = -0.29227,\n D = -0.90649,\n E = +1.97294,\n ED = E * D,\n EB = E * B,\n BC_DA = B * C - D * A;\n\nfunction cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),\n bl = b - l,\n k = (E * (g - l) - C * bl) / D,\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n}\n\nexport default function cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n}\n\nexport function Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Cubehelix, cubehelix, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh)),\n this.opacity\n );\n }\n}));\n","import {cubehelix as colorCubehelix} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction cubehelix(hue) {\n return (function cubehelixGamma(y) {\n y = +y;\n\n function cubehelix(start, end) {\n var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n cubehelix.gamma = cubehelixGamma;\n\n return cubehelix;\n })(1);\n}\n\nexport default cubehelix(hue);\nexport var cubehelixLong = cubehelix(color);\n","export default function(interpolator, n) {\n var samples = new Array(n);\n for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));\n return samples;\n}\n","import { toNumber, peek, toSet, array, constant, isNumber, span, isObject, isString, error, isArray } from 'vega-util';\nimport { bisectRight, range, bisect } from 'd3-array';\nimport * as $ from 'd3-scale';\nimport { scaleOrdinal, tickFormat as tickFormat$1 } from 'd3-scale';\nexport { scaleImplicit } from 'd3-scale';\nimport * as $$1 from 'd3-interpolate';\nimport { timeInterval, utcInterval } from 'vega-time';\n\nfunction bandSpace (count, paddingInner, paddingOuter) {\n const space = count - paddingInner + paddingOuter * 2;\n return count ? space > 0 ? space : 1 : 0;\n}\n\nconst Identity = 'identity';\nconst Linear = 'linear';\nconst Log = 'log';\nconst Pow = 'pow';\nconst Sqrt = 'sqrt';\nconst Symlog = 'symlog';\nconst Time = 'time';\nconst UTC = 'utc';\nconst Sequential = 'sequential';\nconst Diverging = 'diverging';\nconst Quantile = 'quantile';\nconst Quantize = 'quantize';\nconst Threshold = 'threshold';\nconst Ordinal = 'ordinal';\nconst Point = 'point';\nconst Band = 'band';\nconst BinOrdinal = 'bin-ordinal';\n\n// categories\nconst Continuous = 'continuous';\nconst Discrete = 'discrete';\nconst Discretizing = 'discretizing';\nconst Interpolating = 'interpolating';\nconst Temporal = 'temporal';\n\nfunction invertRange (scale) {\n return function (_) {\n let lo = _[0],\n hi = _[1],\n t;\n if (hi < lo) {\n t = lo;\n lo = hi;\n hi = t;\n }\n return [scale.invert(lo), scale.invert(hi)];\n };\n}\n\nfunction invertRangeExtent (scale) {\n return function (_) {\n const range = scale.range();\n let lo = _[0],\n hi = _[1],\n min = -1,\n max,\n t,\n i,\n n;\n if (hi < lo) {\n t = lo;\n lo = hi;\n hi = t;\n }\n for (i = 0, n = range.length; i < n; ++i) {\n if (range[i] >= lo && range[i] <= hi) {\n if (min < 0) min = i;\n max = i;\n }\n }\n if (min < 0) return undefined;\n lo = scale.invertExtent(range[min]);\n hi = scale.invertExtent(range[max]);\n return [lo[0] === undefined ? lo[1] : lo[0], hi[1] === undefined ? hi[0] : hi[1]];\n };\n}\n\nfunction band() {\n const scale = scaleOrdinal().unknown(undefined),\n domain = scale.domain,\n ordinalRange = scale.range;\n let range$1 = [0, 1],\n step,\n bandwidth,\n round = false,\n paddingInner = 0,\n paddingOuter = 0,\n align = 0.5;\n delete scale.unknown;\n function rescale() {\n const n = domain().length,\n reverse = range$1[1] < range$1[0],\n stop = range$1[1 - reverse],\n space = bandSpace(n, paddingInner, paddingOuter);\n let start = range$1[reverse - 0];\n step = (stop - start) / (space || 1);\n if (round) {\n step = Math.floor(step);\n }\n start += (stop - start - step * (n - paddingInner)) * align;\n bandwidth = step * (1 - paddingInner);\n if (round) {\n start = Math.round(start);\n bandwidth = Math.round(bandwidth);\n }\n const values = range(n).map(i => start + step * i);\n return ordinalRange(reverse ? values.reverse() : values);\n }\n scale.domain = function (_) {\n if (arguments.length) {\n domain(_);\n return rescale();\n } else {\n return domain();\n }\n };\n scale.range = function (_) {\n if (arguments.length) {\n range$1 = [+_[0], +_[1]];\n return rescale();\n } else {\n return range$1.slice();\n }\n };\n scale.rangeRound = function (_) {\n range$1 = [+_[0], +_[1]];\n round = true;\n return rescale();\n };\n scale.bandwidth = function () {\n return bandwidth;\n };\n scale.step = function () {\n return step;\n };\n scale.round = function (_) {\n if (arguments.length) {\n round = !!_;\n return rescale();\n } else {\n return round;\n }\n };\n scale.padding = function (_) {\n if (arguments.length) {\n paddingOuter = Math.max(0, Math.min(1, _));\n paddingInner = paddingOuter;\n return rescale();\n } else {\n return paddingInner;\n }\n };\n scale.paddingInner = function (_) {\n if (arguments.length) {\n paddingInner = Math.max(0, Math.min(1, _));\n return rescale();\n } else {\n return paddingInner;\n }\n };\n scale.paddingOuter = function (_) {\n if (arguments.length) {\n paddingOuter = Math.max(0, Math.min(1, _));\n return rescale();\n } else {\n return paddingOuter;\n }\n };\n scale.align = function (_) {\n if (arguments.length) {\n align = Math.max(0, Math.min(1, _));\n return rescale();\n } else {\n return align;\n }\n };\n scale.invertRange = function (_) {\n // bail if range has null or undefined values\n if (_[0] == null || _[1] == null) return;\n const reverse = range$1[1] < range$1[0],\n values = reverse ? ordinalRange().reverse() : ordinalRange(),\n n = values.length - 1;\n let lo = +_[0],\n hi = +_[1],\n a,\n b,\n t;\n\n // bail if either range endpoint is invalid\n if (lo !== lo || hi !== hi) return;\n\n // order range inputs, bail if outside of scale range\n if (hi < lo) {\n t = lo;\n lo = hi;\n hi = t;\n }\n if (hi < values[0] || lo > range$1[1 - reverse]) return;\n\n // binary search to index into scale range\n a = Math.max(0, bisectRight(values, lo) - 1);\n b = lo === hi ? a : bisectRight(values, hi) - 1;\n\n // increment index a if lo is within padding gap\n if (lo - values[a] > bandwidth + 1e-10) ++a;\n if (reverse) {\n // map + swap\n t = a;\n a = n - b;\n b = n - t;\n }\n return a > b ? undefined : domain().slice(a, b + 1);\n };\n scale.invert = function (_) {\n const value = scale.invertRange([_, _]);\n return value ? value[0] : value;\n };\n scale.copy = function () {\n return band().domain(domain()).range(range$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);\n };\n return rescale();\n}\nfunction pointish(scale) {\n const copy = scale.copy;\n scale.padding = scale.paddingOuter;\n delete scale.paddingInner;\n scale.copy = function () {\n return pointish(copy());\n };\n return scale;\n}\nfunction point() {\n return pointish(band().paddingInner(1));\n}\n\nvar map = Array.prototype.map;\nfunction numbers(_) {\n return map.call(_, toNumber);\n}\n\nconst slice = Array.prototype.slice;\n\nfunction scaleBinOrdinal() {\n let domain = [],\n range = [];\n function scale(x) {\n return x == null || x !== x ? undefined : range[(bisect(domain, x) - 1) % range.length];\n }\n scale.domain = function (_) {\n if (arguments.length) {\n domain = numbers(_);\n return scale;\n } else {\n return domain.slice();\n }\n };\n scale.range = function (_) {\n if (arguments.length) {\n range = slice.call(_);\n return scale;\n } else {\n return range.slice();\n }\n };\n scale.tickFormat = function (count, specifier) {\n return tickFormat$1(domain[0], peek(domain), count == null ? 10 : count, specifier);\n };\n scale.copy = function () {\n return scaleBinOrdinal().domain(scale.domain()).range(scale.range());\n };\n return scale;\n}\n\n/** Private scale registry: should not be exported */\nconst scales = new Map();\nconst VEGA_SCALE = Symbol('vega_scale');\nfunction registerScale(scale) {\n scale[VEGA_SCALE] = true;\n return scale;\n}\n\n/**\n * Return true if object was created by a constructor from the vega-scale `scale` function.\n */\nfunction isRegisteredScale(scale) {\n return scale && scale[VEGA_SCALE] === true;\n}\n\n/**\n * Augment scales with their type and needed inverse methods.\n */\nfunction create(type, constructor, metadata) {\n const ctr = function scale() {\n const s = constructor();\n if (!s.invertRange) {\n s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined;\n }\n s.type = type;\n return registerScale(s);\n };\n ctr.metadata = toSet(array(metadata));\n return ctr;\n}\n\n/**\n * Registry function for adding and accessing scale constructor functions.\n * The *type* argument is a String indicating the name of the scale type.\n *\n * If the *scale* argument is not specified, this method returns the matching scale constructor in the registry, or `null` if not found.\n * If the *scale* argument is provided, it must be a scale constructor function to add to the registry under the given *type* name.\n * The *metadata* argument provides additional information to guide appropriate use of scales within Vega.\n *\n * *metadata* can be either a string or string array. The valid string values are:\n * - `\"continuous\"` - the scale is defined over a continuous-valued domain.\n * - `\"discrete\"` - the scale is defined over a discrete domain and range.\n * - `\"discretizing\"` - the scale discretizes a continuous domain to a discrete range.\n * - `\"interpolating\"` - the scale range is defined using a color interpolator.\n * - `\"log\"` - the scale performs a logarithmic transform of the continuous domain.\n * - `\"temporal\"` - the scale domain is defined over date-time values.\n */\nfunction scale(type, scale, metadata) {\n if (arguments.length > 1) {\n scales.set(type, create(type, scale, metadata));\n return this;\n } else {\n return isValidScaleType(type) ? scales.get(type) : undefined;\n }\n}\n\n// identity scale\nscale(Identity, $.scaleIdentity);\n\n// continuous scales\nscale(Linear, $.scaleLinear, Continuous);\nscale(Log, $.scaleLog, [Continuous, Log]);\nscale(Pow, $.scalePow, Continuous);\nscale(Sqrt, $.scaleSqrt, Continuous);\nscale(Symlog, $.scaleSymlog, Continuous);\nscale(Time, $.scaleTime, [Continuous, Temporal]);\nscale(UTC, $.scaleUtc, [Continuous, Temporal]);\n\n// sequential scales\nscale(Sequential, $.scaleSequential, [Continuous, Interpolating]); // backwards compat\nscale(`${Sequential}-${Linear}`, $.scaleSequential, [Continuous, Interpolating]);\nscale(`${Sequential}-${Log}`, $.scaleSequentialLog, [Continuous, Interpolating, Log]);\nscale(`${Sequential}-${Pow}`, $.scaleSequentialPow, [Continuous, Interpolating]);\nscale(`${Sequential}-${Sqrt}`, $.scaleSequentialSqrt, [Continuous, Interpolating]);\nscale(`${Sequential}-${Symlog}`, $.scaleSequentialSymlog, [Continuous, Interpolating]);\n\n// diverging scales\nscale(`${Diverging}-${Linear}`, $.scaleDiverging, [Continuous, Interpolating]);\nscale(`${Diverging}-${Log}`, $.scaleDivergingLog, [Continuous, Interpolating, Log]);\nscale(`${Diverging}-${Pow}`, $.scaleDivergingPow, [Continuous, Interpolating]);\nscale(`${Diverging}-${Sqrt}`, $.scaleDivergingSqrt, [Continuous, Interpolating]);\nscale(`${Diverging}-${Symlog}`, $.scaleDivergingSymlog, [Continuous, Interpolating]);\n\n// discretizing scales\nscale(Quantile, $.scaleQuantile, [Discretizing, Quantile]);\nscale(Quantize, $.scaleQuantize, Discretizing);\nscale(Threshold, $.scaleThreshold, Discretizing);\n\n// discrete scales\nscale(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]);\nscale(Ordinal, $.scaleOrdinal, Discrete);\nscale(Band, band, Discrete);\nscale(Point, point, Discrete);\nfunction isValidScaleType(type) {\n return scales.has(type);\n}\nfunction hasType(key, type) {\n const s = scales.get(key);\n return s && s.metadata[type];\n}\nfunction isContinuous(key) {\n return hasType(key, Continuous);\n}\nfunction isDiscrete(key) {\n return hasType(key, Discrete);\n}\nfunction isDiscretizing(key) {\n return hasType(key, Discretizing);\n}\nfunction isLogarithmic(key) {\n return hasType(key, Log);\n}\nfunction isTemporal(key) {\n return hasType(key, Temporal);\n}\nfunction isInterpolating(key) {\n return hasType(key, Interpolating);\n}\nfunction isQuantile(key) {\n return hasType(key, Quantile);\n}\n\nconst scaleProps = ['clamp', 'base', 'constant', 'exponent'];\nfunction interpolateRange(interpolator, range) {\n const start = range[0],\n span = peek(range) - start;\n return function (i) {\n return interpolator(start + i * span);\n };\n}\nfunction interpolateColors(colors, type, gamma) {\n return $$1.piecewise(interpolate(type || 'rgb', gamma), colors);\n}\nfunction quantizeInterpolator(interpolator, count) {\n const samples = new Array(count),\n n = count + 1;\n for (let i = 0; i < count;) samples[i] = interpolator(++i / n);\n return samples;\n}\nfunction scaleCopy(scale) {\n const t = scale.type,\n s = scale.copy();\n s.type = t;\n return s;\n}\nfunction scaleFraction(scale$1, min, max) {\n const delta = max - min;\n let i, t, s;\n if (!delta || !Number.isFinite(delta)) {\n return constant(0.5);\n } else {\n i = (t = scale$1.type).indexOf('-');\n t = i < 0 ? t : t.slice(i + 1);\n s = scale(t)().domain([min, max]).range([0, 1]);\n scaleProps.forEach(m => scale$1[m] ? s[m](scale$1[m]()) : 0);\n return s;\n }\n}\nfunction interpolate(type, gamma) {\n const interp = $$1[method(type)];\n return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp;\n}\nfunction method(type) {\n return 'interpolate' + type.toLowerCase().split('-').map(s => s[0].toUpperCase() + s.slice(1)).join('');\n}\n\nconst continuous = {\n blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90',\n greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429',\n greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e',\n oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303',\n purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c',\n reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13',\n blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429',\n bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71',\n greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1',\n orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403',\n purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281',\n purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353',\n purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a',\n redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174',\n yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034',\n yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204',\n yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225',\n blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07',\n brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147',\n purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29',\n purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07',\n redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85',\n redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434',\n yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185',\n redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695',\n redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837',\n pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419',\n spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2',\n viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725',\n magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf',\n inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4',\n plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921',\n cividis: '00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647',\n rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa',\n sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040',\n turbo: '23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00',\n browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632',\n tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985',\n teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667',\n warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e',\n goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36',\n goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26',\n goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e',\n lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b',\n lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc',\n lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c',\n lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b',\n lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988',\n darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff',\n darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff',\n darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa',\n darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff',\n darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c'\n};\nconst discrete = {\n category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf',\n category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5',\n category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6',\n category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9',\n tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac',\n tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5',\n accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666',\n dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666',\n paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928',\n pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2',\n pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc',\n set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999',\n set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3',\n set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f'\n};\n\nfunction colors(palette) {\n const n = palette.length / 6 | 0,\n c = new Array(n);\n for (let i = 0; i < n;) {\n c[i] = '#' + palette.slice(i * 6, ++i * 6);\n }\n return c;\n}\nfunction apply(_, f) {\n for (const k in _) scheme(k, f(_[k]));\n}\nconst schemes = {};\napply(discrete, colors);\napply(continuous, _ => interpolateColors(colors(_)));\nfunction scheme(name, scheme) {\n name = name && name.toLowerCase();\n if (arguments.length > 1) {\n schemes[name] = scheme;\n return this;\n } else {\n return schemes[name];\n }\n}\n\nconst SymbolLegend = 'symbol';\nconst DiscreteLegend = 'discrete';\nconst GradientLegend = 'gradient';\n\nconst defaultFormatter = value => isArray(value) ? value.map(v => String(v)) : String(value);\nconst ascending = (a, b) => a[1] - b[1];\nconst descending = (a, b) => b[1] - a[1];\n\n/**\n * Determine the tick count or interval function.\n * @param {Scale} scale - The scale for which to generate tick values.\n * @param {*} count - The desired tick count or interval specifier.\n * @param {number} minStep - The desired minimum step between tick values.\n * @return {*} - The tick count or interval function.\n */\nfunction tickCount(scale, count, minStep) {\n let step;\n if (isNumber(count)) {\n if (scale.bins) {\n count = Math.max(count, scale.bins.length);\n }\n if (minStep != null) {\n count = Math.min(count, Math.floor(span(scale.domain()) / minStep || 1) + 1);\n }\n }\n if (isObject(count)) {\n step = count.step;\n count = count.interval;\n }\n if (isString(count)) {\n count = scale.type === Time ? timeInterval(count) : scale.type == UTC ? utcInterval(count) : error('Only time and utc scales accept interval strings.');\n if (step) count = count.every(step);\n }\n return count;\n}\n\n/**\n * Filter a set of candidate tick values, ensuring that only tick values\n * that lie within the scale range are included.\n * @param {Scale} scale - The scale for which to generate tick values.\n * @param {Array<*>} ticks - The candidate tick values.\n * @param {*} count - The tick count or interval function.\n * @return {Array<*>} - The filtered tick values.\n */\nfunction validTicks(scale, ticks, count) {\n let range = scale.range(),\n lo = range[0],\n hi = peek(range),\n cmp = ascending;\n if (lo > hi) {\n range = hi;\n hi = lo;\n lo = range;\n cmp = descending;\n }\n lo = Math.floor(lo);\n hi = Math.ceil(hi);\n\n // filter ticks to valid values within the range\n // additionally sort ticks in range order (#2579)\n ticks = ticks.map(v => [v, scale(v)]).filter(_ => lo <= _[1] && _[1] <= hi).sort(cmp).map(_ => _[0]);\n if (count > 0 && ticks.length > 1) {\n const endpoints = [ticks[0], peek(ticks)];\n while (ticks.length > count && ticks.length >= 3) {\n ticks = ticks.filter((_, i) => !(i % 2));\n }\n if (ticks.length < 3) {\n ticks = endpoints;\n }\n }\n return ticks;\n}\n\n/**\n * Generate tick values for the given scale and approximate tick count or\n * interval value. If the scale has a 'ticks' method, it will be used to\n * generate the ticks, with the count argument passed as a parameter. If the\n * scale lacks a 'ticks' method, the full scale domain will be returned.\n * @param {Scale} scale - The scale for which to generate tick values.\n * @param {*} [count] - The approximate number of desired ticks.\n * @return {Array<*>} - The generated tick values.\n */\nfunction tickValues(scale, count) {\n return scale.bins ? validTicks(scale, scale.bins) : scale.ticks ? scale.ticks(count) : scale.domain();\n}\n\n/**\n * Generate a label format function for a scale. If the scale has a\n * 'tickFormat' method, it will be used to generate the formatter, with the\n * count and specifier arguments passed as parameters. If the scale lacks a\n * 'tickFormat' method, the returned formatter performs simple string coercion.\n * If the input scale is a logarithmic scale and the format specifier does not\n * indicate a desired decimal precision, a special variable precision formatter\n * that automatically trims trailing zeroes will be generated.\n * @param {Scale} scale - The scale for which to generate the label formatter.\n * @param {*} [count] - The approximate number of desired ticks.\n * @param {string} [specifier] - The format specifier. Must be a legal d3\n * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or\n * time multi-format specifier object.\n * @return {function(*):string} - The generated label formatter.\n */\nfunction tickFormat(locale, scale, count, specifier, formatType, noSkip) {\n const type = scale.type;\n let format = defaultFormatter;\n if (type === Time || formatType === Time) {\n format = locale.timeFormat(specifier);\n } else if (type === UTC || formatType === UTC) {\n format = locale.utcFormat(specifier);\n } else if (isLogarithmic(type)) {\n const varfmt = locale.formatFloat(specifier);\n if (noSkip || scale.bins) {\n format = varfmt;\n } else {\n const test = tickLog(scale, count, false);\n format = _ => test(_) ? varfmt(_) : '';\n }\n } else if (scale.tickFormat) {\n // if d3 scale has tickFormat, it must be continuous\n const d = scale.domain();\n format = locale.formatSpan(d[0], d[d.length - 1], count, specifier);\n } else if (specifier) {\n format = locale.format(specifier);\n }\n return format;\n}\nfunction tickLog(scale, count, values) {\n const ticks = tickValues(scale, count),\n base = scale.base(),\n logb = Math.log(base),\n k = Math.max(1, base * count / ticks.length);\n\n // apply d3-scale's log format filter criteria\n const test = d => {\n let i = d / Math.pow(base, Math.round(Math.log(d) / logb));\n if (i * base < base - 0.5) i *= base;\n return i <= k;\n };\n return values ? ticks.filter(test) : test;\n}\n\nconst symbols = {\n [Quantile]: 'quantiles',\n [Quantize]: 'thresholds',\n [Threshold]: 'domain'\n};\nconst formats = {\n [Quantile]: 'quantiles',\n [Quantize]: 'domain'\n};\nfunction labelValues(scale, count) {\n return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols[scale.type] ? thresholdValues(scale[symbols[scale.type]]()) : tickValues(scale, count);\n}\nfunction thresholdFormat(locale, scale, specifier) {\n const _ = scale[formats[scale.type]](),\n n = _.length;\n let d = n > 1 ? _[1] - _[0] : _[0],\n i;\n for (i = 1; i < n; ++i) {\n d = Math.min(d, _[i] - _[i - 1]);\n }\n\n // tickCount = 3 ticks times 10 for increased resolution\n return locale.formatSpan(0, d, 3 * 10, specifier);\n}\nfunction thresholdValues(thresholds) {\n const values = [-Infinity].concat(thresholds);\n values.max = +Infinity;\n return values;\n}\nfunction binValues(bins) {\n const values = bins.slice(0, -1);\n values.max = peek(bins);\n return values;\n}\nconst isDiscreteRange = scale => symbols[scale.type] || scale.bins;\nfunction labelFormat(locale, scale, count, type, specifier, formatType, noSkip) {\n const format = formats[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat(locale, scale, count, specifier, formatType, noSkip);\n return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format);\n}\nconst formatRange = format => (value, index, array) => {\n const limit = get(array[index + 1], get(array.max, +Infinity)),\n lo = formatValue(value, format),\n hi = formatValue(limit, format);\n return lo && hi ? lo + ' \\u2013 ' + hi : hi ? '< ' + hi : '\\u2265 ' + lo;\n};\nconst get = (value, dflt) => value != null ? value : dflt;\nconst formatDiscrete = format => (value, index) => index ? format(value) : null;\nconst formatPoint = format => value => format(value);\nconst formatValue = (value, format) => Number.isFinite(value) ? format(value) : null;\nfunction labelFraction(scale) {\n const domain = scale.domain(),\n count = domain.length - 1;\n let lo = +domain[0],\n hi = +peek(domain),\n span = hi - lo;\n if (scale.type === Threshold) {\n const adjust = count ? span / count : 0.1;\n lo -= adjust;\n hi += adjust;\n span = hi - lo;\n }\n return value => (value - lo) / span;\n}\n\nfunction format(locale, scale, specifier, formatType) {\n const type = formatType || scale.type;\n\n // replace abbreviated time specifiers to improve screen reader experience\n if (isString(specifier) && isTemporal(type)) {\n specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B');\n }\n return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') : labelFormat(locale, scale, 5, null, specifier, formatType, true);\n}\nfunction domainCaption(locale, scale, opt) {\n opt = opt || {};\n const max = Math.max(3, opt.maxlen || 7),\n fmt = format(locale, scale, opt.format, opt.formatType);\n\n // if scale breaks domain into bins, describe boundaries\n if (isDiscretizing(scale.type)) {\n const v = labelValues(scale).slice(1).map(fmt),\n n = v.length;\n return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`;\n }\n\n // if scale domain is discrete, list values\n else if (isDiscrete(scale.type)) {\n const d = scale.domain(),\n n = d.length,\n v = n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', ');\n return `${n} value${n === 1 ? '' : 's'}: ${v}`;\n }\n\n // if scale domain is continuous, describe value range\n else {\n const d = scale.domain();\n return `values from ${fmt(d[0])} to ${fmt(peek(d))}`;\n }\n}\n\nexport { Band, BinOrdinal, DiscreteLegend, Diverging, GradientLegend, Identity, Linear, Log, Ordinal, Point, Pow, Quantile, Quantize, Sequential, Sqrt, SymbolLegend, Symlog, Threshold, Time, UTC, bandSpace, domainCaption, interpolate, interpolateColors, interpolateRange, isContinuous, isDiscrete, isDiscretizing, isInterpolating, isLogarithmic, isQuantile, isRegisteredScale, isTemporal, isValidScaleType, labelFormat, labelFraction, labelValues, quantizeInterpolator, registerScale, scale, scaleCopy, scaleFraction, scheme, tickCount, tickFormat, tickValues, validTicks };\n","import {linearish} from \"./linear.js\";\nimport number from \"./number.js\";\n\nexport default function identity(domain) {\n var unknown;\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : x;\n }\n\n scale.invert = scale;\n\n scale.domain = scale.range = function(_) {\n return arguments.length ? (domain = Array.from(_, number), scale) : domain.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return identity(domain).unknown(unknown);\n };\n\n domain = arguments.length ? Array.from(domain, number) : [0, 1];\n\n return linearish(scale);\n}\n","import {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcTicks, utcTickInterval} from \"d3-time\";\nimport {utcFormat} from \"d3-time-format\";\nimport {calendar} from \"./time.js\";\nimport {initRange} from \"./init.js\";\n\nexport default function utcTime() {\n return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);\n}\n","import {ascending, bisect, quantileSorted as threshold} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport default function quantile() {\n var domain = [],\n range = [],\n thresholds = [],\n unknown;\n\n function rescale() {\n var i = 0, n = Math.max(1, range.length);\n thresholds = new Array(n - 1);\n while (++i < n) thresholds[i - 1] = threshold(domain, i / n);\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : range[bisect(thresholds, x)];\n }\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN] : [\n i > 0 ? thresholds[i - 1] : domain[0],\n i < thresholds.length ? thresholds[i] : domain[domain.length - 1]\n ];\n };\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [];\n for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d);\n domain.sort(ascending);\n return rescale();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.quantiles = function() {\n return thresholds.slice();\n };\n\n scale.copy = function() {\n return quantile()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(scale, arguments);\n}\n","import {bisect} from \"d3-array\";\nimport {linearish} from \"./linear.js\";\nimport {initRange} from \"./init.js\";\n\nexport default function quantize() {\n var x0 = 0,\n x1 = 1,\n n = 1,\n domain = [0.5],\n range = [0, 1],\n unknown;\n\n function scale(x) {\n return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;\n }\n\n function rescale() {\n var i = -1;\n domain = new Array(n);\n while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);\n return scale;\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1];\n };\n\n scale.range = function(_) {\n return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN]\n : i < 1 ? [x0, domain[0]]\n : i >= n ? [domain[n - 1], x1]\n : [domain[i - 1], domain[i]];\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : scale;\n };\n\n scale.thresholds = function() {\n return domain.slice();\n };\n\n scale.copy = function() {\n return quantize()\n .domain([x0, x1])\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(linearish(scale), arguments);\n}\n","import {bisect} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport default function threshold() {\n var domain = [0.5],\n range = [0, 1],\n unknown,\n n = 1;\n\n function scale(x) {\n return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return [domain[i - 1], domain[i]];\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return threshold()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(scale, arguments);\n}\n","import { hasOwnProperty, isFunction, inherits, truthy, lruCache, isArray, error, toSet, array, peek, extend, isNumber, isObject } from 'vega-util';\nimport { curveBasis, curveBasisClosed, curveBasisOpen, curveBundle, curveCardinal, curveCardinalOpen, curveCardinalClosed, curveCatmullRom, curveCatmullRomClosed, curveCatmullRomOpen, curveLinear, curveLinearClosed, curveMonotoneY, curveMonotoneX, curveNatural, curveStep, curveStepAfter, curveStepBefore, arc as arc$2, area as area$2, line as line$2, symbol as symbol$2 } from 'd3-shape';\nimport { path as path$3 } from 'd3-path';\nexport { path } from 'd3-path';\nimport { image as image$1, canvas } from 'vega-canvas';\nimport { loader } from 'vega-loader';\nimport { isDiscrete, domainCaption } from 'vega-scale';\n\nlet gradient_id = 0;\nfunction resetSVGGradientId() {\n gradient_id = 0;\n}\nconst patternPrefix = 'p_';\nfunction isGradient(value) {\n return value && value.gradient;\n}\nfunction gradientRef(g, defs, base) {\n const type = g.gradient;\n let id = g.id,\n prefix = type === 'radial' ? patternPrefix : '';\n\n // check id, assign default values as needed\n if (!id) {\n id = g.id = 'gradient_' + gradient_id++;\n if (type === 'radial') {\n g.x1 = get(g.x1, 0.5);\n g.y1 = get(g.y1, 0.5);\n g.r1 = get(g.r1, 0);\n g.x2 = get(g.x2, 0.5);\n g.y2 = get(g.y2, 0.5);\n g.r2 = get(g.r2, 0.5);\n prefix = patternPrefix;\n } else {\n g.x1 = get(g.x1, 0);\n g.y1 = get(g.y1, 0);\n g.x2 = get(g.x2, 1);\n g.y2 = get(g.y2, 0);\n }\n }\n\n // register definition\n defs[id] = g;\n\n // return url reference\n return 'url(' + (base || '') + '#' + prefix + id + ')';\n}\nfunction get(val, def) {\n return val != null ? val : def;\n}\nfunction Gradient (p0, p1) {\n var stops = [],\n gradient;\n return gradient = {\n gradient: 'linear',\n x1: p0 ? p0[0] : 0,\n y1: p0 ? p0[1] : 0,\n x2: p1 ? p1[0] : 1,\n y2: p1 ? p1[1] : 0,\n stops: stops,\n stop: function (offset, color) {\n stops.push({\n offset: offset,\n color: color\n });\n return gradient;\n }\n };\n}\n\nconst lookup = {\n 'basis': {\n curve: curveBasis\n },\n 'basis-closed': {\n curve: curveBasisClosed\n },\n 'basis-open': {\n curve: curveBasisOpen\n },\n 'bundle': {\n curve: curveBundle,\n tension: 'beta',\n value: 0.85\n },\n 'cardinal': {\n curve: curveCardinal,\n tension: 'tension',\n value: 0\n },\n 'cardinal-open': {\n curve: curveCardinalOpen,\n tension: 'tension',\n value: 0\n },\n 'cardinal-closed': {\n curve: curveCardinalClosed,\n tension: 'tension',\n value: 0\n },\n 'catmull-rom': {\n curve: curveCatmullRom,\n tension: 'alpha',\n value: 0.5\n },\n 'catmull-rom-closed': {\n curve: curveCatmullRomClosed,\n tension: 'alpha',\n value: 0.5\n },\n 'catmull-rom-open': {\n curve: curveCatmullRomOpen,\n tension: 'alpha',\n value: 0.5\n },\n 'linear': {\n curve: curveLinear\n },\n 'linear-closed': {\n curve: curveLinearClosed\n },\n 'monotone': {\n horizontal: curveMonotoneY,\n vertical: curveMonotoneX\n },\n 'natural': {\n curve: curveNatural\n },\n 'step': {\n curve: curveStep\n },\n 'step-after': {\n curve: curveStepAfter\n },\n 'step-before': {\n curve: curveStepBefore\n }\n};\nfunction curves(type, orientation, tension) {\n var entry = hasOwnProperty(lookup, type) && lookup[type],\n curve = null;\n if (entry) {\n curve = entry.curve || entry[orientation || 'vertical'];\n if (entry.tension && tension != null) {\n curve = curve[entry.tension](tension);\n }\n }\n return curve;\n}\n\nconst paramCounts = {\n m: 2,\n l: 2,\n h: 1,\n v: 1,\n z: 0,\n c: 6,\n s: 4,\n q: 4,\n t: 2,\n a: 7\n};\nconst commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi;\nconst numberPattern = /^[+-]?(([0-9]*\\.[0-9]+)|([0-9]+\\.)|([0-9]+))([eE][+-]?[0-9]+)?/;\nconst spacePattern = /^((\\s+,?\\s*)|(,\\s*))/;\nconst flagPattern = /^[01]/;\nfunction parse(path) {\n const commands = [];\n const matches = path.match(commandPattern) || [];\n matches.forEach(str => {\n let cmd = str[0];\n const type = cmd.toLowerCase();\n\n // parse parameters\n const paramCount = paramCounts[type];\n const params = parseParams(type, paramCount, str.slice(1).trim());\n const count = params.length;\n\n // error checking based on parameter count\n if (count < paramCount || count && count % paramCount !== 0) {\n throw Error('Invalid SVG path, incorrect parameter count');\n }\n\n // register the command\n commands.push([cmd, ...params.slice(0, paramCount)]);\n\n // exit now if we're done, also handles zero-param 'z'\n if (count === paramCount) {\n return;\n }\n\n // handle implicit line-to\n if (type === 'm') {\n cmd = cmd === 'M' ? 'L' : 'l';\n }\n\n // repeat command when given extended param list\n for (let i = paramCount; i < count; i += paramCount) {\n commands.push([cmd, ...params.slice(i, i + paramCount)]);\n }\n });\n return commands;\n}\nfunction parseParams(type, paramCount, segment) {\n const params = [];\n for (let index = 0; paramCount && index < segment.length;) {\n for (let i = 0; i < paramCount; ++i) {\n const pattern = type === 'a' && (i === 3 || i === 4) ? flagPattern : numberPattern;\n const match = segment.slice(index).match(pattern);\n if (match === null) {\n throw Error('Invalid SVG path, incorrect parameter type');\n }\n index += match[0].length;\n params.push(+match[0]);\n const ws = segment.slice(index).match(spacePattern);\n if (ws !== null) {\n index += ws[0].length;\n }\n }\n }\n return params;\n}\n\nconst DegToRad = Math.PI / 180;\nconst Epsilon = 1e-14;\nconst HalfPi = Math.PI / 2;\nconst Tau = Math.PI * 2;\nconst HalfSqrt3 = Math.sqrt(3) / 2;\n\nvar segmentCache = {};\nvar bezierCache = {};\nvar join = [].join;\n\n// Copied from Inkscape svgtopdf, thanks!\nfunction segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {\n const key = join.call(arguments);\n if (segmentCache[key]) {\n return segmentCache[key];\n }\n const th = rotateX * DegToRad;\n const sin_th = Math.sin(th);\n const cos_th = Math.cos(th);\n rx = Math.abs(rx);\n ry = Math.abs(ry);\n const px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;\n const py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;\n let pl = px * px / (rx * rx) + py * py / (ry * ry);\n if (pl > 1) {\n pl = Math.sqrt(pl);\n rx *= pl;\n ry *= pl;\n }\n const a00 = cos_th / rx;\n const a01 = sin_th / rx;\n const a10 = -sin_th / ry;\n const a11 = cos_th / ry;\n const x0 = a00 * ox + a01 * oy;\n const y0 = a10 * ox + a11 * oy;\n const x1 = a00 * x + a01 * y;\n const y1 = a10 * x + a11 * y;\n const d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);\n let sfactor_sq = 1 / d - 0.25;\n if (sfactor_sq < 0) sfactor_sq = 0;\n let sfactor = Math.sqrt(sfactor_sq);\n if (sweep == large) sfactor = -sfactor;\n const xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0);\n const yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);\n const th0 = Math.atan2(y0 - yc, x0 - xc);\n const th1 = Math.atan2(y1 - yc, x1 - xc);\n let th_arc = th1 - th0;\n if (th_arc < 0 && sweep === 1) {\n th_arc += Tau;\n } else if (th_arc > 0 && sweep === 0) {\n th_arc -= Tau;\n }\n const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001)));\n const result = [];\n for (let i = 0; i < segs; ++i) {\n const th2 = th0 + i * th_arc / segs;\n const th3 = th0 + (i + 1) * th_arc / segs;\n result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th];\n }\n return segmentCache[key] = result;\n}\nfunction bezier(params) {\n const key = join.call(params);\n if (bezierCache[key]) {\n return bezierCache[key];\n }\n var cx = params[0],\n cy = params[1],\n th0 = params[2],\n th1 = params[3],\n rx = params[4],\n ry = params[5],\n sin_th = params[6],\n cos_th = params[7];\n const a00 = cos_th * rx;\n const a01 = -sin_th * ry;\n const a10 = sin_th * rx;\n const a11 = cos_th * ry;\n const cos_th0 = Math.cos(th0);\n const sin_th0 = Math.sin(th0);\n const cos_th1 = Math.cos(th1);\n const sin_th1 = Math.sin(th1);\n const th_half = 0.5 * (th1 - th0);\n const sin_th_h2 = Math.sin(th_half * 0.5);\n const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half);\n const x1 = cx + cos_th0 - t * sin_th0;\n const y1 = cy + sin_th0 + t * cos_th0;\n const x3 = cx + cos_th1;\n const y3 = cy + sin_th1;\n const x2 = x3 + t * sin_th1;\n const y2 = y3 - t * cos_th1;\n return bezierCache[key] = [a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3];\n}\n\nconst temp = ['l', 0, 0, 0, 0, 0, 0, 0];\nfunction scale$1(current, sX, sY) {\n const c = temp[0] = current[0];\n if (c === 'a' || c === 'A') {\n temp[1] = sX * current[1];\n temp[2] = sY * current[2];\n temp[3] = current[3];\n temp[4] = current[4];\n temp[5] = current[5];\n temp[6] = sX * current[6];\n temp[7] = sY * current[7];\n } else if (c === 'h' || c === 'H') {\n temp[1] = sX * current[1];\n } else if (c === 'v' || c === 'V') {\n temp[1] = sY * current[1];\n } else {\n for (var i = 1, n = current.length; i < n; ++i) {\n temp[i] = (i % 2 == 1 ? sX : sY) * current[i];\n }\n }\n return temp;\n}\nfunction pathRender (context, path, l, t, sX, sY) {\n var current,\n // current instruction\n previous = null,\n x = 0,\n // current x\n y = 0,\n // current y\n controlX = 0,\n // current control point x\n controlY = 0,\n // current control point y\n tempX,\n tempY,\n tempControlX,\n tempControlY,\n anchorX = 0,\n anchorY = 0;\n if (l == null) l = 0;\n if (t == null) t = 0;\n if (sX == null) sX = 1;\n if (sY == null) sY = sX;\n if (context.beginPath) context.beginPath();\n for (var i = 0, len = path.length; i < len; ++i) {\n current = path[i];\n if (sX !== 1 || sY !== 1) {\n current = scale$1(current, sX, sY);\n }\n switch (current[0]) {\n // first letter\n\n case 'l':\n // lineto, relative\n x += current[1];\n y += current[2];\n context.lineTo(x + l, y + t);\n break;\n case 'L':\n // lineto, absolute\n x = current[1];\n y = current[2];\n context.lineTo(x + l, y + t);\n break;\n case 'h':\n // horizontal lineto, relative\n x += current[1];\n context.lineTo(x + l, y + t);\n break;\n case 'H':\n // horizontal lineto, absolute\n x = current[1];\n context.lineTo(x + l, y + t);\n break;\n case 'v':\n // vertical lineto, relative\n y += current[1];\n context.lineTo(x + l, y + t);\n break;\n case 'V':\n // verical lineto, absolute\n y = current[1];\n context.lineTo(x + l, y + t);\n break;\n case 'm':\n // moveTo, relative\n x += current[1];\n y += current[2];\n anchorX = x;\n anchorY = y;\n context.moveTo(x + l, y + t);\n break;\n case 'M':\n // moveTo, absolute\n x = current[1];\n y = current[2];\n anchorX = x;\n anchorY = y;\n context.moveTo(x + l, y + t);\n break;\n case 'c':\n // bezierCurveTo, relative\n tempX = x + current[5];\n tempY = y + current[6];\n controlX = x + current[3];\n controlY = y + current[4];\n context.bezierCurveTo(x + current[1] + l,\n // x1\n y + current[2] + t,\n // y1\n controlX + l,\n // x2\n controlY + t,\n // y2\n tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n break;\n case 'C':\n // bezierCurveTo, absolute\n x = current[5];\n y = current[6];\n controlX = current[3];\n controlY = current[4];\n context.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t);\n break;\n case 's':\n // shorthand cubic bezierCurveTo, relative\n // transform to absolute x,y\n tempX = x + current[3];\n tempY = y + current[4];\n // calculate reflection of previous control points\n controlX = 2 * x - controlX;\n controlY = 2 * y - controlY;\n context.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t);\n\n // set control point to 2nd one of this command\n // the first control point is assumed to be the reflection of\n // the second control point on the previous command relative\n // to the current point.\n controlX = x + current[1];\n controlY = y + current[2];\n x = tempX;\n y = tempY;\n break;\n case 'S':\n // shorthand cubic bezierCurveTo, absolute\n tempX = current[3];\n tempY = current[4];\n // calculate reflection of previous control points\n controlX = 2 * x - controlX;\n controlY = 2 * y - controlY;\n context.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n // set control point to 2nd one of this command\n // the first control point is assumed to be the reflection of\n // the second control point on the previous command relative\n // to the current point.\n controlX = current[1];\n controlY = current[2];\n break;\n case 'q':\n // quadraticCurveTo, relative\n // transform to absolute x,y\n tempX = x + current[3];\n tempY = y + current[4];\n controlX = x + current[1];\n controlY = y + current[2];\n context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n break;\n case 'Q':\n // quadraticCurveTo, absolute\n tempX = current[3];\n tempY = current[4];\n context.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n controlX = current[1];\n controlY = current[2];\n break;\n case 't':\n // shorthand quadraticCurveTo, relative\n\n // transform to absolute x,y\n tempX = x + current[1];\n tempY = y + current[2];\n if (previous[0].match(/[QqTt]/) === null) {\n // If there is no previous command or if the previous command was not a Q, q, T or t,\n // assume the control point is coincident with the current point\n controlX = x;\n controlY = y;\n } else if (previous[0] === 't') {\n // calculate reflection of previous control points for t\n controlX = 2 * x - tempControlX;\n controlY = 2 * y - tempControlY;\n } else if (previous[0] === 'q') {\n // calculate reflection of previous control points for q\n controlX = 2 * x - controlX;\n controlY = 2 * y - controlY;\n }\n tempControlX = controlX;\n tempControlY = controlY;\n context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n controlX = x + current[1];\n controlY = y + current[2];\n break;\n case 'T':\n tempX = current[1];\n tempY = current[2];\n\n // calculate reflection of previous control points\n controlX = 2 * x - controlX;\n controlY = 2 * y - controlY;\n context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t);\n x = tempX;\n y = tempY;\n break;\n case 'a':\n drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + x + l, current[7] + y + t]);\n x += current[6];\n y += current[7];\n break;\n case 'A':\n drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + l, current[7] + t]);\n x = current[6];\n y = current[7];\n break;\n case 'z':\n case 'Z':\n x = anchorX;\n y = anchorY;\n context.closePath();\n break;\n }\n previous = current;\n }\n}\nfunction drawArc(context, x, y, coords) {\n const seg = segments(coords[5],\n // end x\n coords[6],\n // end y\n coords[0],\n // radius x\n coords[1],\n // radius y\n coords[3],\n // large flag\n coords[4],\n // sweep flag\n coords[2],\n // rotation\n x, y);\n for (let i = 0; i < seg.length; ++i) {\n const bez = bezier(seg[i]);\n context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]);\n }\n}\n\nconst Tan30 = 0.5773502691896257;\nconst builtins = {\n 'circle': {\n draw: function (context, size) {\n const r = Math.sqrt(size) / 2;\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, Tau);\n }\n },\n 'cross': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n s = r / 2.5;\n context.moveTo(-r, -s);\n context.lineTo(-r, s);\n context.lineTo(-s, s);\n context.lineTo(-s, r);\n context.lineTo(s, r);\n context.lineTo(s, s);\n context.lineTo(r, s);\n context.lineTo(r, -s);\n context.lineTo(s, -s);\n context.lineTo(s, -r);\n context.lineTo(-s, -r);\n context.lineTo(-s, -s);\n context.closePath();\n }\n },\n 'diamond': {\n draw: function (context, size) {\n const r = Math.sqrt(size) / 2;\n context.moveTo(-r, 0);\n context.lineTo(0, -r);\n context.lineTo(r, 0);\n context.lineTo(0, r);\n context.closePath();\n }\n },\n 'square': {\n draw: function (context, size) {\n var w = Math.sqrt(size),\n x = -w / 2;\n context.rect(x, x, w, w);\n }\n },\n 'arrow': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n s = r / 7,\n t = r / 2.5,\n v = r / 8;\n context.moveTo(-s, r);\n context.lineTo(s, r);\n context.lineTo(s, -v);\n context.lineTo(t, -v);\n context.lineTo(0, -r);\n context.lineTo(-t, -v);\n context.lineTo(-s, -v);\n context.closePath();\n }\n },\n 'wedge': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r,\n o = h - r * Tan30,\n b = r / 4;\n context.moveTo(0, -h - o);\n context.lineTo(-b, h - o);\n context.lineTo(b, h - o);\n context.closePath();\n }\n },\n 'triangle': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r,\n o = h - r * Tan30;\n context.moveTo(0, -h - o);\n context.lineTo(-r, h - o);\n context.lineTo(r, h - o);\n context.closePath();\n }\n },\n 'triangle-up': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r;\n context.moveTo(0, -h);\n context.lineTo(-r, h);\n context.lineTo(r, h);\n context.closePath();\n }\n },\n 'triangle-down': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r;\n context.moveTo(0, h);\n context.lineTo(-r, -h);\n context.lineTo(r, -h);\n context.closePath();\n }\n },\n 'triangle-right': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r;\n context.moveTo(h, 0);\n context.lineTo(-h, -r);\n context.lineTo(-h, r);\n context.closePath();\n }\n },\n 'triangle-left': {\n draw: function (context, size) {\n var r = Math.sqrt(size) / 2,\n h = HalfSqrt3 * r;\n context.moveTo(-h, 0);\n context.lineTo(h, -r);\n context.lineTo(h, r);\n context.closePath();\n }\n },\n 'stroke': {\n draw: function (context, size) {\n const r = Math.sqrt(size) / 2;\n context.moveTo(-r, 0);\n context.lineTo(r, 0);\n }\n }\n};\nfunction symbols(_) {\n return hasOwnProperty(builtins, _) ? builtins[_] : customSymbol(_);\n}\nvar custom = {};\nfunction customSymbol(path) {\n if (!hasOwnProperty(custom, path)) {\n const parsed = parse(path);\n custom[path] = {\n draw: function (context, size) {\n pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2);\n }\n };\n }\n return custom[path];\n}\n\n// See http://spencermortensen.com/articles/bezier-circle/\nconst C = 0.448084975506; // C = 1 - c\n\nfunction rectangleX(d) {\n return d.x;\n}\nfunction rectangleY(d) {\n return d.y;\n}\nfunction rectangleWidth(d) {\n return d.width;\n}\nfunction rectangleHeight(d) {\n return d.height;\n}\nfunction number(_) {\n return typeof _ === 'function' ? _ : () => +_;\n}\nfunction clamp(value, min, max) {\n return Math.max(min, Math.min(value, max));\n}\nfunction vg_rect () {\n var x = rectangleX,\n y = rectangleY,\n width = rectangleWidth,\n height = rectangleHeight,\n crTL = number(0),\n crTR = crTL,\n crBL = crTL,\n crBR = crTL,\n context = null;\n function rectangle(_, x0, y0) {\n var buffer,\n x1 = x0 != null ? x0 : +x.call(this, _),\n y1 = y0 != null ? y0 : +y.call(this, _),\n w = +width.call(this, _),\n h = +height.call(this, _),\n s = Math.min(w, h) / 2,\n tl = clamp(+crTL.call(this, _), 0, s),\n tr = clamp(+crTR.call(this, _), 0, s),\n bl = clamp(+crBL.call(this, _), 0, s),\n br = clamp(+crBR.call(this, _), 0, s);\n if (!context) context = buffer = path$3();\n if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) {\n context.rect(x1, y1, w, h);\n } else {\n var x2 = x1 + w,\n y2 = y1 + h;\n context.moveTo(x1 + tl, y1);\n context.lineTo(x2 - tr, y1);\n context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr);\n context.lineTo(x2, y2 - br);\n context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2);\n context.lineTo(x1 + bl, y2);\n context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl);\n context.lineTo(x1, y1 + tl);\n context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1);\n context.closePath();\n }\n if (buffer) {\n context = null;\n return buffer + '' || null;\n }\n }\n rectangle.x = function (_) {\n if (arguments.length) {\n x = number(_);\n return rectangle;\n } else {\n return x;\n }\n };\n rectangle.y = function (_) {\n if (arguments.length) {\n y = number(_);\n return rectangle;\n } else {\n return y;\n }\n };\n rectangle.width = function (_) {\n if (arguments.length) {\n width = number(_);\n return rectangle;\n } else {\n return width;\n }\n };\n rectangle.height = function (_) {\n if (arguments.length) {\n height = number(_);\n return rectangle;\n } else {\n return height;\n }\n };\n rectangle.cornerRadius = function (tl, tr, br, bl) {\n if (arguments.length) {\n crTL = number(tl);\n crTR = tr != null ? number(tr) : crTL;\n crBR = br != null ? number(br) : crTL;\n crBL = bl != null ? number(bl) : crTR;\n return rectangle;\n } else {\n return crTL;\n }\n };\n rectangle.context = function (_) {\n if (arguments.length) {\n context = _ == null ? null : _;\n return rectangle;\n } else {\n return context;\n }\n };\n return rectangle;\n}\n\nfunction vg_trail () {\n var x,\n y,\n size,\n defined,\n context = null,\n ready,\n x1,\n y1,\n r1;\n function point(x2, y2, w2) {\n const r2 = w2 / 2;\n if (ready) {\n var ux = y1 - y2,\n uy = x2 - x1;\n if (ux || uy) {\n // get normal vector\n var ud = Math.hypot(ux, uy),\n rx = (ux /= ud) * r1,\n ry = (uy /= ud) * r1,\n t = Math.atan2(uy, ux);\n\n // draw segment\n context.moveTo(x1 - rx, y1 - ry);\n context.lineTo(x2 - ux * r2, y2 - uy * r2);\n context.arc(x2, y2, r2, t - Math.PI, t);\n context.lineTo(x1 + rx, y1 + ry);\n context.arc(x1, y1, r1, t, t + Math.PI);\n } else {\n context.arc(x2, y2, r2, 0, Tau);\n }\n context.closePath();\n } else {\n ready = 1;\n }\n x1 = x2;\n y1 = y2;\n r1 = r2;\n }\n function trail(data) {\n var i,\n n = data.length,\n d,\n defined0 = false,\n buffer;\n if (context == null) context = buffer = path$3();\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) ready = 0;\n }\n if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data));\n }\n if (buffer) {\n context = null;\n return buffer + '' || null;\n }\n }\n trail.x = function (_) {\n if (arguments.length) {\n x = _;\n return trail;\n } else {\n return x;\n }\n };\n trail.y = function (_) {\n if (arguments.length) {\n y = _;\n return trail;\n } else {\n return y;\n }\n };\n trail.size = function (_) {\n if (arguments.length) {\n size = _;\n return trail;\n } else {\n return size;\n }\n };\n trail.defined = function (_) {\n if (arguments.length) {\n defined = _;\n return trail;\n } else {\n return defined;\n }\n };\n trail.context = function (_) {\n if (arguments.length) {\n if (_ == null) {\n context = null;\n } else {\n context = _;\n }\n return trail;\n } else {\n return context;\n }\n };\n return trail;\n}\n\nfunction value$1(a, b) {\n return a != null ? a : b;\n}\nconst x = item => item.x || 0,\n y = item => item.y || 0,\n w = item => item.width || 0,\n h = item => item.height || 0,\n xw = item => (item.x || 0) + (item.width || 0),\n yh = item => (item.y || 0) + (item.height || 0),\n sa = item => item.startAngle || 0,\n ea = item => item.endAngle || 0,\n pa = item => item.padAngle || 0,\n ir = item => item.innerRadius || 0,\n or = item => item.outerRadius || 0,\n cr = item => item.cornerRadius || 0,\n tl = item => value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0,\n tr = item => value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0,\n br = item => value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0,\n bl = item => value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0,\n sz = item => value$1(item.size, 64),\n ts = item => item.size || 1,\n def = item => !(item.defined === false),\n type = item => symbols(item.shape || 'circle');\nconst arcShape = arc$2().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr),\n areavShape = area$2().x(x).y1(y).y0(yh).defined(def),\n areahShape = area$2().y(y).x1(x).x0(xw).defined(def),\n lineShape = line$2().x(x).y(y).defined(def),\n rectShape = vg_rect().x(x).y(y).width(w).height(h).cornerRadius(tl, tr, br, bl),\n symbolShape = symbol$2().type(type).size(sz),\n trailShape = vg_trail().x(x).y(y).defined(def).size(ts);\nfunction hasCornerRadius(item) {\n return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft;\n}\nfunction arc$1(context, item) {\n return arcShape.context(context)(item);\n}\nfunction area$1(context, items) {\n const item = items[0],\n interp = item.interpolate || 'linear';\n return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items);\n}\nfunction line$1(context, items) {\n const item = items[0],\n interp = item.interpolate || 'linear';\n return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items);\n}\nfunction rectangle(context, item, x, y) {\n return rectShape.context(context)(item, x, y);\n}\nfunction shape$1(context, item) {\n return (item.mark.shape || item.shape).context(context)(item);\n}\nfunction symbol$1(context, item) {\n return symbolShape.context(context)(item);\n}\nfunction trail$1(context, items) {\n return trailShape.context(context)(items);\n}\n\nvar clip_id = 1;\nfunction resetSVGClipId() {\n clip_id = 1;\n}\nfunction clip$1 (renderer, item, size) {\n var clip = item.clip,\n defs = renderer._defs,\n id = item.clip_id || (item.clip_id = 'clip' + clip_id++),\n c = defs.clipping[id] || (defs.clipping[id] = {\n id: id\n });\n if (isFunction(clip)) {\n c.path = clip(null);\n } else if (hasCornerRadius(size)) {\n c.path = rectangle(null, size, 0, 0);\n } else {\n c.width = size.width || 0;\n c.height = size.height || 0;\n }\n return 'url(#' + id + ')';\n}\n\nfunction Bounds(b) {\n this.clear();\n if (b) this.union(b);\n}\nBounds.prototype = {\n clone() {\n return new Bounds(this);\n },\n clear() {\n this.x1 = +Number.MAX_VALUE;\n this.y1 = +Number.MAX_VALUE;\n this.x2 = -Number.MAX_VALUE;\n this.y2 = -Number.MAX_VALUE;\n return this;\n },\n empty() {\n return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;\n },\n equals(b) {\n return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;\n },\n set(x1, y1, x2, y2) {\n if (x2 < x1) {\n this.x2 = x1;\n this.x1 = x2;\n } else {\n this.x1 = x1;\n this.x2 = x2;\n }\n if (y2 < y1) {\n this.y2 = y1;\n this.y1 = y2;\n } else {\n this.y1 = y1;\n this.y2 = y2;\n }\n return this;\n },\n add(x, y) {\n if (x < this.x1) this.x1 = x;\n if (y < this.y1) this.y1 = y;\n if (x > this.x2) this.x2 = x;\n if (y > this.y2) this.y2 = y;\n return this;\n },\n expand(d) {\n this.x1 -= d;\n this.y1 -= d;\n this.x2 += d;\n this.y2 += d;\n return this;\n },\n round() {\n this.x1 = Math.floor(this.x1);\n this.y1 = Math.floor(this.y1);\n this.x2 = Math.ceil(this.x2);\n this.y2 = Math.ceil(this.y2);\n return this;\n },\n scale(s) {\n this.x1 *= s;\n this.y1 *= s;\n this.x2 *= s;\n this.y2 *= s;\n return this;\n },\n translate(dx, dy) {\n this.x1 += dx;\n this.x2 += dx;\n this.y1 += dy;\n this.y2 += dy;\n return this;\n },\n rotate(angle, x, y) {\n const p = this.rotatedPoints(angle, x, y);\n return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);\n },\n rotatedPoints(angle, x, y) {\n var {\n x1,\n y1,\n x2,\n y2\n } = this,\n cos = Math.cos(angle),\n sin = Math.sin(angle),\n cx = x - x * cos + y * sin,\n cy = y - x * sin - y * cos;\n return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy];\n },\n union(b) {\n if (b.x1 < this.x1) this.x1 = b.x1;\n if (b.y1 < this.y1) this.y1 = b.y1;\n if (b.x2 > this.x2) this.x2 = b.x2;\n if (b.y2 > this.y2) this.y2 = b.y2;\n return this;\n },\n intersect(b) {\n if (b.x1 > this.x1) this.x1 = b.x1;\n if (b.y1 > this.y1) this.y1 = b.y1;\n if (b.x2 < this.x2) this.x2 = b.x2;\n if (b.y2 < this.y2) this.y2 = b.y2;\n return this;\n },\n encloses(b) {\n return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;\n },\n alignsWith(b) {\n return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2);\n },\n intersects(b) {\n return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);\n },\n contains(x, y) {\n return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);\n },\n width() {\n return this.x2 - this.x1;\n },\n height() {\n return this.y2 - this.y1;\n }\n};\n\nfunction Item(mark) {\n this.mark = mark;\n this.bounds = this.bounds || new Bounds();\n}\n\nfunction GroupItem(mark) {\n Item.call(this, mark);\n this.items = this.items || [];\n}\ninherits(GroupItem, Item);\n\nfunction ResourceLoader(customLoader) {\n this._pending = 0;\n this._loader = customLoader || loader();\n}\nfunction increment(loader) {\n loader._pending += 1;\n}\nfunction decrement(loader) {\n loader._pending -= 1;\n}\nResourceLoader.prototype = {\n pending() {\n return this._pending;\n },\n sanitizeURL(uri) {\n const loader = this;\n increment(loader);\n return loader._loader.sanitize(uri, {\n context: 'href'\n }).then(opt => {\n decrement(loader);\n return opt;\n }).catch(() => {\n decrement(loader);\n return null;\n });\n },\n loadImage(uri) {\n const loader = this,\n Image = image$1();\n increment(loader);\n return loader._loader.sanitize(uri, {\n context: 'image'\n }).then(opt => {\n const url = opt.href;\n if (!url || !Image) throw {\n url: url\n };\n const img = new Image();\n\n // set crossOrigin only if cors is defined; empty string sets anonymous mode\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin\n const cors = hasOwnProperty(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous';\n if (cors != null) img.crossOrigin = cors;\n\n // attempt to load image resource\n img.onload = () => decrement(loader);\n img.onerror = () => decrement(loader);\n img.src = url;\n return img;\n }).catch(e => {\n decrement(loader);\n return {\n complete: false,\n width: 0,\n height: 0,\n src: e && e.url || ''\n };\n });\n },\n ready() {\n const loader = this;\n return new Promise(accept => {\n function poll(value) {\n if (!loader.pending()) accept(value);else setTimeout(() => {\n poll(true);\n }, 10);\n }\n poll(false);\n });\n }\n};\n\nfunction boundStroke (bounds, item, miter) {\n if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) {\n const sw = item.strokeWidth != null ? +item.strokeWidth : 1;\n bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0));\n }\n return bounds;\n}\nfunction miterAdjustment(item, strokeWidth) {\n // TODO: more sophisticated adjustment? Or miter support in boundContext?\n return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth;\n}\n\nconst circleThreshold = Tau - 1e-8;\nlet bounds, lx, ly, rot, ma, mb, mc, md;\nconst add = (x, y) => bounds.add(x, y);\nconst addL = (x, y) => add(lx = x, ly = y);\nconst addX = x => add(x, bounds.y1);\nconst addY = y => add(bounds.x1, y);\nconst px = (x, y) => ma * x + mc * y;\nconst py = (x, y) => mb * x + md * y;\nconst addp = (x, y) => add(px(x, y), py(x, y));\nconst addpL = (x, y) => addL(px(x, y), py(x, y));\nfunction boundContext (_, deg) {\n bounds = _;\n if (deg) {\n rot = deg * DegToRad;\n ma = md = Math.cos(rot);\n mb = Math.sin(rot);\n mc = -mb;\n } else {\n ma = md = 1;\n rot = mb = mc = 0;\n }\n return context$1;\n}\nconst context$1 = {\n beginPath() {},\n closePath() {},\n moveTo: addpL,\n lineTo: addpL,\n rect(x, y, w, h) {\n if (rot) {\n addp(x + w, y);\n addp(x + w, y + h);\n addp(x, y + h);\n addpL(x, y);\n } else {\n add(x + w, y + h);\n addL(x, y);\n }\n },\n quadraticCurveTo(x1, y1, x2, y2) {\n const px1 = px(x1, y1),\n py1 = py(x1, y1),\n px2 = px(x2, y2),\n py2 = py(x2, y2);\n quadExtrema(lx, px1, px2, addX);\n quadExtrema(ly, py1, py2, addY);\n addL(px2, py2);\n },\n bezierCurveTo(x1, y1, x2, y2, x3, y3) {\n const px1 = px(x1, y1),\n py1 = py(x1, y1),\n px2 = px(x2, y2),\n py2 = py(x2, y2),\n px3 = px(x3, y3),\n py3 = py(x3, y3);\n cubicExtrema(lx, px1, px2, px3, addX);\n cubicExtrema(ly, py1, py2, py3, addY);\n addL(px3, py3);\n },\n arc(cx, cy, r, sa, ea, ccw) {\n sa += rot;\n ea += rot;\n\n // store last point on path\n lx = r * Math.cos(ea) + cx;\n ly = r * Math.sin(ea) + cy;\n if (Math.abs(ea - sa) > circleThreshold) {\n // treat as full circle\n add(cx - r, cy - r);\n add(cx + r, cy + r);\n } else {\n const update = a => add(r * Math.cos(a) + cx, r * Math.sin(a) + cy);\n let s, i;\n\n // sample end points\n update(sa);\n update(ea);\n\n // sample interior points aligned with 90 degrees\n if (ea !== sa) {\n sa = sa % Tau;\n if (sa < 0) sa += Tau;\n ea = ea % Tau;\n if (ea < 0) ea += Tau;\n if (ea < sa) {\n ccw = !ccw; // flip direction\n s = sa;\n sa = ea;\n ea = s; // swap end-points\n }\n\n if (ccw) {\n ea -= Tau;\n s = sa - sa % HalfPi;\n for (i = 0; i < 4 && s > ea; ++i, s -= HalfPi) update(s);\n } else {\n s = sa - sa % HalfPi + HalfPi;\n for (i = 0; i < 4 && s < ea; ++i, s = s + HalfPi) update(s);\n }\n }\n }\n }\n};\nfunction quadExtrema(x0, x1, x2, cb) {\n const t = (x0 - x1) / (x0 + x2 - 2 * x1);\n if (0 < t && t < 1) cb(x0 + (x1 - x0) * t);\n}\nfunction cubicExtrema(x0, x1, x2, x3, cb) {\n const a = x3 - x0 + 3 * x1 - 3 * x2,\n b = x0 + x2 - 2 * x1,\n c = x0 - x1;\n let t0 = 0,\n t1 = 0,\n r;\n\n // solve for parameter t\n if (Math.abs(a) > Epsilon) {\n // quadratic equation\n r = b * b + c * a;\n if (r >= 0) {\n r = Math.sqrt(r);\n t0 = (-b + r) / a;\n t1 = (-b - r) / a;\n }\n } else {\n // linear equation\n t0 = 0.5 * c / b;\n }\n\n // calculate position\n if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3));\n if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3));\n}\nfunction cubic(t, x0, x1, x2, x3) {\n const s = 1 - t,\n s2 = s * s,\n t2 = t * t;\n return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3;\n}\n\nvar context = (context = canvas(1, 1)) ? context.getContext('2d') : null;\n\nconst b = new Bounds();\nfunction intersectPath(draw) {\n return function (item, brush) {\n // rely on (inaccurate) bounds intersection if no context\n if (!context) return true;\n\n // add path to offscreen graphics context\n draw(context, item);\n\n // get bounds intersection region\n b.clear().union(item.bounds).intersect(brush).round();\n const {\n x1,\n y1,\n x2,\n y2\n } = b;\n\n // iterate over intersection region\n // perform fine grained inclusion test\n for (let y = y1; y <= y2; ++y) {\n for (let x = x1; x <= x2; ++x) {\n if (context.isPointInPath(x, y)) {\n return true;\n }\n }\n }\n\n // false if no hits in intersection region\n return false;\n };\n}\nfunction intersectPoint(item, box) {\n return box.contains(item.x || 0, item.y || 0);\n}\nfunction intersectRect(item, box) {\n const x = item.x || 0,\n y = item.y || 0,\n w = item.width || 0,\n h = item.height || 0;\n return box.intersects(b.set(x, y, x + w, y + h));\n}\nfunction intersectRule(item, box) {\n const x = item.x || 0,\n y = item.y || 0,\n x2 = item.x2 != null ? item.x2 : x,\n y2 = item.y2 != null ? item.y2 : y;\n return intersectBoxLine(box, x, y, x2, y2);\n}\nfunction intersectBoxLine(box, x, y, u, v) {\n const {\n x1,\n y1,\n x2,\n y2\n } = box,\n dx = u - x,\n dy = v - y;\n let t0 = 0,\n t1 = 1,\n p,\n q,\n r,\n e;\n for (e = 0; e < 4; ++e) {\n if (e === 0) {\n p = -dx;\n q = -(x1 - x);\n }\n if (e === 1) {\n p = dx;\n q = x2 - x;\n }\n if (e === 2) {\n p = -dy;\n q = -(y1 - y);\n }\n if (e === 3) {\n p = dy;\n q = y2 - y;\n }\n if (Math.abs(p) < 1e-10 && q < 0) return false;\n r = q / p;\n if (p < 0) {\n if (r > t1) return false;else if (r > t0) t0 = r;\n } else if (p > 0) {\n if (r < t0) return false;else if (r < t1) t1 = r;\n }\n }\n return true;\n}\n\nfunction blend (context, item) {\n context.globalCompositeOperation = item.blend || 'source-over';\n}\n\nfunction value (value, dflt) {\n return value == null ? dflt : value;\n}\n\nfunction addStops(gradient, stops) {\n const n = stops.length;\n for (let i = 0; i < n; ++i) {\n gradient.addColorStop(stops[i].offset, stops[i].color);\n }\n return gradient;\n}\nfunction gradient (context, spec, bounds) {\n const w = bounds.width(),\n h = bounds.height();\n let gradient;\n if (spec.gradient === 'radial') {\n gradient = context.createRadialGradient(bounds.x1 + value(spec.x1, 0.5) * w, bounds.y1 + value(spec.y1, 0.5) * h, Math.max(w, h) * value(spec.r1, 0), bounds.x1 + value(spec.x2, 0.5) * w, bounds.y1 + value(spec.y2, 0.5) * h, Math.max(w, h) * value(spec.r2, 0.5));\n } else {\n // linear gradient\n const x1 = value(spec.x1, 0),\n y1 = value(spec.y1, 0),\n x2 = value(spec.x2, 1),\n y2 = value(spec.y2, 0);\n if (x1 === x2 || y1 === y2 || w === h) {\n // axis aligned: use normal gradient\n gradient = context.createLinearGradient(bounds.x1 + x1 * w, bounds.y1 + y1 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h);\n } else {\n // not axis aligned: render gradient into a pattern (#2365)\n // this allows us to use normalized bounding box coordinates\n const image = canvas(Math.ceil(w), Math.ceil(h)),\n ictx = image.getContext('2d');\n ictx.scale(w, h);\n ictx.fillStyle = addStops(ictx.createLinearGradient(x1, y1, x2, y2), spec.stops);\n ictx.fillRect(0, 0, w, h);\n return context.createPattern(image, 'no-repeat');\n }\n }\n return addStops(gradient, spec.stops);\n}\n\nfunction color (context, item, value) {\n return isGradient(value) ? gradient(context, value, item.bounds) : value;\n}\n\nfunction fill (context, item, opacity) {\n opacity *= item.fillOpacity == null ? 1 : item.fillOpacity;\n if (opacity > 0) {\n context.globalAlpha = opacity;\n context.fillStyle = color(context, item, item.fill);\n return true;\n } else {\n return false;\n }\n}\n\nvar Empty = [];\nfunction stroke (context, item, opacity) {\n var lw = (lw = item.strokeWidth) != null ? lw : 1;\n if (lw <= 0) return false;\n opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity;\n if (opacity > 0) {\n context.globalAlpha = opacity;\n context.strokeStyle = color(context, item, item.stroke);\n context.lineWidth = lw;\n context.lineCap = item.strokeCap || 'butt';\n context.lineJoin = item.strokeJoin || 'miter';\n context.miterLimit = item.strokeMiterLimit || 10;\n if (context.setLineDash) {\n context.setLineDash(item.strokeDash || Empty);\n context.lineDashOffset = item.strokeDashOffset || 0;\n }\n return true;\n } else {\n return false;\n }\n}\n\nfunction compare(a, b) {\n return a.zindex - b.zindex || a.index - b.index;\n}\nfunction zorder(scene) {\n if (!scene.zdirty) return scene.zitems;\n var items = scene.items,\n output = [],\n item,\n i,\n n;\n for (i = 0, n = items.length; i < n; ++i) {\n item = items[i];\n item.index = i;\n if (item.zindex) output.push(item);\n }\n scene.zdirty = false;\n return scene.zitems = output.sort(compare);\n}\nfunction visit(scene, visitor) {\n var items = scene.items,\n i,\n n;\n if (!items || !items.length) return;\n const zitems = zorder(scene);\n if (zitems && zitems.length) {\n for (i = 0, n = items.length; i < n; ++i) {\n if (!items[i].zindex) visitor(items[i]);\n }\n items = zitems;\n }\n for (i = 0, n = items.length; i < n; ++i) {\n visitor(items[i]);\n }\n}\nfunction pickVisit(scene, visitor) {\n var items = scene.items,\n hit,\n i;\n if (!items || !items.length) return null;\n const zitems = zorder(scene);\n if (zitems && zitems.length) items = zitems;\n for (i = items.length; --i >= 0;) {\n if (hit = visitor(items[i])) return hit;\n }\n if (items === zitems) {\n for (items = scene.items, i = items.length; --i >= 0;) {\n if (!items[i].zindex) {\n if (hit = visitor(items[i])) return hit;\n }\n }\n }\n return null;\n}\n\nfunction drawAll(path) {\n return function (context, scene, bounds) {\n visit(scene, item => {\n if (!bounds || bounds.intersects(item.bounds)) {\n drawPath(path, context, item, item);\n }\n });\n };\n}\nfunction drawOne(path) {\n return function (context, scene, bounds) {\n if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) {\n drawPath(path, context, scene.items[0], scene.items);\n }\n };\n}\nfunction drawPath(path, context, item, items) {\n var opacity = item.opacity == null ? 1 : item.opacity;\n if (opacity === 0) return;\n if (path(context, items)) return;\n blend(context, item);\n if (item.fill && fill(context, item, opacity)) {\n context.fill();\n }\n if (item.stroke && stroke(context, item, opacity)) {\n context.stroke();\n }\n}\n\nfunction pick$1(test) {\n test = test || truthy;\n return function (context, scene, x, y, gx, gy) {\n x *= context.pixelRatio;\n y *= context.pixelRatio;\n return pickVisit(scene, item => {\n const b = item.bounds;\n // first hit test against bounding box\n if (b && !b.contains(gx, gy) || !b) return;\n // if in bounding box, perform more careful test\n if (test(context, item, x, y, gx, gy)) return item;\n });\n };\n}\nfunction hitPath(path, filled) {\n return function (context, o, x, y) {\n var item = Array.isArray(o) ? o[0] : o,\n fill = filled == null ? item.fill : filled,\n stroke = item.stroke && context.isPointInStroke,\n lw,\n lc;\n if (stroke) {\n lw = item.strokeWidth;\n lc = item.strokeCap;\n context.lineWidth = lw != null ? lw : 1;\n context.lineCap = lc != null ? lc : 'butt';\n }\n return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y);\n };\n}\nfunction pickPath(path) {\n return pick$1(hitPath(path));\n}\n\nfunction translate(x, y) {\n return 'translate(' + x + ',' + y + ')';\n}\nfunction rotate(a) {\n return 'rotate(' + a + ')';\n}\nfunction scale(scaleX, scaleY) {\n return 'scale(' + scaleX + ',' + scaleY + ')';\n}\nfunction translateItem(item) {\n return translate(item.x || 0, item.y || 0);\n}\nfunction rotateItem(item) {\n return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '');\n}\nfunction transformItem(item) {\n return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale(item.scaleX || 1, item.scaleY || 1) : '');\n}\n\nfunction markItemPath (type, shape, isect) {\n function attr(emit, item) {\n emit('transform', rotateItem(item));\n emit('d', shape(null, item));\n }\n function bound(bounds, item) {\n shape(boundContext(bounds, item.angle), item);\n return boundStroke(bounds, item).translate(item.x || 0, item.y || 0);\n }\n function draw(context, item) {\n var x = item.x || 0,\n y = item.y || 0,\n a = item.angle || 0;\n context.translate(x, y);\n if (a) context.rotate(a *= DegToRad);\n context.beginPath();\n shape(context, item);\n if (a) context.rotate(-a);\n context.translate(-x, -y);\n }\n return {\n type: type,\n tag: 'path',\n nested: false,\n attr: attr,\n bound: bound,\n draw: drawAll(draw),\n pick: pickPath(draw),\n isect: isect || intersectPath(draw)\n };\n}\n\nvar arc = markItemPath('arc', arc$1);\n\nfunction pickArea(a, p) {\n var v = a[0].orient === 'horizontal' ? p[1] : p[0],\n z = a[0].orient === 'horizontal' ? 'y' : 'x',\n i = a.length,\n min = +Infinity,\n hit,\n d;\n while (--i >= 0) {\n if (a[i].defined === false) continue;\n d = Math.abs(a[i][z] - v);\n if (d < min) {\n min = d;\n hit = a[i];\n }\n }\n return hit;\n}\nfunction pickLine(a, p) {\n var t = Math.pow(a[0].strokeWidth || 1, 2),\n i = a.length,\n dx,\n dy,\n dd;\n while (--i >= 0) {\n if (a[i].defined === false) continue;\n dx = a[i].x - p[0];\n dy = a[i].y - p[1];\n dd = dx * dx + dy * dy;\n if (dd < t) return a[i];\n }\n return null;\n}\nfunction pickTrail(a, p) {\n var i = a.length,\n dx,\n dy,\n dd;\n while (--i >= 0) {\n if (a[i].defined === false) continue;\n dx = a[i].x - p[0];\n dy = a[i].y - p[1];\n dd = dx * dx + dy * dy;\n dx = a[i].size || 1;\n if (dd < dx * dx) return a[i];\n }\n return null;\n}\n\nfunction markMultiItemPath (type, shape, tip) {\n function attr(emit, item) {\n var items = item.mark.items;\n if (items.length) emit('d', shape(null, items));\n }\n function bound(bounds, mark) {\n var items = mark.items;\n if (items.length === 0) {\n return bounds;\n } else {\n shape(boundContext(bounds), items);\n return boundStroke(bounds, items[0]);\n }\n }\n function draw(context, items) {\n context.beginPath();\n shape(context, items);\n }\n const hit = hitPath(draw);\n function pick(context, scene, x, y, gx, gy) {\n var items = scene.items,\n b = scene.bounds;\n if (!items || !items.length || b && !b.contains(gx, gy)) {\n return null;\n }\n x *= context.pixelRatio;\n y *= context.pixelRatio;\n return hit(context, items, x, y) ? items[0] : null;\n }\n return {\n type: type,\n tag: 'path',\n nested: true,\n attr: attr,\n bound: bound,\n draw: drawOne(draw),\n pick: pick,\n isect: intersectPoint,\n tip: tip\n };\n}\n\nvar area = markMultiItemPath('area', area$1, pickArea);\n\nfunction clip (context, scene) {\n var clip = scene.clip;\n context.save();\n if (isFunction(clip)) {\n context.beginPath();\n clip(context);\n context.clip();\n } else {\n clipGroup(context, scene.group);\n }\n}\nfunction clipGroup(context, group) {\n context.beginPath();\n hasCornerRadius(group) ? rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0);\n context.clip();\n}\n\nfunction offset$1(item) {\n const sw = value(item.strokeWidth, 1);\n return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0;\n}\nfunction attr$5(emit, item) {\n emit('transform', translateItem(item));\n}\nfunction emitRectangle(emit, item) {\n const off = offset$1(item);\n emit('d', rectangle(null, item, off, off));\n}\nfunction background(emit, item) {\n emit('class', 'background');\n emit('aria-hidden', true);\n emitRectangle(emit, item);\n}\nfunction foreground(emit, item) {\n emit('class', 'foreground');\n emit('aria-hidden', true);\n if (item.strokeForeground) {\n emitRectangle(emit, item);\n } else {\n emit('d', '');\n }\n}\nfunction content(emit, item, renderer) {\n const url = item.clip ? clip$1(renderer, item, item) : null;\n emit('clip-path', url);\n}\nfunction bound$5(bounds, group) {\n if (!group.clip && group.items) {\n const items = group.items,\n m = items.length;\n for (let j = 0; j < m; ++j) {\n bounds.union(items[j].bounds);\n }\n }\n if ((group.clip || group.width || group.height) && !group.noBound) {\n bounds.add(0, 0).add(group.width || 0, group.height || 0);\n }\n boundStroke(bounds, group);\n return bounds.translate(group.x || 0, group.y || 0);\n}\nfunction rectanglePath(context, group, x, y) {\n const off = offset$1(group);\n context.beginPath();\n rectangle(context, group, (x || 0) + off, (y || 0) + off);\n}\nconst hitBackground = hitPath(rectanglePath);\nconst hitForeground = hitPath(rectanglePath, false);\nconst hitCorner = hitPath(rectanglePath, true);\nfunction draw$4(context, scene, bounds, markTypes) {\n visit(scene, group => {\n const gx = group.x || 0,\n gy = group.y || 0,\n fore = group.strokeForeground,\n opacity = group.opacity == null ? 1 : group.opacity;\n\n // draw group background\n if ((group.stroke || group.fill) && opacity) {\n rectanglePath(context, group, gx, gy);\n blend(context, group);\n if (group.fill && fill(context, group, opacity)) {\n context.fill();\n }\n if (group.stroke && !fore && stroke(context, group, opacity)) {\n context.stroke();\n }\n }\n\n // setup graphics context, set clip and bounds\n context.save();\n context.translate(gx, gy);\n if (group.clip) clipGroup(context, group);\n if (bounds) bounds.translate(-gx, -gy);\n\n // draw group contents\n visit(group, item => {\n if (item.marktype === 'group' || markTypes == null || markTypes.includes(item.marktype)) {\n this.draw(context, item, bounds, markTypes);\n }\n });\n\n // restore graphics context\n if (bounds) bounds.translate(gx, gy);\n context.restore();\n\n // draw group foreground\n if (fore && group.stroke && opacity) {\n rectanglePath(context, group, gx, gy);\n blend(context, group);\n if (stroke(context, group, opacity)) {\n context.stroke();\n }\n }\n });\n}\nfunction pick(context, scene, x, y, gx, gy) {\n if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) {\n return null;\n }\n const cx = x * context.pixelRatio,\n cy = y * context.pixelRatio;\n return pickVisit(scene, group => {\n let hit, dx, dy;\n\n // first hit test bounding box\n const b = group.bounds;\n if (b && !b.contains(gx, gy)) return;\n\n // passed bounds check, test rectangular clip\n dx = group.x || 0;\n dy = group.y || 0;\n const dw = dx + (group.width || 0),\n dh = dy + (group.height || 0),\n c = group.clip;\n if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return;\n\n // adjust coordinate system\n context.save();\n context.translate(dx, dy);\n dx = gx - dx;\n dy = gy - dy;\n\n // test background for rounded corner clip\n if (c && hasCornerRadius(group) && !hitCorner(context, group, cx, cy)) {\n context.restore();\n return null;\n }\n const fore = group.strokeForeground,\n ix = scene.interactive !== false;\n\n // hit test against group foreground\n if (ix && fore && group.stroke && hitForeground(context, group, cx, cy)) {\n context.restore();\n return group;\n }\n\n // hit test against contained marks\n hit = pickVisit(group, mark => pickMark(mark, dx, dy) ? this.pick(mark, x, y, dx, dy) : null);\n\n // hit test against group background\n if (!hit && ix && (group.fill || !fore && group.stroke) && hitBackground(context, group, cx, cy)) {\n hit = group;\n }\n\n // restore state and return\n context.restore();\n return hit || null;\n });\n}\nfunction pickMark(mark, x, y) {\n return (mark.interactive !== false || mark.marktype === 'group') && mark.bounds && mark.bounds.contains(x, y);\n}\nvar group = {\n type: 'group',\n tag: 'g',\n nested: false,\n attr: attr$5,\n bound: bound$5,\n draw: draw$4,\n pick: pick,\n isect: intersectRect,\n content: content,\n background: background,\n foreground: foreground\n};\n\nvar metadata = {\n 'xmlns': 'http://www.w3.org/2000/svg',\n 'xmlns:xlink': 'http://www.w3.org/1999/xlink',\n 'version': '1.1'\n};\n\nfunction getImage(item, renderer) {\n var image = item.image;\n if (!image || item.url && item.url !== image.url) {\n image = {\n complete: false,\n width: 0,\n height: 0\n };\n renderer.loadImage(item.url).then(image => {\n item.image = image;\n item.image.url = item.url;\n });\n }\n return image;\n}\nfunction imageWidth(item, image) {\n return item.width != null ? item.width : !image || !image.width ? 0 : item.aspect !== false && item.height ? item.height * image.width / image.height : image.width;\n}\nfunction imageHeight(item, image) {\n return item.height != null ? item.height : !image || !image.height ? 0 : item.aspect !== false && item.width ? item.width * image.height / image.width : image.height;\n}\nfunction imageXOffset(align, w) {\n return align === 'center' ? w / 2 : align === 'right' ? w : 0;\n}\nfunction imageYOffset(baseline, h) {\n return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0;\n}\nfunction attr$4(emit, item, renderer) {\n const img = getImage(item, renderer),\n w = imageWidth(item, img),\n h = imageHeight(item, img),\n x = (item.x || 0) - imageXOffset(item.align, w),\n y = (item.y || 0) - imageYOffset(item.baseline, h),\n i = !img.src && img.toDataURL ? img.toDataURL() : img.src || '';\n emit('href', i, metadata['xmlns:xlink'], 'xlink:href');\n emit('transform', translate(x, y));\n emit('width', w);\n emit('height', h);\n emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid');\n}\nfunction bound$4(bounds, item) {\n const img = item.image,\n w = imageWidth(item, img),\n h = imageHeight(item, img),\n x = (item.x || 0) - imageXOffset(item.align, w),\n y = (item.y || 0) - imageYOffset(item.baseline, h);\n return bounds.set(x, y, x + w, y + h);\n}\nfunction draw$3(context, scene, bounds) {\n visit(scene, item => {\n if (bounds && !bounds.intersects(item.bounds)) return; // bounds check\n\n const img = getImage(item, this);\n let w = imageWidth(item, img);\n let h = imageHeight(item, img);\n if (w === 0 || h === 0) return; // early exit\n\n let x = (item.x || 0) - imageXOffset(item.align, w),\n y = (item.y || 0) - imageYOffset(item.baseline, h),\n opacity,\n ar0,\n ar1,\n t;\n if (item.aspect !== false) {\n ar0 = img.width / img.height;\n ar1 = item.width / item.height;\n if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) {\n if (ar1 < ar0) {\n t = w / ar0;\n y += (h - t) / 2;\n h = t;\n } else {\n t = h * ar0;\n x += (w - t) / 2;\n w = t;\n }\n }\n }\n if (img.complete || img.toDataURL) {\n blend(context, item);\n context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1;\n context.imageSmoothingEnabled = item.smooth !== false;\n context.drawImage(img, x, y, w, h);\n }\n });\n}\nvar image = {\n type: 'image',\n tag: 'image',\n nested: false,\n attr: attr$4,\n bound: bound$4,\n draw: draw$3,\n pick: pick$1(),\n isect: truthy,\n // bounds check is sufficient\n get: getImage,\n xOffset: imageXOffset,\n yOffset: imageYOffset\n};\n\nvar line = markMultiItemPath('line', line$1, pickLine);\n\nfunction attr$3(emit, item) {\n var sx = item.scaleX || 1,\n sy = item.scaleY || 1;\n if (sx !== 1 || sy !== 1) {\n emit('vector-effect', 'non-scaling-stroke');\n }\n emit('transform', transformItem(item));\n emit('d', item.path);\n}\nfunction path$1(context, item) {\n var path = item.path;\n if (path == null) return true;\n var x = item.x || 0,\n y = item.y || 0,\n sx = item.scaleX || 1,\n sy = item.scaleY || 1,\n a = (item.angle || 0) * DegToRad,\n cache = item.pathCache;\n if (!cache || cache.path !== path) {\n (item.pathCache = cache = parse(path)).path = path;\n }\n if (a && context.rotate && context.translate) {\n context.translate(x, y);\n context.rotate(a);\n pathRender(context, cache, 0, 0, sx, sy);\n context.rotate(-a);\n context.translate(-x, -y);\n } else {\n pathRender(context, cache, x, y, sx, sy);\n }\n}\nfunction bound$3(bounds, item) {\n return path$1(boundContext(bounds, item.angle), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true);\n}\nvar path$2 = {\n type: 'path',\n tag: 'path',\n nested: false,\n attr: attr$3,\n bound: bound$3,\n draw: drawAll(path$1),\n pick: pickPath(path$1),\n isect: intersectPath(path$1)\n};\n\nfunction attr$2(emit, item) {\n emit('d', rectangle(null, item));\n}\nfunction bound$2(bounds, item) {\n var x, y;\n return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item);\n}\nfunction draw$2(context, item) {\n context.beginPath();\n rectangle(context, item);\n}\nvar rect = {\n type: 'rect',\n tag: 'path',\n nested: false,\n attr: attr$2,\n bound: bound$2,\n draw: drawAll(draw$2),\n pick: pickPath(draw$2),\n isect: intersectRect\n};\n\nfunction attr$1(emit, item) {\n emit('transform', translateItem(item));\n emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0);\n emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0);\n}\nfunction bound$1(bounds, item) {\n var x1, y1;\n return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item);\n}\nfunction path(context, item, opacity) {\n var x1, y1, x2, y2;\n if (item.stroke && stroke(context, item, opacity)) {\n x1 = item.x || 0;\n y1 = item.y || 0;\n x2 = item.x2 != null ? item.x2 : x1;\n y2 = item.y2 != null ? item.y2 : y1;\n context.beginPath();\n context.moveTo(x1, y1);\n context.lineTo(x2, y2);\n return true;\n }\n return false;\n}\nfunction draw$1(context, scene, bounds) {\n visit(scene, item => {\n if (bounds && !bounds.intersects(item.bounds)) return; // bounds check\n var opacity = item.opacity == null ? 1 : item.opacity;\n if (opacity && path(context, item, opacity)) {\n blend(context, item);\n context.stroke();\n }\n });\n}\nfunction hit$1(context, item, x, y) {\n if (!context.isPointInStroke) return false;\n return path(context, item, 1) && context.isPointInStroke(x, y);\n}\nvar rule = {\n type: 'rule',\n tag: 'line',\n nested: false,\n attr: attr$1,\n bound: bound$1,\n draw: draw$1,\n pick: pick$1(hit$1),\n isect: intersectRule\n};\n\nvar shape = markItemPath('shape', shape$1);\n\nvar symbol = markItemPath('symbol', symbol$1, intersectPoint);\n\n// memoize text width measurement\nconst widthCache = lruCache();\nvar textMetrics = {\n height: fontSize,\n measureWidth: measureWidth,\n estimateWidth: estimateWidth,\n width: estimateWidth,\n canvas: useCanvas\n};\nuseCanvas(true);\nfunction useCanvas(use) {\n textMetrics.width = use && context ? measureWidth : estimateWidth;\n}\n\n// make simple estimate if no canvas is available\nfunction estimateWidth(item, text) {\n return _estimateWidth(textValue(item, text), fontSize(item));\n}\nfunction _estimateWidth(text, currentFontHeight) {\n return ~~(0.8 * text.length * currentFontHeight);\n}\n\n// measure text width if canvas is available\nfunction measureWidth(item, text) {\n return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, font(item));\n}\nfunction _measureWidth(text, currentFont) {\n const key = `(${currentFont}) ${text}`;\n let width = widthCache.get(key);\n if (width === undefined) {\n context.font = currentFont;\n width = context.measureText(text).width;\n widthCache.set(key, width);\n }\n return width;\n}\nfunction fontSize(item) {\n return item.fontSize != null ? +item.fontSize || 0 : 11;\n}\nfunction lineHeight(item) {\n return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2;\n}\nfunction lineArray(_) {\n return isArray(_) ? _.length > 1 ? _ : _[0] : _;\n}\nfunction textLines(item) {\n return lineArray(item.lineBreak && item.text && !isArray(item.text) ? item.text.split(item.lineBreak) : item.text);\n}\nfunction multiLineOffset(item) {\n const tl = textLines(item);\n return (isArray(tl) ? tl.length - 1 : 0) * lineHeight(item);\n}\nfunction textValue(item, line) {\n const text = line == null ? '' : (line + '').trim();\n return item.limit > 0 && text.length ? truncate(item, text) : text;\n}\nfunction widthGetter(item) {\n if (textMetrics.width === measureWidth) {\n // we are using canvas\n const currentFont = font(item);\n return text => _measureWidth(text, currentFont);\n } else if (textMetrics.width === estimateWidth) {\n // we are relying on estimates\n const currentFontHeight = fontSize(item);\n return text => _estimateWidth(text, currentFontHeight);\n } else {\n // User defined textMetrics.width function in use (e.g. vl-convert)\n return text => textMetrics.width(item, text);\n }\n}\nfunction truncate(item, text) {\n var limit = +item.limit,\n width = widthGetter(item);\n if (width(text) < limit) return text;\n var ellipsis = item.ellipsis || '\\u2026',\n rtl = item.dir === 'rtl',\n lo = 0,\n hi = text.length,\n mid;\n limit -= width(ellipsis);\n if (rtl) {\n while (lo < hi) {\n mid = lo + hi >>> 1;\n if (width(text.slice(mid)) > limit) lo = mid + 1;else hi = mid;\n }\n return ellipsis + text.slice(lo);\n } else {\n while (lo < hi) {\n mid = 1 + (lo + hi >>> 1);\n if (width(text.slice(0, mid)) < limit) lo = mid;else hi = mid - 1;\n }\n return text.slice(0, lo) + ellipsis;\n }\n}\nfunction fontFamily(item, quote) {\n var font = item.font;\n return (quote && font ? String(font).replace(/\"/g, '\\'') : font) || 'sans-serif';\n}\nfunction font(item, quote) {\n return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote);\n}\nfunction offset(item) {\n // perform our own font baseline calculation\n // why? not all browsers support SVG 1.1 'alignment-baseline' :(\n // this also ensures consistent layout across renderers\n var baseline = item.baseline,\n h = fontSize(item);\n return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0);\n}\n\nconst textAlign = {\n 'left': 'start',\n 'center': 'middle',\n 'right': 'end'\n};\nconst tempBounds = new Bounds();\nfunction anchorPoint(item) {\n var x = item.x || 0,\n y = item.y || 0,\n r = item.radius || 0,\n t;\n if (r) {\n t = (item.theta || 0) - HalfPi;\n x += r * Math.cos(t);\n y += r * Math.sin(t);\n }\n tempBounds.x1 = x;\n tempBounds.y1 = y;\n return tempBounds;\n}\nfunction attr(emit, item) {\n var dx = item.dx || 0,\n dy = (item.dy || 0) + offset(item),\n p = anchorPoint(item),\n x = p.x1,\n y = p.y1,\n a = item.angle || 0,\n t;\n emit('text-anchor', textAlign[item.align] || 'start');\n if (a) {\n t = translate(x, y) + ' ' + rotate(a);\n if (dx || dy) t += ' ' + translate(dx, dy);\n } else {\n t = translate(x + dx, y + dy);\n }\n emit('transform', t);\n}\nfunction bound(bounds, item, mode) {\n var h = textMetrics.height(item),\n a = item.align,\n p = anchorPoint(item),\n x = p.x1,\n y = p.y1,\n dx = item.dx || 0,\n dy = (item.dy || 0) + offset(item) - Math.round(0.8 * h),\n // use 4/5 offset\n tl = textLines(item),\n w;\n\n // get dimensions\n if (isArray(tl)) {\n // multi-line text\n h += lineHeight(item) * (tl.length - 1);\n w = tl.reduce((w, t) => Math.max(w, textMetrics.width(item, t)), 0);\n } else {\n // single-line text\n w = textMetrics.width(item, tl);\n }\n\n // horizontal alignment\n if (a === 'center') {\n dx -= w / 2;\n } else if (a === 'right') {\n dx -= w;\n } else ;\n bounds.set(dx += x, dy += y, dx + w, dy + h);\n if (item.angle && !mode) {\n bounds.rotate(item.angle * DegToRad, x, y);\n } else if (mode === 2) {\n return bounds.rotatedPoints(item.angle * DegToRad, x, y);\n }\n return bounds;\n}\nfunction draw(context, scene, bounds) {\n visit(scene, item => {\n var opacity = item.opacity == null ? 1 : item.opacity,\n p,\n x,\n y,\n i,\n lh,\n tl,\n str;\n if (bounds && !bounds.intersects(item.bounds) ||\n // bounds check\n opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return;\n context.font = font(item);\n context.textAlign = item.align || 'left';\n p = anchorPoint(item);\n x = p.x1, y = p.y1;\n if (item.angle) {\n context.save();\n context.translate(x, y);\n context.rotate(item.angle * DegToRad);\n x = y = 0; // reset x, y\n }\n\n x += item.dx || 0;\n y += (item.dy || 0) + offset(item);\n tl = textLines(item);\n blend(context, item);\n if (isArray(tl)) {\n lh = lineHeight(item);\n for (i = 0; i < tl.length; ++i) {\n str = textValue(item, tl[i]);\n if (item.fill && fill(context, item, opacity)) {\n context.fillText(str, x, y);\n }\n if (item.stroke && stroke(context, item, opacity)) {\n context.strokeText(str, x, y);\n }\n y += lh;\n }\n } else {\n str = textValue(item, tl);\n if (item.fill && fill(context, item, opacity)) {\n context.fillText(str, x, y);\n }\n if (item.stroke && stroke(context, item, opacity)) {\n context.strokeText(str, x, y);\n }\n }\n if (item.angle) context.restore();\n });\n}\nfunction hit(context, item, x, y, gx, gy) {\n if (item.fontSize <= 0) return false;\n if (!item.angle) return true; // bounds sufficient if no rotation\n\n // project point into space of unrotated bounds\n var p = anchorPoint(item),\n ax = p.x1,\n ay = p.y1,\n b = bound(tempBounds, item, 1),\n a = -item.angle * DegToRad,\n cos = Math.cos(a),\n sin = Math.sin(a),\n px = cos * gx - sin * gy + (ax - cos * ax + sin * ay),\n py = sin * gx + cos * gy + (ay - sin * ax - cos * ay);\n return b.contains(px, py);\n}\nfunction intersectText(item, box) {\n const p = bound(tempBounds, item, 2);\n return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]);\n}\nvar text = {\n type: 'text',\n tag: 'text',\n nested: false,\n attr: attr,\n bound: bound,\n draw: draw,\n pick: pick$1(hit),\n isect: intersectText\n};\n\nvar trail = markMultiItemPath('trail', trail$1, pickTrail);\n\nvar Marks = {\n arc: arc,\n area: area,\n group: group,\n image: image,\n line: line,\n path: path$2,\n rect: rect,\n rule: rule,\n shape: shape,\n symbol: symbol,\n text: text,\n trail: trail\n};\n\nfunction boundItem (item, func, opt) {\n var type = Marks[item.mark.marktype],\n bound = func || type.bound;\n if (type.nested) item = item.mark;\n return bound(item.bounds || (item.bounds = new Bounds()), item, opt);\n}\n\nvar DUMMY = {\n mark: null\n};\nfunction boundMark (mark, bounds, opt) {\n var type = Marks[mark.marktype],\n bound = type.bound,\n items = mark.items,\n hasItems = items && items.length,\n i,\n n,\n item,\n b;\n if (type.nested) {\n if (hasItems) {\n item = items[0];\n } else {\n // no items, fake it\n DUMMY.mark = mark;\n item = DUMMY;\n }\n b = boundItem(item, bound, opt);\n bounds = bounds && bounds.union(b) || b;\n return bounds;\n }\n bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds();\n if (hasItems) {\n for (i = 0, n = items.length; i < n; ++i) {\n bounds.union(boundItem(items[i], bound, opt));\n }\n }\n return mark.bounds = bounds;\n}\n\nconst keys = ['marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex', 'x', 'y', 'width', 'height', 'align', 'baseline',\n// layout\n'fill', 'fillOpacity', 'opacity', 'blend',\n// fill\n'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap',\n// stroke\n'strokeDash', 'strokeDashOffset',\n// stroke dash\n'strokeForeground', 'strokeOffset',\n// group\n'startAngle', 'endAngle', 'innerRadius', 'outerRadius',\n// arc\n'cornerRadius', 'padAngle',\n// arc, rect\n'cornerRadiusTopLeft', 'cornerRadiusTopRight',\n// rect, group\n'cornerRadiusBottomLeft', 'cornerRadiusBottomRight', 'interpolate', 'tension', 'orient', 'defined',\n// area, line\n'url', 'aspect', 'smooth',\n// image\n'path', 'scaleX', 'scaleY',\n// path\n'x2', 'y2',\n// rule\n'size', 'shape',\n// symbol\n'text', 'angle', 'theta', 'radius', 'dir', 'dx', 'dy',\n// text\n'ellipsis', 'limit', 'lineBreak', 'lineHeight', 'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant',\n// font\n'description', 'aria', 'ariaRole', 'ariaRoleDescription' // aria\n];\n\nfunction sceneToJSON(scene, indent) {\n return JSON.stringify(scene, keys, indent);\n}\nfunction sceneFromJSON(json) {\n const scene = typeof json === 'string' ? JSON.parse(json) : json;\n return initialize(scene);\n}\nfunction initialize(scene) {\n var type = scene.marktype,\n items = scene.items,\n parent,\n i,\n n;\n if (items) {\n for (i = 0, n = items.length; i < n; ++i) {\n parent = type ? 'mark' : 'group';\n items[i][parent] = scene;\n if (items[i].zindex) items[i][parent].zdirty = true;\n if ('group' === (type || parent)) initialize(items[i]);\n }\n }\n if (type) boundMark(scene);\n return scene;\n}\n\nfunction Scenegraph(scene) {\n if (arguments.length) {\n this.root = sceneFromJSON(scene);\n } else {\n this.root = createMark({\n marktype: 'group',\n name: 'root',\n role: 'frame'\n });\n this.root.items = [new GroupItem(this.root)];\n }\n}\nScenegraph.prototype = {\n toJSON(indent) {\n return sceneToJSON(this.root, indent || 0);\n },\n mark(markdef, group, index) {\n group = group || this.root.items[0];\n const mark = createMark(markdef, group);\n group.items[index] = mark;\n if (mark.zindex) mark.group.zdirty = true;\n return mark;\n }\n};\nfunction createMark(def, group) {\n const mark = {\n bounds: new Bounds(),\n clip: !!def.clip,\n group: group,\n interactive: def.interactive === false ? false : true,\n items: [],\n marktype: def.marktype,\n name: def.name || undefined,\n role: def.role || undefined,\n zindex: def.zindex || 0\n };\n\n // add accessibility properties if defined\n if (def.aria != null) {\n mark.aria = def.aria;\n }\n if (def.description) {\n mark.description = def.description;\n }\n return mark;\n}\n\n// create a new DOM element\nfunction domCreate(doc, tag, ns) {\n if (!doc && typeof document !== 'undefined' && document.createElement) {\n doc = document;\n }\n return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null;\n}\n\n// find first child element with matching tag\nfunction domFind(el, tag) {\n tag = tag.toLowerCase();\n var nodes = el.childNodes,\n i = 0,\n n = nodes.length;\n for (; i < n; ++i) if (nodes[i].tagName.toLowerCase() === tag) {\n return nodes[i];\n }\n}\n\n// retrieve child element at given index\n// create & insert if doesn't exist or if tags do not match\nfunction domChild(el, index, tag, ns) {\n var a = el.childNodes[index],\n b;\n if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) {\n b = a || null;\n a = domCreate(el.ownerDocument, tag, ns);\n el.insertBefore(a, b);\n }\n return a;\n}\n\n// remove all child elements at or above the given index\nfunction domClear(el, index) {\n var nodes = el.childNodes,\n curr = nodes.length;\n while (curr > index) el.removeChild(nodes[--curr]);\n return el;\n}\n\n// generate css class name for mark\nfunction cssClass(mark) {\n return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : '');\n}\n\nfunction point (event, el) {\n const rect = el.getBoundingClientRect();\n return [event.clientX - rect.left - (el.clientLeft || 0), event.clientY - rect.top - (el.clientTop || 0)];\n}\n\nfunction resolveItem (item, event, el, origin) {\n var mark = item && item.mark,\n mdef,\n p;\n if (mark && (mdef = Marks[mark.marktype]).tip) {\n p = point(event, el);\n p[0] -= origin[0];\n p[1] -= origin[1];\n while (item = item.mark.group) {\n p[0] -= item.x || 0;\n p[1] -= item.y || 0;\n }\n item = mdef.tip(mark.items, p);\n }\n return item;\n}\n\n/**\n * Create a new Handler instance.\n * @param {object} [customLoader] - Optional loader instance for\n * href URL sanitization. If not specified, a standard loader\n * instance will be generated.\n * @param {function} [customTooltip] - Optional tooltip handler\n * function for custom tooltip display.\n * @constructor\n */\nfunction Handler(customLoader, customTooltip) {\n this._active = null;\n this._handlers = {};\n this._loader = customLoader || loader();\n this._tooltip = customTooltip || defaultTooltip;\n}\n\n// The default tooltip display handler.\n// Sets the HTML title attribute on the visualization container.\nfunction defaultTooltip(handler, event, item, value) {\n handler.element().setAttribute('title', value || '');\n}\nHandler.prototype = {\n /**\n * Initialize a new Handler instance.\n * @param {DOMElement} el - The containing DOM element for the display.\n * @param {Array} origin - The origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {object} [obj] - Optional context object that should serve as\n * the \"this\" context for event callbacks.\n * @return {Handler} - This handler instance.\n */\n initialize(el, origin, obj) {\n this._el = el;\n this._obj = obj || null;\n return this.origin(origin);\n },\n /**\n * Returns the parent container element for a visualization.\n * @return {DOMElement} - The containing DOM element.\n */\n element() {\n return this._el;\n },\n /**\n * Returns the scene element (e.g., canvas or SVG) of the visualization\n * Subclasses must override if the first child is not the scene element.\n * @return {DOMElement} - The scene (e.g., canvas or SVG) element.\n */\n canvas() {\n return this._el && this._el.firstChild;\n },\n /**\n * Get / set the origin coordinates of the visualization.\n */\n origin(origin) {\n if (arguments.length) {\n this._origin = origin || [0, 0];\n return this;\n } else {\n return this._origin.slice();\n }\n },\n /**\n * Get / set the scenegraph root.\n */\n scene(scene) {\n if (!arguments.length) return this._scene;\n this._scene = scene;\n return this;\n },\n /**\n * Add an event handler. Subclasses should override this method.\n */\n on( /*type, handler*/) {},\n /**\n * Remove an event handler. Subclasses should override this method.\n */\n off( /*type, handler*/) {},\n /**\n * Utility method for finding the array index of an event handler.\n * @param {Array} h - An array of registered event handlers.\n * @param {string} type - The event type.\n * @param {function} handler - The event handler instance to find.\n * @return {number} - The handler's array index or -1 if not registered.\n */\n _handlerIndex(h, type, handler) {\n for (let i = h ? h.length : 0; --i >= 0;) {\n if (h[i].type === type && (!handler || h[i].handler === handler)) {\n return i;\n }\n }\n return -1;\n },\n /**\n * Returns an array with registered event handlers.\n * @param {string} [type] - The event type to query. Any annotations\n * are ignored; for example, for the argument \"click.foo\", \".foo\" will\n * be ignored and the method returns all \"click\" handlers. If type is\n * null or unspecified, this method returns handlers for all types.\n * @return {Array} - A new array containing all registered event handlers.\n */\n handlers(type) {\n const h = this._handlers,\n a = [];\n if (type) {\n a.push(...h[this.eventName(type)]);\n } else {\n for (const k in h) {\n a.push(...h[k]);\n }\n }\n return a;\n },\n /**\n * Parses an event name string to return the specific event type.\n * For example, given \"click.foo\" returns \"click\"\n * @param {string} name - The input event type string.\n * @return {string} - A string with the event type only.\n */\n eventName(name) {\n const i = name.indexOf('.');\n return i < 0 ? name : name.slice(0, i);\n },\n /**\n * Handle hyperlink navigation in response to an item.href value.\n * @param {Event} event - The event triggering hyperlink navigation.\n * @param {Item} item - The scenegraph item.\n * @param {string} href - The URL to navigate to.\n */\n handleHref(event, item, href) {\n this._loader.sanitize(href, {\n context: 'href'\n }).then(opt => {\n const e = new MouseEvent(event.type, event),\n a = domCreate(null, 'a');\n for (const name in opt) a.setAttribute(name, opt[name]);\n a.dispatchEvent(e);\n }).catch(() => {/* do nothing */});\n },\n /**\n * Handle tooltip display in response to an item.tooltip value.\n * @param {Event} event - The event triggering tooltip display.\n * @param {Item} item - The scenegraph item.\n * @param {boolean} show - A boolean flag indicating whether\n * to show or hide a tooltip for the given item.\n */\n handleTooltip(event, item, show) {\n if (item && item.tooltip != null) {\n item = resolveItem(item, event, this.canvas(), this._origin);\n const value = show && item && item.tooltip || null;\n this._tooltip.call(this._obj, this, event, item, value);\n }\n },\n /**\n * Returns the size of a scenegraph item and its position relative\n * to the viewport.\n * @param {Item} item - The scenegraph item.\n * @return {object} - A bounding box object (compatible with the\n * DOMRect type) consisting of x, y, width, heigh, top, left,\n * right, and bottom properties.\n */\n getItemBoundingClientRect(item) {\n const el = this.canvas();\n if (!el) return;\n const rect = el.getBoundingClientRect(),\n origin = this._origin,\n bounds = item.bounds,\n width = bounds.width(),\n height = bounds.height();\n let x = bounds.x1 + origin[0] + rect.left,\n y = bounds.y1 + origin[1] + rect.top;\n\n // translate coordinate for each parent group\n while (item.mark && (item = item.mark.group)) {\n x += item.x || 0;\n y += item.y || 0;\n }\n\n // return DOMRect-compatible bounding box\n return {\n x,\n y,\n width,\n height,\n left: x,\n top: y,\n right: x + width,\n bottom: y + height\n };\n }\n};\n\n/**\n * Create a new Renderer instance.\n * @param {object} [loader] - Optional loader instance for\n * image and href URL sanitization. If not specified, a\n * standard loader instance will be generated.\n * @constructor\n */\nfunction Renderer(loader) {\n this._el = null;\n this._bgcolor = null;\n this._loader = new ResourceLoader(loader);\n}\nRenderer.prototype = {\n /**\n * Initialize a new Renderer instance.\n * @param {DOMElement} el - The containing DOM element for the display.\n * @param {number} width - The coordinate width of the display, in pixels.\n * @param {number} height - The coordinate height of the display, in pixels.\n * @param {Array} origin - The origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {Renderer} - This renderer instance.\n */\n initialize(el, width, height, origin, scaleFactor) {\n this._el = el;\n return this.resize(width, height, origin, scaleFactor);\n },\n /**\n * Returns the parent container element for a visualization.\n * @return {DOMElement} - The containing DOM element.\n */\n element() {\n return this._el;\n },\n /**\n * Returns the scene element (e.g., canvas or SVG) of the visualization\n * Subclasses must override if the first child is not the scene element.\n * @return {DOMElement} - The scene (e.g., canvas or SVG) element.\n */\n canvas() {\n return this._el && this._el.firstChild;\n },\n /**\n * Get / set the background color.\n */\n background(bgcolor) {\n if (arguments.length === 0) return this._bgcolor;\n this._bgcolor = bgcolor;\n return this;\n },\n /**\n * Resize the display.\n * @param {number} width - The new coordinate width of the display, in pixels.\n * @param {number} height - The new coordinate height of the display, in pixels.\n * @param {Array} origin - The new origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {Renderer} - This renderer instance;\n */\n resize(width, height, origin, scaleFactor) {\n this._width = width;\n this._height = height;\n this._origin = origin || [0, 0];\n this._scale = scaleFactor || 1;\n return this;\n },\n /**\n * Report a dirty item whose bounds should be redrawn.\n * This base class method does nothing. Subclasses that perform\n * incremental should implement this method.\n * @param {Item} item - The dirty item whose bounds should be redrawn.\n */\n dirty( /*item*/) {},\n /**\n * Render an input scenegraph, potentially with a set of dirty items.\n * This method will perform an immediate rendering with available resources.\n * The renderer may also need to perform image loading to perform a complete\n * render. This process can lead to asynchronous re-rendering of the scene\n * after this method returns. To receive notification when rendering is\n * complete, use the renderAsync method instead.\n * @param {object} scene - The root mark of a scenegraph to render.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n * @return {Renderer} - This renderer instance.\n */\n render(scene, markTypes) {\n const r = this;\n\n // bind arguments into a render call, and cache it\n // this function may be subsequently called for async redraw\n r._call = function () {\n r._render(scene, markTypes);\n };\n\n // invoke the renderer\n r._call();\n\n // clear the cached call for garbage collection\n // async redraws will stash their own copy\n r._call = null;\n return r;\n },\n /**\n * Internal rendering method. Renderer subclasses should override this\n * method to actually perform rendering.\n * @param {object} scene - The root mark of a scenegraph to render.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n */\n _render( /*scene, markTypes*/\n ) {\n // subclasses to override\n },\n /**\n * Asynchronous rendering method. Similar to render, but returns a Promise\n * that resolves when all rendering is completed. Sometimes a renderer must\n * perform image loading to get a complete rendering. The returned\n * Promise will not resolve until this process completes.\n * @param {object} scene - The root mark of a scenegraph to render.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n * @return {Promise} - A Promise that resolves when rendering is complete.\n */\n renderAsync(scene, markTypes) {\n const r = this.render(scene, markTypes);\n return this._ready ? this._ready.then(() => r) : Promise.resolve(r);\n },\n /**\n * Internal method for asynchronous resource loading.\n * Proxies method calls to the ImageLoader, and tracks loading\n * progress to invoke a re-render once complete.\n * @param {string} method - The method name to invoke on the ImageLoader.\n * @param {string} uri - The URI for the requested resource.\n * @return {Promise} - A Promise that resolves to the requested resource.\n */\n _load(method, uri) {\n var r = this,\n p = r._loader[method](uri);\n if (!r._ready) {\n // re-render the scene when loading completes\n const call = r._call;\n r._ready = r._loader.ready().then(redraw => {\n if (redraw) call();\n r._ready = null;\n });\n }\n return p;\n },\n /**\n * Sanitize a URL to include as a hyperlink in the rendered scene.\n * This method proxies a call to ImageLoader.sanitizeURL, but also tracks\n * image loading progress and invokes a re-render once complete.\n * @param {string} uri - The URI string to sanitize.\n * @return {Promise} - A Promise that resolves to the sanitized URL.\n */\n sanitizeURL(uri) {\n return this._load('sanitizeURL', uri);\n },\n /**\n * Requests an image to include in the rendered scene.\n * This method proxies a call to ImageLoader.loadImage, but also tracks\n * image loading progress and invokes a re-render once complete.\n * @param {string} uri - The URI string of the image.\n * @return {Promise} - A Promise that resolves to the loaded Image.\n */\n loadImage(uri) {\n return this._load('loadImage', uri);\n }\n};\n\nconst KeyDownEvent = 'keydown';\nconst KeyPressEvent = 'keypress';\nconst KeyUpEvent = 'keyup';\nconst DragEnterEvent = 'dragenter';\nconst DragLeaveEvent = 'dragleave';\nconst DragOverEvent = 'dragover';\nconst PointerDownEvent = 'pointerdown';\nconst PointerUpEvent = 'pointerup';\nconst PointerMoveEvent = 'pointermove';\nconst PointerOutEvent = 'pointerout';\nconst PointerOverEvent = 'pointerover';\nconst MouseDownEvent = 'mousedown';\nconst MouseUpEvent = 'mouseup';\nconst MouseMoveEvent = 'mousemove';\nconst MouseOutEvent = 'mouseout';\nconst MouseOverEvent = 'mouseover';\nconst ClickEvent = 'click';\nconst DoubleClickEvent = 'dblclick';\nconst WheelEvent = 'wheel';\nconst MouseWheelEvent = 'mousewheel';\nconst TouchStartEvent = 'touchstart';\nconst TouchMoveEvent = 'touchmove';\nconst TouchEndEvent = 'touchend';\nconst Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, PointerDownEvent, PointerUpEvent, PointerMoveEvent, PointerOutEvent, PointerOverEvent, MouseDownEvent, MouseUpEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent];\nconst TooltipShowEvent = PointerMoveEvent;\nconst TooltipHideEvent = PointerOutEvent;\nconst HrefEvent = ClickEvent;\n\nfunction CanvasHandler(loader, tooltip) {\n Handler.call(this, loader, tooltip);\n this._down = null;\n this._touch = null;\n this._first = true;\n this._events = {};\n}\nconst eventBundle = type => type === TouchStartEvent || type === TouchMoveEvent || type === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [type];\n\n// lazily add listeners to the canvas as needed\nfunction eventListenerCheck(handler, type) {\n eventBundle(type).forEach(_ => addEventListener(handler, _));\n}\nfunction addEventListener(handler, type) {\n const canvas = handler.canvas();\n if (canvas && !handler._events[type]) {\n handler._events[type] = 1;\n canvas.addEventListener(type, handler[type] ? evt => handler[type](evt) : evt => handler.fire(type, evt));\n }\n}\nfunction fireAll(handler, types, event) {\n types.forEach(type => handler.fire(type, event));\n}\nfunction move(moveEvents, overEvents, outEvents) {\n return function (evt) {\n const a = this._active,\n p = this.pickEvent(evt);\n if (p === a) {\n // active item and picked item are the same\n fireAll(this, moveEvents, evt); // fire move\n } else {\n // active item and picked item are different\n if (!a || !a.exit) {\n // fire out for prior active item\n // suppress if active item was removed from scene\n fireAll(this, outEvents, evt);\n }\n this._active = p; // set new active item\n fireAll(this, overEvents, evt); // fire over for new active item\n fireAll(this, moveEvents, evt); // fire move for new active item\n }\n };\n}\n\nfunction inactive(types) {\n return function (evt) {\n fireAll(this, types, evt);\n this._active = null;\n };\n}\ninherits(CanvasHandler, Handler, {\n initialize(el, origin, obj) {\n this._canvas = el && domFind(el, 'canvas');\n\n // add minimal events required for proper state management\n [ClickEvent, MouseDownEvent, PointerDownEvent, PointerMoveEvent, PointerOutEvent, DragLeaveEvent].forEach(type => eventListenerCheck(this, type));\n return Handler.prototype.initialize.call(this, el, origin, obj);\n },\n // return the backing canvas instance\n canvas() {\n return this._canvas;\n },\n // retrieve the current canvas context\n context() {\n return this._canvas.getContext('2d');\n },\n // supported events\n events: Events,\n // to keep old versions of firefox happy\n DOMMouseScroll(evt) {\n this.fire(MouseWheelEvent, evt);\n },\n pointermove: move([PointerMoveEvent, MouseMoveEvent], [PointerOverEvent, MouseOverEvent], [PointerOutEvent, MouseOutEvent]),\n dragover: move([DragOverEvent], [DragEnterEvent], [DragLeaveEvent]),\n pointerout: inactive([PointerOutEvent, MouseOutEvent]),\n dragleave: inactive([DragLeaveEvent]),\n pointerdown(evt) {\n this._down = this._active;\n this.fire(PointerDownEvent, evt);\n },\n mousedown(evt) {\n this._down = this._active;\n this.fire(MouseDownEvent, evt);\n },\n click(evt) {\n if (this._down === this._active) {\n this.fire(ClickEvent, evt);\n this._down = null;\n }\n },\n touchstart(evt) {\n this._touch = this.pickEvent(evt.changedTouches[0]);\n if (this._first) {\n this._active = this._touch;\n this._first = false;\n }\n this.fire(TouchStartEvent, evt, true);\n },\n touchmove(evt) {\n this.fire(TouchMoveEvent, evt, true);\n },\n touchend(evt) {\n this.fire(TouchEndEvent, evt, true);\n this._touch = null;\n },\n // fire an event\n fire(type, evt, touch) {\n const a = touch ? this._touch : this._active,\n h = this._handlers[type];\n\n // set event type relative to scenegraph items\n evt.vegaType = type;\n\n // handle hyperlinks and tooltips first\n if (type === HrefEvent && a && a.href) {\n this.handleHref(evt, a, a.href);\n } else if (type === TooltipShowEvent || type === TooltipHideEvent) {\n this.handleTooltip(evt, a, type !== TooltipHideEvent);\n }\n\n // invoke all registered handlers\n if (h) {\n for (let i = 0, len = h.length; i < len; ++i) {\n h[i].handler.call(this._obj, evt, a);\n }\n }\n },\n // add an event handler\n on(type, handler) {\n const name = this.eventName(type),\n h = this._handlers,\n i = this._handlerIndex(h[name], type, handler);\n if (i < 0) {\n eventListenerCheck(this, type);\n (h[name] || (h[name] = [])).push({\n type: type,\n handler: handler\n });\n }\n return this;\n },\n // remove an event handler\n off(type, handler) {\n const name = this.eventName(type),\n h = this._handlers[name],\n i = this._handlerIndex(h, type, handler);\n if (i >= 0) {\n h.splice(i, 1);\n }\n return this;\n },\n pickEvent(evt) {\n const p = point(evt, this._canvas),\n o = this._origin;\n return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]);\n },\n // find the scenegraph item at the current pointer position\n // x, y -- the absolute x, y pointer coordinates on the canvas element\n // gx, gy -- the relative coordinates within the current group\n pick(scene, x, y, gx, gy) {\n const g = this.context(),\n mark = Marks[scene.marktype];\n return mark.pick.call(this, g, scene, x, y, gx, gy);\n }\n});\n\nfunction devicePixelRatio() {\n return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;\n}\nvar pixelRatio = devicePixelRatio();\nfunction resize (canvas, width, height, origin, scaleFactor, opt) {\n const inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null,\n context = canvas.getContext('2d'),\n ratio = inDOM ? pixelRatio : scaleFactor;\n canvas.width = width * ratio;\n canvas.height = height * ratio;\n for (const key in opt) {\n context[key] = opt[key];\n }\n if (inDOM && ratio !== 1) {\n canvas.style.width = width + 'px';\n canvas.style.height = height + 'px';\n }\n context.pixelRatio = ratio;\n context.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]);\n return canvas;\n}\n\nfunction CanvasRenderer(loader) {\n Renderer.call(this, loader);\n this._options = {};\n this._redraw = false;\n this._dirty = new Bounds();\n this._tempb = new Bounds();\n}\nconst base$2 = Renderer.prototype;\nconst viewBounds = (origin, width, height) => new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]);\nfunction clipToBounds(g, b, origin) {\n // expand bounds by 1 pixel, then round to pixel boundaries\n b.expand(1).round();\n\n // align to base pixel grid in case of non-integer scaling (#2425)\n if (g.pixelRatio % 1) {\n b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio);\n }\n\n // to avoid artifacts translate if origin has fractional pixels\n b.translate(-(origin[0] % 1), -(origin[1] % 1));\n\n // set clip path\n g.beginPath();\n g.rect(b.x1, b.y1, b.width(), b.height());\n g.clip();\n return b;\n}\ninherits(CanvasRenderer, Renderer, {\n initialize(el, width, height, origin, scaleFactor, options) {\n this._options = options || {};\n this._canvas = this._options.externalContext ? null : canvas(1, 1, this._options.type); // instantiate a small canvas\n\n if (el && this._canvas) {\n domClear(el, 0).appendChild(this._canvas);\n this._canvas.setAttribute('class', 'marks');\n }\n\n // this method will invoke resize to size the canvas appropriately\n return base$2.initialize.call(this, el, width, height, origin, scaleFactor);\n },\n resize(width, height, origin, scaleFactor) {\n base$2.resize.call(this, width, height, origin, scaleFactor);\n if (this._canvas) {\n // configure canvas size and transform\n resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context);\n } else {\n // external context needs to be scaled and positioned to origin\n const ctx = this._options.externalContext;\n if (!ctx) error('CanvasRenderer is missing a valid canvas or context');\n ctx.scale(this._scale, this._scale);\n ctx.translate(this._origin[0], this._origin[1]);\n }\n this._redraw = true;\n return this;\n },\n canvas() {\n return this._canvas;\n },\n context() {\n return this._options.externalContext || (this._canvas ? this._canvas.getContext('2d') : null);\n },\n dirty(item) {\n const b = this._tempb.clear().union(item.bounds);\n let g = item.mark.group;\n while (g) {\n b.translate(g.x || 0, g.y || 0);\n g = g.mark.group;\n }\n this._dirty.union(b);\n },\n _render(scene, markTypes) {\n const g = this.context(),\n o = this._origin,\n w = this._width,\n h = this._height,\n db = this._dirty,\n vb = viewBounds(o, w, h);\n\n // setup\n g.save();\n const b = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o);\n this.clear(-o[0], -o[1], w, h);\n\n // render\n this.draw(g, scene, b, markTypes);\n\n // takedown\n g.restore();\n db.clear();\n return this;\n },\n draw(ctx, scene, bounds, markTypes) {\n if (scene.marktype !== 'group' && markTypes != null && !markTypes.includes(scene.marktype)) {\n return;\n }\n const mark = Marks[scene.marktype];\n if (scene.clip) clip(ctx, scene);\n mark.draw.call(this, ctx, scene, bounds, markTypes);\n if (scene.clip) ctx.restore();\n },\n clear(x, y, w, h) {\n const opt = this._options,\n g = this.context();\n if (opt.type !== 'pdf' && !opt.externalContext) {\n // calling clear rect voids vector output in pdf mode\n // and could remove external context content (#2615)\n g.clearRect(x, y, w, h);\n }\n if (this._bgcolor != null) {\n g.fillStyle = this._bgcolor;\n g.fillRect(x, y, w, h);\n }\n }\n});\n\nfunction SVGHandler(loader, tooltip) {\n Handler.call(this, loader, tooltip);\n const h = this;\n h._hrefHandler = listener(h, (evt, item) => {\n if (item && item.href) h.handleHref(evt, item, item.href);\n });\n h._tooltipHandler = listener(h, (evt, item) => {\n h.handleTooltip(evt, item, evt.type !== TooltipHideEvent);\n });\n}\n\n// wrap an event listener for the SVG DOM\nconst listener = (context, handler) => evt => {\n let item = evt.target.__data__;\n item = Array.isArray(item) ? item[0] : item;\n evt.vegaType = evt.type;\n handler.call(context._obj, evt, item);\n};\ninherits(SVGHandler, Handler, {\n initialize(el, origin, obj) {\n let svg = this._svg;\n if (svg) {\n svg.removeEventListener(HrefEvent, this._hrefHandler);\n svg.removeEventListener(TooltipShowEvent, this._tooltipHandler);\n svg.removeEventListener(TooltipHideEvent, this._tooltipHandler);\n }\n this._svg = svg = el && domFind(el, 'svg');\n if (svg) {\n svg.addEventListener(HrefEvent, this._hrefHandler);\n svg.addEventListener(TooltipShowEvent, this._tooltipHandler);\n svg.addEventListener(TooltipHideEvent, this._tooltipHandler);\n }\n return Handler.prototype.initialize.call(this, el, origin, obj);\n },\n canvas() {\n return this._svg;\n },\n // add an event handler\n on(type, handler) {\n const name = this.eventName(type),\n h = this._handlers,\n i = this._handlerIndex(h[name], type, handler);\n if (i < 0) {\n const x = {\n type,\n handler,\n listener: listener(this, handler)\n };\n (h[name] || (h[name] = [])).push(x);\n if (this._svg) {\n this._svg.addEventListener(name, x.listener);\n }\n }\n return this;\n },\n // remove an event handler\n off(type, handler) {\n const name = this.eventName(type),\n h = this._handlers[name],\n i = this._handlerIndex(h, type, handler);\n if (i >= 0) {\n if (this._svg) {\n this._svg.removeEventListener(name, h[i].listener);\n }\n h.splice(i, 1);\n }\n return this;\n }\n});\n\nconst ARIA_HIDDEN = 'aria-hidden';\nconst ARIA_LABEL = 'aria-label';\nconst ARIA_ROLE = 'role';\nconst ARIA_ROLEDESCRIPTION = 'aria-roledescription';\nconst GRAPHICS_OBJECT = 'graphics-object';\nconst GRAPHICS_SYMBOL = 'graphics-symbol';\nconst bundle = (role, roledesc, label) => ({\n [ARIA_ROLE]: role,\n [ARIA_ROLEDESCRIPTION]: roledesc,\n [ARIA_LABEL]: label || undefined\n});\n\n// these roles are covered by related roles\n// we can ignore them, no need to generate attributes\nconst AriaIgnore = toSet(['axis-domain', 'axis-grid', 'axis-label', 'axis-tick', 'axis-title', 'legend-band', 'legend-entry', 'legend-gradient', 'legend-label', 'legend-title', 'legend-symbol', 'title']);\n\n// aria attribute generators for guide roles\nconst AriaGuides = {\n 'axis': {\n desc: 'axis',\n caption: axisCaption\n },\n 'legend': {\n desc: 'legend',\n caption: legendCaption\n },\n 'title-text': {\n desc: 'title',\n caption: item => `Title text '${titleCaption(item)}'`\n },\n 'title-subtitle': {\n desc: 'subtitle',\n caption: item => `Subtitle text '${titleCaption(item)}'`\n }\n};\n\n// aria properties generated for mark item encoding channels\nconst AriaEncode = {\n ariaRole: ARIA_ROLE,\n ariaRoleDescription: ARIA_ROLEDESCRIPTION,\n description: ARIA_LABEL\n};\nfunction ariaItemAttributes(emit, item) {\n const hide = item.aria === false;\n emit(ARIA_HIDDEN, hide || undefined);\n if (hide || item.description == null) {\n for (const prop in AriaEncode) {\n emit(AriaEncode[prop], undefined);\n }\n } else {\n const type = item.mark.marktype;\n emit(ARIA_LABEL, item.description);\n emit(ARIA_ROLE, item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL));\n emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type} mark`);\n }\n}\nfunction ariaMarkAttributes(mark) {\n return mark.aria === false ? {\n [ARIA_HIDDEN]: true\n } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark);\n}\nfunction ariaMark(mark) {\n const type = mark.marktype;\n const recurse = type === 'group' || type === 'text' || mark.items.some(_ => _.description != null && _.aria !== false);\n return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type} mark container`, mark.description);\n}\nfunction ariaGuide(mark, opt) {\n try {\n const item = mark.items[0],\n caption = opt.caption || (() => '');\n return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item));\n } catch (err) {\n return null;\n }\n}\nfunction titleCaption(item) {\n return array(item.text).join(' ');\n}\nfunction axisCaption(item) {\n const datum = item.datum,\n orient = item.orient,\n title = datum.title ? extractTitle(item) : null,\n ctx = item.context,\n scale = ctx.scales[datum.scale].value,\n locale = ctx.dataflow.locale(),\n type = scale.type,\n xy = orient === 'left' || orient === 'right' ? 'Y' : 'X';\n return `${xy}-axis` + (title ? ` titled '${title}'` : '') + ` for a ${isDiscrete(type) ? 'discrete' : type} scale` + ` with ${domainCaption(locale, scale, item)}`;\n}\nfunction legendCaption(item) {\n const datum = item.datum,\n title = datum.title ? extractTitle(item) : null,\n type = `${datum.type || ''} legend`.trim(),\n scales = datum.scales,\n props = Object.keys(scales),\n ctx = item.context,\n scale = ctx.scales[scales[props[0]]].value,\n locale = ctx.dataflow.locale();\n return capitalize(type) + (title ? ` titled '${title}'` : '') + ` for ${channelCaption(props)}` + ` with ${domainCaption(locale, scale, item)}`;\n}\nfunction extractTitle(item) {\n try {\n return array(peek(item.items).items[0].text).join(' ');\n } catch (err) {\n return null;\n }\n}\nfunction channelCaption(props) {\n props = props.map(p => p + (p === 'fill' || p === 'stroke' ? ' color' : ''));\n return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + peek(props);\n}\nfunction capitalize(s) {\n return s.length ? s[0].toUpperCase() + s.slice(1) : s;\n}\n\nconst innerText = val => (val + '').replace(/&/g, '&').replace(//g, '>');\nconst attrText = val => innerText(val).replace(/\"/g, '"').replace(/\\t/g, ' ').replace(/\\n/g, ' ').replace(/\\r/g, ' ');\nfunction markup() {\n let buf = '',\n outer = '',\n inner = '';\n const stack = [],\n clear = () => outer = inner = '',\n push = tag => {\n if (outer) {\n buf += `${outer}>${inner}`;\n clear();\n }\n stack.push(tag);\n },\n attr = (name, value) => {\n if (value != null) outer += ` ${name}=\"${attrText(value)}\"`;\n return m;\n },\n m = {\n open(tag) {\n push(tag);\n outer = '<' + tag;\n for (var _len = arguments.length, attrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n attrs[_key - 1] = arguments[_key];\n }\n for (const set of attrs) {\n for (const key in set) attr(key, set[key]);\n }\n return m;\n },\n close() {\n const tag = stack.pop();\n if (outer) {\n buf += outer + (inner ? `>${inner}` : '/>');\n } else {\n buf += ``;\n }\n clear();\n return m;\n },\n attr,\n text: t => (inner += innerText(t), m),\n toString: () => buf\n };\n return m;\n}\nconst serializeXML = node => _serialize(markup(), node) + '';\nfunction _serialize(m, node) {\n m.open(node.tagName);\n if (node.hasAttributes()) {\n const attrs = node.attributes,\n n = attrs.length;\n for (let i = 0; i < n; ++i) {\n m.attr(attrs[i].name, attrs[i].value);\n }\n }\n if (node.hasChildNodes()) {\n const children = node.childNodes;\n for (const child of children) {\n child.nodeType === 3 // text node\n ? m.text(child.nodeValue) : _serialize(m, child);\n }\n }\n return m.close();\n}\n\nconst stylesAttr = {\n fill: 'fill',\n fillOpacity: 'fill-opacity',\n stroke: 'stroke',\n strokeOpacity: 'stroke-opacity',\n strokeWidth: 'stroke-width',\n strokeCap: 'stroke-linecap',\n strokeJoin: 'stroke-linejoin',\n strokeDash: 'stroke-dasharray',\n strokeDashOffset: 'stroke-dashoffset',\n strokeMiterLimit: 'stroke-miterlimit',\n opacity: 'opacity'\n};\nconst stylesCss = {\n blend: 'mix-blend-mode'\n};\n\n// ensure miter limit default is consistent with canvas (#2498)\nconst rootAttributes = {\n 'fill': 'none',\n 'stroke-miterlimit': 10\n};\n\nconst RootIndex = 0,\n xmlns = 'http://www.w3.org/2000/xmlns/',\n svgns = metadata.xmlns;\nfunction SVGRenderer(loader) {\n Renderer.call(this, loader);\n this._dirtyID = 0;\n this._dirty = [];\n this._svg = null;\n this._root = null;\n this._defs = null;\n}\nconst base$1 = Renderer.prototype;\ninherits(SVGRenderer, Renderer, {\n /**\n * Initialize a new SVGRenderer instance.\n * @param {DOMElement} el - The containing DOM element for the display.\n * @param {number} width - The coordinate width of the display, in pixels.\n * @param {number} height - The coordinate height of the display, in pixels.\n * @param {Array} origin - The origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {SVGRenderer} - This renderer instance.\n */\n initialize(el, width, height, origin, scaleFactor) {\n // create the svg definitions cache\n this._defs = {};\n this._clearDefs();\n if (el) {\n this._svg = domChild(el, 0, 'svg', svgns);\n this._svg.setAttributeNS(xmlns, 'xmlns', svgns);\n this._svg.setAttributeNS(xmlns, 'xmlns:xlink', metadata['xmlns:xlink']);\n this._svg.setAttribute('version', metadata['version']);\n this._svg.setAttribute('class', 'marks');\n domClear(el, 1);\n\n // set the svg root group\n this._root = domChild(this._svg, RootIndex, 'g', svgns);\n setAttributes(this._root, rootAttributes);\n\n // ensure no additional child elements\n domClear(this._svg, RootIndex + 1);\n }\n\n // set background color if defined\n this.background(this._bgcolor);\n return base$1.initialize.call(this, el, width, height, origin, scaleFactor);\n },\n /**\n * Get / set the background color.\n */\n background(bgcolor) {\n if (arguments.length && this._svg) {\n this._svg.style.setProperty('background-color', bgcolor);\n }\n return base$1.background.apply(this, arguments);\n },\n /**\n * Resize the display.\n * @param {number} width - The new coordinate width of the display, in pixels.\n * @param {number} height - The new coordinate height of the display, in pixels.\n * @param {Array} origin - The new origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {SVGRenderer} - This renderer instance;\n */\n resize(width, height, origin, scaleFactor) {\n base$1.resize.call(this, width, height, origin, scaleFactor);\n if (this._svg) {\n setAttributes(this._svg, {\n width: this._width * this._scale,\n height: this._height * this._scale,\n viewBox: `0 0 ${this._width} ${this._height}`\n });\n this._root.setAttribute('transform', `translate(${this._origin})`);\n }\n this._dirty = [];\n return this;\n },\n /**\n * Returns the SVG element of the visualization.\n * @return {DOMElement} - The SVG element.\n */\n canvas() {\n return this._svg;\n },\n /**\n * Returns an SVG text string for the rendered content,\n * or null if this renderer is currently headless.\n */\n svg() {\n const svg = this._svg,\n bg = this._bgcolor;\n if (!svg) return null;\n let node;\n if (bg) {\n svg.removeAttribute('style');\n node = domChild(svg, RootIndex, 'rect', svgns);\n setAttributes(node, {\n width: this._width,\n height: this._height,\n fill: bg\n });\n }\n const text = serializeXML(svg);\n if (bg) {\n svg.removeChild(node);\n this._svg.style.setProperty('background-color', bg);\n }\n return text;\n },\n /**\n * Internal rendering method.\n * @param {object} scene - The root mark of a scenegraph to render.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n */\n _render(scene, markTypes) {\n // perform spot updates and re-render markup\n if (this._dirtyCheck()) {\n if (this._dirtyAll) this._clearDefs();\n this.mark(this._root, scene, undefined, markTypes);\n domClear(this._root, 1);\n }\n this.defs();\n this._dirty = [];\n ++this._dirtyID;\n return this;\n },\n // -- Manage rendering of items marked as dirty --\n\n /**\n * Flag a mark item as dirty.\n * @param {Item} item - The mark item.\n */\n dirty(item) {\n if (item.dirty !== this._dirtyID) {\n item.dirty = this._dirtyID;\n this._dirty.push(item);\n }\n },\n /**\n * Check if a mark item is considered dirty.\n * @param {Item} item - The mark item.\n */\n isDirty(item) {\n return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID;\n },\n /**\n * Internal method to check dirty status and, if possible,\n * make targetted updates without a full rendering pass.\n */\n _dirtyCheck() {\n this._dirtyAll = true;\n const items = this._dirty;\n if (!items.length || !this._dirtyID) return true;\n const id = ++this._dirtyID;\n let item, mark, type, mdef, i, n, o;\n for (i = 0, n = items.length; i < n; ++i) {\n item = items[i];\n mark = item.mark;\n if (mark.marktype !== type) {\n // memoize mark instance lookup\n type = mark.marktype;\n mdef = Marks[type];\n }\n if (mark.zdirty && mark.dirty !== id) {\n this._dirtyAll = false;\n dirtyParents(item, id);\n mark.items.forEach(i => {\n i.dirty = id;\n });\n }\n if (mark.zdirty) continue; // handle in standard drawing pass\n\n if (item.exit) {\n // EXIT\n if (mdef.nested && mark.items.length) {\n // if nested mark with remaining points, update instead\n o = mark.items[0];\n if (o._svg) this._update(mdef, o._svg, o);\n } else if (item._svg) {\n // otherwise remove from DOM\n o = item._svg.parentNode;\n if (o) o.removeChild(item._svg);\n }\n item._svg = null;\n continue;\n }\n item = mdef.nested ? mark.items[0] : item;\n if (item._update === id) continue; // already visited\n\n if (!item._svg || !item._svg.ownerSVGElement) {\n // ENTER\n this._dirtyAll = false;\n dirtyParents(item, id);\n } else {\n // IN-PLACE UPDATE\n this._update(mdef, item._svg, item);\n }\n item._update = id;\n }\n return !this._dirtyAll;\n },\n // -- Construct & maintain scenegraph to SVG mapping ---\n\n /**\n * Render a set of mark items.\n * @param {SVGElement} el - The parent element in the SVG tree.\n * @param {object} scene - The mark parent to render.\n * @param {SVGElement} prev - The previous sibling in the SVG tree.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n */\n mark(el, scene, prev, markTypes) {\n if (!this.isDirty(scene)) {\n return scene._svg;\n }\n const svg = this._svg,\n markType = scene.marktype,\n mdef = Marks[markType],\n events = scene.interactive === false ? 'none' : null,\n isGroup = mdef.tag === 'g';\n const parent = bind(scene, el, prev, 'g', svg);\n if (markType !== 'group' && markTypes != null && !markTypes.includes(markType)) {\n domClear(parent, 0);\n return scene._svg;\n }\n parent.setAttribute('class', cssClass(scene));\n\n // apply aria attributes to parent container element\n const aria = ariaMarkAttributes(scene);\n for (const key in aria) setAttribute(parent, key, aria[key]);\n if (!isGroup) {\n setAttribute(parent, 'pointer-events', events);\n }\n setAttribute(parent, 'clip-path', scene.clip ? clip$1(this, scene, scene.group) : null);\n let sibling = null,\n i = 0;\n const process = item => {\n const dirty = this.isDirty(item),\n node = bind(item, parent, sibling, mdef.tag, svg);\n if (dirty) {\n this._update(mdef, node, item);\n if (isGroup) recurse(this, node, item, markTypes);\n }\n sibling = node;\n ++i;\n };\n if (mdef.nested) {\n if (scene.items.length) process(scene.items[0]);\n } else {\n visit(scene, process);\n }\n domClear(parent, i);\n return parent;\n },\n /**\n * Update the attributes of an SVG element for a mark item.\n * @param {object} mdef - The mark definition object\n * @param {SVGElement} el - The SVG element.\n * @param {Item} item - The mark item.\n */\n _update(mdef, el, item) {\n // set dom element and values cache\n // provides access to emit method\n element = el;\n values = el.__values__;\n\n // apply aria-specific properties\n ariaItemAttributes(emit, item);\n\n // apply svg attributes\n mdef.attr(emit, item, this);\n\n // some marks need special treatment\n const extra = mark_extras[mdef.type];\n if (extra) extra.call(this, mdef, el, item);\n\n // apply svg style attributes\n // note: element state may have been modified by 'extra' method\n if (element) this.style(element, item);\n },\n /**\n * Update the presentation attributes of an SVG element for a mark item.\n * @param {SVGElement} el - The SVG element.\n * @param {Item} item - The mark item.\n */\n style(el, item) {\n if (item == null) return;\n for (const prop in stylesAttr) {\n let value = prop === 'font' ? fontFamily(item) : item[prop];\n if (value === values[prop]) continue;\n const name = stylesAttr[prop];\n if (value == null) {\n el.removeAttribute(name);\n } else {\n if (isGradient(value)) {\n value = gradientRef(value, this._defs.gradient, href());\n }\n el.setAttribute(name, value + '');\n }\n values[prop] = value;\n }\n for (const prop in stylesCss) {\n setStyle(el, stylesCss[prop], item[prop]);\n }\n },\n /**\n * Render SVG defs, as needed.\n * Must be called *after* marks have been processed to ensure the\n * collected state is current and accurate.\n */\n defs() {\n const svg = this._svg,\n defs = this._defs;\n let el = defs.el,\n index = 0;\n for (const id in defs.gradient) {\n if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns);\n index = updateGradient(el, defs.gradient[id], index);\n }\n for (const id in defs.clipping) {\n if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns);\n index = updateClipping(el, defs.clipping[id], index);\n }\n\n // clean-up\n if (el) {\n index === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index);\n }\n },\n /**\n * Clear defs caches.\n */\n _clearDefs() {\n const def = this._defs;\n def.gradient = {};\n def.clipping = {};\n }\n});\n\n// mark ancestor chain with a dirty id\nfunction dirtyParents(item, id) {\n for (; item && item.dirty !== id; item = item.mark.group) {\n item.dirty = id;\n if (item.mark && item.mark.dirty !== id) {\n item.mark.dirty = id;\n } else return;\n }\n}\n\n// update gradient definitions\nfunction updateGradient(el, grad, index) {\n let i, n, stop;\n if (grad.gradient === 'radial') {\n // SVG radial gradients automatically transform to normalized bbox\n // coordinates, in a way that is cumbersome to replicate in canvas.\n // We wrap the radial gradient in a pattern element, allowing us to\n // maintain a circular gradient that matches what canvas provides.\n let pt = domChild(el, index++, 'pattern', svgns);\n setAttributes(pt, {\n id: patternPrefix + grad.id,\n viewBox: '0,0,1,1',\n width: '100%',\n height: '100%',\n preserveAspectRatio: 'xMidYMid slice'\n });\n pt = domChild(pt, 0, 'rect', svgns);\n setAttributes(pt, {\n width: 1,\n height: 1,\n fill: `url(${href()}#${grad.id})`\n });\n el = domChild(el, index++, 'radialGradient', svgns);\n setAttributes(el, {\n id: grad.id,\n fx: grad.x1,\n fy: grad.y1,\n fr: grad.r1,\n cx: grad.x2,\n cy: grad.y2,\n r: grad.r2\n });\n } else {\n el = domChild(el, index++, 'linearGradient', svgns);\n setAttributes(el, {\n id: grad.id,\n x1: grad.x1,\n x2: grad.x2,\n y1: grad.y1,\n y2: grad.y2\n });\n }\n for (i = 0, n = grad.stops.length; i < n; ++i) {\n stop = domChild(el, i, 'stop', svgns);\n stop.setAttribute('offset', grad.stops[i].offset);\n stop.setAttribute('stop-color', grad.stops[i].color);\n }\n domClear(el, i);\n return index;\n}\n\n// update clipping path definitions\nfunction updateClipping(el, clip, index) {\n let mask;\n el = domChild(el, index, 'clipPath', svgns);\n el.setAttribute('id', clip.id);\n if (clip.path) {\n mask = domChild(el, 0, 'path', svgns);\n mask.setAttribute('d', clip.path);\n } else {\n mask = domChild(el, 0, 'rect', svgns);\n setAttributes(mask, {\n x: 0,\n y: 0,\n width: clip.width,\n height: clip.height\n });\n }\n domClear(el, 1);\n return index + 1;\n}\n\n// Recursively process group contents.\nfunction recurse(renderer, el, group, markTypes) {\n // child 'g' element is second to last among children (path, g, path)\n // other children here are foreground and background path elements\n el = el.lastChild.previousSibling;\n let prev,\n idx = 0;\n visit(group, item => {\n prev = renderer.mark(el, item, prev, markTypes);\n ++idx;\n });\n\n // remove any extraneous DOM elements\n domClear(el, 1 + idx);\n}\n\n// Bind a scenegraph item to an SVG DOM element.\n// Create new SVG elements as needed.\nfunction bind(item, el, sibling, tag, svg) {\n let node = item._svg,\n doc;\n\n // create a new dom node if needed\n if (!node) {\n doc = el.ownerDocument;\n node = domCreate(doc, tag, svgns);\n item._svg = node;\n if (item.mark) {\n node.__data__ = item;\n node.__values__ = {\n fill: 'default'\n };\n\n // if group, create background, content, and foreground elements\n if (tag === 'g') {\n const bg = domCreate(doc, 'path', svgns);\n node.appendChild(bg);\n bg.__data__ = item;\n const cg = domCreate(doc, 'g', svgns);\n node.appendChild(cg);\n cg.__data__ = item;\n const fg = domCreate(doc, 'path', svgns);\n node.appendChild(fg);\n fg.__data__ = item;\n fg.__values__ = {\n fill: 'default'\n };\n }\n }\n }\n\n // (re-)insert if (a) not contained in SVG or (b) sibling order has changed\n if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) {\n el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild);\n }\n return node;\n}\n\n// check if two nodes are ordered siblings\nfunction siblingCheck(node, sibling) {\n return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same\n}\n\n// -- Set attributes & styles on SVG elements ---\n\nlet element = null,\n // temp var for current SVG element\n values = null; // temp var for current values hash\n\n// Extra configuration for certain mark types\nconst mark_extras = {\n group(mdef, el, item) {\n const fg = element = el.childNodes[2];\n values = fg.__values__;\n mdef.foreground(emit, item, this);\n values = el.__values__; // use parent's values hash\n element = el.childNodes[1];\n mdef.content(emit, item, this);\n const bg = element = el.childNodes[0];\n mdef.background(emit, item, this);\n const value = item.mark.interactive === false ? 'none' : null;\n if (value !== values.events) {\n setAttribute(fg, 'pointer-events', value);\n setAttribute(bg, 'pointer-events', value);\n values.events = value;\n }\n if (item.strokeForeground && item.stroke) {\n const fill = item.fill;\n setAttribute(fg, 'display', null);\n\n // set style of background\n this.style(bg, item);\n setAttribute(bg, 'stroke', null);\n\n // set style of foreground\n if (fill) item.fill = null;\n values = fg.__values__;\n this.style(fg, item);\n if (fill) item.fill = fill;\n\n // leave element null to prevent downstream styling\n element = null;\n } else {\n // ensure foreground is ignored\n setAttribute(fg, 'display', 'none');\n }\n },\n image(mdef, el, item) {\n if (item.smooth === false) {\n setStyle(el, 'image-rendering', 'optimizeSpeed');\n setStyle(el, 'image-rendering', 'pixelated');\n } else {\n setStyle(el, 'image-rendering', null);\n }\n },\n text(mdef, el, item) {\n const tl = textLines(item);\n let key, value, doc, lh;\n if (isArray(tl)) {\n // multi-line text\n value = tl.map(_ => textValue(item, _));\n key = value.join('\\n'); // content cache key\n\n if (key !== values.text) {\n domClear(el, 0);\n doc = el.ownerDocument;\n lh = lineHeight(item);\n value.forEach((t, i) => {\n const ts = domCreate(doc, 'tspan', svgns);\n ts.__data__ = item; // data binding\n ts.textContent = t;\n if (i) {\n ts.setAttribute('x', 0);\n ts.setAttribute('dy', lh);\n }\n el.appendChild(ts);\n });\n values.text = key;\n }\n } else {\n // single-line text\n value = textValue(item, tl);\n if (value !== values.text) {\n el.textContent = value;\n values.text = value;\n }\n }\n setAttribute(el, 'font-family', fontFamily(item));\n setAttribute(el, 'font-size', fontSize(item) + 'px');\n setAttribute(el, 'font-style', item.fontStyle);\n setAttribute(el, 'font-variant', item.fontVariant);\n setAttribute(el, 'font-weight', item.fontWeight);\n }\n};\nfunction emit(name, value, ns) {\n // early exit if value is unchanged\n if (value === values[name]) return;\n\n // use appropriate method given namespace (ns)\n if (ns) {\n setAttributeNS(element, name, value, ns);\n } else {\n setAttribute(element, name, value);\n }\n\n // note current value for future comparison\n values[name] = value;\n}\nfunction setStyle(el, name, value) {\n if (value !== values[name]) {\n if (value == null) {\n el.style.removeProperty(name);\n } else {\n el.style.setProperty(name, value + '');\n }\n values[name] = value;\n }\n}\nfunction setAttributes(el, attrs) {\n for (const key in attrs) {\n setAttribute(el, key, attrs[key]);\n }\n}\nfunction setAttribute(el, name, value) {\n if (value != null) {\n // if value is provided, update DOM attribute\n el.setAttribute(name, value);\n } else {\n // else remove DOM attribute\n el.removeAttribute(name);\n }\n}\nfunction setAttributeNS(el, name, value, ns) {\n if (value != null) {\n // if value is provided, update DOM attribute\n el.setAttributeNS(ns, name, value);\n } else {\n // else remove DOM attribute\n el.removeAttributeNS(ns, name);\n }\n}\nfunction href() {\n let loc;\n return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href;\n}\n\nfunction SVGStringRenderer(loader) {\n Renderer.call(this, loader);\n this._text = null;\n this._defs = {\n gradient: {},\n clipping: {}\n };\n}\ninherits(SVGStringRenderer, Renderer, {\n /**\n * Returns the rendered SVG text string,\n * or null if rendering has not yet occurred.\n */\n svg() {\n return this._text;\n },\n /**\n * Internal rendering method.\n * @param {object} scene - The root mark of a scenegraph to render.\n */\n _render(scene) {\n const m = markup();\n\n // svg tag\n m.open('svg', extend({}, metadata, {\n class: 'marks',\n width: this._width * this._scale,\n height: this._height * this._scale,\n viewBox: `0 0 ${this._width} ${this._height}`\n }));\n\n // background, if defined\n const bg = this._bgcolor;\n if (bg && bg !== 'transparent' && bg !== 'none') {\n m.open('rect', {\n width: this._width,\n height: this._height,\n fill: bg\n }).close();\n }\n\n // root content group\n m.open('g', rootAttributes, {\n transform: 'translate(' + this._origin + ')'\n });\n this.mark(m, scene);\n m.close(); // \n\n // defs\n this.defs(m);\n\n // get SVG text string\n this._text = m.close() + '';\n return this;\n },\n /**\n * Render a set of mark items.\n * @param {object} m - The markup context.\n * @param {object} scene - The mark parent to render.\n */\n mark(m, scene) {\n const mdef = Marks[scene.marktype],\n tag = mdef.tag,\n attrList = [ariaItemAttributes, mdef.attr];\n\n // render opening group tag\n m.open('g', {\n 'class': cssClass(scene),\n 'clip-path': scene.clip ? clip$1(this, scene, scene.group) : null\n }, ariaMarkAttributes(scene), {\n 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null\n });\n\n // render contained elements\n const process = item => {\n const href = this.href(item);\n if (href) m.open('a', href);\n m.open(tag, this.attr(scene, item, attrList, tag !== 'g' ? tag : null));\n if (tag === 'text') {\n const tl = textLines(item);\n if (isArray(tl)) {\n // multi-line text\n const attrs = {\n x: 0,\n dy: lineHeight(item)\n };\n for (let i = 0; i < tl.length; ++i) {\n m.open('tspan', i ? attrs : null).text(textValue(item, tl[i])).close();\n }\n } else {\n // single-line text\n m.text(textValue(item, tl));\n }\n } else if (tag === 'g') {\n const fore = item.strokeForeground,\n fill = item.fill,\n stroke = item.stroke;\n if (fore && stroke) {\n item.stroke = null;\n }\n m.open('path', this.attr(scene, item, mdef.background, 'bgrect')).close();\n\n // recurse for group content\n m.open('g', this.attr(scene, item, mdef.content));\n visit(item, scene => this.mark(m, scene));\n m.close();\n if (fore && stroke) {\n if (fill) item.fill = null;\n item.stroke = stroke;\n m.open('path', this.attr(scene, item, mdef.foreground, 'bgrect')).close();\n if (fill) item.fill = fill;\n } else {\n m.open('path', this.attr(scene, item, mdef.foreground, 'bgfore')).close();\n }\n }\n m.close(); // \n if (href) m.close(); // \n };\n\n if (mdef.nested) {\n if (scene.items && scene.items.length) process(scene.items[0]);\n } else {\n visit(scene, process);\n }\n\n // render closing group tag\n return m.close(); // \n },\n\n /**\n * Get href attributes for a hyperlinked mark item.\n * @param {Item} item - The mark item.\n */\n href(item) {\n const href = item.href;\n let attr;\n if (href) {\n if (attr = this._hrefs && this._hrefs[href]) {\n return attr;\n } else {\n this.sanitizeURL(href).then(attr => {\n // rewrite to use xlink namespace\n attr['xlink:href'] = attr.href;\n attr.href = null;\n (this._hrefs || (this._hrefs = {}))[href] = attr;\n });\n }\n }\n return null;\n },\n /**\n * Get an object of SVG attributes for a mark item.\n * @param {object} scene - The mark parent.\n * @param {Item} item - The mark item.\n * @param {array|function} attrs - One or more attribute emitters.\n * @param {string} tag - The tag being rendered.\n */\n attr(scene, item, attrs, tag) {\n const object = {},\n emit = (name, value, ns, prefixed) => {\n object[prefixed || name] = value;\n };\n\n // apply mark specific attributes\n if (Array.isArray(attrs)) {\n attrs.forEach(fn => fn(emit, item, this));\n } else {\n attrs(emit, item, this);\n }\n\n // apply style attributes\n if (tag) {\n style(object, item, scene, tag, this._defs);\n }\n return object;\n },\n /**\n * Render SVG defs, as needed.\n * Must be called *after* marks have been processed to ensure the\n * collected state is current and accurate.\n * @param {object} m - The markup context.\n */\n defs(m) {\n const gradient = this._defs.gradient,\n clipping = this._defs.clipping,\n count = Object.keys(gradient).length + Object.keys(clipping).length;\n if (count === 0) return; // nothing to do\n\n m.open('defs');\n for (const id in gradient) {\n const def = gradient[id],\n stops = def.stops;\n if (def.gradient === 'radial') {\n // SVG radial gradients automatically transform to normalized bbox\n // coordinates, in a way that is cumbersome to replicate in canvas.\n // We wrap the radial gradient in a pattern element, allowing us to\n // maintain a circular gradient that matches what canvas provides.\n\n m.open('pattern', {\n id: patternPrefix + id,\n viewBox: '0,0,1,1',\n width: '100%',\n height: '100%',\n preserveAspectRatio: 'xMidYMid slice'\n });\n m.open('rect', {\n width: '1',\n height: '1',\n fill: 'url(#' + id + ')'\n }).close();\n m.close(); // \n\n m.open('radialGradient', {\n id: id,\n fx: def.x1,\n fy: def.y1,\n fr: def.r1,\n cx: def.x2,\n cy: def.y2,\n r: def.r2\n });\n } else {\n m.open('linearGradient', {\n id: id,\n x1: def.x1,\n x2: def.x2,\n y1: def.y1,\n y2: def.y2\n });\n }\n for (let i = 0; i < stops.length; ++i) {\n m.open('stop', {\n offset: stops[i].offset,\n 'stop-color': stops[i].color\n }).close();\n }\n m.close();\n }\n for (const id in clipping) {\n const def = clipping[id];\n m.open('clipPath', {\n id: id\n });\n if (def.path) {\n m.open('path', {\n d: def.path\n }).close();\n } else {\n m.open('rect', {\n x: 0,\n y: 0,\n width: def.width,\n height: def.height\n }).close();\n }\n m.close();\n }\n m.close();\n }\n});\n\n// Helper function for attr for style presentation attributes\nfunction style(s, item, scene, tag, defs) {\n let styleList;\n if (item == null) return s;\n if (tag === 'bgrect' && scene.interactive === false) {\n s['pointer-events'] = 'none';\n }\n if (tag === 'bgfore') {\n if (scene.interactive === false) {\n s['pointer-events'] = 'none';\n }\n s.display = 'none';\n if (item.fill !== null) return s;\n }\n if (tag === 'image' && item.smooth === false) {\n styleList = ['image-rendering: optimizeSpeed;', 'image-rendering: pixelated;'];\n }\n if (tag === 'text') {\n s['font-family'] = fontFamily(item);\n s['font-size'] = fontSize(item) + 'px';\n s['font-style'] = item.fontStyle;\n s['font-variant'] = item.fontVariant;\n s['font-weight'] = item.fontWeight;\n }\n for (const prop in stylesAttr) {\n let value = item[prop];\n const name = stylesAttr[prop];\n if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; else if (value != null) {\n if (isGradient(value)) {\n value = gradientRef(value, defs.gradient, '');\n }\n s[name] = value;\n }\n }\n for (const prop in stylesCss) {\n const value = item[prop];\n if (value != null) {\n styleList = styleList || [];\n styleList.push(`${stylesCss[prop]}: ${value};`);\n }\n }\n if (styleList) {\n s.style = styleList.join(' ');\n }\n return s;\n}\n\n/**\n * @typedef {Object} HybridRendererOptions\n *\n * @property {string[]} [svgMarkTypes=['text']] - An array of SVG mark types to render\n * in the SVG layer. All other mark types\n * will be rendered in the Canvas layer.\n * @property {boolean} [svgOnTop=true] - Flag to determine if SVG should be rendered on top.\n * @property {boolean} [debug=false] - Flag to enable or disable debugging mode. When true,\n * the top layer will be stacked below the bottom layer\n * rather than overlaid on top.\n */\n\n/** @type {HybridRendererOptions} */\nconst OPTS = {\n svgMarkTypes: ['text'],\n svgOnTop: true,\n debug: false\n};\n\n/**\n * Configure the HybridRenderer\n *\n * @param {HybridRendererOptions} options - HybridRenderer configuration options.\n */\nfunction setHybridRendererOptions(options) {\n OPTS['svgMarkTypes'] = options.svgMarkTypes ?? ['text'];\n OPTS['svgOnTop'] = options.svgOnTop ?? true;\n OPTS['debug'] = options.debug ?? false;\n}\nfunction HybridRenderer(loader) {\n Renderer.call(this, loader);\n this._svgRenderer = new SVGRenderer(loader);\n this._canvasRenderer = new CanvasRenderer(loader);\n}\nconst base = Renderer.prototype;\ninherits(HybridRenderer, Renderer, {\n /**\n * Initialize a new HybridRenderer instance.\n * @param {DOMElement} el - The containing DOM element for the display.\n * @param {number} width - The coordinate width of the display, in pixels.\n * @param {number} height - The coordinate height of the display, in pixels.\n * @param {Array} origin - The origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {HybridRenderer} - This renderer instance.\n */\n initialize(el, width, height, origin, scaleFactor) {\n this._root_el = domChild(el, 0, 'div');\n const bottomEl = domChild(this._root_el, 0, 'div');\n const topEl = domChild(this._root_el, 1, 'div');\n this._root_el.style.position = 'relative';\n\n // Set position absolute to overlay svg on top of canvas\n if (!OPTS.debug) {\n bottomEl.style.height = '100%';\n topEl.style.position = 'absolute';\n topEl.style.top = '0';\n topEl.style.left = '0';\n topEl.style.height = '100%';\n topEl.style.width = '100%';\n }\n this._svgEl = OPTS.svgOnTop ? topEl : bottomEl;\n this._canvasEl = OPTS.svgOnTop ? bottomEl : topEl;\n\n // pointer-events to none on SVG layer so that canvas gets all events\n this._svgEl.style.pointerEvents = 'none';\n this._canvasRenderer.initialize(this._canvasEl, width, height, origin, scaleFactor);\n this._svgRenderer.initialize(this._svgEl, width, height, origin, scaleFactor);\n return base.initialize.call(this, el, width, height, origin, scaleFactor);\n },\n /**\n * Flag a mark item as dirty.\n * @param {Item} item - The mark item.\n */\n dirty(item) {\n if (OPTS.svgMarkTypes.includes(item.mark.marktype)) {\n this._svgRenderer.dirty(item);\n } else {\n this._canvasRenderer.dirty(item);\n }\n return this;\n },\n /**\n * Internal rendering method.\n * @param {object} scene - The root mark of a scenegraph to render.\n * @param {Array} markTypes - Array of the mark types to render.\n * If undefined, render all mark types\n */\n _render(scene, markTypes) {\n const allMarkTypes = markTypes ?? ['arc', 'area', 'image', 'line', 'path', 'rect', 'rule', 'shape', 'symbol', 'text', 'trail'];\n const canvasMarkTypes = allMarkTypes.filter(m => !OPTS.svgMarkTypes.includes(m));\n this._svgRenderer.render(scene, OPTS.svgMarkTypes);\n this._canvasRenderer.render(scene, canvasMarkTypes);\n },\n /**\n * Resize the display.\n * @param {number} width - The new coordinate width of the display, in pixels.\n * @param {number} height - The new coordinate height of the display, in pixels.\n * @param {Array} origin - The new origin of the display, in pixels.\n * The coordinate system will be translated to this point.\n * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply\n * the width and height to determine the final pixel size.\n * @return {SVGRenderer} - This renderer instance;\n */\n resize(width, height, origin, scaleFactor) {\n base.resize.call(this, width, height, origin, scaleFactor);\n this._svgRenderer.resize(width, height, origin, scaleFactor);\n this._canvasRenderer.resize(width, height, origin, scaleFactor);\n return this;\n },\n background(bgcolor) {\n // Propagate background color to lower canvas renderer\n if (OPTS.svgOnTop) {\n this._canvasRenderer.background(bgcolor);\n } else {\n this._svgRenderer.background(bgcolor);\n }\n return this;\n }\n});\n\nfunction HybridHandler(loader, tooltip) {\n CanvasHandler.call(this, loader, tooltip);\n}\ninherits(HybridHandler, CanvasHandler, {\n initialize(el, origin, obj) {\n const canvas = domChild(domChild(el, 0, 'div'), OPTS.svgOnTop ? 0 : 1, 'div');\n return CanvasHandler.prototype.initialize.call(this, canvas, origin, obj);\n }\n});\n\nconst Canvas = 'canvas';\nconst Hybrid = 'hybrid';\nconst PNG = 'png';\nconst SVG = 'svg';\nconst None = 'none';\nconst RenderType = {\n Canvas: Canvas,\n PNG: PNG,\n SVG: SVG,\n Hybrid: Hybrid,\n None: None\n};\nconst modules = {};\nmodules[Canvas] = modules[PNG] = {\n renderer: CanvasRenderer,\n headless: CanvasRenderer,\n handler: CanvasHandler\n};\nmodules[SVG] = {\n renderer: SVGRenderer,\n headless: SVGStringRenderer,\n handler: SVGHandler\n};\nmodules[Hybrid] = {\n renderer: HybridRenderer,\n headless: HybridRenderer,\n handler: HybridHandler\n};\nmodules[None] = {};\nfunction renderModule(name, _) {\n name = String(name || '').toLowerCase();\n if (arguments.length > 1) {\n modules[name] = _;\n return this;\n } else {\n return modules[name];\n }\n}\n\nfunction intersect(scene, bounds, filter) {\n const hits = [],\n // intersection results\n box = new Bounds().union(bounds),\n // defensive copy\n type = scene.marktype;\n return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : error('Intersect scene must be mark node or group item.');\n}\nfunction intersectMark(mark, box, filter, hits) {\n if (visitMark(mark, box, filter)) {\n const items = mark.items,\n type = mark.marktype,\n n = items.length;\n let i = 0;\n if (type === 'group') {\n for (; i < n; ++i) {\n intersectGroup(items[i], box, filter, hits);\n }\n } else {\n for (const test = Marks[type].isect; i < n; ++i) {\n const item = items[i];\n if (intersectItem(item, box, test)) hits.push(item);\n }\n }\n }\n return hits;\n}\nfunction visitMark(mark, box, filter) {\n // process if bounds intersect and if\n // (1) mark is a group mark (so we must recurse), or\n // (2) mark is interactive and passes filter\n return mark.bounds && box.intersects(mark.bounds) && (mark.marktype === 'group' || mark.interactive !== false && (!filter || filter(mark)));\n}\nfunction intersectGroup(group, box, filter, hits) {\n // test intersect against group\n // skip groups by default unless filter says otherwise\n if (filter && filter(group.mark) && intersectItem(group, box, Marks.group.isect)) {\n hits.push(group);\n }\n\n // recursively test children marks\n // translate box to group coordinate space\n const marks = group.items,\n n = marks && marks.length;\n if (n) {\n const x = group.x || 0,\n y = group.y || 0;\n box.translate(-x, -y);\n for (let i = 0; i < n; ++i) {\n intersectMark(marks[i], box, filter, hits);\n }\n box.translate(x, y);\n }\n return hits;\n}\nfunction intersectItem(item, box, test) {\n // test bounds enclosure, bounds intersection, then detailed test\n const bounds = item.bounds;\n return box.encloses(bounds) || box.intersects(bounds) && test(item, box);\n}\n\nconst clipBounds = new Bounds();\nfunction boundClip (mark) {\n const clip = mark.clip;\n if (isFunction(clip)) {\n clip(boundContext(clipBounds.clear()));\n } else if (clip) {\n clipBounds.set(0, 0, mark.group.width, mark.group.height);\n } else return;\n mark.bounds.intersect(clipBounds);\n}\n\nconst TOLERANCE = 1e-9;\nfunction sceneEqual(a, b, key) {\n return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : isNumber(a) && isNumber(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !isObject(a) && !isObject(b) ? a == b : objectEqual(a, b);\n}\nfunction pathEqual(a, b) {\n return sceneEqual(parse(a), parse(b));\n}\nfunction objectEqual(a, b) {\n var ka = Object.keys(a),\n kb = Object.keys(b),\n key,\n i;\n if (ka.length !== kb.length) return false;\n ka.sort();\n kb.sort();\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i]) return false;\n }\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!sceneEqual(a[key], b[key], key)) return false;\n }\n return typeof a === typeof b;\n}\n\nfunction resetSVGDefIds() {\n resetSVGClipId();\n resetSVGGradientId();\n}\n\nexport { Bounds, CanvasHandler, CanvasRenderer, Gradient, GroupItem, Handler, HybridHandler, HybridRenderer, Item, Marks, RenderType, Renderer, ResourceLoader, SVGHandler, SVGRenderer, SVGStringRenderer, Scenegraph, boundClip, boundContext, boundItem, boundMark, boundStroke, domChild, domClear, domCreate, domFind, font, fontFamily, fontSize, intersect, intersectBoxLine, intersectPath, intersectPoint, intersectRule, lineHeight, markup, multiLineOffset, curves as pathCurves, pathEqual, parse as pathParse, vg_rect as pathRectangle, pathRender, symbols as pathSymbols, vg_trail as pathTrail, point, renderModule, resetSVGClipId, resetSVGDefIds, sceneEqual, sceneFromJSON, pickVisit as scenePickVisit, sceneToJSON, visit as sceneVisit, zorder as sceneZOrder, serializeXML, setHybridRendererOptions, textMetrics };\n","import constant from \"./constant.js\";\nimport {withPath} from \"./path.js\";\nimport asterisk from \"./symbol/asterisk.js\";\nimport circle from \"./symbol/circle.js\";\nimport cross from \"./symbol/cross.js\";\nimport diamond from \"./symbol/diamond.js\";\nimport diamond2 from \"./symbol/diamond2.js\";\nimport plus from \"./symbol/plus.js\";\nimport square from \"./symbol/square.js\";\nimport square2 from \"./symbol/square2.js\";\nimport star from \"./symbol/star.js\";\nimport triangle from \"./symbol/triangle.js\";\nimport triangle2 from \"./symbol/triangle2.js\";\nimport wye from \"./symbol/wye.js\";\nimport times from \"./symbol/times.js\";\n\n// These symbols are designed to be filled.\nexport const symbolsFill = [\n circle,\n cross,\n diamond,\n square,\n star,\n triangle,\n wye\n];\n\n// These symbols are designed to be stroked (with a width of 1.5px and round caps).\nexport const symbolsStroke = [\n circle,\n plus,\n times,\n triangle2,\n asterisk,\n square2,\n diamond2\n];\n\nexport default function Symbol(type, size) {\n let context = null,\n path = withPath(symbol);\n\n type = typeof type === \"function\" ? type : constant(type || circle);\n size = typeof size === \"function\" ? size : constant(size === undefined ? 64 : +size);\n\n function symbol() {\n let buffer;\n if (!context) context = buffer = path();\n type.apply(this, arguments).draw(context, +size.apply(this, arguments));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n symbol.type = function(_) {\n return arguments.length ? (type = typeof _ === \"function\" ? _ : constant(_), symbol) : type;\n };\n\n symbol.size = function(_) {\n return arguments.length ? (size = typeof _ === \"function\" ? _ : constant(+_), symbol) : size;\n };\n\n symbol.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, symbol) : context;\n };\n\n return symbol;\n}\n","import { Transform } from 'vega-dataflow';\nimport { Marks, boundClip, GroupItem, Item, Bounds, multiLineOffset, boundStroke } from 'vega-scenegraph';\nimport { inherits, peek, isObject } from 'vega-util';\n\nconst Top = 'top';\nconst Left = 'left';\nconst Right = 'right';\nconst Bottom = 'bottom';\nconst TopLeft = 'top-left';\nconst TopRight = 'top-right';\nconst BottomLeft = 'bottom-left';\nconst BottomRight = 'bottom-right';\nconst Start = 'start';\nconst Middle = 'middle';\nconst End = 'end';\nconst X = 'x';\nconst Y = 'y';\nconst Group = 'group';\nconst AxisRole = 'axis';\nconst TitleRole = 'title';\nconst FrameRole = 'frame';\nconst ScopeRole = 'scope';\nconst LegendRole = 'legend';\nconst RowHeader = 'row-header';\nconst RowFooter = 'row-footer';\nconst RowTitle = 'row-title';\nconst ColHeader = 'column-header';\nconst ColFooter = 'column-footer';\nconst ColTitle = 'column-title';\nconst Padding = 'padding';\nconst Symbols = 'symbol';\nconst Fit = 'fit';\nconst FitX = 'fit-x';\nconst FitY = 'fit-y';\nconst Pad = 'pad';\nconst None = 'none';\nconst All = 'all';\nconst Each = 'each';\nconst Flush = 'flush';\nconst Column = 'column';\nconst Row = 'row';\n\n/**\n * Calculate bounding boxes for scenegraph items.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {object} params.mark - The scenegraph mark instance to bound.\n */\nfunction Bound(params) {\n Transform.call(this, null, params);\n}\ninherits(Bound, Transform, {\n transform(_, pulse) {\n const view = pulse.dataflow,\n mark = _.mark,\n type = mark.marktype,\n entry = Marks[type],\n bound = entry.bound;\n let markBounds = mark.bounds,\n rebound;\n if (entry.nested) {\n // multi-item marks have a single bounds instance\n if (mark.items.length) view.dirty(mark.items[0]);\n markBounds = boundItem(mark, bound);\n mark.items.forEach(item => {\n item.bounds.clear().union(markBounds);\n });\n } else if (type === Group || _.modified()) {\n // operator parameters modified -> re-bound all items\n // updates group bounds in response to modified group content\n pulse.visit(pulse.MOD, item => view.dirty(item));\n markBounds.clear();\n mark.items.forEach(item => markBounds.union(boundItem(item, bound)));\n\n // force reflow for axes/legends/titles to propagate any layout changes\n switch (mark.role) {\n case AxisRole:\n case LegendRole:\n case TitleRole:\n pulse.reflow();\n }\n } else {\n // incrementally update bounds, re-bound mark as needed\n rebound = pulse.changed(pulse.REM);\n pulse.visit(pulse.ADD, item => {\n markBounds.union(boundItem(item, bound));\n });\n pulse.visit(pulse.MOD, item => {\n rebound = rebound || markBounds.alignsWith(item.bounds);\n view.dirty(item);\n markBounds.union(boundItem(item, bound));\n });\n if (rebound) {\n markBounds.clear();\n mark.items.forEach(item => markBounds.union(item.bounds));\n }\n }\n\n // ensure mark bounds do not exceed any clipping region\n boundClip(mark);\n return pulse.modifies('bounds');\n }\n});\nfunction boundItem(item, bound, opt) {\n return bound(item.bounds.clear(), item, opt);\n}\n\nconst COUNTER_NAME = ':vega_identifier:';\n\n/**\n * Adds a unique identifier to all added tuples.\n * This transform creates a new signal that serves as an id counter.\n * As a result, the id counter is shared across all instances of this\n * transform, generating unique ids across multiple data streams. In\n * addition, this signal value can be included in a snapshot of the\n * dataflow state, enabling correct resumption of id allocation.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {string} params.as - The field name for the generated identifier.\n */\nfunction Identifier(params) {\n Transform.call(this, 0, params);\n}\nIdentifier.Definition = {\n 'type': 'Identifier',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'as',\n 'type': 'string',\n 'required': true\n }]\n};\ninherits(Identifier, Transform, {\n transform(_, pulse) {\n const counter = getCounter(pulse.dataflow),\n as = _.as;\n let id = counter.value;\n pulse.visit(pulse.ADD, t => t[as] = t[as] || ++id);\n counter.set(this.value = id);\n return pulse;\n }\n});\nfunction getCounter(view) {\n return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0));\n}\n\n/**\n * Bind scenegraph items to a scenegraph mark instance.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {object} params.markdef - The mark definition for creating the mark.\n * This is an object of legal scenegraph mark properties which *must* include\n * the 'marktype' property.\n */\nfunction Mark(params) {\n Transform.call(this, null, params);\n}\ninherits(Mark, Transform, {\n transform(_, pulse) {\n let mark = this.value;\n\n // acquire mark on first invocation, bind context and group\n if (!mark) {\n mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index);\n mark.group.context = _.context;\n if (!_.context.group) _.context.group = mark.group;\n mark.source = this.source; // point to upstream collector\n mark.clip = _.clip;\n mark.interactive = _.interactive;\n this.value = mark;\n }\n\n // initialize entering items\n const Init = mark.marktype === Group ? GroupItem : Item;\n pulse.visit(pulse.ADD, item => Init.call(item, mark));\n\n // update clipping and/or interactive status\n if (_.modified('clip') || _.modified('interactive')) {\n mark.clip = _.clip;\n mark.interactive = !!_.interactive;\n mark.zdirty = true; // force scenegraph re-eval\n pulse.reflow();\n }\n\n // bind items array to scenegraph mark\n mark.items = pulse.source;\n return pulse;\n }\n});\nfunction lookup$1(_) {\n const g = _.groups,\n p = _.parent;\n return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null;\n}\n\n/**\n * Analyze items for overlap, changing opacity to hide items with\n * overlapping bounding boxes. This transform will preserve at least\n * two items (e.g., first and last) even if overlap persists.\n * @param {object} params - The parameters for this operator.\n * @param {function(*,*): number} [params.sort] - A comparator\n * function for sorting items.\n * @param {object} [params.method] - The overlap removal method to apply.\n * One of 'parity' (default, hide every other item until there is no\n * more overlap) or 'greedy' (sequentially scan and hide and items that\n * overlap with the last visible item).\n * @param {object} [params.boundScale] - A scale whose range should be used\n * to bound the items. Items exceeding the bounds of the scale range\n * will be treated as overlapping. If null or undefined, no bounds check\n * will be applied.\n * @param {object} [params.boundOrient] - The orientation of the scale\n * (top, bottom, left, or right) used to bound items. This parameter is\n * ignored if boundScale is null or undefined.\n * @param {object} [params.boundTolerance] - The tolerance in pixels for\n * bound inclusion testing (default 1). This specifies by how many pixels\n * an item's bounds may exceed the scale range bounds and not be culled.\n * @constructor\n */\nfunction Overlap(params) {\n Transform.call(this, null, params);\n}\nconst methods = {\n parity: items => items.filter((item, i) => i % 2 ? item.opacity = 0 : 1),\n greedy: (items, sep) => {\n let a;\n return items.filter((b, i) => !i || !intersect(a.bounds, b.bounds, sep) ? (a = b, 1) : b.opacity = 0);\n }\n};\n\n// compute bounding box intersection\n// including padding pixels of separation\nconst intersect = (a, b, sep) => sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);\nconst hasOverlap = (items, pad) => {\n for (var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i) {\n if (intersect(a, b = items[i].bounds, pad)) return true;\n }\n};\nconst hasBounds = item => {\n const b = item.bounds;\n return b.width() > 1 && b.height() > 1;\n};\nconst boundTest = (scale, orient, tolerance) => {\n var range = scale.range(),\n b = new Bounds();\n if (orient === Top || orient === Bottom) {\n b.set(range[0], -Infinity, range[1], +Infinity);\n } else {\n b.set(-Infinity, range[0], +Infinity, range[1]);\n }\n b.expand(tolerance || 1);\n return item => b.encloses(item.bounds);\n};\n\n// reset all items to be fully opaque\nconst reset = source => {\n source.forEach(item => item.opacity = 1);\n return source;\n};\n\n// add all tuples to mod, fork pulse if parameters were modified\n// fork prevents cross-stream tuple pollution (e.g., pulse from scale)\nconst reflow = (pulse, _) => pulse.reflow(_.modified()).modifies('opacity');\ninherits(Overlap, Transform, {\n transform(_, pulse) {\n const reduce = methods[_.method] || methods.parity,\n sep = _.separation || 0;\n let source = pulse.materialize(pulse.SOURCE).source,\n items,\n test;\n if (!source || !source.length) return;\n if (!_.method) {\n // early exit if method is falsy\n if (_.modified('method')) {\n reset(source);\n pulse = reflow(pulse, _);\n }\n return pulse;\n }\n\n // skip labels with no content\n source = source.filter(hasBounds);\n\n // early exit, nothing to do\n if (!source.length) return;\n if (_.sort) {\n source = source.slice().sort(_.sort);\n }\n items = reset(source);\n pulse = reflow(pulse, _);\n if (items.length >= 3 && hasOverlap(items, sep)) {\n do {\n items = reduce(items, sep);\n } while (items.length >= 3 && hasOverlap(items, sep));\n if (items.length < 3 && !peek(source).opacity) {\n if (items.length > 1) peek(items).opacity = 0;\n peek(source).opacity = 1;\n }\n }\n if (_.boundScale && _.boundTolerance >= 0) {\n test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance);\n source.forEach(item => {\n if (!test(item)) item.opacity = 0;\n });\n }\n\n // re-calculate mark bounds\n const bounds = items[0].mark.bounds.clear();\n source.forEach(item => {\n if (item.opacity) bounds.union(item.bounds);\n });\n return pulse;\n }\n});\n\n/**\n * Queue modified scenegraph items for rendering.\n * @constructor\n */\nfunction Render(params) {\n Transform.call(this, null, params);\n}\ninherits(Render, Transform, {\n transform(_, pulse) {\n const view = pulse.dataflow;\n pulse.visit(pulse.ALL, item => view.dirty(item));\n\n // set z-index dirty flag as needed\n if (pulse.fields && pulse.fields['zindex']) {\n const item = pulse.source && pulse.source[0];\n if (item) item.mark.zdirty = true;\n }\n }\n});\n\nconst tempBounds = new Bounds();\nfunction set(item, property, value) {\n return item[property] === value ? 0 : (item[property] = value, 1);\n}\n\nfunction isYAxis(mark) {\n var orient = mark.items[0].orient;\n return orient === Left || orient === Right;\n}\nfunction axisIndices(datum) {\n let index = +datum.grid;\n return [datum.ticks ? index++ : -1,\n // ticks index\n datum.labels ? index++ : -1,\n // labels index\n index + +datum.domain // title index\n ];\n}\n\nfunction axisLayout(view, axis, width, height) {\n var item = axis.items[0],\n datum = item.datum,\n delta = item.translate != null ? item.translate : 0.5,\n orient = item.orient,\n indices = axisIndices(datum),\n range = item.range,\n offset = item.offset,\n position = item.position,\n minExtent = item.minExtent,\n maxExtent = item.maxExtent,\n title = datum.title && item.items[indices[2]].items[0],\n titlePadding = item.titlePadding,\n bounds = item.bounds,\n dl = title && multiLineOffset(title),\n x = 0,\n y = 0,\n i,\n s;\n tempBounds.clear().union(bounds);\n bounds.clear();\n if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds);\n if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds);\n\n // position axis group and title\n switch (orient) {\n case Top:\n x = position || 0;\n y = -offset;\n s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1));\n bounds.add(0, -s).add(range, 0);\n if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds);\n break;\n case Left:\n x = -offset;\n y = position || 0;\n s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1));\n bounds.add(-s, 0).add(0, range);\n if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds);\n break;\n case Right:\n x = width + offset;\n y = position || 0;\n s = Math.max(minExtent, Math.min(maxExtent, bounds.x2));\n bounds.add(0, 0).add(s, range);\n if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds);\n break;\n case Bottom:\n x = position || 0;\n y = height + offset;\n s = Math.max(minExtent, Math.min(maxExtent, bounds.y2));\n bounds.add(0, 0).add(range, s);\n if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds);\n break;\n default:\n x = item.x;\n y = item.y;\n }\n\n // update bounds\n boundStroke(bounds.translate(x, y), item);\n if (set(item, 'x', x + delta) | set(item, 'y', y + delta)) {\n item.bounds = tempBounds;\n view.dirty(item);\n item.bounds = bounds;\n view.dirty(item);\n }\n return item.mark.bounds.clear().union(bounds);\n}\nfunction axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) {\n const b = title.bounds;\n if (title.auto) {\n const v = sign * (offset + dl + pad);\n let dx = 0,\n dy = 0;\n view.dirty(title);\n isYAxis ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v);\n title.mark.bounds.clear().union(b.translate(-dx, -dy));\n view.dirty(title);\n }\n bounds.union(b);\n}\n\n// aggregation functions for grid margin determination\nconst min = (a, b) => Math.floor(Math.min(a, b));\nconst max = (a, b) => Math.ceil(Math.max(a, b));\nfunction gridLayoutGroups(group) {\n var groups = group.items,\n n = groups.length,\n i = 0,\n mark,\n items;\n const views = {\n marks: [],\n rowheaders: [],\n rowfooters: [],\n colheaders: [],\n colfooters: [],\n rowtitle: null,\n coltitle: null\n };\n\n // layout axes, gather legends, collect bounds\n for (; i < n; ++i) {\n mark = groups[i];\n items = mark.items;\n if (mark.marktype === Group) {\n switch (mark.role) {\n case AxisRole:\n case LegendRole:\n case TitleRole:\n break;\n case RowHeader:\n views.rowheaders.push(...items);\n break;\n case RowFooter:\n views.rowfooters.push(...items);\n break;\n case ColHeader:\n views.colheaders.push(...items);\n break;\n case ColFooter:\n views.colfooters.push(...items);\n break;\n case RowTitle:\n views.rowtitle = items[0];\n break;\n case ColTitle:\n views.coltitle = items[0];\n break;\n default:\n views.marks.push(...items);\n }\n }\n }\n return views;\n}\nfunction bboxFlush(item) {\n return new Bounds().set(0, 0, item.width || 0, item.height || 0);\n}\nfunction bboxFull(item) {\n const b = item.bounds.clone();\n return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0));\n}\nfunction get(opt, key, d) {\n const v = isObject(opt) ? opt[key] : opt;\n return v != null ? v : d !== undefined ? d : 0;\n}\nfunction offsetValue(v) {\n return v < 0 ? Math.ceil(-v) : 0;\n}\nfunction gridLayout(view, groups, opt) {\n var dirty = !opt.nodirty,\n bbox = opt.bounds === Flush ? bboxFlush : bboxFull,\n bounds = tempBounds.set(0, 0, 0, 0),\n alignCol = get(opt.align, Column),\n alignRow = get(opt.align, Row),\n padCol = get(opt.padding, Column),\n padRow = get(opt.padding, Row),\n ncols = opt.columns || groups.length,\n nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols),\n n = groups.length,\n xOffset = Array(n),\n xExtent = Array(ncols),\n xMax = 0,\n yOffset = Array(n),\n yExtent = Array(nrows),\n yMax = 0,\n dx = Array(n),\n dy = Array(n),\n boxes = Array(n),\n m,\n i,\n c,\n r,\n b,\n g,\n px,\n py,\n x,\n y,\n offset;\n for (i = 0; i < ncols; ++i) xExtent[i] = 0;\n for (i = 0; i < nrows; ++i) yExtent[i] = 0;\n\n // determine offsets for each group\n for (i = 0; i < n; ++i) {\n g = groups[i];\n b = boxes[i] = bbox(g);\n g.x = g.x || 0;\n dx[i] = 0;\n g.y = g.y || 0;\n dy[i] = 0;\n c = i % ncols;\n r = ~~(i / ncols);\n xMax = Math.max(xMax, px = Math.ceil(b.x2));\n yMax = Math.max(yMax, py = Math.ceil(b.y2));\n xExtent[c] = Math.max(xExtent[c], px);\n yExtent[r] = Math.max(yExtent[r], py);\n xOffset[i] = padCol + offsetValue(b.x1);\n yOffset[i] = padRow + offsetValue(b.y1);\n if (dirty) view.dirty(groups[i]);\n }\n\n // set initial alignment offsets\n for (i = 0; i < n; ++i) {\n if (i % ncols === 0) xOffset[i] = 0;\n if (i < ncols) yOffset[i] = 0;\n }\n\n // enforce column alignment constraints\n if (alignCol === Each) {\n for (c = 1; c < ncols; ++c) {\n for (offset = 0, i = c; i < n; i += ncols) {\n if (offset < xOffset[i]) offset = xOffset[i];\n }\n for (i = c; i < n; i += ncols) {\n xOffset[i] = offset + xExtent[c - 1];\n }\n }\n } else if (alignCol === All) {\n for (offset = 0, i = 0; i < n; ++i) {\n if (i % ncols && offset < xOffset[i]) offset = xOffset[i];\n }\n for (i = 0; i < n; ++i) {\n if (i % ncols) xOffset[i] = offset + xMax;\n }\n } else {\n for (alignCol = false, c = 1; c < ncols; ++c) {\n for (i = c; i < n; i += ncols) {\n xOffset[i] += xExtent[c - 1];\n }\n }\n }\n\n // enforce row alignment constraints\n if (alignRow === Each) {\n for (r = 1; r < nrows; ++r) {\n for (offset = 0, i = r * ncols, m = i + ncols; i < m; ++i) {\n if (offset < yOffset[i]) offset = yOffset[i];\n }\n for (i = r * ncols; i < m; ++i) {\n yOffset[i] = offset + yExtent[r - 1];\n }\n }\n } else if (alignRow === All) {\n for (offset = 0, i = ncols; i < n; ++i) {\n if (offset < yOffset[i]) offset = yOffset[i];\n }\n for (i = ncols; i < n; ++i) {\n yOffset[i] = offset + yMax;\n }\n } else {\n for (alignRow = false, r = 1; r < nrows; ++r) {\n for (i = r * ncols, m = i + ncols; i < m; ++i) {\n yOffset[i] += yExtent[r - 1];\n }\n }\n }\n\n // perform horizontal grid layout\n for (x = 0, i = 0; i < n; ++i) {\n x = xOffset[i] + (i % ncols ? x : 0);\n dx[i] += x - groups[i].x;\n }\n\n // perform vertical grid layout\n for (c = 0; c < ncols; ++c) {\n for (y = 0, i = c; i < n; i += ncols) {\n y += yOffset[i];\n dy[i] += y - groups[i].y;\n }\n }\n\n // perform horizontal centering\n if (alignCol && get(opt.center, Column) && nrows > 1) {\n for (i = 0; i < n; ++i) {\n b = alignCol === All ? xMax : xExtent[i % ncols];\n x = b - boxes[i].x2 - groups[i].x - dx[i];\n if (x > 0) dx[i] += x / 2;\n }\n }\n\n // perform vertical centering\n if (alignRow && get(opt.center, Row) && ncols !== 1) {\n for (i = 0; i < n; ++i) {\n b = alignRow === All ? yMax : yExtent[~~(i / ncols)];\n y = b - boxes[i].y2 - groups[i].y - dy[i];\n if (y > 0) dy[i] += y / 2;\n }\n }\n\n // position grid relative to anchor\n for (i = 0; i < n; ++i) {\n bounds.union(boxes[i].translate(dx[i], dy[i]));\n }\n x = get(opt.anchor, X);\n y = get(opt.anchor, Y);\n switch (get(opt.anchor, Column)) {\n case End:\n x -= bounds.width();\n break;\n case Middle:\n x -= bounds.width() / 2;\n }\n switch (get(opt.anchor, Row)) {\n case End:\n y -= bounds.height();\n break;\n case Middle:\n y -= bounds.height() / 2;\n }\n x = Math.round(x);\n y = Math.round(y);\n\n // update mark positions, bounds, dirty\n bounds.clear();\n for (i = 0; i < n; ++i) {\n groups[i].mark.bounds.clear();\n }\n for (i = 0; i < n; ++i) {\n g = groups[i];\n g.x += dx[i] += x;\n g.y += dy[i] += y;\n bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i])));\n if (dirty) view.dirty(g);\n }\n return bounds;\n}\nfunction trellisLayout(view, group, opt) {\n var views = gridLayoutGroups(group),\n groups = views.marks,\n bbox = opt.bounds === Flush ? boundFlush : boundFull,\n off = opt.offset,\n ncols = opt.columns || groups.length,\n nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols),\n cells = nrows * ncols,\n x,\n y,\n x2,\n y2,\n anchor,\n band,\n offset;\n\n // -- initial grid layout\n const bounds = gridLayout(view, groups, opt);\n if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid\n\n // -- layout grid headers and footers --\n\n // perform row header layout\n if (views.rowheaders) {\n band = get(opt.headerBand, Row, null);\n x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get(off, 'rowHeader'), min, 0, bbox, 'x1', 0, ncols, 1, band);\n }\n\n // perform column header layout\n if (views.colheaders) {\n band = get(opt.headerBand, Column, null);\n y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get(off, 'columnHeader'), min, 1, bbox, 'y1', 0, 1, ncols, band);\n }\n\n // perform row footer layout\n if (views.rowfooters) {\n band = get(opt.footerBand, Row, null);\n x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols - 1, ncols, 1, band);\n }\n\n // perform column footer layout\n if (views.colfooters) {\n band = get(opt.footerBand, Column, null);\n y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells - ncols, 1, ncols, band);\n }\n\n // perform row title layout\n if (views.rowtitle) {\n anchor = get(opt.titleAnchor, Row);\n offset = get(off, 'rowTitle');\n offset = anchor === End ? x2 + offset : x - offset;\n band = get(opt.titleBand, Row, 0.5);\n layoutTitle(view, views.rowtitle, offset, 0, bounds, band);\n }\n\n // perform column title layout\n if (views.coltitle) {\n anchor = get(opt.titleAnchor, Column);\n offset = get(off, 'columnTitle');\n offset = anchor === End ? y2 + offset : y - offset;\n band = get(opt.titleBand, Column, 0.5);\n layoutTitle(view, views.coltitle, offset, 1, bounds, band);\n }\n}\nfunction boundFlush(item, field) {\n return field === 'x1' ? item.x || 0 : field === 'y1' ? item.y || 0 : field === 'x2' ? (item.x || 0) + (item.width || 0) : field === 'y2' ? (item.y || 0) + (item.height || 0) : undefined;\n}\nfunction boundFull(item, field) {\n return item.bounds[field];\n}\nfunction layoutHeaders(view, headers, groups, ncols, limit, offset, agg, isX, bound, bf, start, stride, back, band) {\n var n = groups.length,\n init = 0,\n edge = 0,\n i,\n j,\n k,\n m,\n b,\n h,\n g,\n x,\n y;\n\n // if no groups, early exit and return 0\n if (!n) return init;\n\n // compute margin\n for (i = start; i < n; i += stride) {\n if (groups[i]) init = agg(init, bound(groups[i], bf));\n }\n\n // if no headers, return margin calculation\n if (!headers.length) return init;\n\n // check if number of headers exceeds number of rows or columns\n if (headers.length > limit) {\n view.warn('Grid headers exceed limit: ' + limit);\n headers = headers.slice(0, limit);\n }\n\n // apply offset\n init += offset;\n\n // clear mark bounds for all headers\n for (j = 0, m = headers.length; j < m; ++j) {\n view.dirty(headers[j]);\n headers[j].mark.bounds.clear();\n }\n\n // layout each header\n for (i = start, j = 0, m = headers.length; j < m; ++j, i += stride) {\n h = headers[j];\n b = h.mark.bounds;\n\n // search for nearest group to align to\n // necessary if table has empty cells\n for (k = i; k >= 0 && (g = groups[k]) == null; k -= back);\n\n // assign coordinates and update bounds\n if (isX) {\n x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width());\n y = init;\n } else {\n x = init;\n y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height());\n }\n b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0)));\n h.x = x;\n h.y = y;\n view.dirty(h);\n\n // update current edge of layout bounds\n edge = agg(edge, b[bf]);\n }\n return edge;\n}\nfunction layoutTitle(view, g, offset, isX, bounds, band) {\n if (!g) return;\n view.dirty(g);\n\n // compute title coordinates\n var x = offset,\n y = offset;\n isX ? x = Math.round(bounds.x1 + band * bounds.width()) : y = Math.round(bounds.y1 + band * bounds.height());\n\n // assign coordinates and update bounds\n g.bounds.translate(x - (g.x || 0), y - (g.y || 0));\n g.mark.bounds.clear().union(g.bounds);\n g.x = x;\n g.y = y;\n\n // queue title for redraw\n view.dirty(g);\n}\n\n// utility for looking up legend layout configuration\nfunction lookup(config, orient) {\n const opt = config[orient] || {};\n return (key, d) => opt[key] != null ? opt[key] : config[key] != null ? config[key] : d;\n}\n\n// if legends specify offset directly, use the maximum specified value\nfunction offsets(legends, value) {\n let max = -Infinity;\n legends.forEach(item => {\n if (item.offset != null) max = Math.max(max, item.offset);\n });\n return max > -Infinity ? max : value;\n}\nfunction legendParams(g, orient, config, xb, yb, w, h) {\n const _ = lookup(config, orient),\n offset = offsets(g, _('offset', 0)),\n anchor = _('anchor', Start),\n mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0;\n const p = {\n align: Each,\n bounds: _('bounds', Flush),\n columns: _('direction') === 'vertical' ? 1 : g.length,\n padding: _('margin', 8),\n center: _('center'),\n nodirty: true\n };\n switch (orient) {\n case Left:\n p.anchor = {\n x: Math.floor(xb.x1) - offset,\n column: End,\n y: mult * (h || xb.height() + 2 * xb.y1),\n row: anchor\n };\n break;\n case Right:\n p.anchor = {\n x: Math.ceil(xb.x2) + offset,\n y: mult * (h || xb.height() + 2 * xb.y1),\n row: anchor\n };\n break;\n case Top:\n p.anchor = {\n y: Math.floor(yb.y1) - offset,\n row: End,\n x: mult * (w || yb.width() + 2 * yb.x1),\n column: anchor\n };\n break;\n case Bottom:\n p.anchor = {\n y: Math.ceil(yb.y2) + offset,\n x: mult * (w || yb.width() + 2 * yb.x1),\n column: anchor\n };\n break;\n case TopLeft:\n p.anchor = {\n x: offset,\n y: offset\n };\n break;\n case TopRight:\n p.anchor = {\n x: w - offset,\n y: offset,\n column: End\n };\n break;\n case BottomLeft:\n p.anchor = {\n x: offset,\n y: h - offset,\n row: End\n };\n break;\n case BottomRight:\n p.anchor = {\n x: w - offset,\n y: h - offset,\n column: End,\n row: End\n };\n break;\n }\n return p;\n}\nfunction legendLayout(view, legend) {\n var item = legend.items[0],\n datum = item.datum,\n orient = item.orient,\n bounds = item.bounds,\n x = item.x,\n y = item.y,\n w,\n h;\n\n // cache current bounds for later comparison\n item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone();\n bounds.clear();\n\n // adjust legend to accommodate padding and title\n legendGroupLayout(view, item, item.items[0].items[0]);\n\n // aggregate bounds to determine size, and include origin\n bounds = legendBounds(item, bounds);\n w = 2 * item.padding;\n h = 2 * item.padding;\n if (!bounds.empty()) {\n w = Math.ceil(bounds.width() + w);\n h = Math.ceil(bounds.height() + h);\n }\n if (datum.type === Symbols) {\n legendEntryLayout(item.items[0].items[0].items[0].items);\n }\n if (orient !== None) {\n item.x = x = 0;\n item.y = y = 0;\n }\n item.width = w;\n item.height = h;\n boundStroke(bounds.set(x, y, x + w, y + h), item);\n item.mark.bounds.clear().union(bounds);\n return item;\n}\nfunction legendBounds(item, b) {\n // aggregate item bounds\n item.items.forEach(_ => b.union(_.bounds));\n\n // anchor to legend origin\n b.x1 = item.padding;\n b.y1 = item.padding;\n return b;\n}\nfunction legendGroupLayout(view, item, entry) {\n var pad = item.padding,\n ex = pad - entry.x,\n ey = pad - entry.y;\n if (!item.datum.title) {\n if (ex || ey) translate(view, entry, ex, ey);\n } else {\n var title = item.items[1].items[0],\n anchor = title.anchor,\n tpad = item.titlePadding || 0,\n tx = pad - title.x,\n ty = pad - title.y;\n switch (title.orient) {\n case Left:\n ex += Math.ceil(title.bounds.width()) + tpad;\n break;\n case Right:\n case Bottom:\n break;\n default:\n ey += title.bounds.height() + tpad;\n }\n if (ex || ey) translate(view, entry, ex, ey);\n switch (title.orient) {\n case Left:\n ty += legendTitleOffset(item, entry, title, anchor, 1, 1);\n break;\n case Right:\n tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad;\n ty += legendTitleOffset(item, entry, title, anchor, 1, 1);\n break;\n case Bottom:\n tx += legendTitleOffset(item, entry, title, anchor, 0, 0);\n ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad;\n break;\n default:\n tx += legendTitleOffset(item, entry, title, anchor, 0, 0);\n }\n if (tx || ty) translate(view, title, tx, ty);\n\n // translate legend if title pushes into negative coordinates\n if ((tx = Math.round(title.bounds.x1 - pad)) < 0) {\n translate(view, entry, -tx, 0);\n translate(view, title, -tx, 0);\n }\n }\n}\nfunction legendTitleOffset(item, entry, title, anchor, y, lr, noBar) {\n const grad = item.datum.type !== 'symbol',\n vgrad = title.datum.vgrad,\n e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry,\n s = e.bounds[y ? 'y2' : 'x2'] - item.padding,\n u = vgrad && lr ? s : 0,\n v = vgrad && lr ? 0 : s,\n o = y <= 0 ? 0 : multiLineOffset(title);\n return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o));\n}\nfunction translate(view, item, dx, dy) {\n item.x += dx;\n item.y += dy;\n item.bounds.translate(dx, dy);\n item.mark.bounds.translate(dx, dy);\n view.dirty(item);\n}\nfunction legendEntryLayout(entries) {\n // get max widths for each column\n const widths = entries.reduce((w, g) => {\n w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0);\n return w;\n }, {});\n\n // set dimensions of legend entry groups\n entries.forEach(g => {\n g.width = widths[g.column];\n g.height = g.bounds.y2 - g.y;\n });\n}\n\nfunction titleLayout(view, mark, width, height, viewBounds) {\n var group = mark.items[0],\n frame = group.frame,\n orient = group.orient,\n anchor = group.anchor,\n offset = group.offset,\n padding = group.padding,\n title = group.items[0].items[0],\n subtitle = group.items[1] && group.items[1].items[0],\n end = orient === Left || orient === Right ? height : width,\n start = 0,\n x = 0,\n y = 0,\n sx = 0,\n sy = 0,\n pos;\n if (frame !== Group) {\n orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2);\n } else if (orient === Left) {\n start = height, end = 0;\n }\n pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2;\n if (subtitle && subtitle.text) {\n // position subtitle\n switch (orient) {\n case Top:\n case Bottom:\n sy = title.bounds.height() + padding;\n break;\n case Left:\n sx = title.bounds.width() + padding;\n break;\n case Right:\n sx = -title.bounds.width() - padding;\n break;\n }\n tempBounds.clear().union(subtitle.bounds);\n tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0));\n if (set(subtitle, 'x', sx) | set(subtitle, 'y', sy)) {\n view.dirty(subtitle);\n subtitle.bounds.clear().union(tempBounds);\n subtitle.mark.bounds.clear().union(tempBounds);\n view.dirty(subtitle);\n }\n tempBounds.clear().union(subtitle.bounds);\n } else {\n tempBounds.clear();\n }\n tempBounds.union(title.bounds);\n\n // position title group\n switch (orient) {\n case Top:\n x = pos;\n y = viewBounds.y1 - tempBounds.height() - offset;\n break;\n case Left:\n x = viewBounds.x1 - tempBounds.width() - offset;\n y = pos;\n break;\n case Right:\n x = viewBounds.x2 + tempBounds.width() + offset;\n y = pos;\n break;\n case Bottom:\n x = pos;\n y = viewBounds.y2 + offset;\n break;\n default:\n x = group.x;\n y = group.y;\n }\n if (set(group, 'x', x) | set(group, 'y', y)) {\n tempBounds.translate(x, y);\n view.dirty(group);\n group.bounds.clear().union(tempBounds);\n mark.bounds.clear().union(tempBounds);\n view.dirty(group);\n }\n return group.bounds;\n}\n\n/**\n * Layout view elements such as axes and legends.\n * Also performs size adjustments.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {object} params.mark - Scenegraph mark of groups to layout.\n */\nfunction ViewLayout(params) {\n Transform.call(this, null, params);\n}\ninherits(ViewLayout, Transform, {\n transform(_, pulse) {\n const view = pulse.dataflow;\n _.mark.items.forEach(group => {\n if (_.layout) trellisLayout(view, group, _.layout);\n layoutGroup(view, group, _);\n });\n return shouldReflow(_.mark.group) ? pulse.reflow() : pulse;\n }\n});\nfunction shouldReflow(group) {\n // We typically should reflow if layout is invoked (#2568), as child items\n // may have resized and reflow ensures group bounds are re-calculated.\n // However, legend entries have a special exception to avoid instability.\n // For example, if a selected legend symbol gains a stroke on hover,\n // we don't want to re-position subsequent elements in the legend.\n return group && group.mark.role !== 'legend-entry';\n}\nfunction layoutGroup(view, group, _) {\n var items = group.items,\n width = Math.max(0, group.width || 0),\n height = Math.max(0, group.height || 0),\n viewBounds = new Bounds().set(0, 0, width, height),\n xBounds = viewBounds.clone(),\n yBounds = viewBounds.clone(),\n legends = [],\n title,\n mark,\n orient,\n b,\n i,\n n;\n\n // layout axes, gather legends, collect bounds\n for (i = 0, n = items.length; i < n; ++i) {\n mark = items[i];\n switch (mark.role) {\n case AxisRole:\n b = isYAxis(mark) ? xBounds : yBounds;\n b.union(axisLayout(view, mark, width, height));\n break;\n case TitleRole:\n title = mark;\n break;\n case LegendRole:\n legends.push(legendLayout(view, mark));\n break;\n case FrameRole:\n case ScopeRole:\n case RowHeader:\n case RowFooter:\n case RowTitle:\n case ColHeader:\n case ColFooter:\n case ColTitle:\n xBounds.union(mark.bounds);\n yBounds.union(mark.bounds);\n break;\n default:\n viewBounds.union(mark.bounds);\n }\n }\n\n // layout legends, adjust viewBounds\n if (legends.length) {\n // group legends by orient\n const l = {};\n legends.forEach(item => {\n orient = item.orient || Right;\n if (orient !== None) (l[orient] || (l[orient] = [])).push(item);\n });\n\n // perform grid layout for each orient group\n for (const orient in l) {\n const g = l[orient];\n gridLayout(view, g, legendParams(g, orient, _.legends, xBounds, yBounds, width, height));\n }\n\n // update view bounds\n legends.forEach(item => {\n const b = item.bounds;\n if (!b.equals(item._bounds)) {\n item.bounds = item._bounds;\n view.dirty(item); // dirty previous location\n item.bounds = b;\n view.dirty(item);\n }\n if (_.autosize && (_.autosize.type === Fit || _.autosize.type === FitX || _.autosize.type === FitY)) {\n // For autosize fit, incorporate the orthogonal dimension only.\n // Legends that overrun the chart area will then be clipped;\n // otherwise the chart area gets reduced to nothing!\n switch (item.orient) {\n case Left:\n case Right:\n viewBounds.add(b.x1, 0).add(b.x2, 0);\n break;\n case Top:\n case Bottom:\n viewBounds.add(0, b.y1).add(0, b.y2);\n }\n } else {\n viewBounds.union(b);\n }\n });\n }\n\n // combine bounding boxes\n viewBounds.union(xBounds).union(yBounds);\n\n // layout title, adjust bounds\n if (title) {\n viewBounds.union(titleLayout(view, title, width, height, viewBounds));\n }\n\n // override aggregated view bounds if content is clipped\n if (group.clip) {\n viewBounds.set(0, 0, group.width || 0, group.height || 0);\n }\n\n // perform size adjustment\n viewSizeLayout(view, group, viewBounds, _);\n}\nfunction viewSizeLayout(view, group, viewBounds, _) {\n const auto = _.autosize || {},\n type = auto.type;\n if (view._autosize < 1 || !type) return;\n let viewWidth = view._width,\n viewHeight = view._height,\n width = Math.max(0, group.width || 0),\n left = Math.max(0, Math.ceil(-viewBounds.x1)),\n height = Math.max(0, group.height || 0),\n top = Math.max(0, Math.ceil(-viewBounds.y1));\n const right = Math.max(0, Math.ceil(viewBounds.x2 - width)),\n bottom = Math.max(0, Math.ceil(viewBounds.y2 - height));\n if (auto.contains === Padding) {\n const padding = view.padding();\n viewWidth -= padding.left + padding.right;\n viewHeight -= padding.top + padding.bottom;\n }\n if (type === None) {\n left = 0;\n top = 0;\n width = viewWidth;\n height = viewHeight;\n } else if (type === Fit) {\n width = Math.max(0, viewWidth - left - right);\n height = Math.max(0, viewHeight - top - bottom);\n } else if (type === FitX) {\n width = Math.max(0, viewWidth - left - right);\n viewHeight = height + top + bottom;\n } else if (type === FitY) {\n viewWidth = width + left + right;\n height = Math.max(0, viewHeight - top - bottom);\n } else if (type === Pad) {\n viewWidth = width + left + right;\n viewHeight = height + top + bottom;\n }\n view._resizeView(viewWidth, viewHeight, width, height, [left, top], auto.resize);\n}\n\nexport { Bound as bound, Identifier as identifier, Mark as mark, Overlap as overlap, Render as render, ViewLayout as viewlayout };\n","export default function sum(values, valueof) {\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value = +value) {\n sum += value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if (value = +valueof(value, ++index, values)) {\n sum += value;\n }\n }\n }\n return sum;\n}\n","import { Transform, ingest, tupleid, stableCompare } from 'vega-dataflow';\nimport { tickCount, tickFormat, validTicks, tickValues, SymbolLegend, labelFormat, labelValues, GradientLegend, scaleFraction, labelFraction, scale, Sequential, Linear, isContinuous, Time, UTC, Ordinal, scaleImplicit, Log, Sqrt, Pow, Symlog, isLogarithmic, BinOrdinal, isInterpolating, interpolateColors, interpolate, Band, Point, bandSpace, scheme, Threshold, Quantile, Quantize, quantizeInterpolator, interpolateRange, Diverging } from 'vega-scale';\nimport { inherits, isArray, error, fastmap, falsy, isFunction, constant, peek, one, toSet, isString, zoomLog, zoomPow, zoomSymlog, zoomLinear, stringValue } from 'vega-util';\nimport { sum, range } from 'd3-array';\nimport { interpolateRound, interpolate as interpolate$1 } from 'd3-interpolate';\n\n/**\n * Generates axis ticks for visualizing a spatial scale.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Scale} params.scale - The scale to generate ticks for.\n * @param {*} [params.count=10] - The approximate number of ticks, or\n * desired tick interval, to use.\n * @param {Array<*>} [params.values] - The exact tick values to use.\n * These must be legal domain values for the provided scale.\n * If provided, the count argument is ignored.\n * @param {function(*):string} [params.formatSpecifier] - A format specifier\n * to use in conjunction with scale.tickFormat. Legal values are\n * any valid d3 4.0 format specifier.\n * @param {function(*):string} [params.format] - The format function to use.\n * If provided, the formatSpecifier argument is ignored.\n */\nfunction AxisTicks(params) {\n Transform.call(this, null, params);\n}\ninherits(AxisTicks, Transform, {\n transform(_, pulse) {\n if (this.value && !_.modified()) {\n return pulse.StopPropagation;\n }\n var locale = pulse.dataflow.locale(),\n out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n ticks = this.value,\n scale = _.scale,\n tally = _.count == null ? _.values ? _.values.length : 10 : _.count,\n count = tickCount(scale, tally, _.minstep),\n format = _.format || tickFormat(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values),\n values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count);\n if (ticks) out.rem = ticks;\n ticks = values.map((value, i) => ingest({\n index: i / (values.length - 1 || 1),\n value: value,\n label: format(value)\n }));\n if (_.extra && ticks.length) {\n // add an extra tick pegged to the initial domain value\n // this is used to generate axes with 'binned' domains\n ticks.push(ingest({\n index: -1,\n extra: {\n value: ticks[0].value\n },\n label: ''\n }));\n }\n out.source = ticks;\n out.add = ticks;\n this.value = ticks;\n return out;\n }\n});\n\n/**\n * Joins a set of data elements against a set of visual items.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): object} [params.item] - An item generator function.\n * @param {function(object): *} [params.key] - The key field associating data and visual items.\n */\nfunction DataJoin(params) {\n Transform.call(this, null, params);\n}\nfunction defaultItemCreate() {\n return ingest({});\n}\nfunction newMap(key) {\n const map = fastmap().test(t => t.exit);\n map.lookup = t => map.get(key(t));\n return map;\n}\ninherits(DataJoin, Transform, {\n transform(_, pulse) {\n var df = pulse.dataflow,\n out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n item = _.item || defaultItemCreate,\n key = _.key || tupleid,\n map = this.value;\n\n // prevent transient (e.g., hover) requests from\n // cascading across marks derived from marks\n if (isArray(out.encode)) {\n out.encode = null;\n }\n if (map && (_.modified('key') || pulse.modified(key))) {\n error('DataJoin does not support modified key function or fields.');\n }\n if (!map) {\n pulse = pulse.addAll();\n this.value = map = newMap(key);\n }\n pulse.visit(pulse.ADD, t => {\n const k = key(t);\n let x = map.get(k);\n if (x) {\n if (x.exit) {\n map.empty--;\n out.add.push(x);\n } else {\n out.mod.push(x);\n }\n } else {\n x = item(t);\n map.set(k, x);\n out.add.push(x);\n }\n x.datum = t;\n x.exit = false;\n });\n pulse.visit(pulse.MOD, t => {\n const k = key(t),\n x = map.get(k);\n if (x) {\n x.datum = t;\n out.mod.push(x);\n }\n });\n pulse.visit(pulse.REM, t => {\n const k = key(t),\n x = map.get(k);\n if (t === x.datum && !x.exit) {\n out.rem.push(x);\n x.exit = true;\n ++map.empty;\n }\n });\n if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum');\n if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) {\n df.runAfter(map.clean);\n }\n return out;\n }\n});\n\n/**\n * Invokes encoding functions for visual items.\n * @constructor\n * @param {object} params - The parameters to the encoding functions. This\n * parameter object will be passed through to all invoked encoding functions.\n * @param {object} [params.mod=false] - Flag indicating if tuples in the input\n * mod set that are unmodified by encoders should be included in the output.\n * @param {object} param.encoders - The encoding functions\n * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set\n * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set\n * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set\n */\nfunction Encode(params) {\n Transform.call(this, null, params);\n}\ninherits(Encode, Transform, {\n transform(_, pulse) {\n var out = pulse.fork(pulse.ADD_REM),\n fmod = _.mod || false,\n encoders = _.encoders,\n encode = pulse.encode;\n\n // if an array, the encode directive includes additional sets\n // that must be defined in order for the primary set to be invoked\n // e.g., only run the update set if the hover set is defined\n if (isArray(encode)) {\n if (out.changed() || encode.every(e => encoders[e])) {\n encode = encode[0];\n out.encode = null; // consume targeted encode directive\n } else {\n return pulse.StopPropagation;\n }\n }\n\n // marshall encoder functions\n var reenter = encode === 'enter',\n update = encoders.update || falsy,\n enter = encoders.enter || falsy,\n exit = encoders.exit || falsy,\n set = (encode && !reenter ? encoders[encode] : update) || falsy;\n if (pulse.changed(pulse.ADD)) {\n pulse.visit(pulse.ADD, t => {\n enter(t, _);\n update(t, _);\n });\n out.modifies(enter.output);\n out.modifies(update.output);\n if (set !== falsy && set !== update) {\n pulse.visit(pulse.ADD, t => {\n set(t, _);\n });\n out.modifies(set.output);\n }\n }\n if (pulse.changed(pulse.REM) && exit !== falsy) {\n pulse.visit(pulse.REM, t => {\n exit(t, _);\n });\n out.modifies(exit.output);\n }\n if (reenter || set !== falsy) {\n const flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0);\n if (reenter) {\n pulse.visit(flag, t => {\n const mod = enter(t, _) || fmod;\n if (set(t, _) || mod) out.mod.push(t);\n });\n if (out.mod.length) out.modifies(enter.output);\n } else {\n pulse.visit(flag, t => {\n if (set(t, _) || fmod) out.mod.push(t);\n });\n }\n if (out.mod.length) out.modifies(set.output);\n }\n return out.changed() ? out : pulse.StopPropagation;\n }\n});\n\n/**\n * Generates legend entries for visualizing a scale.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Scale} params.scale - The scale to generate items for.\n * @param {*} [params.count=5] - The approximate number of items, or\n * desired tick interval, to use.\n * @param {*} [params.limit] - The maximum number of entries to\n * include in a symbol legend.\n * @param {Array<*>} [params.values] - The exact tick values to use.\n * These must be legal domain values for the provided scale.\n * If provided, the count argument is ignored.\n * @param {string} [params.formatSpecifier] - A format specifier\n * to use in conjunction with scale.tickFormat. Legal values are\n * any valid D3 format specifier string.\n * @param {function(*):string} [params.format] - The format function to use.\n * If provided, the formatSpecifier argument is ignored.\n */\nfunction LegendEntries(params) {\n Transform.call(this, [], params);\n}\ninherits(LegendEntries, Transform, {\n transform(_, pulse) {\n if (this.value != null && !_.modified()) {\n return pulse.StopPropagation;\n }\n var locale = pulse.dataflow.locale(),\n out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n items = this.value,\n type = _.type || SymbolLegend,\n scale = _.scale,\n limit = +_.limit,\n count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep),\n lskip = !!_.values || type === SymbolLegend,\n format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip),\n values = _.values || labelValues(scale, count),\n domain,\n fraction,\n size,\n offset,\n ellipsis;\n if (items) out.rem = items;\n if (type === SymbolLegend) {\n if (limit && values.length > limit) {\n pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.');\n items = values.slice(0, limit - 1);\n ellipsis = true;\n } else {\n items = values;\n }\n if (isFunction(size = _.size)) {\n // if first value maps to size zero, remove from list (vega#717)\n if (!_.values && scale(items[0]) === 0) {\n items = items.slice(1);\n }\n // compute size offset for legend entries\n offset = items.reduce((max, value) => Math.max(max, size(value, _)), 0);\n } else {\n size = constant(offset = size || 8);\n }\n items = items.map((value, index) => ingest({\n index: index,\n label: format(value, index, items),\n value: value,\n offset: offset,\n size: size(value, _)\n }));\n if (ellipsis) {\n ellipsis = values[items.length];\n items.push(ingest({\n index: items.length,\n label: `\\u2026${values.length - items.length} entries`,\n value: ellipsis,\n offset: offset,\n size: size(ellipsis, _)\n }));\n }\n } else if (type === GradientLegend) {\n domain = scale.domain(), fraction = scaleFraction(scale, domain[0], peek(domain));\n\n // if automatic label generation produces 2 or fewer values,\n // use the domain end points instead (fixes vega/vega#1364)\n if (values.length < 3 && !_.values && domain[0] !== peek(domain)) {\n values = [domain[0], peek(domain)];\n }\n items = values.map((value, index) => ingest({\n index: index,\n label: format(value, index, values),\n value: value,\n perc: fraction(value)\n }));\n } else {\n size = values.length - 1;\n fraction = labelFraction(scale);\n items = values.map((value, index) => ingest({\n index: index,\n label: format(value, index, values),\n value: value,\n perc: index ? fraction(value) : 0,\n perc2: index === size ? 1 : fraction(values[index + 1])\n }));\n }\n out.source = items;\n out.add = items;\n this.value = items;\n return out;\n }\n});\n\nconst sourceX = t => t.source.x;\nconst sourceY = t => t.source.y;\nconst targetX = t => t.target.x;\nconst targetY = t => t.target.y;\n\n/**\n * Layout paths linking source and target elements.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction LinkPath(params) {\n Transform.call(this, {}, params);\n}\nLinkPath.Definition = {\n 'type': 'LinkPath',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'sourceX',\n 'type': 'field',\n 'default': 'source.x'\n }, {\n 'name': 'sourceY',\n 'type': 'field',\n 'default': 'source.y'\n }, {\n 'name': 'targetX',\n 'type': 'field',\n 'default': 'target.x'\n }, {\n 'name': 'targetY',\n 'type': 'field',\n 'default': 'target.y'\n }, {\n 'name': 'orient',\n 'type': 'enum',\n 'default': 'vertical',\n 'values': ['horizontal', 'vertical', 'radial']\n }, {\n 'name': 'shape',\n 'type': 'enum',\n 'default': 'line',\n 'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal']\n }, {\n 'name': 'require',\n 'type': 'signal'\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'path'\n }]\n};\ninherits(LinkPath, Transform, {\n transform(_, pulse) {\n var sx = _.sourceX || sourceX,\n sy = _.sourceY || sourceY,\n tx = _.targetX || targetX,\n ty = _.targetY || targetY,\n as = _.as || 'path',\n orient = _.orient || 'vertical',\n shape = _.shape || 'line',\n path = Paths.get(shape + '-' + orient) || Paths.get(shape);\n if (!path) {\n error('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : ''));\n }\n pulse.visit(pulse.SOURCE, t => {\n t[as] = path(sx(t), sy(t), tx(t), ty(t));\n });\n return pulse.reflow(_.modified()).modifies(as);\n }\n});\nconst line = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'L' + tx + ',' + ty;\nconst lineR = (sa, sr, ta, tr) => line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));\nconst arc = (sx, sy, tx, ty) => {\n var dx = tx - sx,\n dy = ty - sy,\n rr = Math.hypot(dx, dy) / 2,\n ra = 180 * Math.atan2(dy, dx) / Math.PI;\n return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty;\n};\nconst arcR = (sa, sr, ta, tr) => arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));\nconst curve = (sx, sy, tx, ty) => {\n const dx = tx - sx,\n dy = ty - sy,\n ix = 0.2 * (dx + dy),\n iy = 0.2 * (dy - dx);\n return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty;\n};\nconst curveR = (sa, sr, ta, tr) => curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));\nconst orthoX = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'V' + ty + 'H' + tx;\nconst orthoY = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'H' + tx + 'V' + ty;\nconst orthoR = (sa, sr, ta, tr) => {\n const sc = Math.cos(sa),\n ss = Math.sin(sa),\n tc = Math.cos(ta),\n ts = Math.sin(ta),\n sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa;\n return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts;\n};\nconst diagonalX = (sx, sy, tx, ty) => {\n const m = (sx + tx) / 2;\n return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty;\n};\nconst diagonalY = (sx, sy, tx, ty) => {\n const m = (sy + ty) / 2;\n return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty;\n};\nconst diagonalR = (sa, sr, ta, tr) => {\n const sc = Math.cos(sa),\n ss = Math.sin(sa),\n tc = Math.cos(ta),\n ts = Math.sin(ta),\n mr = (sr + tr) / 2;\n return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts;\n};\nconst Paths = fastmap({\n 'line': line,\n 'line-radial': lineR,\n 'arc': arc,\n 'arc-radial': arcR,\n 'curve': curve,\n 'curve-radial': curveR,\n 'orthogonal-horizontal': orthoX,\n 'orthogonal-vertical': orthoY,\n 'orthogonal-radial': orthoR,\n 'diagonal-horizontal': diagonalX,\n 'diagonal-vertical': diagonalY,\n 'diagonal-radial': diagonalR\n});\n\n/**\n * Pie and donut chart layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to size pie segments.\n * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout.\n * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout.\n * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value.\n */\nfunction Pie(params) {\n Transform.call(this, null, params);\n}\nPie.Definition = {\n 'type': 'Pie',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'startAngle',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'endAngle',\n 'type': 'number',\n 'default': 6.283185307179586\n }, {\n 'name': 'sort',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['startAngle', 'endAngle']\n }]\n};\ninherits(Pie, Transform, {\n transform(_, pulse) {\n var as = _.as || ['startAngle', 'endAngle'],\n startAngle = as[0],\n endAngle = as[1],\n field = _.field || one,\n start = _.startAngle || 0,\n stop = _.endAngle != null ? _.endAngle : 2 * Math.PI,\n data = pulse.source,\n values = data.map(field),\n n = values.length,\n a = start,\n k = (stop - start) / sum(values),\n index = range(n),\n i,\n t,\n v;\n if (_.sort) {\n index.sort((a, b) => values[a] - values[b]);\n }\n for (i = 0; i < n; ++i) {\n v = values[index[i]];\n t = data[index[i]];\n t[startAngle] = a;\n t[endAngle] = a += v * k;\n }\n this.value = values;\n return pulse.reflow(_.modified()).modifies(as);\n }\n});\n\nconst DEFAULT_COUNT = 5;\nfunction includeZero(scale) {\n const type = scale.type;\n return !scale.bins && (type === Linear || type === Pow || type === Sqrt);\n}\nfunction includePad(type) {\n return isContinuous(type) && type !== Sequential;\n}\nconst SKIP = toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']);\n\n/**\n * Maintains a scale function mapping data values to visual channels.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction Scale(params) {\n Transform.call(this, null, params);\n this.modified(true); // always treat as modified\n}\n\ninherits(Scale, Transform, {\n transform(_, pulse) {\n var df = pulse.dataflow,\n scale$1 = this.value,\n key = scaleKey(_);\n if (!scale$1 || key !== scale$1.type) {\n this.value = scale$1 = scale(key)();\n }\n for (key in _) if (!SKIP[key]) {\n // padding is a scale property for band/point but not others\n if (key === 'padding' && includePad(scale$1.type)) continue;\n // invoke scale property setter, raise warning if not found\n isFunction(scale$1[key]) ? scale$1[key](_[key]) : df.warn('Unsupported scale property: ' + key);\n }\n configureRange(scale$1, _, configureBins(scale$1, _, configureDomain(scale$1, _, df)));\n return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n }\n});\nfunction scaleKey(_) {\n var t = _.type,\n d = '',\n n;\n\n // backwards compatibility pre Vega 5.\n if (t === Sequential) return Sequential + '-' + Linear;\n if (isContinuousColor(_)) {\n n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0;\n d = n === 2 ? Sequential + '-' : n === 3 ? Diverging + '-' : '';\n }\n return (d + t || Linear).toLowerCase();\n}\nfunction isContinuousColor(_) {\n const t = _.type;\n return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(isString));\n}\nfunction configureDomain(scale, _, df) {\n // check raw domain, if provided use that and exit early\n const raw = rawDomain(scale, _.domainRaw, df);\n if (raw > -1) return raw;\n var domain = _.domain,\n type = scale.type,\n zero = _.zero || _.zero === undefined && includeZero(scale),\n n,\n mid;\n if (!domain) return 0;\n\n // adjust continuous domain for minimum pixel padding\n if (includePad(type) && _.padding && domain[0] !== peek(domain)) {\n domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant);\n }\n\n // adjust domain based on zero, min, max settings\n if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) {\n n = (domain = domain.slice()).length - 1 || 1;\n if (zero) {\n if (domain[0] > 0) domain[0] = 0;\n if (domain[n] < 0) domain[n] = 0;\n }\n if (_.domainMin != null) domain[0] = _.domainMin;\n if (_.domainMax != null) domain[n] = _.domainMax;\n if (_.domainMid != null) {\n mid = _.domainMid;\n const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n;\n if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid);\n domain.splice(i, 0, mid);\n }\n }\n\n // set the scale domain\n scale.domain(domainCheck(type, domain, df));\n\n // if ordinal scale domain is defined, prevent implicit\n // domain construction as side-effect of scale lookup\n if (type === Ordinal) {\n scale.unknown(_.domainImplicit ? scaleImplicit : undefined);\n }\n\n // perform 'nice' adjustment as requested\n if (_.nice && scale.nice) {\n scale.nice(_.nice !== true && tickCount(scale, _.nice) || null);\n }\n\n // return the cardinality of the domain\n return domain.length;\n}\nfunction rawDomain(scale, raw, df) {\n if (raw) {\n scale.domain(domainCheck(scale.type, raw, df));\n return raw.length;\n } else {\n return -1;\n }\n}\nfunction padDomain(type, domain, range, pad, exponent, constant) {\n var span = Math.abs(peek(range) - range[0]),\n frac = span / (span - 2 * pad),\n d = type === Log ? zoomLog(domain, null, frac) : type === Sqrt ? zoomPow(domain, null, frac, 0.5) : type === Pow ? zoomPow(domain, null, frac, exponent || 1) : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) : zoomLinear(domain, null, frac);\n domain = domain.slice();\n domain[0] = d[0];\n domain[domain.length - 1] = d[1];\n return domain;\n}\nfunction domainCheck(type, domain, df) {\n if (isLogarithmic(type)) {\n // sum signs of domain values\n // if all pos or all neg, abs(sum) === domain.length\n var s = Math.abs(domain.reduce((s, v) => s + (v < 0 ? -1 : v > 0 ? 1 : 0), 0));\n if (s !== domain.length) {\n df.warn('Log scale domain includes zero: ' + stringValue(domain));\n }\n }\n return domain;\n}\nfunction configureBins(scale, _, count) {\n let bins = _.bins;\n if (bins && !isArray(bins)) {\n // generate bin boundary array\n const domain = scale.domain(),\n lo = domain[0],\n hi = peek(domain),\n step = bins.step;\n let start = bins.start == null ? lo : bins.start,\n stop = bins.stop == null ? hi : bins.stop;\n if (!step) error('Scale bins parameter missing step property.');\n if (start < lo) start = step * Math.ceil(lo / step);\n if (stop > hi) stop = step * Math.floor(hi / step);\n bins = range(start, stop + step / 2, step);\n }\n if (bins) {\n // assign bin boundaries to scale instance\n scale.bins = bins;\n } else if (scale.bins) {\n // no current bins, remove bins if previously set\n delete scale.bins;\n }\n\n // special handling for bin-ordinal scales\n if (scale.type === BinOrdinal) {\n if (!bins) {\n // the domain specifies the bins\n scale.bins = scale.domain();\n } else if (!_.domain && !_.domainRaw) {\n // the bins specify the domain\n scale.domain(bins);\n count = bins.length;\n }\n }\n\n // return domain cardinality\n return count;\n}\nfunction configureRange(scale, _, count) {\n var type = scale.type,\n round = _.round || false,\n range = _.range;\n\n // if range step specified, calculate full range extent\n if (_.rangeStep != null) {\n range = configureRangeStep(type, _, count);\n }\n\n // else if a range scheme is defined, use that\n else if (_.scheme) {\n range = configureScheme(type, _, count);\n if (isFunction(range)) {\n if (scale.interpolator) {\n return scale.interpolator(range);\n } else {\n error(`Scale type ${type} does not support interpolating color schemes.`);\n }\n }\n }\n\n // given a range array for an interpolating scale, convert to interpolator\n if (range && isInterpolating(type)) {\n return scale.interpolator(interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma));\n }\n\n // configure rounding / interpolation\n if (range && _.interpolate && scale.interpolate) {\n scale.interpolate(interpolate(_.interpolate, _.interpolateGamma));\n } else if (isFunction(scale.round)) {\n scale.round(round);\n } else if (isFunction(scale.rangeRound)) {\n scale.interpolate(round ? interpolateRound : interpolate$1);\n }\n if (range) scale.range(flip(range, _.reverse));\n}\nfunction configureRangeStep(type, _, count) {\n if (type !== Band && type !== Point) {\n error('Only band and point scales support rangeStep.');\n }\n\n // calculate full range based on requested step size and padding\n var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0,\n inner = type === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0;\n return [0, _.rangeStep * bandSpace(count, inner, outer)];\n}\nfunction configureScheme(type, _, count) {\n var extent = _.schemeExtent,\n name,\n scheme$1;\n if (isArray(_.scheme)) {\n scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma);\n } else {\n name = _.scheme.toLowerCase();\n scheme$1 = scheme(name);\n if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`);\n }\n\n // determine size for potential discrete range\n count = type === Threshold ? count + 1 : type === BinOrdinal ? count - 1 : type === Quantile || type === Quantize ? +_.schemeCount || DEFAULT_COUNT : count;\n\n // adjust and/or quantize scheme as appropriate\n return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) : type === Ordinal ? scheme$1 : scheme$1.slice(0, count);\n}\nfunction adjustScheme(scheme, extent, reverse) {\n return isFunction(scheme) && (extent || reverse) ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) : scheme;\n}\nfunction flip(array, reverse) {\n return reverse ? array.slice().reverse() : array;\n}\n\n/**\n * Sorts scenegraph items in the pulse source array.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(*,*): number} [params.sort] - A comparator\n * function for sorting tuples.\n */\nfunction SortItems(params) {\n Transform.call(this, null, params);\n}\ninherits(SortItems, Transform, {\n transform(_, pulse) {\n const mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum');\n if (mod) pulse.source.sort(stableCompare(_.sort));\n this.modified(mod);\n return pulse;\n }\n});\n\nconst Zero = 'zero',\n Center = 'center',\n Normalize = 'normalize',\n DefOutput = ['y0', 'y1'];\n\n/**\n * Stack layout for visualization elements.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to stack.\n * @param {Array} [params.groupby] - An array of accessors to groupby.\n * @param {function(object,object): number} [params.sort] - A comparator for stack sorting.\n * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'.\n */\nfunction Stack(params) {\n Transform.call(this, null, params);\n}\nStack.Definition = {\n 'type': 'Stack',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'offset',\n 'type': 'enum',\n 'default': Zero,\n 'values': [Zero, Center, Normalize]\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': DefOutput\n }]\n};\ninherits(Stack, Transform, {\n transform(_, pulse) {\n var as = _.as || DefOutput,\n y0 = as[0],\n y1 = as[1],\n sort = stableCompare(_.sort),\n field = _.field || one,\n stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero,\n groups,\n i,\n n,\n max;\n\n // partition, sum, and sort the stack groups\n groups = partition(pulse.source, _.groupby, sort, field);\n\n // compute stack layouts per group\n for (i = 0, n = groups.length, max = groups.max; i < n; ++i) {\n stack(groups[i], max, field, y0, y1);\n }\n return pulse.reflow(_.modified()).modifies(as);\n }\n});\nfunction stackCenter(group, max, field, y0, y1) {\n var last = (max - group.sum) / 2,\n m = group.length,\n j = 0,\n t;\n for (; j < m; ++j) {\n t = group[j];\n t[y0] = last;\n t[y1] = last += Math.abs(field(t));\n }\n}\nfunction stackNormalize(group, max, field, y0, y1) {\n var scale = 1 / group.sum,\n last = 0,\n m = group.length,\n j = 0,\n v = 0,\n t;\n for (; j < m; ++j) {\n t = group[j];\n t[y0] = last;\n t[y1] = last = scale * (v += Math.abs(field(t)));\n }\n}\nfunction stackZero(group, max, field, y0, y1) {\n var lastPos = 0,\n lastNeg = 0,\n m = group.length,\n j = 0,\n v,\n t;\n for (; j < m; ++j) {\n t = group[j];\n v = +field(t);\n if (v < 0) {\n t[y0] = lastNeg;\n t[y1] = lastNeg += v;\n } else {\n t[y0] = lastPos;\n t[y1] = lastPos += v;\n }\n }\n}\nfunction partition(data, groupby, sort, field) {\n var groups = [],\n get = f => f(t),\n map,\n i,\n n,\n m,\n t,\n k,\n g,\n s,\n max;\n\n // partition data points into stack groups\n if (groupby == null) {\n groups.push(data.slice());\n } else {\n for (map = {}, i = 0, n = data.length; i < n; ++i) {\n t = data[i];\n k = groupby.map(get);\n g = map[k];\n if (!g) {\n map[k] = g = [];\n groups.push(g);\n }\n g.push(t);\n }\n }\n\n // compute sums of groups, sort groups as needed\n for (k = 0, max = 0, m = groups.length; k < m; ++k) {\n g = groups[k];\n for (i = 0, s = 0, n = g.length; i < n; ++i) {\n s += Math.abs(field(g[i]));\n }\n g.sum = s;\n if (s > max) max = s;\n if (sort) g.sort(sort);\n }\n groups.max = max;\n return groups;\n}\n\nexport { AxisTicks as axisticks, DataJoin as datajoin, Encode as encode, LegendEntries as legendentries, LinkPath as linkpath, Pie as pie, Scale as scale, SortItems as sortitems, Stack as stack };\n","export default x => x;\n","function streamGeometry(geometry, stream) {\n if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {\n streamGeometryType[geometry.type](geometry, stream);\n }\n}\n\nvar streamObjectType = {\n Feature: function(object, stream) {\n streamGeometry(object.geometry, stream);\n },\n FeatureCollection: function(object, stream) {\n var features = object.features, i = -1, n = features.length;\n while (++i < n) streamGeometry(features[i].geometry, stream);\n }\n};\n\nvar streamGeometryType = {\n Sphere: function(object, stream) {\n stream.sphere();\n },\n Point: function(object, stream) {\n object = object.coordinates;\n stream.point(object[0], object[1], object[2]);\n },\n MultiPoint: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);\n },\n LineString: function(object, stream) {\n streamLine(object.coordinates, stream, 0);\n },\n MultiLineString: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamLine(coordinates[i], stream, 0);\n },\n Polygon: function(object, stream) {\n streamPolygon(object.coordinates, stream);\n },\n MultiPolygon: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamPolygon(coordinates[i], stream);\n },\n GeometryCollection: function(object, stream) {\n var geometries = object.geometries, i = -1, n = geometries.length;\n while (++i < n) streamGeometry(geometries[i], stream);\n }\n};\n\nfunction streamLine(coordinates, stream, closed) {\n var i = -1, n = coordinates.length - closed, coordinate;\n stream.lineStart();\n while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);\n stream.lineEnd();\n}\n\nfunction streamPolygon(coordinates, stream) {\n var i = -1, n = coordinates.length;\n stream.polygonStart();\n while (++i < n) streamLine(coordinates[i], stream, 1);\n stream.polygonEnd();\n}\n\nexport default function(object, stream) {\n if (object && streamObjectType.hasOwnProperty(object.type)) {\n streamObjectType[object.type](object, stream);\n } else {\n streamGeometry(object, stream);\n }\n}\n","// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423\nexport class Adder {\n constructor() {\n this._partials = new Float64Array(32);\n this._n = 0;\n }\n add(x) {\n const p = this._partials;\n let i = 0;\n for (let j = 0; j < this._n && j < 32; j++) {\n const y = p[j],\n hi = x + y,\n lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);\n if (lo) p[i++] = lo;\n x = hi;\n }\n p[i] = x;\n this._n = i + 1;\n return this;\n }\n valueOf() {\n const p = this._partials;\n let n = this._n, x, y, lo, hi = 0;\n if (n > 0) {\n hi = p[--n];\n while (n > 0) {\n x = hi;\n y = p[--n];\n hi = x + y;\n lo = y - (hi - x);\n if (lo) break;\n }\n if (n > 0 && ((lo < 0 && p[n - 1] < 0) || (lo > 0 && p[n - 1] > 0))) {\n y = lo * 2;\n x = hi + y;\n if (y == x - hi) hi = x;\n }\n }\n return hi;\n }\n}\n\nexport function fsum(values, valueof) {\n const adder = new Adder();\n if (valueof === undefined) {\n for (let value of values) {\n if (value = +value) {\n adder.add(value);\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if (value = +valueof(value, ++index, values)) {\n adder.add(value);\n }\n }\n }\n return +adder;\n}\n\nexport function fcumsum(values, valueof) {\n const adder = new Adder();\n let index = -1;\n return Float64Array.from(values, valueof === undefined\n ? v => adder.add(+v || 0)\n : v => adder.add(+valueof(v, ++index, values) || 0)\n );\n}\n","export var epsilon = 1e-6;\nexport var epsilon2 = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var quarterPi = pi / 4;\nexport var tau = pi * 2;\n\nexport var degrees = 180 / pi;\nexport var radians = pi / 180;\n\nexport var abs = Math.abs;\nexport var atan = Math.atan;\nexport var atan2 = Math.atan2;\nexport var cos = Math.cos;\nexport var ceil = Math.ceil;\nexport var exp = Math.exp;\nexport var floor = Math.floor;\nexport var hypot = Math.hypot;\nexport var log = Math.log;\nexport var pow = Math.pow;\nexport var sin = Math.sin;\nexport var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };\nexport var sqrt = Math.sqrt;\nexport var tan = Math.tan;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n}\n\nexport function haversin(x) {\n return (x = sin(x / 2)) * x;\n}\n","export default function noop() {}\n","import {Adder} from \"d3-array\";\nimport {abs} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar areaSum = new Adder(),\n areaRingSum = new Adder(),\n x00,\n y00,\n x0,\n y0;\n\nvar areaStream = {\n point: noop,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: function() {\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function() {\n areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop;\n areaSum.add(abs(areaRingSum));\n areaRingSum = new Adder();\n },\n result: function() {\n var area = areaSum / 2;\n areaSum = new Adder();\n return area;\n }\n};\n\nfunction areaRingStart() {\n areaStream.point = areaPointFirst;\n}\n\nfunction areaPointFirst(x, y) {\n areaStream.point = areaPoint;\n x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction areaPoint(x, y) {\n areaRingSum.add(y0 * x - x0 * y);\n x0 = x, y0 = y;\n}\n\nfunction areaRingEnd() {\n areaPoint(x00, y00);\n}\n\nexport default areaStream;\n","import noop from \"../noop.js\";\n\nvar x0 = Infinity,\n y0 = x0,\n x1 = -x0,\n y1 = x1;\n\nvar boundsStream = {\n point: boundsPoint,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: noop,\n polygonEnd: noop,\n result: function() {\n var bounds = [[x0, y0], [x1, y1]];\n x1 = y1 = -(y0 = x0 = Infinity);\n return bounds;\n }\n};\n\nfunction boundsPoint(x, y) {\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n}\n\nexport default boundsStream;\n","import {sqrt} from \"../math.js\";\n\n// TODO Enforce positive area for exterior, negative area for interior?\n\nvar X0 = 0,\n Y0 = 0,\n Z0 = 0,\n X1 = 0,\n Y1 = 0,\n Z1 = 0,\n X2 = 0,\n Y2 = 0,\n Z2 = 0,\n x00,\n y00,\n x0,\n y0;\n\nvar centroidStream = {\n point: centroidPoint,\n lineStart: centroidLineStart,\n lineEnd: centroidLineEnd,\n polygonStart: function() {\n centroidStream.lineStart = centroidRingStart;\n centroidStream.lineEnd = centroidRingEnd;\n },\n polygonEnd: function() {\n centroidStream.point = centroidPoint;\n centroidStream.lineStart = centroidLineStart;\n centroidStream.lineEnd = centroidLineEnd;\n },\n result: function() {\n var centroid = Z2 ? [X2 / Z2, Y2 / Z2]\n : Z1 ? [X1 / Z1, Y1 / Z1]\n : Z0 ? [X0 / Z0, Y0 / Z0]\n : [NaN, NaN];\n X0 = Y0 = Z0 =\n X1 = Y1 = Z1 =\n X2 = Y2 = Z2 = 0;\n return centroid;\n }\n};\n\nfunction centroidPoint(x, y) {\n X0 += x;\n Y0 += y;\n ++Z0;\n}\n\nfunction centroidLineStart() {\n centroidStream.point = centroidPointFirstLine;\n}\n\nfunction centroidPointFirstLine(x, y) {\n centroidStream.point = centroidPointLine;\n centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidPointLine(x, y) {\n var dx = x - x0, dy = y - y0, z = sqrt(dx * dx + dy * dy);\n X1 += z * (x0 + x) / 2;\n Y1 += z * (y0 + y) / 2;\n Z1 += z;\n centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidLineEnd() {\n centroidStream.point = centroidPoint;\n}\n\nfunction centroidRingStart() {\n centroidStream.point = centroidPointFirstRing;\n}\n\nfunction centroidRingEnd() {\n centroidPointRing(x00, y00);\n}\n\nfunction centroidPointFirstRing(x, y) {\n centroidStream.point = centroidPointRing;\n centroidPoint(x00 = x0 = x, y00 = y0 = y);\n}\n\nfunction centroidPointRing(x, y) {\n var dx = x - x0,\n dy = y - y0,\n z = sqrt(dx * dx + dy * dy);\n\n X1 += z * (x0 + x) / 2;\n Y1 += z * (y0 + y) / 2;\n Z1 += z;\n\n z = y0 * x - x0 * y;\n X2 += z * (x0 + x);\n Y2 += z * (y0 + y);\n Z2 += z * 3;\n centroidPoint(x0 = x, y0 = y);\n}\n\nexport default centroidStream;\n","import {tau} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nexport default function PathContext(context) {\n this._context = context;\n}\n\nPathContext.prototype = {\n _radius: 4.5,\n pointRadius: function(_) {\n return this._radius = _, this;\n },\n polygonStart: function() {\n this._line = 0;\n },\n polygonEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line === 0) this._context.closePath();\n this._point = NaN;\n },\n point: function(x, y) {\n switch (this._point) {\n case 0: {\n this._context.moveTo(x, y);\n this._point = 1;\n break;\n }\n case 1: {\n this._context.lineTo(x, y);\n break;\n }\n default: {\n this._context.moveTo(x + this._radius, y);\n this._context.arc(x, y, this._radius, 0, tau);\n break;\n }\n }\n },\n result: noop\n};\n","import {Adder} from \"d3-array\";\nimport {sqrt} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar lengthSum = new Adder(),\n lengthRing,\n x00,\n y00,\n x0,\n y0;\n\nvar lengthStream = {\n point: noop,\n lineStart: function() {\n lengthStream.point = lengthPointFirst;\n },\n lineEnd: function() {\n if (lengthRing) lengthPoint(x00, y00);\n lengthStream.point = noop;\n },\n polygonStart: function() {\n lengthRing = true;\n },\n polygonEnd: function() {\n lengthRing = null;\n },\n result: function() {\n var length = +lengthSum;\n lengthSum = new Adder();\n return length;\n }\n};\n\nfunction lengthPointFirst(x, y) {\n lengthStream.point = lengthPoint;\n x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction lengthPoint(x, y) {\n x0 -= x, y0 -= y;\n lengthSum.add(sqrt(x0 * x0 + y0 * y0));\n x0 = x, y0 = y;\n}\n\nexport default lengthStream;\n","// Simple caching for constant-radius points.\nlet cacheDigits, cacheAppend, cacheRadius, cacheCircle;\n\nexport default class PathString {\n constructor(digits) {\n this._append = digits == null ? append : appendRound(digits);\n this._radius = 4.5;\n this._ = \"\";\n }\n pointRadius(_) {\n this._radius = +_;\n return this;\n }\n polygonStart() {\n this._line = 0;\n }\n polygonEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {\n if (this._line === 0) this._ += \"Z\";\n this._point = NaN;\n }\n point(x, y) {\n switch (this._point) {\n case 0: {\n this._append`M${x},${y}`;\n this._point = 1;\n break;\n }\n case 1: {\n this._append`L${x},${y}`;\n break;\n }\n default: {\n this._append`M${x},${y}`;\n if (this._radius !== cacheRadius || this._append !== cacheAppend) {\n const r = this._radius;\n const s = this._;\n this._ = \"\"; // stash the old string so we can cache the circle path fragment\n this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;\n cacheRadius = r;\n cacheAppend = this._append;\n cacheCircle = this._;\n this._ = s;\n }\n this._ += cacheCircle;\n break;\n }\n }\n }\n result() {\n const result = this._;\n this._ = \"\";\n return result.length ? result : null;\n }\n}\n\nfunction append(strings) {\n let i = 1;\n this._ += strings[0];\n for (const j = strings.length; i < j; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n const d = Math.floor(digits);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`);\n if (d > 15) return append;\n if (d !== cacheDigits) {\n const k = 10 ** d;\n cacheDigits = d;\n cacheAppend = function append(strings) {\n let i = 1;\n this._ += strings[0];\n for (const j = strings.length; i < j; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n }\n return cacheAppend;\n}\n","import identity from \"../identity.js\";\nimport stream from \"../stream.js\";\nimport pathArea from \"./area.js\";\nimport pathBounds from \"./bounds.js\";\nimport pathCentroid from \"./centroid.js\";\nimport PathContext from \"./context.js\";\nimport pathMeasure from \"./measure.js\";\nimport PathString from \"./string.js\";\n\nexport default function(projection, context) {\n let digits = 3,\n pointRadius = 4.5,\n projectionStream,\n contextStream;\n\n function path(object) {\n if (object) {\n if (typeof pointRadius === \"function\") contextStream.pointRadius(+pointRadius.apply(this, arguments));\n stream(object, projectionStream(contextStream));\n }\n return contextStream.result();\n }\n\n path.area = function(object) {\n stream(object, projectionStream(pathArea));\n return pathArea.result();\n };\n\n path.measure = function(object) {\n stream(object, projectionStream(pathMeasure));\n return pathMeasure.result();\n };\n\n path.bounds = function(object) {\n stream(object, projectionStream(pathBounds));\n return pathBounds.result();\n };\n\n path.centroid = function(object) {\n stream(object, projectionStream(pathCentroid));\n return pathCentroid.result();\n };\n\n path.projection = function(_) {\n if (!arguments.length) return projection;\n projectionStream = _ == null ? (projection = null, identity) : (projection = _).stream;\n return path;\n };\n\n path.context = function(_) {\n if (!arguments.length) return context;\n contextStream = _ == null ? (context = null, new PathString(digits)) : new PathContext(context = _);\n if (typeof pointRadius !== \"function\") contextStream.pointRadius(pointRadius);\n return path;\n };\n\n path.pointRadius = function(_) {\n if (!arguments.length) return pointRadius;\n pointRadius = typeof _ === \"function\" ? _ : (contextStream.pointRadius(+_), +_);\n return path;\n };\n\n path.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) digits = null;\n else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n if (context === null) contextStream = new PathString(digits);\n return path;\n };\n\n return path.projection(projection).digits(digits).context(context);\n}\n","import noop from \"../noop.js\";\n\nexport default function() {\n var lines = [],\n line;\n return {\n point: function(x, y, m) {\n line.push([x, y, m]);\n },\n lineStart: function() {\n lines.push(line = []);\n },\n lineEnd: noop,\n rejoin: function() {\n if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));\n },\n result: function() {\n var result = lines;\n lines = [];\n line = null;\n return result;\n }\n };\n}\n","import {abs, epsilon} from \"./math.js\";\n\nexport default function(a, b) {\n return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;\n}\n","import pointEqual from \"../pointEqual.js\";\nimport {epsilon} from \"../math.js\";\n\nfunction Intersection(point, points, other, entry) {\n this.x = point;\n this.z = points;\n this.o = other; // another intersection\n this.e = entry; // is an entry?\n this.v = false; // visited\n this.n = this.p = null; // next & previous\n}\n\n// A generalized polygon clipping algorithm: given a polygon that has been cut\n// into its visible line segments, and rejoins the segments by interpolating\n// along the clip edge.\nexport default function(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}\n\nfunction link(array) {\n if (!(n = array.length)) return;\n var n,\n i = 0,\n a = array[0],\n b;\n while (++i < n) {\n a.n = b = array[i];\n b.p = a;\n a = b;\n }\n a.n = b = array[0];\n b.p = a;\n}\n","import {asin, atan2, cos, sin, sqrt} from \"./math.js\";\n\nexport function spherical(cartesian) {\n return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];\n}\n\nexport function cartesian(spherical) {\n var lambda = spherical[0], phi = spherical[1], cosPhi = cos(phi);\n return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];\n}\n\nexport function cartesianDot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\nexport function cartesianCross(a, b) {\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\n}\n\n// TODO return a\nexport function cartesianAddInPlace(a, b) {\n a[0] += b[0], a[1] += b[1], a[2] += b[2];\n}\n\nexport function cartesianScale(vector, k) {\n return [vector[0] * k, vector[1] * k, vector[2] * k];\n}\n\n// TODO return d\nexport function cartesianNormalizeInPlace(d) {\n var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);\n d[0] /= l, d[1] /= l, d[2] /= l;\n}\n","import {Adder} from \"d3-array\";\nimport {cartesian, cartesianCross, cartesianNormalizeInPlace} from \"./cartesian.js\";\nimport {abs, asin, atan2, cos, epsilon, epsilon2, halfPi, pi, quarterPi, sign, sin, tau} from \"./math.js\";\n\nfunction longitude(point) {\n return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);\n}\n\nexport default function(polygon, point) {\n var lambda = longitude(point),\n phi = point[1],\n sinPhi = sin(phi),\n normal = [sin(lambda), -cos(lambda), 0],\n angle = 0,\n winding = 0;\n\n var sum = new Adder();\n\n if (sinPhi === 1) phi = halfPi + epsilon;\n else if (sinPhi === -1) phi = -halfPi - epsilon;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n if (!(m = (ring = polygon[i]).length)) continue;\n var ring,\n m,\n point0 = ring[m - 1],\n lambda0 = longitude(point0),\n phi0 = point0[1] / 2 + quarterPi,\n sinPhi0 = sin(phi0),\n cosPhi0 = cos(phi0);\n\n for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {\n var point1 = ring[j],\n lambda1 = longitude(point1),\n phi1 = point1[1] / 2 + quarterPi,\n sinPhi1 = sin(phi1),\n cosPhi1 = cos(phi1),\n delta = lambda1 - lambda0,\n sign = delta >= 0 ? 1 : -1,\n absDelta = sign * delta,\n antimeridian = absDelta > pi,\n k = sinPhi0 * sinPhi1;\n\n sum.add(atan2(k * sign * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta)));\n angle += antimeridian ? delta + sign * tau : delta;\n\n // Are the longitudes either side of the point’s meridian (lambda),\n // and are the latitudes smaller than the parallel (phi)?\n if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {\n var arc = cartesianCross(cartesian(point0), cartesian(point1));\n cartesianNormalizeInPlace(arc);\n var intersection = cartesianCross(normal, arc);\n cartesianNormalizeInPlace(intersection);\n var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);\n if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {\n winding += antimeridian ^ delta >= 0 ? 1 : -1;\n }\n }\n }\n }\n\n // First, determine whether the South pole is inside or outside:\n //\n // It is inside if:\n // * the polygon winds around it in a clockwise direction.\n // * the polygon does not (cumulatively) wind around it, but has a negative\n // (counter-clockwise) area.\n //\n // Second, count the (signed) number of times a segment crosses a lambda\n // from the point to the South pole. If it is zero, then the point is the\n // same side as the South pole.\n\n return (angle < -epsilon || angle < epsilon && sum < -epsilon2) ^ (winding & 1);\n}\n","function* flatten(arrays) {\n for (const array of arrays) {\n yield* array;\n }\n}\n\nexport default function merge(arrays) {\n return Array.from(flatten(arrays));\n}\n","import clipBuffer from \"./buffer.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport {epsilon, halfPi} from \"../math.js\";\nimport polygonContains from \"../polygonContains.js\";\nimport {merge} from \"d3-array\";\n\nexport default function(pointVisible, clipLine, interpolate, start) {\n return function(sink) {\n var line = clipLine(sink),\n ringBuffer = clipBuffer(),\n ringSink = clipLine(ringBuffer),\n polygonStarted = false,\n polygon,\n segments,\n ring;\n\n var clip = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() {\n clip.point = pointRing;\n clip.lineStart = ringStart;\n clip.lineEnd = ringEnd;\n segments = [];\n polygon = [];\n },\n polygonEnd: function() {\n clip.point = point;\n clip.lineStart = lineStart;\n clip.lineEnd = lineEnd;\n segments = merge(segments);\n var startInside = polygonContains(polygon, start);\n if (segments.length) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n clipRejoin(segments, compareIntersection, startInside, interpolate, sink);\n } else if (startInside) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n }\n if (polygonStarted) sink.polygonEnd(), polygonStarted = false;\n segments = polygon = null;\n },\n sphere: function() {\n sink.polygonStart();\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n sink.polygonEnd();\n }\n };\n\n function point(lambda, phi) {\n if (pointVisible(lambda, phi)) sink.point(lambda, phi);\n }\n\n function pointLine(lambda, phi) {\n line.point(lambda, phi);\n }\n\n function lineStart() {\n clip.point = pointLine;\n line.lineStart();\n }\n\n function lineEnd() {\n clip.point = point;\n line.lineEnd();\n }\n\n function pointRing(lambda, phi) {\n ring.push([lambda, phi]);\n ringSink.point(lambda, phi);\n }\n\n function ringStart() {\n ringSink.lineStart();\n ring = [];\n }\n\n function ringEnd() {\n pointRing(ring[0][0], ring[0][1]);\n ringSink.lineEnd();\n\n var clean = ringSink.clean(),\n ringSegments = ringBuffer.result(),\n i, n = ringSegments.length, m,\n segment,\n point;\n\n ring.pop();\n polygon.push(ring);\n ring = null;\n\n if (!n) return;\n\n // No intersections.\n if (clean & 1) {\n segment = ringSegments[0];\n if ((m = segment.length - 1) > 0) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);\n sink.lineEnd();\n }\n return;\n }\n\n // Rejoin connected segments.\n // TODO reuse ringBuffer.rejoin()?\n if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));\n\n segments.push(ringSegments.filter(validSegment));\n }\n\n return clip;\n };\n}\n\nfunction validSegment(segment) {\n return segment.length > 1;\n}\n\n// Intersections are sorted along the clip edge. For both antimeridian cutting\n// and circle clipping, the same comparison is used.\nfunction compareIntersection(a, b) {\n return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1])\n - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]);\n}\n","import clip from \"./index.js\";\nimport {abs, atan, cos, epsilon, halfPi, pi, sin} from \"../math.js\";\n\nexport default clip(\n function() { return true; },\n clipAntimeridianLine,\n clipAntimeridianInterpolate,\n [-pi, -halfPi]\n);\n\n// Takes a line and cuts into visible segments. Return values: 0 - there were\n// intersections or the line was empty; 1 - no intersections; 2 - there were\n// intersections, and the first and last segments should be rejoined.\nfunction clipAntimeridianLine(stream) {\n var lambda0 = NaN,\n phi0 = NaN,\n sign0 = NaN,\n clean; // no intersections\n\n return {\n lineStart: function() {\n stream.lineStart();\n clean = 1;\n },\n point: function(lambda1, phi1) {\n var sign1 = lambda1 > 0 ? pi : -pi,\n delta = abs(lambda1 - lambda0);\n if (abs(delta - pi) < epsilon) { // line crosses a pole\n stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n stream.point(lambda1, phi0);\n clean = 0;\n } else if (sign0 !== sign1 && delta >= pi) { // line crosses antimeridian\n if (abs(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon; // handle degeneracies\n if (abs(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon;\n phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n clean = 0;\n }\n stream.point(lambda0 = lambda1, phi0 = phi1);\n sign0 = sign1;\n },\n lineEnd: function() {\n stream.lineEnd();\n lambda0 = phi0 = NaN;\n },\n clean: function() {\n return 2 - clean; // if intersections, rejoin first and last segments\n }\n };\n}\n\nfunction clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {\n var cosPhi0,\n cosPhi1,\n sinLambda0Lambda1 = sin(lambda0 - lambda1);\n return abs(sinLambda0Lambda1) > epsilon\n ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1)\n - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0))\n / (cosPhi0 * cosPhi1 * sinLambda0Lambda1))\n : (phi0 + phi1) / 2;\n}\n\nfunction clipAntimeridianInterpolate(from, to, direction, stream) {\n var phi;\n if (from == null) {\n phi = direction * halfPi;\n stream.point(-pi, phi);\n stream.point(0, phi);\n stream.point(pi, phi);\n stream.point(pi, 0);\n stream.point(pi, -phi);\n stream.point(0, -phi);\n stream.point(-pi, -phi);\n stream.point(-pi, 0);\n stream.point(-pi, phi);\n } else if (abs(from[0] - to[0]) > epsilon) {\n var lambda = from[0] < to[0] ? pi : -pi;\n phi = direction * lambda / 2;\n stream.point(-lambda, phi);\n stream.point(0, phi);\n stream.point(lambda, phi);\n } else {\n stream.point(to[0], to[1]);\n }\n}\n","import {cartesian, cartesianNormalizeInPlace, spherical} from \"./cartesian.js\";\nimport constant from \"./constant.js\";\nimport {acos, cos, degrees, epsilon, radians, sin, tau} from \"./math.js\";\nimport {rotateRadians} from \"./rotation.js\";\n\n// Generates a circle centered at [0°, 0°], with a given radius and precision.\nexport function circleStream(stream, radius, delta, direction, t0, t1) {\n if (!delta) return;\n var cosRadius = cos(radius),\n sinRadius = sin(radius),\n step = direction * delta;\n if (t0 == null) {\n t0 = radius + direction * tau;\n t1 = radius - step / 2;\n } else {\n t0 = circleRadius(cosRadius, t0);\n t1 = circleRadius(cosRadius, t1);\n if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau;\n }\n for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {\n point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);\n stream.point(point[0], point[1]);\n }\n}\n\n// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].\nfunction circleRadius(cosRadius, point) {\n point = cartesian(point), point[0] -= cosRadius;\n cartesianNormalizeInPlace(point);\n var radius = acos(-point[1]);\n return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;\n}\n\nexport default function() {\n var center = constant([0, 0]),\n radius = constant(90),\n precision = constant(6),\n ring,\n rotate,\n stream = {point: point};\n\n function point(x, y) {\n ring.push(x = rotate(x, y));\n x[0] *= degrees, x[1] *= degrees;\n }\n\n function circle() {\n var c = center.apply(this, arguments),\n r = radius.apply(this, arguments) * radians,\n p = precision.apply(this, arguments) * radians;\n ring = [];\n rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert;\n circleStream(stream, r, p, 1);\n c = {type: \"Polygon\", coordinates: [ring]};\n ring = rotate = null;\n return c;\n }\n\n circle.center = function(_) {\n return arguments.length ? (center = typeof _ === \"function\" ? _ : constant([+_[0], +_[1]]), circle) : center;\n };\n\n circle.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant(+_), circle) : radius;\n };\n\n circle.precision = function(_) {\n return arguments.length ? (precision = typeof _ === \"function\" ? _ : constant(+_), circle) : precision;\n };\n\n return circle;\n}\n","import {abs, epsilon} from \"../math.js\";\nimport clipBuffer from \"./buffer.js\";\nimport clipLine from \"./line.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport {merge} from \"d3-array\";\n\nvar clipMax = 1e9, clipMin = -clipMax;\n\n// TODO Use d3-polygon’s polygonContains here for the ring check?\n// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?\n\nexport default function clipRectangle(x0, y0, x1, y1) {\n\n function visible(x, y) {\n return x0 <= x && x <= x1 && y0 <= y && y <= y1;\n }\n\n function interpolate(from, to, direction, stream) {\n var a = 0, a1 = 0;\n if (from == null\n || (a = corner(from, direction)) !== (a1 = corner(to, direction))\n || comparePoint(from, to) < 0 ^ direction > 0) {\n do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);\n while ((a = (a + direction + 4) % 4) !== a1);\n } else {\n stream.point(to[0], to[1]);\n }\n }\n\n function corner(p, direction) {\n return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3\n : abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1\n : abs(p[1] - y0) < epsilon ? direction > 0 ? 1 : 0\n : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon\n }\n\n function compareIntersection(a, b) {\n return comparePoint(a.x, b.x);\n }\n\n function comparePoint(a, b) {\n var ca = corner(a, 1),\n cb = corner(b, 1);\n return ca !== cb ? ca - cb\n : ca === 0 ? b[1] - a[1]\n : ca === 1 ? a[0] - b[0]\n : ca === 2 ? a[1] - b[1]\n : b[0] - a[0];\n }\n\n return function(stream) {\n var activeStream = stream,\n bufferStream = clipBuffer(),\n segments,\n polygon,\n ring,\n x__, y__, v__, // first point\n x_, y_, v_, // previous point\n first,\n clean;\n\n var clipStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: polygonStart,\n polygonEnd: polygonEnd\n };\n\n function point(x, y) {\n if (visible(x, y)) activeStream.point(x, y);\n }\n\n function polygonInside() {\n var winding = 0;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {\n a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];\n if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; }\n else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; }\n }\n }\n\n return winding;\n }\n\n // Buffer geometry within a polygon and then clip it en masse.\n function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }\n\n function polygonEnd() {\n var startInside = polygonInside(),\n cleanInside = clean && startInside,\n visible = (segments = merge(segments)).length;\n if (cleanInside || visible) {\n stream.polygonStart();\n if (cleanInside) {\n stream.lineStart();\n interpolate(null, null, 1, stream);\n stream.lineEnd();\n }\n if (visible) {\n clipRejoin(segments, compareIntersection, startInside, interpolate, stream);\n }\n stream.polygonEnd();\n }\n activeStream = stream, segments = polygon = ring = null;\n }\n\n function lineStart() {\n clipStream.point = linePoint;\n if (polygon) polygon.push(ring = []);\n first = true;\n v_ = false;\n x_ = y_ = NaN;\n }\n\n // TODO rather than special-case polygons, simply handle them separately.\n // Ideally, coincident intersection points should be jittered to avoid\n // clipping issues.\n function lineEnd() {\n if (segments) {\n linePoint(x__, y__);\n if (v__ && v_) bufferStream.rejoin();\n segments.push(bufferStream.result());\n }\n clipStream.point = point;\n if (v_) activeStream.lineEnd();\n }\n\n function linePoint(x, y) {\n var v = visible(x, y);\n if (polygon) ring.push([x, y]);\n if (first) {\n x__ = x, y__ = y, v__ = v;\n first = false;\n if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n }\n } else {\n if (v && v_) activeStream.point(x, y);\n else {\n var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],\n b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];\n if (clipLine(a, b, x0, y0, x1, y1)) {\n if (!v_) {\n activeStream.lineStart();\n activeStream.point(a[0], a[1]);\n }\n activeStream.point(b[0], b[1]);\n if (!v) activeStream.lineEnd();\n clean = false;\n } else if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n clean = false;\n }\n }\n }\n x_ = x, y_ = y, v_ = v;\n }\n\n return clipStream;\n };\n}\n","export default function(a, b, x0, y0, x1, y1) {\n var ax = a[0],\n ay = a[1],\n bx = b[0],\n by = b[1],\n t0 = 0,\n t1 = 1,\n dx = bx - ax,\n dy = by - ay,\n r;\n\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dx > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dx > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dy > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dy > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;\n if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;\n return true;\n}\n","export default function(a, b) {\n\n function compose(x, y) {\n return x = a(x, y), b(x[0], x[1]);\n }\n\n if (a.invert && b.invert) compose.invert = function(x, y) {\n return x = b.invert(x, y), x && a.invert(x[0], x[1]);\n };\n\n return compose;\n}\n","import compose from \"./compose.js\";\nimport {abs, asin, atan2, cos, degrees, pi, radians, sin, tau} from \"./math.js\";\n\nfunction rotationIdentity(lambda, phi) {\n if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;\n return [lambda, phi];\n}\n\nrotationIdentity.invert = rotationIdentity;\n\nexport function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {\n return (deltaLambda %= tau) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma))\n : rotationLambda(deltaLambda))\n : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma)\n : rotationIdentity);\n}\n\nfunction forwardRotationLambda(deltaLambda) {\n return function(lambda, phi) {\n lambda += deltaLambda;\n if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;\n return [lambda, phi];\n };\n}\n\nfunction rotationLambda(deltaLambda) {\n var rotation = forwardRotationLambda(deltaLambda);\n rotation.invert = forwardRotationLambda(-deltaLambda);\n return rotation;\n}\n\nfunction rotationPhiGamma(deltaPhi, deltaGamma) {\n var cosDeltaPhi = cos(deltaPhi),\n sinDeltaPhi = sin(deltaPhi),\n cosDeltaGamma = cos(deltaGamma),\n sinDeltaGamma = sin(deltaGamma);\n\n function rotation(lambda, phi) {\n var cosPhi = cos(phi),\n x = cos(lambda) * cosPhi,\n y = sin(lambda) * cosPhi,\n z = sin(phi),\n k = z * cosDeltaPhi + x * sinDeltaPhi;\n return [\n atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),\n asin(k * cosDeltaGamma + y * sinDeltaGamma)\n ];\n }\n\n rotation.invert = function(lambda, phi) {\n var cosPhi = cos(phi),\n x = cos(lambda) * cosPhi,\n y = sin(lambda) * cosPhi,\n z = sin(phi),\n k = z * cosDeltaGamma - y * sinDeltaGamma;\n return [\n atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),\n asin(k * cosDeltaPhi - x * sinDeltaPhi)\n ];\n };\n\n return rotation;\n}\n\nexport default function(rotate) {\n rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);\n\n function forward(coordinates) {\n coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;\n }\n\n forward.invert = function(coordinates) {\n coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;\n };\n\n return forward;\n}\n","export default function(methods) {\n return {\n stream: transformer(methods)\n };\n}\n\nexport function transformer(methods) {\n return function(stream) {\n var s = new TransformStream;\n for (var key in methods) s[key] = methods[key];\n s.stream = stream;\n return s;\n };\n}\n\nfunction TransformStream() {}\n\nTransformStream.prototype = {\n constructor: TransformStream,\n point: function(x, y) { this.stream.point(x, y); },\n sphere: function() { this.stream.sphere(); },\n lineStart: function() { this.stream.lineStart(); },\n lineEnd: function() { this.stream.lineEnd(); },\n polygonStart: function() { this.stream.polygonStart(); },\n polygonEnd: function() { this.stream.polygonEnd(); }\n};\n","import {default as geoStream} from \"../stream.js\";\nimport boundsStream from \"../path/bounds.js\";\n\nfunction fit(projection, fitBounds, object) {\n var clip = projection.clipExtent && projection.clipExtent();\n projection.scale(150).translate([0, 0]);\n if (clip != null) projection.clipExtent(null);\n geoStream(object, projection.stream(boundsStream));\n fitBounds(boundsStream.result());\n if (clip != null) projection.clipExtent(clip);\n return projection;\n}\n\nexport function fitExtent(projection, extent, object) {\n return fit(projection, function(b) {\n var w = extent[1][0] - extent[0][0],\n h = extent[1][1] - extent[0][1],\n k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),\n x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,\n y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n\nexport function fitSize(projection, size, object) {\n return fitExtent(projection, [[0, 0], size], object);\n}\n\nexport function fitWidth(projection, width, object) {\n return fit(projection, function(b) {\n var w = +width,\n k = w / (b[1][0] - b[0][0]),\n x = (w - k * (b[1][0] + b[0][0])) / 2,\n y = -k * b[0][1];\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n\nexport function fitHeight(projection, height, object) {\n return fit(projection, function(b) {\n var h = +height,\n k = h / (b[1][1] - b[0][1]),\n x = -k * b[0][0],\n y = (h - k * (b[1][1] + b[0][1])) / 2;\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n","import {cartesian} from \"../cartesian.js\";\nimport {abs, asin, atan2, cos, epsilon, radians, sqrt} from \"../math.js\";\nimport {transformer} from \"../transform.js\";\n\nvar maxDepth = 16, // maximum depth of subdivision\n cosMinDistance = cos(30 * radians); // cos(minimum angular distance)\n\nexport default function(project, delta2) {\n return +delta2 ? resample(project, delta2) : resampleNone(project);\n}\n\nfunction resampleNone(project) {\n return transformer({\n point: function(x, y) {\n x = project(x, y);\n this.stream.point(x[0], x[1]);\n }\n });\n}\n\nfunction resample(project, delta2) {\n\n function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {\n var dx = x1 - x0,\n dy = y1 - y0,\n d2 = dx * dx + dy * dy;\n if (d2 > 4 * delta2 && depth--) {\n var a = a0 + a1,\n b = b0 + b1,\n c = c0 + c1,\n m = sqrt(a * a + b * b + c * c),\n phi2 = asin(c /= m),\n lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a),\n p = project(lambda2, phi2),\n x2 = p[0],\n y2 = p[1],\n dx2 = x2 - x0,\n dy2 = y2 - y0,\n dz = dy * dx2 - dx * dy2;\n if (dz * dz / d2 > delta2 // perpendicular projected distance\n || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end\n || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);\n stream.point(x2, y2);\n resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream);\n }\n }\n }\n return function(stream) {\n var lambda00, x00, y00, a00, b00, c00, // first point\n lambda0, x0, y0, a0, b0, c0; // previous point\n\n var resampleStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; },\n polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; }\n };\n\n function point(x, y) {\n x = project(x, y);\n stream.point(x[0], x[1]);\n }\n\n function lineStart() {\n x0 = NaN;\n resampleStream.point = linePoint;\n stream.lineStart();\n }\n\n function linePoint(lambda, phi) {\n var c = cartesian([lambda, phi]), p = project(lambda, phi);\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);\n stream.point(x0, y0);\n }\n\n function lineEnd() {\n resampleStream.point = point;\n stream.lineEnd();\n }\n\n function ringStart() {\n lineStart();\n resampleStream.point = ringPoint;\n resampleStream.lineEnd = ringEnd;\n }\n\n function ringPoint(lambda, phi) {\n linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;\n resampleStream.point = linePoint;\n }\n\n function ringEnd() {\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream);\n resampleStream.lineEnd = lineEnd;\n lineEnd();\n }\n\n return resampleStream;\n };\n}\n","import clipAntimeridian from \"../clip/antimeridian.js\";\nimport clipCircle from \"../clip/circle.js\";\nimport clipRectangle from \"../clip/rectangle.js\";\nimport compose from \"../compose.js\";\nimport identity from \"../identity.js\";\nimport {cos, degrees, radians, sin, sqrt} from \"../math.js\";\nimport {rotateRadians} from \"../rotation.js\";\nimport {transformer} from \"../transform.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\nimport resample from \"./resample.js\";\n\nvar transformRadians = transformer({\n point: function(x, y) {\n this.stream.point(x * radians, y * radians);\n }\n});\n\nfunction transformRotate(rotate) {\n return transformer({\n point: function(x, y) {\n var r = rotate(x, y);\n return this.stream.point(r[0], r[1]);\n }\n });\n}\n\nfunction scaleTranslate(k, dx, dy, sx, sy) {\n function transform(x, y) {\n x *= sx; y *= sy;\n return [dx + k * x, dy - k * y];\n }\n transform.invert = function(x, y) {\n return [(x - dx) / k * sx, (dy - y) / k * sy];\n };\n return transform;\n}\n\nfunction scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {\n if (!alpha) return scaleTranslate(k, dx, dy, sx, sy);\n var cosAlpha = cos(alpha),\n sinAlpha = sin(alpha),\n a = cosAlpha * k,\n b = sinAlpha * k,\n ai = cosAlpha / k,\n bi = sinAlpha / k,\n ci = (sinAlpha * dy - cosAlpha * dx) / k,\n fi = (sinAlpha * dx + cosAlpha * dy) / k;\n function transform(x, y) {\n x *= sx; y *= sy;\n return [a * x - b * y + dx, dy - b * x - a * y];\n }\n transform.invert = function(x, y) {\n return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];\n };\n return transform;\n}\n\nexport default function projection(project) {\n return projectionMutator(function() { return project; })();\n}\n\nexport function projectionMutator(projectAt) {\n var project,\n k = 150, // scale\n x = 480, y = 250, // translate\n lambda = 0, phi = 0, // center\n deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, // pre-rotate\n alpha = 0, // post-rotate angle\n sx = 1, // reflectX\n sy = 1, // reflectX\n theta = null, preclip = clipAntimeridian, // pre-clip angle\n x0 = null, y0, x1, y1, postclip = identity, // post-clip extent\n delta2 = 0.5, // precision\n projectResample,\n projectTransform,\n projectRotateTransform,\n cache,\n cacheStream;\n\n function projection(point) {\n return projectRotateTransform(point[0] * radians, point[1] * radians);\n }\n\n function invert(point) {\n point = projectRotateTransform.invert(point[0], point[1]);\n return point && [point[0] * degrees, point[1] * degrees];\n }\n\n projection.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));\n };\n\n projection.preclip = function(_) {\n return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;\n };\n\n projection.postclip = function(_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n };\n\n projection.clipAngle = function(_) {\n return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees;\n };\n\n projection.clipExtent = function(_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n projection.scale = function(_) {\n return arguments.length ? (k = +_, recenter()) : k;\n };\n\n projection.translate = function(_) {\n return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];\n };\n\n projection.center = function(_) {\n return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];\n };\n\n projection.rotate = function(_) {\n return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];\n };\n\n projection.angle = function(_) {\n return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;\n };\n\n projection.reflectX = function(_) {\n return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;\n };\n\n projection.reflectY = function(_) {\n return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;\n };\n\n projection.precision = function(_) {\n return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);\n };\n\n projection.fitExtent = function(extent, object) {\n return fitExtent(projection, extent, object);\n };\n\n projection.fitSize = function(size, object) {\n return fitSize(projection, size, object);\n };\n\n projection.fitWidth = function(width, object) {\n return fitWidth(projection, width, object);\n };\n\n projection.fitHeight = function(height, object) {\n return fitHeight(projection, height, object);\n };\n\n function recenter() {\n var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)),\n transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha);\n rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);\n projectTransform = compose(project, transform);\n projectRotateTransform = compose(rotate, projectTransform);\n projectResample = resample(projectTransform, delta2);\n return reset();\n }\n\n function reset() {\n cache = cacheStream = null;\n return projection;\n }\n\n return function() {\n project = projectAt.apply(this, arguments);\n projection.invert = project.invert && invert;\n return recenter();\n };\n}\n","import {cartesian, cartesianAddInPlace, cartesianCross, cartesianDot, cartesianScale, spherical} from \"../cartesian.js\";\nimport {circleStream} from \"../circle.js\";\nimport {abs, cos, epsilon, pi, radians, sqrt} from \"../math.js\";\nimport pointEqual from \"../pointEqual.js\";\nimport clip from \"./index.js\";\n\nexport default function(radius) {\n var cr = cos(radius),\n delta = 6 * radians,\n smallRadius = cr > 0,\n notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case\n\n function interpolate(from, to, direction, stream) {\n circleStream(stream, radius, delta, direction, from, to);\n }\n\n function visible(lambda, phi) {\n return cos(lambda) * cos(phi) > cr;\n }\n\n // Takes a line and cuts into visible segments. Return values used for polygon\n // clipping: 0 - there were intersections or the line was empty; 1 - no\n // intersections 2 - there were intersections, and the first and last segments\n // should be rejoined.\n function clipLine(stream) {\n var point0, // previous point\n c0, // code for previous point\n v0, // visibility of previous point\n v00, // visibility of first point\n clean; // no intersections\n return {\n lineStart: function() {\n v00 = v0 = false;\n clean = 1;\n },\n point: function(lambda, phi) {\n var point1 = [lambda, phi],\n point2,\n v = visible(lambda, phi),\n c = smallRadius\n ? v ? 0 : code(lambda, phi)\n : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;\n if (!point0 && (v00 = v0 = v)) stream.lineStart();\n if (v !== v0) {\n point2 = intersect(point0, point1);\n if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2))\n point1[2] = 1;\n }\n if (v !== v0) {\n clean = 0;\n if (v) {\n // outside going in\n stream.lineStart();\n point2 = intersect(point1, point0);\n stream.point(point2[0], point2[1]);\n } else {\n // inside going out\n point2 = intersect(point0, point1);\n stream.point(point2[0], point2[1], 2);\n stream.lineEnd();\n }\n point0 = point2;\n } else if (notHemisphere && point0 && smallRadius ^ v) {\n var t;\n // If the codes for two points are different, or are both zero,\n // and there this segment intersects with the small circle.\n if (!(c & c0) && (t = intersect(point1, point0, true))) {\n clean = 0;\n if (smallRadius) {\n stream.lineStart();\n stream.point(t[0][0], t[0][1]);\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n } else {\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n stream.lineStart();\n stream.point(t[0][0], t[0][1], 3);\n }\n }\n }\n if (v && (!point0 || !pointEqual(point0, point1))) {\n stream.point(point1[0], point1[1]);\n }\n point0 = point1, v0 = v, c0 = c;\n },\n lineEnd: function() {\n if (v0) stream.lineEnd();\n point0 = null;\n },\n // Rejoin first and last segments if there were intersections and the first\n // and last points were visible.\n clean: function() {\n return clean | ((v00 && v0) << 1);\n }\n };\n }\n\n // Intersects the great circle between a and b with the clip circle.\n function intersect(a, b, two) {\n var pa = cartesian(a),\n pb = cartesian(b);\n\n // We have two planes, n1.p = d1 and n2.p = d2.\n // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).\n var n1 = [1, 0, 0], // normal\n n2 = cartesianCross(pa, pb),\n n2n2 = cartesianDot(n2, n2),\n n1n2 = n2[0], // cartesianDot(n1, n2),\n determinant = n2n2 - n1n2 * n1n2;\n\n // Two polar points.\n if (!determinant) return !two && a;\n\n var c1 = cr * n2n2 / determinant,\n c2 = -cr * n1n2 / determinant,\n n1xn2 = cartesianCross(n1, n2),\n A = cartesianScale(n1, c1),\n B = cartesianScale(n2, c2);\n cartesianAddInPlace(A, B);\n\n // Solve |p(t)|^2 = 1.\n var u = n1xn2,\n w = cartesianDot(A, u),\n uu = cartesianDot(u, u),\n t2 = w * w - uu * (cartesianDot(A, A) - 1);\n\n if (t2 < 0) return;\n\n var t = sqrt(t2),\n q = cartesianScale(u, (-w - t) / uu);\n cartesianAddInPlace(q, A);\n q = spherical(q);\n\n if (!two) return q;\n\n // Two intersection points.\n var lambda0 = a[0],\n lambda1 = b[0],\n phi0 = a[1],\n phi1 = b[1],\n z;\n\n if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;\n\n var delta = lambda1 - lambda0,\n polar = abs(delta - pi) < epsilon,\n meridian = polar || delta < epsilon;\n\n if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;\n\n // Check that the first point is between a and b.\n if (meridian\n ? polar\n ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1)\n : phi0 <= q[1] && q[1] <= phi1\n : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) {\n var q1 = cartesianScale(u, (-w + t) / uu);\n cartesianAddInPlace(q1, A);\n return [q, spherical(q1)];\n }\n }\n\n // Generates a 4-bit vector representing the location of a point relative to\n // the small circle's bounding box.\n function code(lambda, phi) {\n var r = smallRadius ? radius : pi - radius,\n code = 0;\n if (lambda < -r) code |= 1; // left\n else if (lambda > r) code |= 2; // right\n if (phi < -r) code |= 4; // below\n else if (phi > r) code |= 8; // above\n return code;\n }\n\n return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);\n}\n","import {degrees, pi, radians} from \"../math.js\";\nimport {projectionMutator} from \"./index.js\";\n\nexport function conicProjection(projectAt) {\n var phi0 = 0,\n phi1 = pi / 3,\n m = projectionMutator(projectAt),\n p = m(phi0, phi1);\n\n p.parallels = function(_) {\n return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees, phi1 * degrees];\n };\n\n return p;\n}\n","import {abs, asin, atan2, cos, epsilon, pi, sign, sin, sqrt} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {cylindricalEqualAreaRaw} from \"./cylindricalEqualArea.js\";\n\nexport function conicEqualAreaRaw(y0, y1) {\n var sy0 = sin(y0), n = (sy0 + sin(y1)) / 2;\n\n // Are the parallels symmetrical around the Equator?\n if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y0);\n\n var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n;\n\n function project(x, y) {\n var r = sqrt(c - 2 * n * sin(y)) / n;\n return [r * sin(x *= n), r0 - r * cos(x)];\n }\n\n project.invert = function(x, y) {\n var r0y = r0 - y,\n l = atan2(x, abs(r0y)) * sign(r0y);\n if (r0y * n < 0)\n l -= pi * sign(x) * sign(r0y);\n return [l / n, asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicEqualAreaRaw)\n .scale(155.424)\n .center([0, 33.6442]);\n}\n","import {asin, cos, sin} from \"../math.js\";\n\nexport function cylindricalEqualAreaRaw(phi0) {\n var cosPhi0 = cos(phi0);\n\n function forward(lambda, phi) {\n return [lambda * cosPhi0, sin(phi) / cosPhi0];\n }\n\n forward.invert = function(x, y) {\n return [x / cosPhi0, asin(y * cosPhi0)];\n };\n\n return forward;\n}\n","import conicEqualArea from \"./conicEqualArea.js\";\n\nexport default function() {\n return conicEqualArea()\n .parallels([29.5, 45.5])\n .scale(1070)\n .translate([480, 250])\n .rotate([96, 0])\n .center([-0.6, 38.7]);\n}\n","import {asin, atan2, cos, sin, sqrt} from \"../math.js\";\n\nexport function azimuthalRaw(scale) {\n return function(x, y) {\n var cx = cos(x),\n cy = cos(y),\n k = scale(cx * cy);\n if (k === Infinity) return [2, 0];\n return [\n k * cy * sin(x),\n k * sin(y)\n ];\n }\n}\n\nexport function azimuthalInvert(angle) {\n return function(x, y) {\n var z = sqrt(x * x + y * y),\n c = angle(z),\n sc = sin(c),\n cc = cos(c);\n return [\n atan2(x * sc, z * cc),\n asin(z && y * sc / z)\n ];\n }\n}\n","import {asin, sqrt} from \"../math.js\";\nimport {azimuthalRaw, azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {\n return sqrt(2 / (1 + cxcy));\n});\n\nazimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {\n return 2 * asin(z / 2);\n});\n\nexport default function() {\n return projection(azimuthalEqualAreaRaw)\n .scale(124.75)\n .clipAngle(180 - 1e-3);\n}\n","import {acos, sin} from \"../math.js\";\nimport {azimuthalRaw, azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport var azimuthalEquidistantRaw = azimuthalRaw(function(c) {\n return (c = acos(c)) && c / sin(c);\n});\n\nazimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {\n return z;\n});\n\nexport default function() {\n return projection(azimuthalEquidistantRaw)\n .scale(79.4188)\n .clipAngle(180 - 1e-3);\n}\n","import {atan, exp, halfPi, log, pi, tan, tau} from \"../math.js\";\nimport rotation from \"../rotation.js\";\nimport projection from \"./index.js\";\n\nexport function mercatorRaw(lambda, phi) {\n return [lambda, log(tan((halfPi + phi) / 2))];\n}\n\nmercatorRaw.invert = function(x, y) {\n return [x, 2 * atan(exp(y)) - halfPi];\n};\n\nexport default function() {\n return mercatorProjection(mercatorRaw)\n .scale(961 / tau);\n}\n\nexport function mercatorProjection(project) {\n var m = projection(project),\n center = m.center,\n scale = m.scale,\n translate = m.translate,\n clipExtent = m.clipExtent,\n x0 = null, y0, x1, y1; // clip extent\n\n m.scale = function(_) {\n return arguments.length ? (scale(_), reclip()) : scale();\n };\n\n m.translate = function(_) {\n return arguments.length ? (translate(_), reclip()) : translate();\n };\n\n m.center = function(_) {\n return arguments.length ? (center(_), reclip()) : center();\n };\n\n m.clipExtent = function(_) {\n return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n function reclip() {\n var k = pi * scale(),\n t = m(rotation(m.rotate()).invert([0, 0]));\n return clipExtent(x0 == null\n ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw\n ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]]\n : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]);\n }\n\n return reclip();\n}\n","import {abs, atan, atan2, cos, epsilon, halfPi, log, pi, pow, sign, sin, sqrt, tan} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {mercatorRaw} from \"./mercator.js\";\n\nfunction tany(y) {\n return tan((halfPi + y) / 2);\n}\n\nexport function conicConformalRaw(y0, y1) {\n var cy0 = cos(y0),\n n = y0 === y1 ? sin(y0) : log(cy0 / cos(y1)) / log(tany(y1) / tany(y0)),\n f = cy0 * pow(tany(y0), n) / n;\n\n if (!n) return mercatorRaw;\n\n function project(x, y) {\n if (f > 0) { if (y < -halfPi + epsilon) y = -halfPi + epsilon; }\n else { if (y > halfPi - epsilon) y = halfPi - epsilon; }\n var r = f / pow(tany(y), n);\n return [r * sin(n * x), f - r * cos(n * x)];\n }\n\n project.invert = function(x, y) {\n var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy),\n l = atan2(x, abs(fy)) * sign(fy);\n if (fy * n < 0)\n l -= pi * sign(x) * sign(fy);\n return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicConformalRaw)\n .scale(109.5)\n .parallels([30, 30]);\n}\n","import projection from \"./index.js\";\n\nexport function equirectangularRaw(lambda, phi) {\n return [lambda, phi];\n}\n\nequirectangularRaw.invert = equirectangularRaw;\n\nexport default function() {\n return projection(equirectangularRaw)\n .scale(152.63);\n}\n","import {abs, atan2, cos, epsilon, pi, sign, sin, sqrt} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {equirectangularRaw} from \"./equirectangular.js\";\n\nexport function conicEquidistantRaw(y0, y1) {\n var cy0 = cos(y0),\n n = y0 === y1 ? sin(y0) : (cy0 - cos(y1)) / (y1 - y0),\n g = cy0 / n + y0;\n\n if (abs(n) < epsilon) return equirectangularRaw;\n\n function project(x, y) {\n var gy = g - y, nx = n * x;\n return [gy * sin(nx), g - gy * cos(nx)];\n }\n\n project.invert = function(x, y) {\n var gy = g - y,\n l = atan2(x, abs(gy)) * sign(gy);\n if (gy * n < 0)\n l -= pi * sign(x) * sign(gy);\n return [l / n, g - sign(n) * sqrt(x * x + gy * gy)];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicEquidistantRaw)\n .scale(131.154)\n .center([0, 13.9389]);\n}\n","import projection from \"./index.js\";\nimport {abs, asin, cos, epsilon2, sin, sqrt} from \"../math.js\";\n\nvar A1 = 1.340264,\n A2 = -0.081106,\n A3 = 0.000893,\n A4 = 0.003796,\n M = sqrt(3) / 2,\n iterations = 12;\n\nexport function equalEarthRaw(lambda, phi) {\n var l = asin(M * sin(phi)), l2 = l * l, l6 = l2 * l2 * l2;\n return [\n lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))),\n l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2))\n ];\n}\n\nequalEarthRaw.invert = function(x, y) {\n var l = y, l2 = l * l, l6 = l2 * l2 * l2;\n for (var i = 0, delta, fy, fpy; i < iterations; ++i) {\n fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y;\n fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2);\n l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2;\n if (abs(delta) < epsilon2) break;\n }\n return [\n M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l),\n asin(sin(l) / M)\n ];\n};\n\nexport default function() {\n return projection(equalEarthRaw)\n .scale(177.158);\n}\n","import {atan, cos, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function gnomonicRaw(x, y) {\n var cy = cos(y), k = cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n}\n\ngnomonicRaw.invert = azimuthalInvert(atan);\n\nexport default function() {\n return projection(gnomonicRaw)\n .scale(144.049)\n .clipAngle(60);\n}\n","import projection from \"./index.js\";\nimport {abs, epsilon} from \"../math.js\";\n\nexport function naturalEarth1Raw(lambda, phi) {\n var phi2 = phi * phi, phi4 = phi2 * phi2;\n return [\n lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))),\n phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4)))\n ];\n}\n\nnaturalEarth1Raw.invert = function(x, y) {\n var phi = y, i = 25, delta;\n do {\n var phi2 = phi * phi, phi4 = phi2 * phi2;\n phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) /\n (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4)));\n } while (abs(delta) > epsilon && --i > 0);\n return [\n x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))),\n phi\n ];\n};\n\nexport default function() {\n return projection(naturalEarth1Raw)\n .scale(175.295);\n}\n","import {asin, cos, epsilon, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function orthographicRaw(x, y) {\n return [cos(y) * sin(x), sin(y)];\n}\n\northographicRaw.invert = azimuthalInvert(asin);\n\nexport default function() {\n return projection(orthographicRaw)\n .scale(249.5)\n .clipAngle(90 + epsilon);\n}\n","import {atan, cos, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function stereographicRaw(x, y) {\n var cy = cos(y), k = 1 + cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n}\n\nstereographicRaw.invert = azimuthalInvert(function(z) {\n return 2 * atan(z);\n});\n\nexport default function() {\n return projection(stereographicRaw)\n .scale(250)\n .clipAngle(142);\n}\n","import {atan, exp, halfPi, log, tan} from \"../math.js\";\nimport {mercatorProjection} from \"./mercator.js\";\n\nexport function transverseMercatorRaw(lambda, phi) {\n return [log(tan((halfPi + phi) / 2)), -lambda];\n}\n\ntransverseMercatorRaw.invert = function(x, y) {\n return [-y, 2 * atan(exp(x)) - halfPi];\n};\n\nexport default function() {\n var m = mercatorProjection(transverseMercatorRaw),\n center = m.center,\n rotate = m.rotate;\n\n m.center = function(_) {\n return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]);\n };\n\n m.rotate = function(_) {\n return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);\n };\n\n return rotate([0, 0, 90])\n .scale(159.155);\n}\n","export var abs = Math.abs;\nexport var atan = Math.atan;\nexport var atan2 = Math.atan2;\nexport var ceil = Math.ceil;\nexport var cos = Math.cos;\nexport var exp = Math.exp;\nexport var floor = Math.floor;\nexport var log = Math.log;\nexport var max = Math.max;\nexport var min = Math.min;\nexport var pow = Math.pow;\nexport var round = Math.round;\nexport var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };\nexport var sin = Math.sin;\nexport var tan = Math.tan;\n\nexport var epsilon = 1e-6;\nexport var epsilon2 = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var quarterPi = pi / 4;\nexport var sqrt1_2 = Math.SQRT1_2;\nexport var sqrt2 = sqrt(2);\nexport var sqrtPi = sqrt(pi);\nexport var tau = pi * 2;\nexport var degrees = 180 / pi;\nexport var radians = pi / 180;\n\nexport function sinci(x) {\n return x ? x / Math.sin(x) : 1;\n}\n\nexport function asin(x) {\n return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n}\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function sqrt(x) {\n return x > 0 ? Math.sqrt(x) : 0;\n}\n\nexport function tanh(x) {\n x = exp(2 * x);\n return (x - 1) / (x + 1);\n}\n\nexport function sinh(x) {\n return (exp(x) - exp(-x)) / 2;\n}\n\nexport function cosh(x) {\n return (exp(x) + exp(-x)) / 2;\n}\n\nexport function arsinh(x) {\n return log(x + sqrt(x * x + 1));\n}\n\nexport function arcosh(x) {\n return log(x + sqrt(x * x - 1));\n}\n","import {geoProjection as projection} from \"d3-geo\";\nimport {abs, asin, cos, epsilon, halfPi, pi, sin, sqrt2} from \"./math.js\";\n\nexport function mollweideBromleyTheta(cp, phi) {\n var cpsinPhi = cp * sin(phi), i = 30, delta;\n do phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi));\n while (abs(delta) > epsilon && --i > 0);\n return phi / 2;\n}\n\nexport function mollweideBromleyRaw(cx, cy, cp) {\n\n function forward(lambda, phi) {\n return [cx * lambda * cos(phi = mollweideBromleyTheta(cp, phi)), cy * sin(phi)];\n }\n\n forward.invert = function(x, y) {\n return y = asin(y / cy), [x / (cx * cos(y)), asin((2 * y + sin(2 * y)) / cp)];\n };\n\n return forward;\n}\n\nexport var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi);\n\nexport default function() {\n return projection(mollweideRaw)\n .scale(169.529);\n}\n","import { geoPath, geoAlbers, geoAlbersUsa, geoAzimuthalEqualArea, geoAzimuthalEquidistant, geoConicConformal, geoConicEqualArea, geoConicEquidistant, geoEqualEarth, geoEquirectangular, geoGnomonic, geoIdentity, geoMercator, geoNaturalEarth1, geoOrthographic, geoStereographic, geoTransverseMercator } from 'd3-geo';\nimport { geoMollweide } from 'd3-geo-projection';\nimport { registerScale } from 'vega-scale';\n\nconst defaultPath = geoPath();\nconst projectionProperties = [\n// standard properties in d3-geo\n'clipAngle', 'clipExtent', 'scale', 'translate', 'center', 'rotate', 'parallels', 'precision', 'reflectX', 'reflectY',\n// extended properties in d3-geo-projections\n'coefficient', 'distance', 'fraction', 'lobes', 'parallel', 'radius', 'ratio', 'spacing', 'tilt'];\n\n/**\n * Augment projections with their type and a copy method.\n */\nfunction create(type, constructor) {\n return function projection() {\n const p = constructor();\n p.type = type;\n p.path = geoPath().projection(p);\n p.copy = p.copy || function () {\n const c = projection();\n projectionProperties.forEach(prop => {\n if (p[prop]) c[prop](p[prop]());\n });\n c.path.pointRadius(p.path.pointRadius());\n return c;\n };\n return registerScale(p);\n };\n}\nfunction projection(type, proj) {\n if (!type || typeof type !== 'string') {\n throw new Error('Projection type must be a name string.');\n }\n type = type.toLowerCase();\n if (arguments.length > 1) {\n projections[type] = create(type, proj);\n return this;\n } else {\n return projections[type] || null;\n }\n}\nfunction getProjectionPath(proj) {\n return proj && proj.path || defaultPath;\n}\nconst projections = {\n // base d3-geo projection types\n albers: geoAlbers,\n albersusa: geoAlbersUsa,\n azimuthalequalarea: geoAzimuthalEqualArea,\n azimuthalequidistant: geoAzimuthalEquidistant,\n conicconformal: geoConicConformal,\n conicequalarea: geoConicEqualArea,\n conicequidistant: geoConicEquidistant,\n equalEarth: geoEqualEarth,\n equirectangular: geoEquirectangular,\n gnomonic: geoGnomonic,\n identity: geoIdentity,\n mercator: geoMercator,\n mollweide: geoMollweide,\n naturalEarth1: geoNaturalEarth1,\n orthographic: geoOrthographic,\n stereographic: geoStereographic,\n transversemercator: geoTransverseMercator\n};\nfor (const key in projections) {\n projection(key, projections[key]);\n}\n\nexport { getProjectionPath, projection, projectionProperties };\n","import {epsilon} from \"../math.js\";\nimport albers from \"./albers.js\";\nimport conicEqualArea from \"./conicEqualArea.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\n\n// The projections must have mutually exclusive clip regions on the sphere,\n// as this will avoid emitting interleaving lines and polygons.\nfunction multiplex(streams) {\n var n = streams.length;\n return {\n point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); },\n sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); },\n lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); },\n lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); },\n polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); },\n polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); }\n };\n}\n\n// A composite projection for the United States, configured by default for\n// 960×500. The projection also works quite well at 960×600 if you change the\n// scale to 1285 and adjust the translate accordingly. The set of standard\n// parallels for each region comes from USGS, which is published here:\n// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers\nexport default function() {\n var cache,\n cacheStream,\n lower48 = albers(), lower48Point,\n alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338\n hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007\n point, pointStream = {point: function(x, y) { point = [x, y]; }};\n\n function albersUsa(coordinates) {\n var x = coordinates[0], y = coordinates[1];\n return point = null,\n (lower48Point.point(x, y), point)\n || (alaskaPoint.point(x, y), point)\n || (hawaiiPoint.point(x, y), point);\n }\n\n albersUsa.invert = function(coordinates) {\n var k = lower48.scale(),\n t = lower48.translate(),\n x = (coordinates[0] - t[0]) / k,\n y = (coordinates[1] - t[1]) / k;\n return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska\n : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii\n : lower48).invert(coordinates);\n };\n\n albersUsa.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);\n };\n\n albersUsa.precision = function(_) {\n if (!arguments.length) return lower48.precision();\n lower48.precision(_), alaska.precision(_), hawaii.precision(_);\n return reset();\n };\n\n albersUsa.scale = function(_) {\n if (!arguments.length) return lower48.scale();\n lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);\n return albersUsa.translate(lower48.translate());\n };\n\n albersUsa.translate = function(_) {\n if (!arguments.length) return lower48.translate();\n var k = lower48.scale(), x = +_[0], y = +_[1];\n\n lower48Point = lower48\n .translate(_)\n .clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])\n .stream(pointStream);\n\n alaskaPoint = alaska\n .translate([x - 0.307 * k, y + 0.201 * k])\n .clipExtent([[x - 0.425 * k + epsilon, y + 0.120 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]])\n .stream(pointStream);\n\n hawaiiPoint = hawaii\n .translate([x - 0.205 * k, y + 0.212 * k])\n .clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]])\n .stream(pointStream);\n\n return reset();\n };\n\n albersUsa.fitExtent = function(extent, object) {\n return fitExtent(albersUsa, extent, object);\n };\n\n albersUsa.fitSize = function(size, object) {\n return fitSize(albersUsa, size, object);\n };\n\n albersUsa.fitWidth = function(width, object) {\n return fitWidth(albersUsa, width, object);\n };\n\n albersUsa.fitHeight = function(height, object) {\n return fitHeight(albersUsa, height, object);\n };\n\n function reset() {\n cache = cacheStream = null;\n return albersUsa;\n }\n\n return albersUsa.scale(1070);\n}\n","import clipRectangle from \"../clip/rectangle.js\";\nimport identity from \"../identity.js\";\nimport {transformer} from \"../transform.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\nimport {cos, degrees, radians, sin} from \"../math.js\";\n\nexport default function() {\n var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, // scale, translate and reflect\n alpha = 0, ca, sa, // angle\n x0 = null, y0, x1, y1, // clip extent\n kx = 1, ky = 1,\n transform = transformer({\n point: function(x, y) {\n var p = projection([x, y])\n this.stream.point(p[0], p[1]);\n }\n }),\n postclip = identity,\n cache,\n cacheStream;\n\n function reset() {\n kx = k * sx;\n ky = k * sy;\n cache = cacheStream = null;\n return projection;\n }\n\n function projection (p) {\n var x = p[0] * kx, y = p[1] * ky;\n if (alpha) {\n var t = y * ca - x * sa;\n x = x * ca + y * sa;\n y = t;\n } \n return [x + tx, y + ty];\n }\n projection.invert = function(p) {\n var x = p[0] - tx, y = p[1] - ty;\n if (alpha) {\n var t = y * ca + x * sa;\n x = x * ca - y * sa;\n y = t;\n }\n return [x / kx, y / ky];\n };\n projection.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream));\n };\n projection.postclip = function(_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n };\n projection.clipExtent = function(_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n projection.scale = function(_) {\n return arguments.length ? (k = +_, reset()) : k;\n };\n projection.translate = function(_) {\n return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty];\n }\n projection.angle = function(_) {\n return arguments.length ? (alpha = _ % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;\n };\n projection.reflectX = function(_) {\n return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0;\n };\n projection.reflectY = function(_) {\n return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0;\n };\n projection.fitExtent = function(extent, object) {\n return fitExtent(projection, extent, object);\n };\n projection.fitSize = function(size, object) {\n return fitSize(projection, size, object);\n };\n projection.fitWidth = function(width, object) {\n return fitWidth(projection, width, object);\n };\n projection.fitHeight = function(height, object) {\n return fitHeight(projection, height, object);\n };\n\n return projection;\n}\n","import {range} from \"d3-array\";\nimport {abs, ceil, epsilon} from \"./math.js\";\n\nfunction graticuleX(y0, y1, dy) {\n var y = range(y0, y1 - epsilon, dy).concat(y1);\n return function(x) { return y.map(function(y) { return [x, y]; }); };\n}\n\nfunction graticuleY(x0, x1, dx) {\n var x = range(x0, x1 - epsilon, dx).concat(x1);\n return function(y) { return x.map(function(x) { return [x, y]; }); };\n}\n\nexport default function graticule() {\n var x1, x0, X1, X0,\n y1, y0, Y1, Y0,\n dx = 10, dy = dx, DX = 90, DY = 360,\n x, y, X, Y,\n precision = 2.5;\n\n function graticule() {\n return {type: \"MultiLineString\", coordinates: lines()};\n }\n\n function lines() {\n return range(ceil(X0 / DX) * DX, X1, DX).map(X)\n .concat(range(ceil(Y0 / DY) * DY, Y1, DY).map(Y))\n .concat(range(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs(x % DX) > epsilon; }).map(x))\n .concat(range(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs(y % DY) > epsilon; }).map(y));\n }\n\n graticule.lines = function() {\n return lines().map(function(coordinates) { return {type: \"LineString\", coordinates: coordinates}; });\n };\n\n graticule.outline = function() {\n return {\n type: \"Polygon\",\n coordinates: [\n X(X0).concat(\n Y(Y1).slice(1),\n X(X1).reverse().slice(1),\n Y(Y0).reverse().slice(1))\n ]\n };\n };\n\n graticule.extent = function(_) {\n if (!arguments.length) return graticule.extentMinor();\n return graticule.extentMajor(_).extentMinor(_);\n };\n\n graticule.extentMajor = function(_) {\n if (!arguments.length) return [[X0, Y0], [X1, Y1]];\n X0 = +_[0][0], X1 = +_[1][0];\n Y0 = +_[0][1], Y1 = +_[1][1];\n if (X0 > X1) _ = X0, X0 = X1, X1 = _;\n if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;\n return graticule.precision(precision);\n };\n\n graticule.extentMinor = function(_) {\n if (!arguments.length) return [[x0, y0], [x1, y1]];\n x0 = +_[0][0], x1 = +_[1][0];\n y0 = +_[0][1], y1 = +_[1][1];\n if (x0 > x1) _ = x0, x0 = x1, x1 = _;\n if (y0 > y1) _ = y0, y0 = y1, y1 = _;\n return graticule.precision(precision);\n };\n\n graticule.step = function(_) {\n if (!arguments.length) return graticule.stepMinor();\n return graticule.stepMajor(_).stepMinor(_);\n };\n\n graticule.stepMajor = function(_) {\n if (!arguments.length) return [DX, DY];\n DX = +_[0], DY = +_[1];\n return graticule;\n };\n\n graticule.stepMinor = function(_) {\n if (!arguments.length) return [dx, dy];\n dx = +_[0], dy = +_[1];\n return graticule;\n };\n\n graticule.precision = function(_) {\n if (!arguments.length) return precision;\n precision = +_;\n x = graticuleX(y0, y1, 90);\n y = graticuleY(x0, x1, precision);\n X = graticuleX(Y0, Y1, 90);\n Y = graticuleY(X0, X1, precision);\n return graticule;\n };\n\n return graticule\n .extentMajor([[-180, -90 + epsilon], [180, 90 - epsilon]])\n .extentMinor([[-180, -80 - epsilon], [180, 80 + epsilon]]);\n}\n\nexport function graticule10() {\n return graticule()();\n}\n","import { Transform, rederive, ingest, replace } from 'vega-dataflow';\nimport { error, extent, inherits, identity, isArray, isFunction, isNumber, array, constant, one, accessorName, accessorFields, field, extend, toSet, zero } from 'vega-util';\nimport { tickStep, range, max, sum } from 'd3-array';\nimport { bandwidthNRD } from 'vega-statistics';\nimport { getProjectionPath, projectionProperties, projection } from 'vega-projection';\nimport { geoGraticule } from 'd3-geo';\nimport { rgb } from 'd3-color';\nimport { canvas } from 'vega-canvas';\n\nfunction noop() {}\nconst cases = [[], [[[1.0, 1.5], [0.5, 1.0]]], [[[1.5, 1.0], [1.0, 1.5]]], [[[1.5, 1.0], [0.5, 1.0]]], [[[1.0, 0.5], [1.5, 1.0]]], [[[1.0, 1.5], [0.5, 1.0]], [[1.0, 0.5], [1.5, 1.0]]], [[[1.0, 0.5], [1.0, 1.5]]], [[[1.0, 0.5], [0.5, 1.0]]], [[[0.5, 1.0], [1.0, 0.5]]], [[[1.0, 1.5], [1.0, 0.5]]], [[[0.5, 1.0], [1.0, 0.5]], [[1.5, 1.0], [1.0, 1.5]]], [[[1.5, 1.0], [1.0, 0.5]]], [[[0.5, 1.0], [1.5, 1.0]]], [[[1.0, 1.5], [1.5, 1.0]]], [[[0.5, 1.0], [1.0, 1.5]]], []];\n\n// Implementation adapted from d3/d3-contour. Thanks!\nfunction contours () {\n var dx = 1,\n dy = 1,\n smooth = smoothLinear;\n function contours(values, tz) {\n return tz.map(value => contour(values, value));\n }\n\n // Accumulate, smooth contour rings, assign holes to exterior rings.\n // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js\n function contour(values, value) {\n var polygons = [],\n holes = [];\n isorings(values, value, ring => {\n smooth(ring, values, value);\n if (area(ring) > 0) polygons.push([ring]);else holes.push(ring);\n });\n holes.forEach(hole => {\n for (var i = 0, n = polygons.length, polygon; i < n; ++i) {\n if (contains((polygon = polygons[i])[0], hole) !== -1) {\n polygon.push(hole);\n return;\n }\n }\n });\n return {\n type: 'MultiPolygon',\n value: value,\n coordinates: polygons\n };\n }\n\n // Marching squares with isolines stitched into rings.\n // Based on https://github.com/topojson/topojson-client/blob/v3.0.0/src/stitch.js\n function isorings(values, value, callback) {\n var fragmentByStart = new Array(),\n fragmentByEnd = new Array(),\n x,\n y,\n t0,\n t1,\n t2,\n t3;\n\n // Special case for the first row (y = -1, t2 = t3 = 0).\n x = y = -1;\n t1 = values[0] >= value;\n cases[t1 << 1].forEach(stitch);\n while (++x < dx - 1) {\n t0 = t1, t1 = values[x + 1] >= value;\n cases[t0 | t1 << 1].forEach(stitch);\n }\n cases[t1 << 0].forEach(stitch);\n\n // General case for the intermediate rows.\n while (++y < dy - 1) {\n x = -1;\n t1 = values[y * dx + dx] >= value;\n t2 = values[y * dx] >= value;\n cases[t1 << 1 | t2 << 2].forEach(stitch);\n while (++x < dx - 1) {\n t0 = t1, t1 = values[y * dx + dx + x + 1] >= value;\n t3 = t2, t2 = values[y * dx + x + 1] >= value;\n cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch);\n }\n cases[t1 | t2 << 3].forEach(stitch);\n }\n\n // Special case for the last row (y = dy - 1, t0 = t1 = 0).\n x = -1;\n t2 = values[y * dx] >= value;\n cases[t2 << 2].forEach(stitch);\n while (++x < dx - 1) {\n t3 = t2, t2 = values[y * dx + x + 1] >= value;\n cases[t2 << 2 | t3 << 3].forEach(stitch);\n }\n cases[t2 << 3].forEach(stitch);\n function stitch(line) {\n var start = [line[0][0] + x, line[0][1] + y],\n end = [line[1][0] + x, line[1][1] + y],\n startIndex = index(start),\n endIndex = index(end),\n f,\n g;\n if (f = fragmentByEnd[startIndex]) {\n if (g = fragmentByStart[endIndex]) {\n delete fragmentByEnd[f.end];\n delete fragmentByStart[g.start];\n if (f === g) {\n f.ring.push(end);\n callback(f.ring);\n } else {\n fragmentByStart[f.start] = fragmentByEnd[g.end] = {\n start: f.start,\n end: g.end,\n ring: f.ring.concat(g.ring)\n };\n }\n } else {\n delete fragmentByEnd[f.end];\n f.ring.push(end);\n fragmentByEnd[f.end = endIndex] = f;\n }\n } else if (f = fragmentByStart[endIndex]) {\n if (g = fragmentByEnd[startIndex]) {\n delete fragmentByStart[f.start];\n delete fragmentByEnd[g.end];\n if (f === g) {\n f.ring.push(end);\n callback(f.ring);\n } else {\n fragmentByStart[g.start] = fragmentByEnd[f.end] = {\n start: g.start,\n end: f.end,\n ring: g.ring.concat(f.ring)\n };\n }\n } else {\n delete fragmentByStart[f.start];\n f.ring.unshift(start);\n fragmentByStart[f.start = startIndex] = f;\n }\n } else {\n fragmentByStart[startIndex] = fragmentByEnd[endIndex] = {\n start: startIndex,\n end: endIndex,\n ring: [start, end]\n };\n }\n }\n }\n function index(point) {\n return point[0] * 2 + point[1] * (dx + 1) * 4;\n }\n function smoothLinear(ring, values, value) {\n ring.forEach(point => {\n var x = point[0],\n y = point[1],\n xt = x | 0,\n yt = y | 0,\n v0,\n v1 = values[yt * dx + xt];\n if (x > 0 && x < dx && xt === x) {\n v0 = values[yt * dx + xt - 1];\n point[0] = x + (value - v0) / (v1 - v0) - 0.5;\n }\n if (y > 0 && y < dy && yt === y) {\n v0 = values[(yt - 1) * dx + xt];\n point[1] = y + (value - v0) / (v1 - v0) - 0.5;\n }\n });\n }\n contours.contour = contour;\n contours.size = function (_) {\n if (!arguments.length) return [dx, dy];\n var _0 = Math.floor(_[0]),\n _1 = Math.floor(_[1]);\n if (!(_0 >= 0 && _1 >= 0)) error('invalid size');\n return dx = _0, dy = _1, contours;\n };\n contours.smooth = function (_) {\n return arguments.length ? (smooth = _ ? smoothLinear : noop, contours) : smooth === smoothLinear;\n };\n return contours;\n}\nfunction area(ring) {\n var i = 0,\n n = ring.length,\n area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1];\n while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1];\n return area;\n}\nfunction contains(ring, hole) {\n var i = -1,\n n = hole.length,\n c;\n while (++i < n) if (c = ringContains(ring, hole[i])) return c;\n return 0;\n}\nfunction ringContains(ring, point) {\n var x = point[0],\n y = point[1],\n contains = -1;\n for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) {\n var pi = ring[i],\n xi = pi[0],\n yi = pi[1],\n pj = ring[j],\n xj = pj[0],\n yj = pj[1];\n if (segmentContains(pi, pj, point)) return 0;\n if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = -contains;\n }\n return contains;\n}\nfunction segmentContains(a, b, c) {\n var i;\n return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]);\n}\nfunction collinear(a, b, c) {\n return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]);\n}\nfunction within(p, q, r) {\n return p <= q && q <= r || r <= q && q <= p;\n}\n\nfunction quantize (k, nice, zero) {\n return function (values) {\n var ex = extent(values),\n start = zero ? Math.min(ex[0], 0) : ex[0],\n stop = ex[1],\n span = stop - start,\n step = nice ? tickStep(start, stop, k) : span / (k + 1);\n return range(start + step, stop, step);\n };\n}\n\n/**\n * Generate isocontours (level sets) based on input raster grid data.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} [params.field] - The field with raster grid\n * data. If unspecified, the tuple itself is interpreted as a raster grid.\n * @param {Array} [params.thresholds] - Contour threshold array. If\n * specified, the levels, nice, resolve, and zero parameters are ignored.\n * @param {number} [params.levels] - The desired number of contour levels.\n * @param {boolean} [params.nice] - Boolean flag indicating if the contour\n * threshold values should be automatically aligned to \"nice\"\n * human-friendly values. Setting this flag may cause the number of\n * thresholds to deviate from the specified levels.\n * @param {string} [params.resolve] - The method for resolving thresholds\n * across multiple input grids. If 'independent' (the default), threshold\n * calculation will be performed separately for each grid. If 'shared', a\n * single set of threshold values will be used for all input grids.\n * @param {boolean} [params.zero] - Boolean flag indicating if the contour\n * threshold values should include zero.\n * @param {boolean} [params.smooth] - Boolean flag indicating if the contour\n * polygons should be smoothed using linear interpolation. The default is\n * true. The parameter is ignored when using density estimation.\n * @param {boolean} [params.scale] - Optional numerical value by which to\n * scale the output isocontour coordinates. This parameter can be useful\n * to scale the contours to match a desired output resolution.\n * @param {string} [params.as='contour'] - The output field in which to store\n * the generated isocontour data (default 'contour').\n */\nfunction Isocontour(params) {\n Transform.call(this, null, params);\n}\nIsocontour.Definition = {\n 'type': 'Isocontour',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'thresholds',\n 'type': 'number',\n 'array': true\n }, {\n 'name': 'levels',\n 'type': 'number'\n }, {\n 'name': 'nice',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'resolve',\n 'type': 'enum',\n 'values': ['shared', 'independent'],\n 'default': 'independent'\n }, {\n 'name': 'zero',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'smooth',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'scale',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'translate',\n 'type': 'number',\n 'array': true,\n 'expr': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'null': true,\n 'default': 'contour'\n }]\n};\ninherits(Isocontour, Transform, {\n transform(_, pulse) {\n if (this.value && !pulse.changed() && !_.modified()) {\n return pulse.StopPropagation;\n }\n var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n source = pulse.materialize(pulse.SOURCE).source,\n field = _.field || identity,\n contour = contours().smooth(_.smooth !== false),\n tz = _.thresholds || levels(source, field, _),\n as = _.as === null ? null : _.as || 'contour',\n values = [];\n source.forEach(t => {\n const grid = field(t);\n\n // generate contour paths in GeoJSON format\n const paths = contour.size([grid.width, grid.height])(grid.values, isArray(tz) ? tz : tz(grid.values));\n\n // adjust contour path coordinates as needed\n transformPaths(paths, grid, t, _);\n\n // ingest; copy source data properties to output\n paths.forEach(p => {\n values.push(rederive(t, ingest(as != null ? {\n [as]: p\n } : p)));\n });\n });\n if (this.value) out.rem = this.value;\n this.value = out.source = out.add = values;\n return out;\n }\n});\nfunction levels(values, f, _) {\n const q = quantize(_.levels || 10, _.nice, _.zero !== false);\n return _.resolve !== 'shared' ? q : q(values.map(t => max(f(t).values)));\n}\nfunction transformPaths(paths, grid, datum, _) {\n let s = _.scale || grid.scale,\n t = _.translate || grid.translate;\n if (isFunction(s)) s = s(datum, _);\n if (isFunction(t)) t = t(datum, _);\n if ((s === 1 || s == null) && !t) return;\n const sx = (isNumber(s) ? s : s[0]) || 1,\n sy = (isNumber(s) ? s : s[1]) || 1,\n tx = t && t[0] || 0,\n ty = t && t[1] || 0;\n paths.forEach(transform(grid, sx, sy, tx, ty));\n}\nfunction transform(grid, sx, sy, tx, ty) {\n const x1 = grid.x1 || 0,\n y1 = grid.y1 || 0,\n flip = sx * sy < 0;\n function transformPolygon(coordinates) {\n coordinates.forEach(transformRing);\n }\n function transformRing(coordinates) {\n if (flip) coordinates.reverse(); // maintain winding order\n coordinates.forEach(transformPoint);\n }\n function transformPoint(coordinates) {\n coordinates[0] = (coordinates[0] - x1) * sx + tx;\n coordinates[1] = (coordinates[1] - y1) * sy + ty;\n }\n return function (geometry) {\n geometry.coordinates.forEach(transformPolygon);\n return geometry;\n };\n}\n\nfunction radius(bw, data, f) {\n const v = bw >= 0 ? bw : bandwidthNRD(data, f);\n return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2);\n}\nfunction number(_) {\n return isFunction(_) ? _ : constant(+_);\n}\n\n// Implementation adapted from d3/d3-contour. Thanks!\nfunction density2D () {\n var x = d => d[0],\n y = d => d[1],\n weight = one,\n bandwidth = [-1, -1],\n dx = 960,\n dy = 500,\n k = 2; // log2(cellSize)\n\n function density(data, counts) {\n const rx = radius(bandwidth[0], data, x) >> k,\n // blur x-radius\n ry = radius(bandwidth[1], data, y) >> k,\n // blur y-radius\n ox = rx ? rx + 2 : 0,\n // x-offset padding for blur\n oy = ry ? ry + 2 : 0,\n // y-offset padding for blur\n n = 2 * ox + (dx >> k),\n // grid width\n m = 2 * oy + (dy >> k),\n // grid height\n values0 = new Float32Array(n * m),\n values1 = new Float32Array(n * m);\n let values = values0;\n data.forEach(d => {\n const xi = ox + (+x(d) >> k),\n yi = oy + (+y(d) >> k);\n if (xi >= 0 && xi < n && yi >= 0 && yi < m) {\n values0[xi + yi * n] += +weight(d);\n }\n });\n if (rx > 0 && ry > 0) {\n blurX(n, m, values0, values1, rx);\n blurY(n, m, values1, values0, ry);\n blurX(n, m, values0, values1, rx);\n blurY(n, m, values1, values0, ry);\n blurX(n, m, values0, values1, rx);\n blurY(n, m, values1, values0, ry);\n } else if (rx > 0) {\n blurX(n, m, values0, values1, rx);\n blurX(n, m, values1, values0, rx);\n blurX(n, m, values0, values1, rx);\n values = values1;\n } else if (ry > 0) {\n blurY(n, m, values0, values1, ry);\n blurY(n, m, values1, values0, ry);\n blurY(n, m, values0, values1, ry);\n values = values1;\n }\n\n // scale density estimates\n // density in points per square pixel or probability density\n const s = counts ? Math.pow(2, -2 * k) : 1 / sum(values);\n for (let i = 0, sz = n * m; i < sz; ++i) values[i] *= s;\n return {\n values: values,\n scale: 1 << k,\n width: n,\n height: m,\n x1: ox,\n y1: oy,\n x2: ox + (dx >> k),\n y2: oy + (dy >> k)\n };\n }\n density.x = function (_) {\n return arguments.length ? (x = number(_), density) : x;\n };\n density.y = function (_) {\n return arguments.length ? (y = number(_), density) : y;\n };\n density.weight = function (_) {\n return arguments.length ? (weight = number(_), density) : weight;\n };\n density.size = function (_) {\n if (!arguments.length) return [dx, dy];\n var _0 = +_[0],\n _1 = +_[1];\n if (!(_0 >= 0 && _1 >= 0)) error('invalid size');\n return dx = _0, dy = _1, density;\n };\n density.cellSize = function (_) {\n if (!arguments.length) return 1 << k;\n if (!((_ = +_) >= 1)) error('invalid cell size');\n k = Math.floor(Math.log(_) / Math.LN2);\n return density;\n };\n density.bandwidth = function (_) {\n if (!arguments.length) return bandwidth;\n _ = array(_);\n if (_.length === 1) _ = [+_[0], +_[0]];\n if (_.length !== 2) error('invalid bandwidth');\n return bandwidth = _, density;\n };\n return density;\n}\nfunction blurX(n, m, source, target, r) {\n const w = (r << 1) + 1;\n for (let j = 0; j < m; ++j) {\n for (let i = 0, sr = 0; i < n + r; ++i) {\n if (i < n) {\n sr += source[i + j * n];\n }\n if (i >= r) {\n if (i >= w) {\n sr -= source[i - w + j * n];\n }\n target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w);\n }\n }\n }\n}\nfunction blurY(n, m, source, target, r) {\n const w = (r << 1) + 1;\n for (let i = 0; i < n; ++i) {\n for (let j = 0, sr = 0; j < m + r; ++j) {\n if (j < m) {\n sr += source[i + j * n];\n }\n if (j >= r) {\n if (j >= w) {\n sr -= source[i + (j - w) * n];\n }\n target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w);\n }\n }\n }\n}\n\n/**\n * Perform 2D kernel-density estimation of point data.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.size - The [width, height] extent (in\n * units of input pixels) over which to perform density estimation.\n * @param {function(object): number} params.x - The x-coordinate accessor.\n * @param {function(object): number} params.y - The y-coordinate accessor.\n * @param {function(object): number} [params.weight] - The weight accessor.\n * @param {Array} [params.groupby] - An array of accessors\n * to groupby.\n * @param {number} [params.cellSize] - Contour density calculation cell size.\n * This parameter determines the level of spatial approximation. For example,\n * the default value of 4 maps to 2x reductions in both x- and y- dimensions.\n * A value of 1 will result in an output raster grid whose dimensions exactly\n * matches the size parameter.\n * @param {Array} [params.bandwidth] - The KDE kernel bandwidths,\n * in pixels. The input can be a two-element array specifying separate\n * x and y bandwidths, or a single-element array specifying both. If the\n * bandwidth is unspecified or less than zero, the bandwidth will be\n * automatically determined.\n * @param {boolean} [params.counts=false] - A boolean flag indicating if the\n * output values should be probability estimates (false, default) or\n * smoothed counts (true).\n * @param {string} [params.as='grid'] - The output field in which to store\n * the generated raster grid (default 'grid').\n */\nfunction KDE2D(params) {\n Transform.call(this, null, params);\n}\nKDE2D.Definition = {\n 'type': 'KDE2D',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2,\n 'required': true\n }, {\n 'name': 'x',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'y',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'weight',\n 'type': 'field'\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'cellSize',\n 'type': 'number'\n }, {\n 'name': 'bandwidth',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'counts',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'grid'\n }]\n};\nconst PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth'];\nfunction params(obj, _) {\n PARAMS.forEach(param => _[param] != null ? obj[param](_[param]) : 0);\n return obj;\n}\ninherits(KDE2D, Transform, {\n transform(_, pulse) {\n if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation;\n var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n source = pulse.materialize(pulse.SOURCE).source,\n groups = partition(source, _.groupby),\n names = (_.groupby || []).map(accessorName),\n kde = params(density2D(), _),\n as = _.as || 'grid',\n values = [];\n function set(t, vals) {\n for (let i = 0; i < names.length; ++i) t[names[i]] = vals[i];\n return t;\n }\n\n // generate density raster grids\n values = groups.map(g => ingest(set({\n [as]: kde(g, _.counts)\n }, g.dims)));\n if (this.value) out.rem = this.value;\n this.value = out.source = out.add = values;\n return out;\n }\n});\nfunction partition(data, groupby) {\n var groups = [],\n get = f => f(t),\n map,\n i,\n n,\n t,\n k,\n g;\n\n // partition data points into groups\n if (groupby == null) {\n groups.push(data);\n } else {\n for (map = {}, i = 0, n = data.length; i < n; ++i) {\n t = data[i];\n k = groupby.map(get);\n g = map[k];\n if (!g) {\n map[k] = g = [];\n g.dims = k;\n groups.push(g);\n }\n g.push(t);\n }\n }\n return groups;\n}\n\n/**\n * Generate contours based on kernel-density estimation of point data.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.size - The dimensions [width, height] over which to compute contours.\n * If the values parameter is provided, this must be the dimensions of the input data.\n * If density estimation is performed, this is the output view dimensions in pixels.\n * @param {Array} [params.values] - An array of numeric values representing an\n * width x height grid of values over which to compute contours. If unspecified, this\n * transform will instead attempt to compute contours for the kernel density estimate\n * using values drawn from data tuples in the input pulse.\n * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation.\n * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation.\n * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation.\n * @param {number} [params.cellSize] - Contour density calculation cell size.\n * @param {number} [params.bandwidth] - Kernel density estimation bandwidth.\n * @param {Array} [params.thresholds] - Contour threshold array. If\n * this parameter is set, the count and nice parameters will be ignored.\n * @param {number} [params.count] - The desired number of contours.\n * @param {boolean} [params.nice] - Boolean flag indicating if the contour\n * threshold values should be automatically aligned to \"nice\"\n * human-friendly values. Setting this flag may cause the number of\n * thresholds to deviate from the specified count.\n * @param {boolean} [params.smooth] - Boolean flag indicating if the contour\n * polygons should be smoothed using linear interpolation. The default is\n * true. The parameter is ignored when using density estimation.\n */\nfunction Contour(params) {\n Transform.call(this, null, params);\n}\nContour.Definition = {\n 'type': 'Contour',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2,\n 'required': true\n }, {\n 'name': 'values',\n 'type': 'number',\n 'array': true\n }, {\n 'name': 'x',\n 'type': 'field'\n }, {\n 'name': 'y',\n 'type': 'field'\n }, {\n 'name': 'weight',\n 'type': 'field'\n }, {\n 'name': 'cellSize',\n 'type': 'number'\n }, {\n 'name': 'bandwidth',\n 'type': 'number'\n }, {\n 'name': 'count',\n 'type': 'number'\n }, {\n 'name': 'nice',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'thresholds',\n 'type': 'number',\n 'array': true\n }, {\n 'name': 'smooth',\n 'type': 'boolean',\n 'default': true\n }]\n};\ninherits(Contour, Transform, {\n transform(_, pulse) {\n if (this.value && !pulse.changed() && !_.modified()) {\n return pulse.StopPropagation;\n }\n var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),\n contour = contours().smooth(_.smooth !== false),\n values = _.values,\n thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values),\n size = _.size,\n grid,\n post;\n if (!values) {\n values = pulse.materialize(pulse.SOURCE).source;\n grid = params(density2D(), _)(values, true);\n post = transform(grid, grid.scale || 1, grid.scale || 1, 0, 0);\n size = [grid.width, grid.height];\n values = grid.values;\n }\n thresh = isArray(thresh) ? thresh : thresh(values);\n values = contour.size(size)(values, thresh);\n if (post) values.forEach(post);\n if (this.value) out.rem = this.value;\n this.value = out.source = out.add = (values || []).map(ingest);\n return out;\n }\n});\n\nconst Feature = 'Feature';\nconst FeatureCollection = 'FeatureCollection';\nconst MultiPoint = 'MultiPoint';\n\n/**\n * Consolidate an array of [longitude, latitude] points or GeoJSON features\n * into a combined GeoJSON object. This transform is particularly useful for\n * combining geo data for a Projection's fit argument. The resulting GeoJSON\n * data is available as this transform's value. Input pulses are unchanged.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} [params.fields] - A two-element array\n * of field accessors for the longitude and latitude values.\n * @param {function(object): *} params.geojson - A field accessor for\n * retrieving GeoJSON feature data.\n */\nfunction GeoJSON(params) {\n Transform.call(this, null, params);\n}\nGeoJSON.Definition = {\n 'type': 'GeoJSON',\n 'metadata': {},\n 'params': [{\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'geojson',\n 'type': 'field'\n }]\n};\ninherits(GeoJSON, Transform, {\n transform(_, pulse) {\n var features = this._features,\n points = this._points,\n fields = _.fields,\n lon = fields && fields[0],\n lat = fields && fields[1],\n geojson = _.geojson || !fields && identity,\n flag = pulse.ADD,\n mod;\n mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified(accessorFields(geojson)) || lon && pulse.modified(accessorFields(lon)) || lat && pulse.modified(accessorFields(lat));\n if (!this.value || mod) {\n flag = pulse.SOURCE;\n this._features = features = [];\n this._points = points = [];\n }\n if (geojson) {\n pulse.visit(flag, t => features.push(geojson(t)));\n }\n if (lon && lat) {\n pulse.visit(flag, t => {\n var x = lon(t),\n y = lat(t);\n if (x != null && y != null && (x = +x) === x && (y = +y) === y) {\n points.push([x, y]);\n }\n });\n features = features.concat({\n type: Feature,\n geometry: {\n type: MultiPoint,\n coordinates: points\n }\n });\n }\n this.value = {\n type: FeatureCollection,\n features: features\n };\n }\n});\n\n/**\n * Map GeoJSON data to an SVG path string.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(number, number): *} params.projection - The cartographic\n * projection to apply.\n * @param {function(object): *} [params.field] - The field with GeoJSON data,\n * or null if the tuple itself is a GeoJSON feature.\n * @param {string} [params.as='path'] - The output field in which to store\n * the generated path data (default 'path').\n */\nfunction GeoPath(params) {\n Transform.call(this, null, params);\n}\nGeoPath.Definition = {\n 'type': 'GeoPath',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'projection',\n 'type': 'projection'\n }, {\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'pointRadius',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'path'\n }]\n};\ninherits(GeoPath, Transform, {\n transform(_, pulse) {\n var out = pulse.fork(pulse.ALL),\n path = this.value,\n field = _.field || identity,\n as = _.as || 'path',\n flag = out.SOURCE;\n if (!path || _.modified()) {\n // parameters updated, reset and reflow\n this.value = path = getProjectionPath(_.projection);\n out.materialize().reflow();\n } else {\n flag = field === identity || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD;\n }\n const prev = initPath(path, _.pointRadius);\n out.visit(flag, t => t[as] = path(field(t)));\n path.pointRadius(prev);\n return out.modifies(as);\n }\n});\nfunction initPath(path, pointRadius) {\n const prev = path.pointRadius();\n path.context(null);\n if (pointRadius != null) {\n path.pointRadius(pointRadius);\n }\n return prev;\n}\n\n/**\n * Geo-code a longitude/latitude point to an x/y coordinate.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(number, number): *} params.projection - The cartographic\n * projection to apply.\n * @param {Array} params.fields - A two-element array of\n * field accessors for the longitude and latitude values.\n * @param {Array} [params.as] - A two-element array of field names\n * under which to store the result. Defaults to ['x','y'].\n */\nfunction GeoPoint(params) {\n Transform.call(this, null, params);\n}\nGeoPoint.Definition = {\n 'type': 'GeoPoint',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'projection',\n 'type': 'projection',\n 'required': true\n }, {\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'required': true,\n 'length': 2\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 2,\n 'default': ['x', 'y']\n }]\n};\ninherits(GeoPoint, Transform, {\n transform(_, pulse) {\n var proj = _.projection,\n lon = _.fields[0],\n lat = _.fields[1],\n as = _.as || ['x', 'y'],\n x = as[0],\n y = as[1],\n mod;\n function set(t) {\n const xy = proj([lon(t), lat(t)]);\n if (xy) {\n t[x] = xy[0];\n t[y] = xy[1];\n } else {\n t[x] = undefined;\n t[y] = undefined;\n }\n }\n if (_.modified()) {\n // parameters updated, reflow\n pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set);\n } else {\n mod = pulse.modified(lon.fields) || pulse.modified(lat.fields);\n pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set);\n }\n return pulse.modifies(as);\n }\n});\n\n/**\n * Annotate items with a geopath shape generator.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(number, number): *} params.projection - The cartographic\n * projection to apply.\n * @param {function(object): *} [params.field] - The field with GeoJSON data,\n * or null if the tuple itself is a GeoJSON feature.\n * @param {string} [params.as='shape'] - The output field in which to store\n * the generated path data (default 'shape').\n */\nfunction GeoShape(params) {\n Transform.call(this, null, params);\n}\nGeoShape.Definition = {\n 'type': 'GeoShape',\n 'metadata': {\n 'modifies': true,\n 'nomod': true\n },\n 'params': [{\n 'name': 'projection',\n 'type': 'projection'\n }, {\n 'name': 'field',\n 'type': 'field',\n 'default': 'datum'\n }, {\n 'name': 'pointRadius',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'shape'\n }]\n};\ninherits(GeoShape, Transform, {\n transform(_, pulse) {\n var out = pulse.fork(pulse.ALL),\n shape = this.value,\n as = _.as || 'shape',\n flag = out.ADD;\n if (!shape || _.modified()) {\n // parameters updated, reset and reflow\n this.value = shape = shapeGenerator(getProjectionPath(_.projection), _.field || field('datum'), _.pointRadius);\n out.materialize().reflow();\n flag = out.SOURCE;\n }\n out.visit(flag, t => t[as] = shape);\n return out.modifies(as);\n }\n});\nfunction shapeGenerator(path, field, pointRadius) {\n const shape = pointRadius == null ? _ => path(field(_)) : _ => {\n var prev = path.pointRadius(),\n value = path.pointRadius(pointRadius)(field(_));\n path.pointRadius(prev);\n return value;\n };\n shape.context = _ => {\n path.context(_);\n return shape;\n };\n return shape;\n}\n\n/**\n * GeoJSON feature generator for creating graticules.\n * @constructor\n */\nfunction Graticule(params) {\n Transform.call(this, [], params);\n this.generator = geoGraticule();\n}\nGraticule.Definition = {\n 'type': 'Graticule',\n 'metadata': {\n 'changes': true,\n 'generates': true\n },\n 'params': [{\n 'name': 'extent',\n 'type': 'array',\n 'array': true,\n 'length': 2,\n 'content': {\n 'type': 'number',\n 'array': true,\n 'length': 2\n }\n }, {\n 'name': 'extentMajor',\n 'type': 'array',\n 'array': true,\n 'length': 2,\n 'content': {\n 'type': 'number',\n 'array': true,\n 'length': 2\n }\n }, {\n 'name': 'extentMinor',\n 'type': 'array',\n 'array': true,\n 'length': 2,\n 'content': {\n 'type': 'number',\n 'array': true,\n 'length': 2\n }\n }, {\n 'name': 'step',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'stepMajor',\n 'type': 'number',\n 'array': true,\n 'length': 2,\n 'default': [90, 360]\n }, {\n 'name': 'stepMinor',\n 'type': 'number',\n 'array': true,\n 'length': 2,\n 'default': [10, 10]\n }, {\n 'name': 'precision',\n 'type': 'number',\n 'default': 2.5\n }]\n};\ninherits(Graticule, Transform, {\n transform(_, pulse) {\n var src = this.value,\n gen = this.generator,\n t;\n if (!src.length || _.modified()) {\n for (const prop in _) {\n if (isFunction(gen[prop])) {\n gen[prop](_[prop]);\n }\n }\n }\n t = gen();\n if (src.length) {\n pulse.mod.push(replace(src[0], t));\n } else {\n pulse.add.push(ingest(t));\n }\n src[0] = t;\n return pulse;\n }\n});\n\n/**\n * Render a heatmap image for input raster grid data.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} [params.field] - The field with raster grid\n * data. If unspecified, the tuple itself is interpreted as a raster grid.\n * @param {string} [params.color] - A constant color value or function for\n * individual pixel color. If a function, it will be invoked with an input\n * object that includes $x, $y, $value, and $max fields for the grid.\n * @param {number} [params.opacity] - A constant opacity value or function for\n * individual pixel opacity. If a function, it will be invoked with an input\n * object that includes $x, $y, $value, and $max fields for the grid.\n * @param {string} [params.resolve] - The method for resolving maximum values\n * across multiple input grids. If 'independent' (the default), maximum\n * calculation will be performed separately for each grid. If 'shared',\n * a single global maximum will be used for all input grids.\n * @param {string} [params.as='image'] - The output field in which to store\n * the generated bitmap canvas images (default 'image').\n */\nfunction Heatmap(params) {\n Transform.call(this, null, params);\n}\nHeatmap.Definition = {\n 'type': 'heatmap',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'color',\n 'type': 'string',\n 'expr': true\n }, {\n 'name': 'opacity',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'resolve',\n 'type': 'enum',\n 'values': ['shared', 'independent'],\n 'default': 'independent'\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'image'\n }]\n};\ninherits(Heatmap, Transform, {\n transform(_, pulse) {\n if (!pulse.changed() && !_.modified()) {\n return pulse.StopPropagation;\n }\n var source = pulse.materialize(pulse.SOURCE).source,\n shared = _.resolve === 'shared',\n field = _.field || identity,\n opacity = opacity_(_.opacity, _),\n color = color_(_.color, _),\n as = _.as || 'image',\n obj = {\n $x: 0,\n $y: 0,\n $value: 0,\n $max: shared ? max(source.map(t => max(field(t).values))) : 0\n };\n source.forEach(t => {\n const v = field(t);\n\n // build proxy data object\n const o = extend({}, t, obj);\n // set maximum value if not globally shared\n if (!shared) o.$max = max(v.values || []);\n\n // generate canvas image\n // optimize color/opacity if not pixel-dependent\n t[as] = toCanvas(v, o, color.dep ? color : constant(color(o)), opacity.dep ? opacity : constant(opacity(o)));\n });\n return pulse.reflow(true).modifies(as);\n }\n});\n\n// get image color function\nfunction color_(color, _) {\n let f;\n if (isFunction(color)) {\n f = obj => rgb(color(obj, _));\n f.dep = dependency(color);\n } else {\n // default to mid-grey\n f = constant(rgb(color || '#888'));\n }\n return f;\n}\n\n// get image opacity function\nfunction opacity_(opacity, _) {\n let f;\n if (isFunction(opacity)) {\n f = obj => opacity(obj, _);\n f.dep = dependency(opacity);\n } else if (opacity) {\n f = constant(opacity);\n } else {\n // default to [0, max] opacity gradient\n f = obj => obj.$value / obj.$max || 0;\n f.dep = true;\n }\n return f;\n}\n\n// check if function depends on individual pixel data\nfunction dependency(f) {\n if (!isFunction(f)) return false;\n const set = toSet(accessorFields(f));\n return set.$x || set.$y || set.$value || set.$max;\n}\n\n// render raster grid to canvas\nfunction toCanvas(grid, obj, color, opacity) {\n const n = grid.width,\n m = grid.height,\n x1 = grid.x1 || 0,\n y1 = grid.y1 || 0,\n x2 = grid.x2 || n,\n y2 = grid.y2 || m,\n val = grid.values,\n value = val ? i => val[i] : zero,\n can = canvas(x2 - x1, y2 - y1),\n ctx = can.getContext('2d'),\n img = ctx.getImageData(0, 0, x2 - x1, y2 - y1),\n pix = img.data;\n for (let j = y1, k = 0; j < y2; ++j) {\n obj.$y = j - y1;\n for (let i = x1, r = j * n; i < x2; ++i, k += 4) {\n obj.$x = i - x1;\n obj.$value = value(i + r);\n const v = color(obj);\n pix[k + 0] = v.r;\n pix[k + 1] = v.g;\n pix[k + 2] = v.b;\n pix[k + 3] = ~~(255 * opacity(obj));\n }\n }\n ctx.putImageData(img, 0, 0);\n return can;\n}\n\n/**\n * Maintains a cartographic projection.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction Projection(params) {\n Transform.call(this, null, params);\n this.modified(true); // always treat as modified\n}\n\ninherits(Projection, Transform, {\n transform(_, pulse) {\n let proj = this.value;\n if (!proj || _.modified('type')) {\n this.value = proj = create(_.type);\n projectionProperties.forEach(prop => {\n if (_[prop] != null) set(proj, prop, _[prop]);\n });\n } else {\n projectionProperties.forEach(prop => {\n if (_.modified(prop)) set(proj, prop, _[prop]);\n });\n }\n if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius);\n if (_.fit) fit(proj, _);\n return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n }\n});\nfunction fit(proj, _) {\n const data = collectGeoJSON(_.fit);\n _.extent ? proj.fitExtent(_.extent, data) : _.size ? proj.fitSize(_.size, data) : 0;\n}\nfunction create(type) {\n const constructor = projection((type || 'mercator').toLowerCase());\n if (!constructor) error('Unrecognized projection type: ' + type);\n return constructor();\n}\nfunction set(proj, key, value) {\n if (isFunction(proj[key])) proj[key](value);\n}\nfunction collectGeoJSON(data) {\n data = array(data);\n return data.length === 1 ? data[0] : {\n type: FeatureCollection,\n features: data.reduce((a, f) => a.concat(featurize(f)), [])\n };\n}\nfunction featurize(f) {\n return f.type === FeatureCollection ? f.features : array(f).filter(d => d != null).map(d => d.type === Feature ? d : {\n type: Feature,\n geometry: d\n });\n}\n\nexport { Contour as contour, GeoJSON as geojson, GeoPath as geopath, GeoPoint as geopoint, GeoShape as geoshape, Graticule as graticule, Heatmap as heatmap, Isocontour as isocontour, KDE2D as kde2d, Projection as projection };\n","export default function(d) {\n const x = +this._x.call(null, d),\n y = +this._y.call(null, d);\n return add(this.cover(x, y), x, y, d);\n}\n\nfunction add(tree, x, y, d) {\n if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points\n\n var parent,\n node = tree._root,\n leaf = {data: d},\n x0 = tree._x0,\n y0 = tree._y0,\n x1 = tree._x1,\n y1 = tree._y1,\n xm,\n ym,\n xp,\n yp,\n right,\n bottom,\n i,\n j;\n\n // If the tree is empty, initialize the root as a leaf.\n if (!node) return tree._root = leaf, tree;\n\n // Find the existing leaf for the new point, or add it.\n while (node.length) {\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;\n }\n\n // Is the new point is exactly coincident with the existing point?\n xp = +tree._x.call(null, node.data);\n yp = +tree._y.call(null, node.data);\n if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;\n\n // Otherwise, split the leaf node until the old and new point are separated.\n do {\n parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm)));\n return parent[j] = node, parent[i] = leaf, tree;\n}\n\nexport function addAll(data) {\n var d, i, n = data.length,\n x,\n y,\n xz = new Array(n),\n yz = new Array(n),\n x0 = Infinity,\n y0 = Infinity,\n x1 = -Infinity,\n y1 = -Infinity;\n\n // Compute the points and their extent.\n for (i = 0; i < n; ++i) {\n if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;\n xz[i] = x;\n yz[i] = y;\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n\n // If there were no (valid) points, abort.\n if (x0 > x1 || y0 > y1) return this;\n\n // Expand the tree to cover the new points.\n this.cover(x0, y0).cover(x1, y1);\n\n // Add the new points.\n for (i = 0; i < n; ++i) {\n add(this, xz[i], yz[i], data[i]);\n }\n\n return this;\n}\n","export default function(node, x0, y0, x1, y1) {\n this.node = node;\n this.x0 = x0;\n this.y0 = y0;\n this.x1 = x1;\n this.y1 = y1;\n}\n","export function defaultX(d) {\n return d[0];\n}\n\nexport default function(_) {\n return arguments.length ? (this._x = _, this) : this._x;\n}\n","export function defaultY(d) {\n return d[1];\n}\n\nexport default function(_) {\n return arguments.length ? (this._y = _, this) : this._y;\n}\n","import tree_add, {addAll as tree_addAll} from \"./add.js\";\nimport tree_cover from \"./cover.js\";\nimport tree_data from \"./data.js\";\nimport tree_extent from \"./extent.js\";\nimport tree_find from \"./find.js\";\nimport tree_remove, {removeAll as tree_removeAll} from \"./remove.js\";\nimport tree_root from \"./root.js\";\nimport tree_size from \"./size.js\";\nimport tree_visit from \"./visit.js\";\nimport tree_visitAfter from \"./visitAfter.js\";\nimport tree_x, {defaultX} from \"./x.js\";\nimport tree_y, {defaultY} from \"./y.js\";\n\nexport default function quadtree(nodes, x, y) {\n var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);\n return nodes == null ? tree : tree.addAll(nodes);\n}\n\nfunction Quadtree(x, y, x0, y0, x1, y1) {\n this._x = x;\n this._y = y;\n this._x0 = x0;\n this._y0 = y0;\n this._x1 = x1;\n this._y1 = y1;\n this._root = undefined;\n}\n\nfunction leaf_copy(leaf) {\n var copy = {data: leaf.data}, next = copy;\n while (leaf = leaf.next) next = next.next = {data: leaf.data};\n return copy;\n}\n\nvar treeProto = quadtree.prototype = Quadtree.prototype;\n\ntreeProto.copy = function() {\n var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1),\n node = this._root,\n nodes,\n child;\n\n if (!node) return copy;\n\n if (!node.length) return copy._root = leaf_copy(node), copy;\n\n nodes = [{source: node, target: copy._root = new Array(4)}];\n while (node = nodes.pop()) {\n for (var i = 0; i < 4; ++i) {\n if (child = node.source[i]) {\n if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)});\n else node.target[i] = leaf_copy(child);\n }\n }\n }\n\n return copy;\n};\n\ntreeProto.add = tree_add;\ntreeProto.addAll = tree_addAll;\ntreeProto.cover = tree_cover;\ntreeProto.data = tree_data;\ntreeProto.extent = tree_extent;\ntreeProto.find = tree_find;\ntreeProto.remove = tree_remove;\ntreeProto.removeAll = tree_removeAll;\ntreeProto.root = tree_root;\ntreeProto.size = tree_size;\ntreeProto.visit = tree_visit;\ntreeProto.visitAfter = tree_visitAfter;\ntreeProto.x = tree_x;\ntreeProto.y = tree_y;\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","export default function(random) {\n return (random() - 0.5) * 1e-6;\n}\n","import {quadtree} from \"d3-quadtree\";\nimport constant from \"./constant.js\";\nimport jiggle from \"./jiggle.js\";\n\nfunction x(d) {\n return d.x + d.vx;\n}\n\nfunction y(d) {\n return d.y + d.vy;\n}\n\nexport default function(radius) {\n var nodes,\n radii,\n random,\n strength = 1,\n iterations = 1;\n\n if (typeof radius !== \"function\") radius = constant(radius == null ? 1 : +radius);\n\n function force() {\n var i, n = nodes.length,\n tree,\n node,\n xi,\n yi,\n ri,\n ri2;\n\n for (var k = 0; k < iterations; ++k) {\n tree = quadtree(nodes, x, y).visitAfter(prepare);\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n ri = radii[node.index], ri2 = ri * ri;\n xi = node.x + node.vx;\n yi = node.y + node.vy;\n tree.visit(apply);\n }\n }\n\n function apply(quad, x0, y0, x1, y1) {\n var data = quad.data, rj = quad.r, r = ri + rj;\n if (data) {\n if (data.index > node.index) {\n var x = xi - data.x - data.vx,\n y = yi - data.y - data.vy,\n l = x * x + y * y;\n if (l < r * r) {\n if (x === 0) x = jiggle(random), l += x * x;\n if (y === 0) y = jiggle(random), l += y * y;\n l = (r - (l = Math.sqrt(l))) / l * strength;\n node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));\n node.vy += (y *= l) * r;\n data.vx -= x * (r = 1 - r);\n data.vy -= y * r;\n }\n }\n return;\n }\n return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;\n }\n }\n\n function prepare(quad) {\n if (quad.data) return quad.r = radii[quad.data.index];\n for (var i = quad.r = 0; i < 4; ++i) {\n if (quad[i] && quad[i].r > quad.r) {\n quad.r = quad[i].r;\n }\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, node;\n radii = new Array(n);\n for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);\n }\n\n force.initialize = function(_nodes, _random) {\n nodes = _nodes;\n random = _random;\n initialize();\n };\n\n force.iterations = function(_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = +_, force) : strength;\n };\n\n force.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : radius;\n };\n\n return force;\n}\n","export default function(x, y) {\n if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points\n\n var x0 = this._x0,\n y0 = this._y0,\n x1 = this._x1,\n y1 = this._y1;\n\n // If the quadtree has no extent, initialize them.\n // Integer extent are necessary so that if we later double the extent,\n // the existing quadrant boundaries don’t change due to floating point error!\n if (isNaN(x0)) {\n x1 = (x0 = Math.floor(x)) + 1;\n y1 = (y0 = Math.floor(y)) + 1;\n }\n\n // Otherwise, double repeatedly to cover.\n else {\n var z = x1 - x0 || 1,\n node = this._root,\n parent,\n i;\n\n while (x0 > x || x >= x1 || y0 > y || y >= y1) {\n i = (y < y0) << 1 | (x < x0);\n parent = new Array(4), parent[i] = node, node = parent, z *= 2;\n switch (i) {\n case 0: x1 = x0 + z, y1 = y0 + z; break;\n case 1: x0 = x1 - z, y1 = y0 + z; break;\n case 2: x1 = x0 + z, y0 = y1 - z; break;\n case 3: x0 = x1 - z, y0 = y1 - z; break;\n }\n }\n\n if (this._root && this._root.length) this._root = node;\n }\n\n this._x0 = x0;\n this._y0 = y0;\n this._x1 = x1;\n this._y1 = y1;\n return this;\n}\n","export default function() {\n var data = [];\n this.visit(function(node) {\n if (!node.length) do data.push(node.data); while (node = node.next)\n });\n return data;\n}\n","export default function(_) {\n return arguments.length\n ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1])\n : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];\n}\n","import Quad from \"./quad.js\";\n\nexport default function(x, y, radius) {\n var data,\n x0 = this._x0,\n y0 = this._y0,\n x1,\n y1,\n x2,\n y2,\n x3 = this._x1,\n y3 = this._y1,\n quads = [],\n node = this._root,\n q,\n i;\n\n if (node) quads.push(new Quad(node, x0, y0, x3, y3));\n if (radius == null) radius = Infinity;\n else {\n x0 = x - radius, y0 = y - radius;\n x3 = x + radius, y3 = y + radius;\n radius *= radius;\n }\n\n while (q = quads.pop()) {\n\n // Stop searching if this quadrant can’t contain a closer node.\n if (!(node = q.node)\n || (x1 = q.x0) > x3\n || (y1 = q.y0) > y3\n || (x2 = q.x1) < x0\n || (y2 = q.y1) < y0) continue;\n\n // Bisect the current quadrant.\n if (node.length) {\n var xm = (x1 + x2) / 2,\n ym = (y1 + y2) / 2;\n\n quads.push(\n new Quad(node[3], xm, ym, x2, y2),\n new Quad(node[2], x1, ym, xm, y2),\n new Quad(node[1], xm, y1, x2, ym),\n new Quad(node[0], x1, y1, xm, ym)\n );\n\n // Visit the closest quadrant first.\n if (i = (y >= ym) << 1 | (x >= xm)) {\n q = quads[quads.length - 1];\n quads[quads.length - 1] = quads[quads.length - 1 - i];\n quads[quads.length - 1 - i] = q;\n }\n }\n\n // Visit this point. (Visiting coincident points isn’t necessary!)\n else {\n var dx = x - +this._x.call(null, node.data),\n dy = y - +this._y.call(null, node.data),\n d2 = dx * dx + dy * dy;\n if (d2 < radius) {\n var d = Math.sqrt(radius = d2);\n x0 = x - d, y0 = y - d;\n x3 = x + d, y3 = y + d;\n data = node.data;\n }\n }\n }\n\n return data;\n}\n","export default function(d) {\n if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points\n\n var parent,\n node = this._root,\n retainer,\n previous,\n next,\n x0 = this._x0,\n y0 = this._y0,\n x1 = this._x1,\n y1 = this._y1,\n x,\n y,\n xm,\n ym,\n right,\n bottom,\n i,\n j;\n\n // If the tree is empty, initialize the root as a leaf.\n if (!node) return this;\n\n // Find the leaf node for the point.\n // While descending, also retain the deepest parent with a non-removed sibling.\n if (node.length) while (true) {\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n if (!(parent = node, node = node[i = bottom << 1 | right])) return this;\n if (!node.length) break;\n if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i;\n }\n\n // Find the point to remove.\n while (node.data !== d) if (!(previous = node, node = node.next)) return this;\n if (next = node.next) delete node.next;\n\n // If there are multiple coincident points, remove just the point.\n if (previous) return (next ? previous.next = next : delete previous.next), this;\n\n // If this is the root point, remove it.\n if (!parent) return this._root = next, this;\n\n // Remove this leaf.\n next ? parent[i] = next : delete parent[i];\n\n // If the parent now contains exactly one leaf, collapse superfluous parents.\n if ((node = parent[0] || parent[1] || parent[2] || parent[3])\n && node === (parent[3] || parent[2] || parent[1] || parent[0])\n && !node.length) {\n if (retainer) retainer[j] = node;\n else this._root = node;\n }\n\n return this;\n}\n\nexport function removeAll(data) {\n for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);\n return this;\n}\n","export default function() {\n return this._root;\n}\n","export default function() {\n var size = 0;\n this.visit(function(node) {\n if (!node.length) do ++size; while (node = node.next)\n });\n return size;\n}\n","import Quad from \"./quad.js\";\n\nexport default function(callback) {\n var quads = [], q, node = this._root, child, x0, y0, x1, y1;\n if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1));\n while (q = quads.pop()) {\n if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {\n var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;\n if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));\n if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));\n if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));\n if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));\n }\n }\n return this;\n}\n","import Quad from \"./quad.js\";\n\nexport default function(callback) {\n var quads = [], next = [], q;\n if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));\n while (q = quads.pop()) {\n var node = q.node;\n if (node.length) {\n var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;\n if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));\n if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));\n if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));\n if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));\n }\n next.push(q);\n }\n while (q = next.pop()) {\n callback(q.node, q.x0, q.y0, q.x1, q.y1);\n }\n return this;\n}\n","var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n","var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we’ve set an alarm, if we haven’t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n","// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use\nconst a = 1664525;\nconst c = 1013904223;\nconst m = 4294967296; // 2^32\n\nexport default function() {\n let s = 1;\n return () => (s = (a * s + c) % m) / m;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {timer} from \"d3-timer\";\nimport lcg from \"./lcg.js\";\n\nexport function x(d) {\n return d.x;\n}\n\nexport function y(d) {\n return d.y;\n}\n\nvar initialRadius = 10,\n initialAngle = Math.PI * (3 - Math.sqrt(5));\n\nexport default function(nodes) {\n var simulation,\n alpha = 1,\n alphaMin = 0.001,\n alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),\n alphaTarget = 0,\n velocityDecay = 0.6,\n forces = new Map(),\n stepper = timer(step),\n event = dispatch(\"tick\", \"end\"),\n random = lcg();\n\n if (nodes == null) nodes = [];\n\n function step() {\n tick();\n event.call(\"tick\", simulation);\n if (alpha < alphaMin) {\n stepper.stop();\n event.call(\"end\", simulation);\n }\n }\n\n function tick(iterations) {\n var i, n = nodes.length, node;\n\n if (iterations === undefined) iterations = 1;\n\n for (var k = 0; k < iterations; ++k) {\n alpha += (alphaTarget - alpha) * alphaDecay;\n\n forces.forEach(function(force) {\n force(alpha);\n });\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (node.fx == null) node.x += node.vx *= velocityDecay;\n else node.x = node.fx, node.vx = 0;\n if (node.fy == null) node.y += node.vy *= velocityDecay;\n else node.y = node.fy, node.vy = 0;\n }\n }\n\n return simulation;\n }\n\n function initializeNodes() {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.index = i;\n if (node.fx != null) node.x = node.fx;\n if (node.fy != null) node.y = node.fy;\n if (isNaN(node.x) || isNaN(node.y)) {\n var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle;\n node.x = radius * Math.cos(angle);\n node.y = radius * Math.sin(angle);\n }\n if (isNaN(node.vx) || isNaN(node.vy)) {\n node.vx = node.vy = 0;\n }\n }\n }\n\n function initializeForce(force) {\n if (force.initialize) force.initialize(nodes, random);\n return force;\n }\n\n initializeNodes();\n\n return simulation = {\n tick: tick,\n\n restart: function() {\n return stepper.restart(step), simulation;\n },\n\n stop: function() {\n return stepper.stop(), simulation;\n },\n\n nodes: function(_) {\n return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes;\n },\n\n alpha: function(_) {\n return arguments.length ? (alpha = +_, simulation) : alpha;\n },\n\n alphaMin: function(_) {\n return arguments.length ? (alphaMin = +_, simulation) : alphaMin;\n },\n\n alphaDecay: function(_) {\n return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;\n },\n\n alphaTarget: function(_) {\n return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;\n },\n\n velocityDecay: function(_) {\n return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;\n },\n\n randomSource: function(_) {\n return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random;\n },\n\n force: function(name, _) {\n return arguments.length > 1 ? ((_ == null ? forces.delete(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);\n },\n\n find: function(x, y, radius) {\n var i = 0,\n n = nodes.length,\n dx,\n dy,\n d2,\n node,\n closest;\n\n if (radius == null) radius = Infinity;\n else radius *= radius;\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n dx = x - node.x;\n dy = y - node.y;\n d2 = dx * dx + dy * dy;\n if (d2 < radius) closest = node, radius = d2;\n }\n\n return closest;\n },\n\n on: function(name, _) {\n return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);\n }\n };\n}\n","import constant from \"./constant.js\";\nimport jiggle from \"./jiggle.js\";\n\nfunction index(d) {\n return d.index;\n}\n\nfunction find(nodeById, nodeId) {\n var node = nodeById.get(nodeId);\n if (!node) throw new Error(\"node not found: \" + nodeId);\n return node;\n}\n\nexport default function(links) {\n var id = index,\n strength = defaultStrength,\n strengths,\n distance = constant(30),\n distances,\n nodes,\n count,\n bias,\n random,\n iterations = 1;\n\n if (links == null) links = [];\n\n function defaultStrength(link) {\n return 1 / Math.min(count[link.source.index], count[link.target.index]);\n }\n\n function force(alpha) {\n for (var k = 0, n = links.length; k < iterations; ++k) {\n for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {\n link = links[i], source = link.source, target = link.target;\n x = target.x + target.vx - source.x - source.vx || jiggle(random);\n y = target.y + target.vy - source.y - source.vy || jiggle(random);\n l = Math.sqrt(x * x + y * y);\n l = (l - distances[i]) / l * alpha * strengths[i];\n x *= l, y *= l;\n target.vx -= x * (b = bias[i]);\n target.vy -= y * b;\n source.vx += x * (b = 1 - b);\n source.vy += y * b;\n }\n }\n }\n\n function initialize() {\n if (!nodes) return;\n\n var i,\n n = nodes.length,\n m = links.length,\n nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d])),\n link;\n\n for (i = 0, count = new Array(n); i < m; ++i) {\n link = links[i], link.index = i;\n if (typeof link.source !== \"object\") link.source = find(nodeById, link.source);\n if (typeof link.target !== \"object\") link.target = find(nodeById, link.target);\n count[link.source.index] = (count[link.source.index] || 0) + 1;\n count[link.target.index] = (count[link.target.index] || 0) + 1;\n }\n\n for (i = 0, bias = new Array(m); i < m; ++i) {\n link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);\n }\n\n strengths = new Array(m), initializeStrength();\n distances = new Array(m), initializeDistance();\n }\n\n function initializeStrength() {\n if (!nodes) return;\n\n for (var i = 0, n = links.length; i < n; ++i) {\n strengths[i] = +strength(links[i], i, links);\n }\n }\n\n function initializeDistance() {\n if (!nodes) return;\n\n for (var i = 0, n = links.length; i < n; ++i) {\n distances[i] = +distance(links[i], i, links);\n }\n }\n\n force.initialize = function(_nodes, _random) {\n nodes = _nodes;\n random = _random;\n initialize();\n };\n\n force.links = function(_) {\n return arguments.length ? (links = _, initialize(), force) : links;\n };\n\n force.id = function(_) {\n return arguments.length ? (id = _, force) : id;\n };\n\n force.iterations = function(_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initializeStrength(), force) : strength;\n };\n\n force.distance = function(_) {\n return arguments.length ? (distance = typeof _ === \"function\" ? _ : constant(+_), initializeDistance(), force) : distance;\n };\n\n return force;\n}\n","import { Transform } from 'vega-dataflow';\nimport { inherits, array, isFunction, accessorFields, hasOwnProperty, error } from 'vega-util';\nimport { forceSimulation, forceCenter, forceCollide, forceManyBody, forceLink, forceX, forceY } from 'd3-force';\n\nconst ForceMap = {\n center: forceCenter,\n collide: forceCollide,\n nbody: forceManyBody,\n link: forceLink,\n x: forceX,\n y: forceY\n};\nconst Forces = 'forces',\n ForceParams = ['alpha', 'alphaMin', 'alphaTarget', 'velocityDecay', 'forces'],\n ForceConfig = ['static', 'iterations'],\n ForceOutput = ['x', 'y', 'vx', 'vy'];\n\n/**\n * Force simulation layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.forces - The forces to apply.\n */\nfunction Force(params) {\n Transform.call(this, null, params);\n}\nForce.Definition = {\n 'type': 'Force',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'static',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'restart',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'iterations',\n 'type': 'number',\n 'default': 300\n }, {\n 'name': 'alpha',\n 'type': 'number',\n 'default': 1\n }, {\n 'name': 'alphaMin',\n 'type': 'number',\n 'default': 0.001\n }, {\n 'name': 'alphaTarget',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'velocityDecay',\n 'type': 'number',\n 'default': 0.4\n }, {\n 'name': 'forces',\n 'type': 'param',\n 'array': true,\n 'params': [{\n 'key': {\n 'force': 'center'\n },\n 'params': [{\n 'name': 'x',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'y',\n 'type': 'number',\n 'default': 0\n }]\n }, {\n 'key': {\n 'force': 'collide'\n },\n 'params': [{\n 'name': 'radius',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'strength',\n 'type': 'number',\n 'default': 0.7\n }, {\n 'name': 'iterations',\n 'type': 'number',\n 'default': 1\n }]\n }, {\n 'key': {\n 'force': 'nbody'\n },\n 'params': [{\n 'name': 'strength',\n 'type': 'number',\n 'default': -30,\n 'expr': true\n }, {\n 'name': 'theta',\n 'type': 'number',\n 'default': 0.9\n }, {\n 'name': 'distanceMin',\n 'type': 'number',\n 'default': 1\n }, {\n 'name': 'distanceMax',\n 'type': 'number'\n }]\n }, {\n 'key': {\n 'force': 'link'\n },\n 'params': [{\n 'name': 'links',\n 'type': 'data'\n }, {\n 'name': 'id',\n 'type': 'field'\n }, {\n 'name': 'distance',\n 'type': 'number',\n 'default': 30,\n 'expr': true\n }, {\n 'name': 'strength',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'iterations',\n 'type': 'number',\n 'default': 1\n }]\n }, {\n 'key': {\n 'force': 'x'\n },\n 'params': [{\n 'name': 'strength',\n 'type': 'number',\n 'default': 0.1\n }, {\n 'name': 'x',\n 'type': 'field'\n }]\n }, {\n 'key': {\n 'force': 'y'\n },\n 'params': [{\n 'name': 'strength',\n 'type': 'number',\n 'default': 0.1\n }, {\n 'name': 'y',\n 'type': 'field'\n }]\n }]\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'modify': false,\n 'default': ForceOutput\n }]\n};\ninherits(Force, Transform, {\n transform(_, pulse) {\n var sim = this.value,\n change = pulse.changed(pulse.ADD_REM),\n params = _.modified(ForceParams),\n iters = _.iterations || 300;\n\n // configure simulation\n if (!sim) {\n this.value = sim = simulation(pulse.source, _);\n sim.on('tick', rerun(pulse.dataflow, this));\n if (!_.static) {\n change = true;\n sim.tick(); // ensure we run on init\n }\n\n pulse.modifies('index');\n } else {\n if (change) {\n pulse.modifies('index');\n sim.nodes(pulse.source);\n }\n if (params || pulse.changed(pulse.MOD)) {\n setup(sim, _, 0, pulse);\n }\n }\n\n // run simulation\n if (params || change || _.modified(ForceConfig) || pulse.changed() && _.restart) {\n sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters));\n if (_.static) {\n for (sim.stop(); --iters >= 0;) sim.tick();\n } else {\n if (sim.stopped()) sim.restart();\n if (!change) return pulse.StopPropagation; // defer to sim ticks\n }\n }\n\n return this.finish(_, pulse);\n },\n finish(_, pulse) {\n const dataflow = pulse.dataflow;\n\n // inspect dependencies, touch link source data\n for (let args = this._argops, j = 0, m = args.length, arg; j < m; ++j) {\n arg = args[j];\n if (arg.name !== Forces || arg.op._argval.force !== 'link') {\n continue;\n }\n for (var ops = arg.op._argops, i = 0, n = ops.length, op; i < n; ++i) {\n if (ops[i].name === 'links' && (op = ops[i].op.source)) {\n dataflow.pulse(op, dataflow.changeset().reflow());\n break;\n }\n }\n }\n\n // reflow all nodes\n return pulse.reflow(_.modified()).modifies(ForceOutput);\n }\n});\nfunction rerun(df, op) {\n return () => df.touch(op).run();\n}\nfunction simulation(nodes, _) {\n const sim = forceSimulation(nodes),\n stop = sim.stop,\n restart = sim.restart;\n let stopped = false;\n sim.stopped = () => stopped;\n sim.restart = () => (stopped = false, restart());\n sim.stop = () => (stopped = true, stop());\n return setup(sim, _, true).on('end', () => stopped = true);\n}\nfunction setup(sim, _, init, pulse) {\n var f = array(_.forces),\n i,\n n,\n p,\n name;\n for (i = 0, n = ForceParams.length; i < n; ++i) {\n p = ForceParams[i];\n if (p !== Forces && _.modified(p)) sim[p](_[p]);\n }\n for (i = 0, n = f.length; i < n; ++i) {\n name = Forces + i;\n p = init || _.modified(Forces, i) ? getForce(f[i]) : pulse && modified(f[i], pulse) ? sim.force(name) : null;\n if (p) sim.force(name, p);\n }\n for (n = sim.numForces || 0; i < n; ++i) {\n sim.force(Forces + i, null); // remove\n }\n\n sim.numForces = f.length;\n return sim;\n}\nfunction modified(f, pulse) {\n var k, v;\n for (k in f) {\n if (isFunction(v = f[k]) && pulse.modified(accessorFields(v))) return 1;\n }\n return 0;\n}\nfunction getForce(_) {\n var f, p;\n if (!hasOwnProperty(ForceMap, _.force)) {\n error('Unrecognized force: ' + _.force);\n }\n f = ForceMap[_.force]();\n for (p in _) {\n if (isFunction(f[p])) setForceParam(f[p], _[p], _);\n }\n return f;\n}\nfunction setForceParam(f, v, _) {\n f(isFunction(v) ? d => v(d, _) : v);\n}\n\nexport { Force as force };\n","export default function(x, y) {\n var nodes, strength = 1;\n\n if (x == null) x = 0;\n if (y == null) y = 0;\n\n function force() {\n var i,\n n = nodes.length,\n node,\n sx = 0,\n sy = 0;\n\n for (i = 0; i < n; ++i) {\n node = nodes[i], sx += node.x, sy += node.y;\n }\n\n for (sx = (sx / n - x) * strength, sy = (sy / n - y) * strength, i = 0; i < n; ++i) {\n node = nodes[i], node.x -= sx, node.y -= sy;\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n };\n\n force.x = function(_) {\n return arguments.length ? (x = +_, force) : x;\n };\n\n force.y = function(_) {\n return arguments.length ? (y = +_, force) : y;\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = +_, force) : strength;\n };\n\n return force;\n}\n","import {quadtree} from \"d3-quadtree\";\nimport constant from \"./constant.js\";\nimport jiggle from \"./jiggle.js\";\nimport {x, y} from \"./simulation.js\";\n\nexport default function() {\n var nodes,\n node,\n random,\n alpha,\n strength = constant(-30),\n strengths,\n distanceMin2 = 1,\n distanceMax2 = Infinity,\n theta2 = 0.81;\n\n function force(_) {\n var i, n = nodes.length, tree = quadtree(nodes, x, y).visitAfter(accumulate);\n for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, node;\n strengths = new Array(n);\n for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);\n }\n\n function accumulate(quad) {\n var strength = 0, q, c, weight = 0, x, y, i;\n\n // For internal nodes, accumulate forces from child quadrants.\n if (quad.length) {\n for (x = y = i = 0; i < 4; ++i) {\n if ((q = quad[i]) && (c = Math.abs(q.value))) {\n strength += q.value, weight += c, x += c * q.x, y += c * q.y;\n }\n }\n quad.x = x / weight;\n quad.y = y / weight;\n }\n\n // For leaf nodes, accumulate forces from coincident quadrants.\n else {\n q = quad;\n q.x = q.data.x;\n q.y = q.data.y;\n do strength += strengths[q.data.index];\n while (q = q.next);\n }\n\n quad.value = strength;\n }\n\n function apply(quad, x1, _, x2) {\n if (!quad.value) return true;\n\n var x = quad.x - node.x,\n y = quad.y - node.y,\n w = x2 - x1,\n l = x * x + y * y;\n\n // Apply the Barnes-Hut approximation if possible.\n // Limit forces for very close nodes; randomize direction if coincident.\n if (w * w / theta2 < l) {\n if (l < distanceMax2) {\n if (x === 0) x = jiggle(random), l += x * x;\n if (y === 0) y = jiggle(random), l += y * y;\n if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);\n node.vx += x * quad.value * alpha / l;\n node.vy += y * quad.value * alpha / l;\n }\n return true;\n }\n\n // Otherwise, process points directly.\n else if (quad.length || l >= distanceMax2) return;\n\n // Limit forces for very close nodes; randomize direction if coincident.\n if (quad.data !== node || quad.next) {\n if (x === 0) x = jiggle(random), l += x * x;\n if (y === 0) y = jiggle(random), l += y * y;\n if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);\n }\n\n do if (quad.data !== node) {\n w = strengths[quad.data.index] * alpha / l;\n node.vx += x * w;\n node.vy += y * w;\n } while (quad = quad.next);\n }\n\n force.initialize = function(_nodes, _random) {\n nodes = _nodes;\n random = _random;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n };\n\n force.distanceMin = function(_) {\n return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);\n };\n\n force.distanceMax = function(_) {\n return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);\n };\n\n force.theta = function(_) {\n return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);\n };\n\n return force;\n}\n","import constant from \"./constant.js\";\n\nexport default function(x) {\n var strength = constant(0.1),\n nodes,\n strengths,\n xz;\n\n if (typeof x !== \"function\") x = constant(x == null ? 0 : +x);\n\n function force(alpha) {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n xz = new Array(n);\n for (i = 0; i < n; ++i) {\n strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n };\n\n force.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : x;\n };\n\n return force;\n}\n","import constant from \"./constant.js\";\n\nexport default function(y) {\n var strength = constant(0.1),\n nodes,\n strengths,\n yz;\n\n if (typeof y !== \"function\") y = constant(y == null ? 0 : +y);\n\n function force(alpha) {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n yz = new Array(n);\n for (i = 0; i < n; ++i) {\n strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n };\n\n force.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : y;\n };\n\n return force;\n}\n","function count(node) {\n var sum = 0,\n children = node.children,\n i = children && children.length;\n if (!i) sum = 1;\n else while (--i >= 0) sum += children[i].value;\n node.value = sum;\n}\n\nexport default function() {\n return this.eachAfter(count);\n}\n","import node_count from \"./count.js\";\nimport node_each from \"./each.js\";\nimport node_eachBefore from \"./eachBefore.js\";\nimport node_eachAfter from \"./eachAfter.js\";\nimport node_find from \"./find.js\";\nimport node_sum from \"./sum.js\";\nimport node_sort from \"./sort.js\";\nimport node_path from \"./path.js\";\nimport node_ancestors from \"./ancestors.js\";\nimport node_descendants from \"./descendants.js\";\nimport node_leaves from \"./leaves.js\";\nimport node_links from \"./links.js\";\nimport node_iterator from \"./iterator.js\";\n\nexport default function hierarchy(data, children) {\n if (data instanceof Map) {\n data = [undefined, data];\n if (children === undefined) children = mapChildren;\n } else if (children === undefined) {\n children = objectChildren;\n }\n\n var root = new Node(data),\n node,\n nodes = [root],\n child,\n childs,\n i,\n n;\n\n while (node = nodes.pop()) {\n if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {\n node.children = childs;\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = childs[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n\n return root.eachBefore(computeHeight);\n}\n\nfunction node_copy() {\n return hierarchy(this).eachBefore(copyData);\n}\n\nfunction objectChildren(d) {\n return d.children;\n}\n\nfunction mapChildren(d) {\n return Array.isArray(d) ? d[1] : null;\n}\n\nfunction copyData(node) {\n if (node.data.value !== undefined) node.value = node.data.value;\n node.data = node.data.data;\n}\n\nexport function computeHeight(node) {\n var height = 0;\n do node.height = height;\n while ((node = node.parent) && (node.height < ++height));\n}\n\nexport function Node(data) {\n this.data = data;\n this.depth =\n this.height = 0;\n this.parent = null;\n}\n\nNode.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n find: node_find,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy,\n [Symbol.iterator]: node_iterator\n};\n","export function optional(f) {\n return f == null ? null : required(f);\n}\n\nexport function required(f) {\n if (typeof f !== \"function\") throw new Error;\n return f;\n}\n","export function constantZero() {\n return 0;\n}\n\nexport default function(x) {\n return function() {\n return x;\n };\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], next = [], children, i, n, index = -1;\n while (node = nodes.pop()) {\n next.push(node);\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n }\n while (node = next.pop()) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], children, i, index = -1;\n while (node = nodes.pop()) {\n callback.call(that, node, ++index, this);\n if (children = node.children) {\n for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n }\n return this;\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n if (callback.call(that, node, ++index, this)) {\n return node;\n }\n }\n}\n","export default function(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0,\n children = node.children,\n i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n}\n","export default function(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n}\n","export default function(end) {\n var start = this,\n ancestor = leastCommonAncestor(start, end),\n nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n}\n\nfunction leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(),\n bNodes = b.ancestors(),\n c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n}\n","export default function() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n}\n","export default function() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) { // Don’t include the root’s parent, if any.\n links.push({source: node.parent, target: node});\n }\n });\n return links;\n}\n","export default function*() {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n yield node;\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n }\n } while (next.length);\n}\n","// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use\nconst a = 1664525;\nconst c = 1013904223;\nconst m = 4294967296; // 2^32\n\nexport default function() {\n let s = 1;\n return () => (s = (a * s + c) % m) / m;\n}\n","import {shuffle} from \"../array.js\";\nimport lcg from \"../lcg.js\";\n\nexport default function(circles) {\n return packEncloseRandom(circles, lcg());\n}\n\nexport function packEncloseRandom(circles, random) {\n var i = 0, n = (circles = shuffle(Array.from(circles), random)).length, B = [], p, e;\n\n while (i < n) {\n p = circles[i];\n if (e && enclosesWeak(e, p)) ++i;\n else e = encloseBasis(B = extendBasis(B, p)), i = 0;\n }\n\n return e;\n}\n\nfunction extendBasis(B, p) {\n var i, j;\n\n if (enclosesWeakAll(p, B)) return [p];\n\n // If we get here then B must have at least one element.\n for (i = 0; i < B.length; ++i) {\n if (enclosesNot(p, B[i])\n && enclosesWeakAll(encloseBasis2(B[i], p), B)) {\n return [B[i], p];\n }\n }\n\n // If we get here then B must have at least two elements.\n for (i = 0; i < B.length - 1; ++i) {\n for (j = i + 1; j < B.length; ++j) {\n if (enclosesNot(encloseBasis2(B[i], B[j]), p)\n && enclosesNot(encloseBasis2(B[i], p), B[j])\n && enclosesNot(encloseBasis2(B[j], p), B[i])\n && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) {\n return [B[i], B[j], p];\n }\n }\n }\n\n // If we get here then something is very wrong.\n throw new Error;\n}\n\nfunction enclosesNot(a, b) {\n var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y;\n return dr < 0 || dr * dr < dx * dx + dy * dy;\n}\n\nfunction enclosesWeak(a, b) {\n var dr = a.r - b.r + Math.max(a.r, b.r, 1) * 1e-9, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n}\n\nfunction enclosesWeakAll(a, B) {\n for (var i = 0; i < B.length; ++i) {\n if (!enclosesWeak(a, B[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction encloseBasis(B) {\n switch (B.length) {\n case 1: return encloseBasis1(B[0]);\n case 2: return encloseBasis2(B[0], B[1]);\n case 3: return encloseBasis3(B[0], B[1], B[2]);\n }\n}\n\nfunction encloseBasis1(a) {\n return {\n x: a.x,\n y: a.y,\n r: a.r\n };\n}\n\nfunction encloseBasis2(a, b) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1,\n l = Math.sqrt(x21 * x21 + y21 * y21);\n return {\n x: (x1 + x2 + x21 / l * r21) / 2,\n y: (y1 + y2 + y21 / l * r21) / 2,\n r: (l + r1 + r2) / 2\n };\n}\n\nfunction encloseBasis3(a, b, c) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x3 = c.x, y3 = c.y, r3 = c.r,\n a2 = x1 - x2,\n a3 = x1 - x3,\n b2 = y1 - y2,\n b3 = y1 - y3,\n c2 = r2 - r1,\n c3 = r3 - r1,\n d1 = x1 * x1 + y1 * y1 - r1 * r1,\n d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2,\n d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3,\n ab = a3 * b2 - a2 * b3,\n xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1,\n xb = (b3 * c2 - b2 * c3) / ab,\n ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1,\n yb = (a2 * c3 - a3 * c2) / ab,\n A = xb * xb + yb * yb - 1,\n B = 2 * (r1 + xa * xb + ya * yb),\n C = xa * xa + ya * ya - r1 * r1,\n r = -(Math.abs(A) > 1e-6 ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B);\n return {\n x: x1 + xa + xb * r,\n y: y1 + ya + yb * r,\n r: r\n };\n}\n","import array from \"../array.js\";\nimport lcg from \"../lcg.js\";\nimport {packEncloseRandom} from \"./enclose.js\";\n\nfunction place(b, a, c) {\n var dx = b.x - a.x, x, a2,\n dy = b.y - a.y, y, b2,\n d2 = dx * dx + dy * dy;\n if (d2) {\n a2 = a.r + c.r, a2 *= a2;\n b2 = b.r + c.r, b2 *= b2;\n if (a2 > b2) {\n x = (d2 + b2 - a2) / (2 * d2);\n y = Math.sqrt(Math.max(0, b2 / d2 - x * x));\n c.x = b.x - x * dx - y * dy;\n c.y = b.y - x * dy + y * dx;\n } else {\n x = (d2 + a2 - b2) / (2 * d2);\n y = Math.sqrt(Math.max(0, a2 / d2 - x * x));\n c.x = a.x + x * dx - y * dy;\n c.y = a.y + x * dy + y * dx;\n }\n } else {\n c.x = a.x + c.r;\n c.y = a.y;\n }\n}\n\nfunction intersects(a, b) {\n var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n}\n\nfunction score(node) {\n var a = node._,\n b = node.next._,\n ab = a.r + b.r,\n dx = (a.x * b.r + b.x * a.r) / ab,\n dy = (a.y * b.r + b.y * a.r) / ab;\n return dx * dx + dy * dy;\n}\n\nfunction Node(circle) {\n this._ = circle;\n this.next = null;\n this.previous = null;\n}\n\nexport function packSiblingsRandom(circles, random) {\n if (!(n = (circles = array(circles)).length)) return 0;\n\n var a, b, c, n, aa, ca, i, j, k, sj, sk;\n\n // Place the first circle.\n a = circles[0], a.x = 0, a.y = 0;\n if (!(n > 1)) return a.r;\n\n // Place the second circle.\n b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0;\n if (!(n > 2)) return a.r + b.r;\n\n // Place the third circle.\n place(b, a, c = circles[2]);\n\n // Initialize the front-chain using the first three circles a, b and c.\n a = new Node(a), b = new Node(b), c = new Node(c);\n a.next = c.previous = b;\n b.next = a.previous = c;\n c.next = b.previous = a;\n\n // Attempt to place each remaining circle…\n pack: for (i = 3; i < n; ++i) {\n place(a._, b._, c = circles[i]), c = new Node(c);\n\n // Find the closest intersecting circle on the front-chain, if any.\n // “Closeness” is determined by linear distance along the front-chain.\n // “Ahead” or “behind” is likewise determined by linear distance.\n j = b.next, k = a.previous, sj = b._.r, sk = a._.r;\n do {\n if (sj <= sk) {\n if (intersects(j._, c._)) {\n b = j, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sj += j._.r, j = j.next;\n } else {\n if (intersects(k._, c._)) {\n a = k, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sk += k._.r, k = k.previous;\n }\n } while (j !== k.next);\n\n // Success! Insert the new circle c between a and b.\n c.previous = a, c.next = b, a.next = b.previous = b = c;\n\n // Compute the new closest circle pair to the centroid.\n aa = score(a);\n while ((c = c.next) !== b) {\n if ((ca = score(c)) < aa) {\n a = c, aa = ca;\n }\n }\n b = a.next;\n }\n\n // Compute the enclosing circle of the front chain.\n a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = packEncloseRandom(a, random);\n\n // Translate the circles to put the enclosing circle around the origin.\n for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;\n\n return c.r;\n}\n\nexport default function(circles) {\n packSiblingsRandom(circles, lcg());\n return circles;\n}\n","export default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n\nexport function shuffle(array, random) {\n let m = array.length,\n t,\n i;\n\n while (m) {\n i = random() * m-- | 0;\n t = array[m];\n array[m] = array[i];\n array[i] = t;\n }\n\n return array;\n}\n","import {optional} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\nimport lcg from \"../lcg.js\";\nimport {packSiblingsRandom} from \"./siblings.js\";\n\nfunction defaultRadius(d) {\n return Math.sqrt(d.value);\n}\n\nexport default function() {\n var radius = null,\n dx = 1,\n dy = 1,\n padding = constantZero;\n\n function pack(root) {\n const random = lcg();\n root.x = dx / 2, root.y = dy / 2;\n if (radius) {\n root.eachBefore(radiusLeaf(radius))\n .eachAfter(packChildrenRandom(padding, 0.5, random))\n .eachBefore(translateChild(1));\n } else {\n root.eachBefore(radiusLeaf(defaultRadius))\n .eachAfter(packChildrenRandom(constantZero, 1, random))\n .eachAfter(packChildrenRandom(padding, root.r / Math.min(dx, dy), random))\n .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));\n }\n return root;\n }\n\n pack.radius = function(x) {\n return arguments.length ? (radius = optional(x), pack) : radius;\n };\n\n pack.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy];\n };\n\n pack.padding = function(x) {\n return arguments.length ? (padding = typeof x === \"function\" ? x : constant(+x), pack) : padding;\n };\n\n return pack;\n}\n\nfunction radiusLeaf(radius) {\n return function(node) {\n if (!node.children) {\n node.r = Math.max(0, +radius(node) || 0);\n }\n };\n}\n\nfunction packChildrenRandom(padding, k, random) {\n return function(node) {\n if (children = node.children) {\n var children,\n i,\n n = children.length,\n r = padding(node) * k || 0,\n e;\n\n if (r) for (i = 0; i < n; ++i) children[i].r += r;\n e = packSiblingsRandom(children, random);\n if (r) for (i = 0; i < n; ++i) children[i].r -= r;\n node.r = e + r;\n }\n };\n}\n\nfunction translateChild(k) {\n return function(node) {\n var parent = node.parent;\n node.r *= k;\n if (parent) {\n node.x = parent.x + k * node.x;\n node.y = parent.y + k * node.y;\n }\n };\n}\n","export default function(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (x1 - x0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n}\n","import {optional} from \"./accessors.js\";\nimport {Node, computeHeight} from \"./hierarchy/index.js\";\n\nvar preroot = {depth: -1},\n ambiguous = {},\n imputed = {};\n\nfunction defaultId(d) {\n return d.id;\n}\n\nfunction defaultParentId(d) {\n return d.parentId;\n}\n\nexport default function() {\n var id = defaultId,\n parentId = defaultParentId,\n path;\n\n function stratify(data) {\n var nodes = Array.from(data),\n currentId = id,\n currentParentId = parentId,\n n,\n d,\n i,\n root,\n parent,\n node,\n nodeId,\n nodeKey,\n nodeByKey = new Map;\n\n if (path != null) {\n const I = nodes.map((d, i) => normalize(path(d, i, data)));\n const P = I.map(parentof);\n const S = new Set(I).add(\"\");\n for (const i of P) {\n if (!S.has(i)) {\n S.add(i);\n I.push(i);\n P.push(parentof(i));\n nodes.push(imputed);\n }\n }\n currentId = (_, i) => I[i];\n currentParentId = (_, i) => P[i];\n }\n\n for (i = 0, n = nodes.length; i < n; ++i) {\n d = nodes[i], node = nodes[i] = new Node(d);\n if ((nodeId = currentId(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = node.id = nodeId;\n nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);\n }\n if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += \"\")) {\n node.parent = nodeId;\n }\n }\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (nodeId = node.parent) {\n parent = nodeByKey.get(nodeId);\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n } else {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n }\n }\n\n if (!root) throw new Error(\"no root\");\n\n // When imputing internal nodes, only introduce roots if needed.\n // Then replace the imputed marker data with null.\n if (path != null) {\n while (root.data === imputed && root.children.length === 1) {\n root = root.children[0], --n;\n }\n for (let i = nodes.length - 1; i >= 0; --i) {\n node = nodes[i];\n if (node.data !== imputed) break;\n node.data = null;\n }\n }\n\n root.parent = preroot;\n root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n\n return root;\n }\n\n stratify.id = function(x) {\n return arguments.length ? (id = optional(x), stratify) : id;\n };\n\n stratify.parentId = function(x) {\n return arguments.length ? (parentId = optional(x), stratify) : parentId;\n };\n\n stratify.path = function(x) {\n return arguments.length ? (path = optional(x), stratify) : path;\n };\n\n return stratify;\n}\n\n// To normalize a path, we coerce to a string, strip the trailing slash if any\n// (as long as the trailing slash is not immediately preceded by another slash),\n// and add leading slash if missing.\nfunction normalize(path) {\n path = `${path}`;\n let i = path.length;\n if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1);\n return path[0] === \"/\" ? path : `/${path}`;\n}\n\n// Walk backwards to find the first slash that is not the leading slash, e.g.:\n// \"/foo/bar\" ⇥ \"/foo\", \"/foo\" ⇥ \"/\", \"/\" ↦ \"\". (The root is special-cased\n// because the id of the root must be a truthy value.)\nfunction parentof(path) {\n let i = path.length;\n if (i < 2) return \"\";\n while (--i > 1) if (slash(path, i)) break;\n return path.slice(0, i);\n}\n\n// Slashes can be escaped; to determine whether a slash is a path delimiter, we\n// count the number of preceding backslashes escaping the forward slash: an odd\n// number indicates an escaped forward slash.\nfunction slash(path, i) {\n if (path[i] === \"/\") {\n let k = 0;\n while (i > 0 && path[--i] === \"\\\\\") ++k;\n if ((k & 1) === 0) return true;\n }\n return false;\n}\n","import {Node} from \"./hierarchy/index.js\";\n\nfunction defaultSeparation(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\n// function radialSeparation(a, b) {\n// return (a.parent === b.parent ? 1 : 2) / a.depth;\n// }\n\n// This function is used to traverse the left contour of a subtree (or\n// subforest). It returns the successor of v on this contour. This successor is\n// either given by the leftmost child of v or by the thread of v. The function\n// returns null if and only if v is on the highest level of its subtree.\nfunction nextLeft(v) {\n var children = v.children;\n return children ? children[0] : v.t;\n}\n\n// This function works analogously to nextLeft.\nfunction nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}\n\n// Shifts the current subtree rooted at w+. This is done by increasing\n// prelim(w+) and mod(w+) by shift.\nfunction moveSubtree(wm, wp, shift) {\n var change = shift / (wp.i - wm.i);\n wp.c -= change;\n wp.s += shift;\n wm.c += change;\n wp.z += shift;\n wp.m += shift;\n}\n\n// All other shifts, applied to the smaller subtrees between w- and w+, are\n// performed by this function. To prepare the shifts, we have to adjust\n// change(w+), shift(w+), and change(w-).\nfunction executeShifts(v) {\n var shift = 0,\n change = 0,\n children = v.children,\n i = children.length,\n w;\n while (--i >= 0) {\n w = children[i];\n w.z += shift;\n w.m += shift;\n shift += w.s + (change += w.c);\n }\n}\n\n// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise,\n// returns the specified (default) ancestor.\nfunction nextAncestor(vim, v, ancestor) {\n return vim.a.parent === v.parent ? vim.a : ancestor;\n}\n\nfunction TreeNode(node, i) {\n this._ = node;\n this.parent = null;\n this.children = null;\n this.A = null; // default ancestor\n this.a = this; // ancestor\n this.z = 0; // prelim\n this.m = 0; // mod\n this.c = 0; // change\n this.s = 0; // shift\n this.t = null; // thread\n this.i = i; // number\n}\n\nTreeNode.prototype = Object.create(Node.prototype);\n\nfunction treeRoot(root) {\n var tree = new TreeNode(root, 0),\n node,\n nodes = [tree],\n child,\n children,\n i,\n n;\n\n while (node = nodes.pop()) {\n if (children = node._.children) {\n node.children = new Array(n = children.length);\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = node.children[i] = new TreeNode(children[i], i));\n child.parent = node;\n }\n }\n }\n\n (tree.parent = new TreeNode(null, 0)).children = [tree];\n return tree;\n}\n\n// Node-link tree diagram using the Reingold-Tilford \"tidy\" algorithm\nexport default function() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n}\n","function defaultSeparation(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\nfunction meanX(children) {\n return children.reduce(meanXReduce, 0) / children.length;\n}\n\nfunction meanXReduce(x, c) {\n return x + c.x;\n}\n\nfunction maxY(children) {\n return 1 + children.reduce(maxYReduce, 0);\n}\n\nfunction maxYReduce(y, c) {\n return Math.max(y, c.y);\n}\n\nfunction leafLeft(node) {\n var children;\n while (children = node.children) node = children[0];\n return node;\n}\n\nfunction leafRight(node) {\n var children;\n while (children = node.children) node = children[children.length - 1];\n return node;\n}\n\nexport default function() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = false;\n\n function cluster(root) {\n var previousNode,\n x = 0;\n\n // First walk, computing the initial x & y values.\n root.eachAfter(function(node) {\n var children = node.children;\n if (children) {\n node.x = meanX(children);\n node.y = maxY(children);\n } else {\n node.x = previousNode ? x += separation(node, previousNode) : 0;\n node.y = 0;\n previousNode = node;\n }\n });\n\n var left = leafLeft(root),\n right = leafRight(root),\n x0 = left.x - separation(left, right) / 2,\n x1 = right.x + separation(right, left) / 2;\n\n // Second walk, normalizing x & y to the desired size.\n return root.eachAfter(nodeSize ? function(node) {\n node.x = (node.x - root.x) * dx;\n node.y = (root.y - node.y) * dy;\n } : function(node) {\n node.x = (node.x - x0) / (x1 - x0) * dx;\n node.y = (1 - (root.y ? node.y / root.y : 1)) * dy;\n });\n }\n\n cluster.separation = function(x) {\n return arguments.length ? (separation = x, cluster) : separation;\n };\n\n cluster.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]);\n };\n\n cluster.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null);\n };\n\n return cluster;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (y1 - y0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n}\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\n\nexport var phi = (1 + Math.sqrt(5)) / 2;\n\nexport function squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [],\n nodes = parent.children,\n row,\n nodeValue,\n i0 = 0,\n i1 = 0,\n n = nodes.length,\n dx, dy,\n value = parent.value,\n sumValue,\n minValue,\n maxValue,\n newRatio,\n minRatio,\n alpha,\n beta;\n\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n\n // Find the next non-empty node.\n do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n\n // Keep adding nodes while the aspect ratio maintains or improves.\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) { sumValue -= nodeValue; break; }\n minRatio = newRatio;\n }\n\n // Position and record the row orientation.\n rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n\n return rows;\n}\n\nexport default (function custom(ratio) {\n\n function squarify(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n\n squarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return squarify;\n})(phi);\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\nimport {phi, squarifyRatio} from \"./squarify.js\";\n\nexport default (function custom(ratio) {\n\n function resquarify(parent, x0, y0, x1, y1) {\n if ((rows = parent._squarify) && (rows.ratio === ratio)) {\n var rows,\n row,\n nodes,\n i,\n j = -1,\n n,\n m = rows.length,\n value = parent.value;\n\n while (++j < m) {\n row = rows[j], nodes = row.children;\n for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1);\n value -= row.value;\n }\n } else {\n parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);\n rows.ratio = ratio;\n }\n }\n\n resquarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return resquarify;\n})(phi);\n","import { Transform, isTuple, ingest, tupleid, stableCompare } from 'vega-dataflow';\nimport { inherits, error, array, one, truthy, hasOwnProperty } from 'vega-util';\nimport { hierarchy, pack, partition, stratify, tree, cluster, treemap, treemapBinary, treemapDice, treemapSlice, treemapSliceDice, treemapSquarify, treemapResquarify } from 'd3-hierarchy';\n\n// Build lookup table mapping tuple keys to tree node instances\nfunction lookup (tree, key, filter) {\n const map = {};\n tree.each(node => {\n const t = node.data;\n if (filter(t)) map[key(t)] = node;\n });\n tree.lookup = map;\n return tree;\n}\n\n/**\n * Nest tuples into a tree structure, grouped by key values.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.keys - The key fields to nest by, in order.\n * @param {boolean} [params.generate=false] - A boolean flag indicating if\n * non-leaf nodes generated by this transform should be included in the\n * output. The default (false) includes only the input data (leaf nodes)\n * in the data stream.\n */\nfunction Nest(params) {\n Transform.call(this, null, params);\n}\nNest.Definition = {\n 'type': 'Nest',\n 'metadata': {\n 'treesource': true,\n 'changes': true\n },\n 'params': [{\n 'name': 'keys',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'generate',\n 'type': 'boolean'\n }]\n};\nconst children = n => n.values;\ninherits(Nest, Transform, {\n transform(_, pulse) {\n if (!pulse.source) {\n error('Nest transform requires an upstream data source.');\n }\n var gen = _.generate,\n mod = _.modified(),\n out = pulse.clone(),\n tree = this.value;\n if (!tree || mod || pulse.changed()) {\n // collect nodes to remove\n if (tree) {\n tree.each(node => {\n if (node.children && isTuple(node.data)) {\n out.rem.push(node.data);\n }\n });\n }\n\n // generate new tree structure\n this.value = tree = hierarchy({\n values: array(_.keys).reduce((n, k) => {\n n.key(k);\n return n;\n }, nest()).entries(out.source)\n }, children);\n\n // collect nodes to add\n if (gen) {\n tree.each(node => {\n if (node.children) {\n node = ingest(node.data);\n out.add.push(node);\n out.source.push(node);\n }\n });\n }\n\n // build lookup table\n lookup(tree, tupleid, tupleid);\n }\n out.source.root = tree;\n return out;\n }\n});\nfunction nest() {\n const keys = [],\n nest = {\n entries: array => entries(apply(array, 0), 0),\n key: d => (keys.push(d), nest)\n };\n function apply(array, depth) {\n if (depth >= keys.length) {\n return array;\n }\n const n = array.length,\n key = keys[depth++],\n valuesByKey = {},\n result = {};\n let i = -1,\n keyValue,\n value,\n values;\n while (++i < n) {\n keyValue = key(value = array[i]) + '';\n if (values = valuesByKey[keyValue]) {\n values.push(value);\n } else {\n valuesByKey[keyValue] = [value];\n }\n }\n for (keyValue in valuesByKey) {\n result[keyValue] = apply(valuesByKey[keyValue], depth);\n }\n return result;\n }\n function entries(map, depth) {\n if (++depth > keys.length) return map;\n const array = [];\n for (const key in map) {\n array.push({\n key,\n values: entries(map[key], depth)\n });\n }\n return array;\n }\n return nest;\n}\n\n/**\n * Abstract class for tree layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction HierarchyLayout(params) {\n Transform.call(this, null, params);\n}\nconst defaultSeparation = (a, b) => a.parent === b.parent ? 1 : 2;\ninherits(HierarchyLayout, Transform, {\n transform(_, pulse) {\n if (!pulse.source || !pulse.source.root) {\n error(this.constructor.name + ' transform requires a backing tree data source.');\n }\n const layout = this.layout(_.method),\n fields = this.fields,\n root = pulse.source.root,\n as = _.as || fields;\n if (_.field) root.sum(_.field);else root.count();\n if (_.sort) root.sort(stableCompare(_.sort, d => d.data));\n setParams(layout, this.params, _);\n if (layout.separation) {\n layout.separation(_.separation !== false ? defaultSeparation : one);\n }\n try {\n this.value = layout(root);\n } catch (err) {\n error(err);\n }\n root.each(node => setFields(node, fields, as));\n return pulse.reflow(_.modified()).modifies(as).modifies('leaf');\n }\n});\nfunction setParams(layout, params, _) {\n for (let p, i = 0, n = params.length; i < n; ++i) {\n p = params[i];\n if (p in _) layout[p](_[p]);\n }\n}\nfunction setFields(node, fields, as) {\n const t = node.data,\n n = fields.length - 1;\n for (let i = 0; i < n; ++i) {\n t[as[i]] = node[fields[i]];\n }\n t[as[n]] = node.children ? node.children.length : 0;\n}\n\nconst Output$3 = ['x', 'y', 'r', 'depth', 'children'];\n\n/**\n * Packed circle tree layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to size nodes.\n */\nfunction Pack(params) {\n HierarchyLayout.call(this, params);\n}\nPack.Definition = {\n 'type': 'Pack',\n 'metadata': {\n 'tree': true,\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'padding',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'radius',\n 'type': 'field',\n 'default': null\n }, {\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': Output$3.length,\n 'default': Output$3\n }]\n};\ninherits(Pack, HierarchyLayout, {\n layout: pack,\n params: ['radius', 'size', 'padding'],\n fields: Output$3\n});\n\nconst Output$2 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];\n\n/**\n * Partition tree layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to size nodes.\n */\nfunction Partition(params) {\n HierarchyLayout.call(this, params);\n}\nPartition.Definition = {\n 'type': 'Partition',\n 'metadata': {\n 'tree': true,\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'padding',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'round',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': Output$2.length,\n 'default': Output$2\n }]\n};\ninherits(Partition, HierarchyLayout, {\n layout: partition,\n params: ['size', 'round', 'padding'],\n fields: Output$2\n});\n\n/**\n * Stratify a collection of tuples into a tree structure based on\n * id and parent id fields.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.key - Unique key field for each tuple.\n * @param {function(object): *} params.parentKey - Field with key for parent tuple.\n */\nfunction Stratify(params) {\n Transform.call(this, null, params);\n}\nStratify.Definition = {\n 'type': 'Stratify',\n 'metadata': {\n 'treesource': true\n },\n 'params': [{\n 'name': 'key',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'parentKey',\n 'type': 'field',\n 'required': true\n }]\n};\ninherits(Stratify, Transform, {\n transform(_, pulse) {\n if (!pulse.source) {\n error('Stratify transform requires an upstream data source.');\n }\n let tree = this.value;\n const mod = _.modified(),\n out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE),\n run = !tree || mod || pulse.changed(pulse.ADD_REM) || pulse.modified(_.key.fields) || pulse.modified(_.parentKey.fields);\n\n // prevent upstream source pollution\n out.source = out.source.slice();\n if (run) {\n tree = out.source.length ? lookup(stratify().id(_.key).parentId(_.parentKey)(out.source), _.key, truthy) : lookup(stratify()([{}]), _.key, _.key);\n }\n out.source.root = this.value = tree;\n return out;\n }\n});\n\nconst Layouts = {\n tidy: tree,\n cluster: cluster\n};\nconst Output$1 = ['x', 'y', 'depth', 'children'];\n\n/**\n * Tree layout. Depending on the method parameter, performs either\n * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction Tree(params) {\n HierarchyLayout.call(this, params);\n}\nTree.Definition = {\n 'type': 'Tree',\n 'metadata': {\n 'tree': true,\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'method',\n 'type': 'enum',\n 'default': 'tidy',\n 'values': ['tidy', 'cluster']\n }, {\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'nodeSize',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'separation',\n 'type': 'boolean',\n 'default': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': Output$1.length,\n 'default': Output$1\n }]\n};\ninherits(Tree, HierarchyLayout, {\n /**\n * Tree layout generator. Supports both 'tidy' and 'cluster' layouts.\n */\n layout(method) {\n const m = method || 'tidy';\n if (hasOwnProperty(Layouts, m)) return Layouts[m]();else error('Unrecognized Tree layout method: ' + m);\n },\n params: ['size', 'nodeSize'],\n fields: Output$1\n});\n\n/**\n * Generate tuples representing links between tree nodes.\n * The resulting tuples will contain 'source' and 'target' fields,\n * which point to parent and child node tuples, respectively.\n * @constructor\n * @param {object} params - The parameters for this operator.\n */\nfunction TreeLinks(params) {\n Transform.call(this, [], params);\n}\nTreeLinks.Definition = {\n 'type': 'TreeLinks',\n 'metadata': {\n 'tree': true,\n 'generates': true,\n 'changes': true\n },\n 'params': []\n};\ninherits(TreeLinks, Transform, {\n transform(_, pulse) {\n const links = this.value,\n tree = pulse.source && pulse.source.root,\n out = pulse.fork(pulse.NO_SOURCE),\n lut = {};\n if (!tree) error('TreeLinks transform requires a tree data source.');\n if (pulse.changed(pulse.ADD_REM)) {\n // remove previous links\n out.rem = links;\n\n // build lookup table of valid tuples\n pulse.visit(pulse.SOURCE, t => lut[tupleid(t)] = 1);\n\n // generate links for all edges incident on valid tuples\n tree.each(node => {\n const t = node.data,\n p = node.parent && node.parent.data;\n if (p && lut[tupleid(t)] && lut[tupleid(p)]) {\n out.add.push(ingest({\n source: p,\n target: t\n }));\n }\n });\n this.value = out.add;\n } else if (pulse.changed(pulse.MOD)) {\n // build lookup table of modified tuples\n pulse.visit(pulse.MOD, t => lut[tupleid(t)] = 1);\n\n // gather links incident on modified tuples\n links.forEach(link => {\n if (lut[tupleid(link.source)] || lut[tupleid(link.target)]) {\n out.mod.push(link);\n }\n });\n }\n return out;\n }\n});\n\nconst Tiles = {\n binary: treemapBinary,\n dice: treemapDice,\n slice: treemapSlice,\n slicedice: treemapSliceDice,\n squarify: treemapSquarify,\n resquarify: treemapResquarify\n};\nconst Output = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];\n\n/**\n * Treemap layout.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.field - The value field to size nodes.\n */\nfunction Treemap(params) {\n HierarchyLayout.call(this, params);\n}\nTreemap.Definition = {\n 'type': 'Treemap',\n 'metadata': {\n 'tree': true,\n 'modifies': true\n },\n 'params': [{\n 'name': 'field',\n 'type': 'field'\n }, {\n 'name': 'sort',\n 'type': 'compare'\n }, {\n 'name': 'method',\n 'type': 'enum',\n 'default': 'squarify',\n 'values': ['squarify', 'resquarify', 'binary', 'dice', 'slice', 'slicedice']\n }, {\n 'name': 'padding',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingInner',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingOuter',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingTop',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingRight',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingBottom',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'paddingLeft',\n 'type': 'number',\n 'default': 0\n }, {\n 'name': 'ratio',\n 'type': 'number',\n 'default': 1.618033988749895\n }, {\n 'name': 'round',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': Output.length,\n 'default': Output\n }]\n};\ninherits(Treemap, HierarchyLayout, {\n /**\n * Treemap layout generator. Adds 'method' and 'ratio' parameters\n * to configure the underlying tile method.\n */\n layout() {\n const x = treemap();\n x.ratio = _ => {\n const t = x.tile();\n if (t.ratio) x.tile(t.ratio(_));\n };\n x.method = _ => {\n if (hasOwnProperty(Tiles, _)) x.tile(Tiles[_]);else error('Unrecognized Treemap layout method: ' + _);\n };\n return x;\n },\n params: ['method', 'ratio', 'size', 'round', 'padding', 'paddingInner', 'paddingOuter', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],\n fields: Output\n});\n\nexport { Nest as nest, Pack as pack, Partition as partition, Stratify as stratify, Tree as tree, TreeLinks as treelinks, Treemap as treemap };\n","import roundNode from \"./treemap/round.js\";\nimport treemapDice from \"./treemap/dice.js\";\n\nexport default function() {\n var dx = 1,\n dy = 1,\n padding = 0,\n round = false;\n\n function partition(root) {\n var n = root.height + 1;\n root.x0 =\n root.y0 = padding;\n root.x1 = dx;\n root.y1 = dy / n;\n root.eachBefore(positionNode(dy, n));\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(dy, n) {\n return function(node) {\n if (node.children) {\n treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);\n }\n var x0 = node.x0,\n y0 = node.y0,\n x1 = node.x1 - padding,\n y1 = node.y1 - padding;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n };\n }\n\n partition.round = function(x) {\n return arguments.length ? (round = !!x, partition) : round;\n };\n\n partition.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy];\n };\n\n partition.padding = function(x) {\n return arguments.length ? (padding = +x, partition) : padding;\n };\n\n return partition;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n i, n = nodes.length,\n sum, sums = new Array(n + 1);\n\n for (sums[0] = sum = i = 0; i < n; ++i) {\n sums[i + 1] = sum += nodes[i].value;\n }\n\n partition(0, n, parent.value, x0, y0, x1, y1);\n\n function partition(i, j, value, x0, y0, x1, y1) {\n if (i >= j - 1) {\n var node = nodes[i];\n node.x0 = x0, node.y0 = y0;\n node.x1 = x1, node.y1 = y1;\n return;\n }\n\n var valueOffset = sums[i],\n valueTarget = (value / 2) + valueOffset,\n k = i + 1,\n hi = j - 1;\n\n while (k < hi) {\n var mid = k + hi >>> 1;\n if (sums[mid] < valueTarget) k = mid + 1;\n else hi = mid;\n }\n\n if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k;\n\n var valueLeft = sums[k] - valueOffset,\n valueRight = value - valueLeft;\n\n if ((x1 - x0) > (y1 - y0)) {\n var xk = value ? (x0 * valueRight + x1 * valueLeft) / value : x1;\n partition(i, k, valueLeft, x0, y0, xk, y1);\n partition(k, j, valueRight, xk, y0, x1, y1);\n } else {\n var yk = value ? (y0 * valueRight + y1 * valueLeft) / value : y1;\n partition(i, k, valueLeft, x0, y0, x1, yk);\n partition(k, j, valueRight, x0, yk, x1, y1);\n }\n }\n}\n","import dice from \"./dice.js\";\nimport slice from \"./slice.js\";\n\nexport default function(parent, x0, y0, x1, y1) {\n (parent.depth & 1 ? slice : dice)(parent, x0, y0, x1, y1);\n}\n","import roundNode from \"./round.js\";\nimport squarify from \"./squarify.js\";\nimport {required} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\n\nexport default function() {\n var tile = squarify,\n round = false,\n dx = 1,\n dy = 1,\n paddingStack = [0],\n paddingInner = constantZero,\n paddingTop = constantZero,\n paddingRight = constantZero,\n paddingBottom = constantZero,\n paddingLeft = constantZero;\n\n function treemap(root) {\n root.x0 =\n root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(node) {\n var p = paddingStack[node.depth],\n x0 = node.x0 + p,\n y0 = node.y0 + p,\n x1 = node.x1 - p,\n y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant(+x), treemap) : paddingInner;\n };\n\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant(+x), treemap) : paddingTop;\n };\n\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant(+x), treemap) : paddingRight;\n };\n\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant(+x), treemap) : paddingBottom;\n };\n\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant(+x), treemap) : paddingLeft;\n };\n\n return treemap;\n}\n","import { Marks, textMetrics } from 'vega-scenegraph';\nimport { canvas } from 'vega-canvas';\nimport { rederive, Transform } from 'vega-dataflow';\nimport { inherits, error, array, isFunction } from 'vega-util';\n\n// bit mask for getting first 2 bytes of alpha value\nconst ALPHA_MASK = 0xff000000;\nfunction baseBitmaps($, data) {\n const bitmap = $.bitmap();\n // when there is no base mark but data points are to be avoided\n (data || []).forEach(d => bitmap.set($(d.boundary[0]), $(d.boundary[3])));\n return [bitmap, undefined];\n}\nfunction markBitmaps($, baseMark, avoidMarks, labelInside, isGroupArea) {\n // create canvas\n const width = $.width,\n height = $.height,\n border = labelInside || isGroupArea,\n context = canvas(width, height).getContext('2d'),\n baseMarkContext = canvas(width, height).getContext('2d'),\n strokeContext = border && canvas(width, height).getContext('2d');\n\n // render all marks to be avoided into canvas\n avoidMarks.forEach(items => draw(context, items, false));\n draw(baseMarkContext, baseMark, false);\n if (border) {\n draw(strokeContext, baseMark, true);\n }\n\n // get canvas buffer, create bitmaps\n const buffer = getBuffer(context, width, height),\n baseMarkBuffer = getBuffer(baseMarkContext, width, height),\n strokeBuffer = border && getBuffer(strokeContext, width, height),\n layer1 = $.bitmap(),\n layer2 = border && $.bitmap();\n\n // populate bitmap layers\n let x, y, u, v, index, alpha, strokeAlpha, baseMarkAlpha;\n for (y = 0; y < height; ++y) {\n for (x = 0; x < width; ++x) {\n index = y * width + x;\n alpha = buffer[index] & ALPHA_MASK;\n baseMarkAlpha = baseMarkBuffer[index] & ALPHA_MASK;\n strokeAlpha = border && strokeBuffer[index] & ALPHA_MASK;\n if (alpha || strokeAlpha || baseMarkAlpha) {\n u = $(x);\n v = $(y);\n if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u, v); // update interior bitmap\n if (border && (alpha || strokeAlpha)) layer2.set(u, v); // update border bitmap\n }\n }\n }\n\n return [layer1, layer2];\n}\nfunction getBuffer(context, width, height) {\n return new Uint32Array(context.getImageData(0, 0, width, height).data.buffer);\n}\nfunction draw(context, items, interior) {\n if (!items.length) return;\n const type = items[0].mark.marktype;\n if (type === 'group') {\n items.forEach(group => {\n group.items.forEach(mark => draw(context, mark.items, interior));\n });\n } else {\n Marks[type].draw(context, {\n items: interior ? items.map(prepare) : items\n });\n }\n}\n\n/**\n * Prepare item before drawing into canvas (setting stroke and opacity)\n * @param {object} source item to be prepared\n * @returns prepared item\n */\nfunction prepare(source) {\n const item = rederive(source, {});\n if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) {\n return {\n ...item,\n strokeOpacity: 1,\n stroke: '#000',\n fillOpacity: 0\n };\n }\n return item;\n}\n\nconst DIV = 5,\n // bit shift from x, y index to bit vector array index\n MOD = 31,\n // bit mask for index lookup within a bit vector\n SIZE = 32,\n // individual bit vector size\n RIGHT0 = new Uint32Array(SIZE + 1),\n // left-anchored bit vectors, full -> 0\n RIGHT1 = new Uint32Array(SIZE + 1); // right-anchored bit vectors, 0 -> full\n\nRIGHT1[0] = 0;\nRIGHT0[0] = ~RIGHT1[0];\nfor (let i = 1; i <= SIZE; ++i) {\n RIGHT1[i] = RIGHT1[i - 1] << 1 | 1;\n RIGHT0[i] = ~RIGHT1[i];\n}\nfunction Bitmap (w, h) {\n const array = new Uint32Array(~~((w * h + SIZE) / SIZE));\n function _set(index, mask) {\n array[index] |= mask;\n }\n function _clear(index, mask) {\n array[index] &= mask;\n }\n return {\n array: array,\n get: (x, y) => {\n const index = y * w + x;\n return array[index >>> DIV] & 1 << (index & MOD);\n },\n set: (x, y) => {\n const index = y * w + x;\n _set(index >>> DIV, 1 << (index & MOD));\n },\n clear: (x, y) => {\n const index = y * w + x;\n _clear(index >>> DIV, ~(1 << (index & MOD)));\n },\n getRange: (x, y, x2, y2) => {\n let r = y2,\n start,\n end,\n indexStart,\n indexEnd;\n for (; r >= y; --r) {\n start = r * w + x;\n end = r * w + x2;\n indexStart = start >>> DIV;\n indexEnd = end >>> DIV;\n if (indexStart === indexEnd) {\n if (array[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) {\n return true;\n }\n } else {\n if (array[indexStart] & RIGHT0[start & MOD]) return true;\n if (array[indexEnd] & RIGHT1[(end & MOD) + 1]) return true;\n for (let i = indexStart + 1; i < indexEnd; ++i) {\n if (array[i]) return true;\n }\n }\n }\n return false;\n },\n setRange: (x, y, x2, y2) => {\n let start, end, indexStart, indexEnd, i;\n for (; y <= y2; ++y) {\n start = y * w + x;\n end = y * w + x2;\n indexStart = start >>> DIV;\n indexEnd = end >>> DIV;\n if (indexStart === indexEnd) {\n _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]);\n } else {\n _set(indexStart, RIGHT0[start & MOD]);\n _set(indexEnd, RIGHT1[(end & MOD) + 1]);\n for (i = indexStart + 1; i < indexEnd; ++i) _set(i, 0xffffffff);\n }\n }\n },\n clearRange: (x, y, x2, y2) => {\n let start, end, indexStart, indexEnd, i;\n for (; y <= y2; ++y) {\n start = y * w + x;\n end = y * w + x2;\n indexStart = start >>> DIV;\n indexEnd = end >>> DIV;\n if (indexStart === indexEnd) {\n _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]);\n } else {\n _clear(indexStart, RIGHT1[start & MOD]);\n _clear(indexEnd, RIGHT0[(end & MOD) + 1]);\n for (i = indexStart + 1; i < indexEnd; ++i) _clear(i, 0);\n }\n }\n },\n outOfBounds: (x, y, x2, y2) => x < 0 || y < 0 || y2 >= h || x2 >= w\n };\n}\n\nfunction scaler (width, height, padding) {\n const ratio = Math.max(1, Math.sqrt(width * height / 1e6)),\n w = ~~((width + 2 * padding + ratio) / ratio),\n h = ~~((height + 2 * padding + ratio) / ratio),\n scale = _ => ~~((_ + padding) / ratio);\n scale.invert = _ => _ * ratio - padding;\n scale.bitmap = () => Bitmap(w, h);\n scale.ratio = ratio;\n scale.padding = padding;\n scale.width = width;\n scale.height = height;\n return scale;\n}\n\nfunction placeAreaLabelNaive ($, bitmaps, avoidBaseMark, markIndex) {\n const width = $.width,\n height = $.height;\n\n // try to place a label within an input area mark\n return function (d) {\n const items = d.datum.datum.items[markIndex].items,\n // area points\n n = items.length,\n // number of points\n textHeight = d.datum.fontSize,\n // label width\n textWidth = textMetrics.width(d.datum, d.datum.text); // label height\n\n let maxAreaWidth = 0,\n x1,\n x2,\n y1,\n y2,\n x,\n y,\n areaWidth;\n\n // for each area sample point\n for (let i = 0; i < n; ++i) {\n x1 = items[i].x;\n y1 = items[i].y;\n x2 = items[i].x2 === undefined ? x1 : items[i].x2;\n y2 = items[i].y2 === undefined ? y1 : items[i].y2;\n x = (x1 + x2) / 2;\n y = (y1 + y2) / 2;\n areaWidth = Math.abs(x2 - x1 + y2 - y1);\n if (areaWidth >= maxAreaWidth) {\n maxAreaWidth = areaWidth;\n d.x = x;\n d.y = y;\n }\n }\n x = textWidth / 2;\n y = textHeight / 2;\n x1 = d.x - x;\n x2 = d.x + x;\n y1 = d.y - y;\n y2 = d.y + y;\n d.align = 'center';\n if (x1 < 0 && x2 <= width) {\n d.align = 'left';\n } else if (0 <= x1 && width < x2) {\n d.align = 'right';\n }\n d.baseline = 'middle';\n if (y1 < 0 && y2 <= height) {\n d.baseline = 'top';\n } else if (0 <= y1 && height < y2) {\n d.baseline = 'bottom';\n }\n return true;\n };\n}\n\nfunction outOfBounds(x, y, textWidth, textHeight, width, height) {\n let r = textWidth / 2;\n return x - r < 0 || x + r > width || y - (r = textHeight / 2) < 0 || y + r > height;\n}\nfunction collision($, x, y, textHeight, textWidth, h, bm0, bm1) {\n const w = textWidth * h / (textHeight * 2),\n x1 = $(x - w),\n x2 = $(x + w),\n y1 = $(y - (h = h / 2)),\n y2 = $(y + h);\n return bm0.outOfBounds(x1, y1, x2, y2) || bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2);\n}\n\nfunction placeAreaLabelReducedSearch ($, bitmaps, avoidBaseMark, markIndex) {\n const width = $.width,\n height = $.height,\n bm0 = bitmaps[0],\n // where labels have been placed\n bm1 = bitmaps[1]; // area outlines\n\n function tryLabel(_x, _y, maxSize, textWidth, textHeight) {\n const x = $.invert(_x),\n y = $.invert(_y);\n let lo = maxSize,\n hi = height,\n mid;\n if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {\n // if the label fits at the current sample point,\n // perform binary search to find the largest font size that fits\n while (hi - lo >= 1) {\n mid = (lo + hi) / 2;\n if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) {\n hi = mid;\n } else {\n lo = mid;\n }\n }\n // place label if current lower bound exceeds prior max font size\n if (lo > maxSize) {\n return [x, y, lo, true];\n }\n }\n }\n\n // try to place a label within an input area mark\n return function (d) {\n const items = d.datum.datum.items[markIndex].items,\n // area points\n n = items.length,\n // number of points\n textHeight = d.datum.fontSize,\n // label width\n textWidth = textMetrics.width(d.datum, d.datum.text); // label height\n\n let maxSize = avoidBaseMark ? textHeight : 0,\n labelPlaced = false,\n labelPlaced2 = false,\n maxAreaWidth = 0,\n x1,\n x2,\n y1,\n y2,\n x,\n y,\n _x,\n _y,\n _x1,\n _xMid,\n _x2,\n _y1,\n _yMid,\n _y2,\n areaWidth,\n result,\n swapTmp;\n\n // for each area sample point\n for (let i = 0; i < n; ++i) {\n x1 = items[i].x;\n y1 = items[i].y;\n x2 = items[i].x2 === undefined ? x1 : items[i].x2;\n y2 = items[i].y2 === undefined ? y1 : items[i].y2;\n if (x1 > x2) {\n swapTmp = x1;\n x1 = x2;\n x2 = swapTmp;\n }\n if (y1 > y2) {\n swapTmp = y1;\n y1 = y2;\n y2 = swapTmp;\n }\n _x1 = $(x1);\n _x2 = $(x2);\n _xMid = ~~((_x1 + _x2) / 2);\n _y1 = $(y1);\n _y2 = $(y2);\n _yMid = ~~((_y1 + _y2) / 2);\n\n // search along the line from mid point between the 2 border to lower border\n for (_x = _xMid; _x >= _x1; --_x) {\n for (_y = _yMid; _y >= _y1; --_y) {\n result = tryLabel(_x, _y, maxSize, textWidth, textHeight);\n if (result) {\n [d.x, d.y, maxSize, labelPlaced] = result;\n }\n }\n }\n\n // search along the line from mid point between the 2 border to upper border\n for (_x = _xMid; _x <= _x2; ++_x) {\n for (_y = _yMid; _y <= _y2; ++_y) {\n result = tryLabel(_x, _y, maxSize, textWidth, textHeight);\n if (result) {\n [d.x, d.y, maxSize, labelPlaced] = result;\n }\n }\n }\n\n // place label at slice center if not placed through other means\n // and if we're not avoiding overlap with other areas\n if (!labelPlaced && !avoidBaseMark) {\n // one span is zero, hence we can add\n areaWidth = Math.abs(x2 - x1 + y2 - y1);\n x = (x1 + x2) / 2;\n y = (y1 + y2) / 2;\n\n // place label if it fits and improves the max area width\n if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {\n maxAreaWidth = areaWidth;\n d.x = x;\n d.y = y;\n labelPlaced2 = true;\n }\n }\n }\n\n // record current label placement information, update label bitmap\n if (labelPlaced || labelPlaced2) {\n x = textWidth / 2;\n y = textHeight / 2;\n bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y));\n d.align = 'center';\n d.baseline = 'middle';\n return true;\n } else {\n return false;\n }\n };\n}\n\n// pixel direction offsets for flood fill search\nconst X_DIR = [-1, -1, 1, 1];\nconst Y_DIR = [-1, 1, -1, 1];\nfunction placeAreaLabelFloodFill ($, bitmaps, avoidBaseMark, markIndex) {\n const width = $.width,\n height = $.height,\n bm0 = bitmaps[0],\n // where labels have been placed\n bm1 = bitmaps[1],\n // area outlines\n bm2 = $.bitmap(); // flood-fill visitations\n\n // try to place a label within an input area mark\n return function (d) {\n const items = d.datum.datum.items[markIndex].items,\n // area points\n n = items.length,\n // number of points\n textHeight = d.datum.fontSize,\n // label width\n textWidth = textMetrics.width(d.datum, d.datum.text),\n // label height\n stack = []; // flood fill stack\n\n let maxSize = avoidBaseMark ? textHeight : 0,\n labelPlaced = false,\n labelPlaced2 = false,\n maxAreaWidth = 0,\n x1,\n x2,\n y1,\n y2,\n x,\n y,\n _x,\n _y,\n lo,\n hi,\n mid,\n areaWidth;\n\n // for each area sample point\n for (let i = 0; i < n; ++i) {\n x1 = items[i].x;\n y1 = items[i].y;\n x2 = items[i].x2 === undefined ? x1 : items[i].x2;\n y2 = items[i].y2 === undefined ? y1 : items[i].y2;\n\n // add scaled center point to stack\n stack.push([$((x1 + x2) / 2), $((y1 + y2) / 2)]);\n\n // perform flood fill, visit points\n while (stack.length) {\n [_x, _y] = stack.pop();\n\n // exit if point already marked\n if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue;\n\n // mark point in flood fill bitmap\n // add search points for all (in bound) directions\n bm2.set(_x, _y);\n for (let j = 0; j < 4; ++j) {\n x = _x + X_DIR[j];\n y = _y + Y_DIR[j];\n if (!bm2.outOfBounds(x, y, x, y)) stack.push([x, y]);\n }\n\n // unscale point back to x, y space\n x = $.invert(_x);\n y = $.invert(_y);\n lo = maxSize;\n hi = height; // TODO: make this bound smaller\n\n if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {\n // if the label fits at the current sample point,\n // perform binary search to find the largest font size that fits\n while (hi - lo >= 1) {\n mid = (lo + hi) / 2;\n if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) {\n hi = mid;\n } else {\n lo = mid;\n }\n }\n // place label if current lower bound exceeds prior max font size\n if (lo > maxSize) {\n d.x = x;\n d.y = y;\n maxSize = lo;\n labelPlaced = true;\n }\n }\n }\n\n // place label at slice center if not placed through other means\n // and if we're not avoiding overlap with other areas\n if (!labelPlaced && !avoidBaseMark) {\n // one span is zero, hence we can add\n areaWidth = Math.abs(x2 - x1 + y2 - y1);\n x = (x1 + x2) / 2;\n y = (y1 + y2) / 2;\n\n // place label if it fits and improves the max area width\n if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {\n maxAreaWidth = areaWidth;\n d.x = x;\n d.y = y;\n labelPlaced2 = true;\n }\n }\n }\n\n // record current label placement information, update label bitmap\n if (labelPlaced || labelPlaced2) {\n x = textWidth / 2;\n y = textHeight / 2;\n bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y));\n d.align = 'center';\n d.baseline = 'middle';\n return true;\n } else {\n return false;\n }\n };\n}\n\nconst Aligns = ['right', 'center', 'left'],\n Baselines = ['bottom', 'middle', 'top'];\nfunction placeMarkLabel ($, bitmaps, anchors, offsets) {\n const width = $.width,\n height = $.height,\n bm0 = bitmaps[0],\n bm1 = bitmaps[1],\n n = offsets.length;\n return function (d) {\n const boundary = d.boundary,\n textHeight = d.datum.fontSize;\n\n // can not be placed if the mark is not visible in the graph bound\n if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width || boundary[3] > height) {\n return false;\n }\n let textWidth = d.textWidth ?? 0,\n dx,\n dy,\n isInside,\n sizeFactor,\n insideFactor,\n x1,\n x2,\n y1,\n y2,\n xc,\n yc,\n _x1,\n _x2,\n _y1,\n _y2;\n\n // for each anchor and offset\n for (let i = 0; i < n; ++i) {\n dx = (anchors[i] & 0x3) - 1;\n dy = (anchors[i] >>> 0x2 & 0x3) - 1;\n isInside = dx === 0 && dy === 0 || offsets[i] < 0;\n sizeFactor = dx && dy ? Math.SQRT1_2 : 1;\n insideFactor = offsets[i] < 0 ? -1 : 1;\n x1 = boundary[1 + dx] + offsets[i] * dx * sizeFactor;\n yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets[i] * dy * sizeFactor;\n y1 = yc - textHeight / 2;\n y2 = yc + textHeight / 2;\n _x1 = $(x1);\n _y1 = $(y1);\n _y2 = $(y2);\n if (!textWidth) {\n // to avoid finding width of text label,\n if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x1, x1, y1, y2, boundary, isInside)) {\n // skip this anchor/offset option if we fail to place a label with 1px width\n continue;\n } else {\n // Otherwise, find the label width\n textWidth = textMetrics.width(d.datum, d.datum.text);\n }\n }\n xc = x1 + insideFactor * textWidth * dx / 2;\n x1 = xc - textWidth / 2;\n x2 = xc + textWidth / 2;\n _x1 = $(x1);\n _x2 = $(x2);\n if (test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside)) {\n // place label if the position is placeable\n d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x1;\n d.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y1;\n d.align = Aligns[dx * insideFactor + 1];\n d.baseline = Baselines[dy * insideFactor + 1];\n bm0.setRange(_x1, _y1, _x2, _y2);\n return true;\n }\n }\n return false;\n };\n}\n\n// Test if a label with the given dimensions can be added without overlap\nfunction test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside) {\n return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2));\n}\n\n// 8-bit representation of anchors\nconst TOP = 0x0,\n MIDDLE = 0x4,\n BOTTOM = 0x8,\n LEFT = 0x0,\n CENTER = 0x1,\n RIGHT = 0x2;\n\n// Mapping from text anchor to number representation\nconst anchorCode = {\n 'top-left': TOP + LEFT,\n 'top': TOP + CENTER,\n 'top-right': TOP + RIGHT,\n 'left': MIDDLE + LEFT,\n 'middle': MIDDLE + CENTER,\n 'right': MIDDLE + RIGHT,\n 'bottom-left': BOTTOM + LEFT,\n 'bottom': BOTTOM + CENTER,\n 'bottom-right': BOTTOM + RIGHT\n};\nconst placeAreaLabel = {\n 'naive': placeAreaLabelNaive,\n 'reduced-search': placeAreaLabelReducedSearch,\n 'floodfill': placeAreaLabelFloodFill\n};\nfunction labelLayout (texts, size, compare, offset, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding, method) {\n // early exit for empty data\n if (!texts.length) return texts;\n const positions = Math.max(offset.length, anchor.length),\n offsets = getOffsets(offset, positions),\n anchors = getAnchors(anchor, positions),\n marktype = markType(texts[0].datum),\n grouptype = marktype === 'group' && texts[0].datum.items[markIndex].marktype,\n isGroupArea = grouptype === 'area',\n boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex),\n infPadding = padding === null || padding === Infinity,\n isNaiveGroupArea = isGroupArea && method === 'naive';\n let maxTextWidth = -1,\n maxTextHeight = -1;\n\n // prepare text mark data for placing\n const data = texts.map(d => {\n const textWidth = infPadding ? textMetrics.width(d, d.text) : undefined;\n maxTextWidth = Math.max(maxTextWidth, textWidth);\n maxTextHeight = Math.max(maxTextHeight, d.fontSize);\n return {\n datum: d,\n opacity: 0,\n x: undefined,\n y: undefined,\n align: undefined,\n baseline: undefined,\n boundary: boundary(d),\n textWidth\n };\n });\n padding = padding === null || padding === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset) : padding;\n const $ = scaler(size[0], size[1], padding);\n let bitmaps;\n if (!isNaiveGroupArea) {\n // sort labels in priority order, if comparator is provided\n if (compare) {\n data.sort((a, b) => compare(a.datum, b.datum));\n }\n\n // flag indicating if label can be placed inside its base mark\n let labelInside = false;\n for (let i = 0; i < anchors.length && !labelInside; ++i) {\n // label inside if anchor is at center\n // label inside if offset to be inside the mark bound\n labelInside = anchors[i] === 0x5 || offsets[i] < 0;\n }\n\n // extract data information from base mark when base mark is to be avoided\n // base mark is implicitly avoided if it is a group area\n const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map(d => d.datum);\n\n // generate bitmaps for layout calculation\n bitmaps = avoidMarks.length || baseMark ? markBitmaps($, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($, avoidBaseMark && data);\n }\n\n // generate label placement function\n const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($, bitmaps, anchors, offsets);\n\n // place all labels\n data.forEach(d => d.opacity = +place(d));\n return data;\n}\nfunction getOffsets(_, count) {\n const offsets = new Float64Array(count),\n n = _.length;\n for (let i = 0; i < n; ++i) offsets[i] = _[i] || 0;\n for (let i = n; i < count; ++i) offsets[i] = offsets[n - 1];\n return offsets;\n}\nfunction getAnchors(_, count) {\n const anchors = new Int8Array(count),\n n = _.length;\n for (let i = 0; i < n; ++i) anchors[i] |= anchorCode[_[i]];\n for (let i = n; i < count; ++i) anchors[i] = anchors[n - 1];\n return anchors;\n}\nfunction markType(item) {\n return item && item.mark && item.mark.marktype;\n}\n\n/**\n * Factory function for function for getting base mark boundary, depending\n * on mark and group type. When mark type is undefined, line or area: boundary\n * is the coordinate of each data point. When base mark is grouped line,\n * boundary is either at the start or end of the line depending on the\n * value of lineAnchor. Otherwise, use bounds of base mark.\n */\nfunction markBoundary(marktype, grouptype, lineAnchor, markIndex) {\n const xy = d => [d.x, d.x, d.x, d.y, d.y, d.y];\n if (!marktype) {\n return xy; // no reactive geometry\n } else if (marktype === 'line' || marktype === 'area') {\n return d => xy(d.datum);\n } else if (grouptype === 'line') {\n return d => {\n const items = d.datum.items[markIndex].items;\n return xy(items.length ? items[lineAnchor === 'start' ? 0 : items.length - 1] : {\n x: NaN,\n y: NaN\n });\n };\n } else {\n return d => {\n const b = d.datum.bounds;\n return [b.x1, (b.x1 + b.x2) / 2, b.x2, b.y1, (b.y1 + b.y2) / 2, b.y2];\n };\n }\n}\n\nconst Output = ['x', 'y', 'opacity', 'align', 'baseline'];\nconst Anchors = ['top-left', 'left', 'bottom-left', 'top', 'bottom', 'top-right', 'right', 'bottom-right'];\n\n/**\n * Compute text label layout to annotate marks.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.size - The size of the layout, provided as a [width, height] array.\n * @param {function(*,*): number} [params.sort] - An optional\n * comparator function for sorting label data in priority order.\n * @param {Array} [params.anchor] - Label anchor points relative to the base mark bounding box.\n * The available options are 'top-left', 'left', 'bottom-left', 'top',\n * 'bottom', 'top-right', 'right', 'bottom-right', 'middle'.\n * @param {Array} [params.offset] - Label offsets (in pixels) from the base mark bounding box.\n * This parameter is parallel to the list of anchor points.\n * @param {number | null} [params.padding=0] - The amount (in pixels) that a label may exceed the layout size.\n * If this parameter is null, a label may exceed the layout size without any boundary.\n * @param {string} [params.lineAnchor='end'] - For group line mark labels only, indicates the anchor\n * position for labels. One of 'start' or 'end'.\n * @param {string} [params.markIndex=0] - For group mark labels only, an index indicating\n * which mark within the group should be labeled.\n * @param {Array} [params.avoidMarks] - A list of additional mark names for which the label\n * layout should avoid overlap.\n * @param {boolean} [params.avoidBaseMark=true] - Boolean flag indicating if labels should avoid\n * overlap with the underlying base mark being labeled.\n * @param {string} [params.method='naive'] - For area make labels only, a method for\n * place labels. One of 'naive', 'reduced-search', or 'floodfill'.\n * @param {Array} [params.as] - The output fields written by the transform.\n * The default is ['x', 'y', 'opacity', 'align', 'baseline'].\n */\nfunction Label(params) {\n Transform.call(this, null, params);\n}\nLabel.Definition = {\n type: 'Label',\n metadata: {\n modifies: true\n },\n params: [{\n name: 'size',\n type: 'number',\n array: true,\n length: 2,\n required: true\n }, {\n name: 'sort',\n type: 'compare'\n }, {\n name: 'anchor',\n type: 'string',\n array: true,\n default: Anchors\n }, {\n name: 'offset',\n type: 'number',\n array: true,\n default: [1]\n }, {\n name: 'padding',\n type: 'number',\n default: 0,\n null: true\n }, {\n name: 'lineAnchor',\n type: 'string',\n values: ['start', 'end'],\n default: 'end'\n }, {\n name: 'markIndex',\n type: 'number',\n default: 0\n }, {\n name: 'avoidBaseMark',\n type: 'boolean',\n default: true\n }, {\n name: 'avoidMarks',\n type: 'data',\n array: true\n }, {\n name: 'method',\n type: 'string',\n default: 'naive'\n }, {\n name: 'as',\n type: 'string',\n array: true,\n length: Output.length,\n default: Output\n }]\n};\ninherits(Label, Transform, {\n transform(_, pulse) {\n function modp(param) {\n const p = _[param];\n return isFunction(p) && pulse.modified(p.fields);\n }\n const mod = _.modified();\n if (!(mod || pulse.changed(pulse.ADD_REM) || modp('sort'))) return;\n if (!_.size || _.size.length !== 2) {\n error('Size parameter should be specified as a [width, height] array.');\n }\n const as = _.as || Output;\n\n // run label layout\n labelLayout(pulse.materialize(pulse.SOURCE).source || [], _.size, _.sort, array(_.offset == null ? 1 : _.offset), array(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || 'end', _.markIndex || 0, _.padding === undefined ? 0 : _.padding, _.method || 'naive').forEach(l => {\n // write layout results to data stream\n const t = l.datum;\n t[as[0]] = l.x;\n t[as[1]] = l.y;\n t[as[2]] = l.opacity;\n t[as[3]] = l.align;\n t[as[4]] = l.baseline;\n });\n return pulse.reflow(mod).modifies(as);\n }\n});\n\nexport { Label as label };\n","import { regressionLoess, sampleCurve, regressionConstant, regressionLinear, regressionLog, regressionExp, regressionPow, regressionQuad, regressionPoly } from 'vega-statistics';\nimport { Transform, ingest } from 'vega-dataflow';\nimport { inherits, accessorName, hasOwnProperty, error, extent } from 'vega-util';\n\nfunction partition (data, groupby) {\n var groups = [],\n get = function (f) {\n return f(t);\n },\n map,\n i,\n n,\n t,\n k,\n g;\n\n // partition data points into stack groups\n if (groupby == null) {\n groups.push(data);\n } else {\n for (map = {}, i = 0, n = data.length; i < n; ++i) {\n t = data[i];\n k = groupby.map(get);\n g = map[k];\n if (!g) {\n map[k] = g = [];\n g.dims = k;\n groups.push(g);\n }\n g.push(t);\n }\n }\n return groups;\n}\n\n/**\n * Compute locally-weighted regression fits for one or more data groups.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.x - An accessor for the predictor data field.\n * @param {function(object): *} params.y - An accessor for the predicted data field.\n * @param {Array} [params.groupby] - An array of accessors to groupby.\n * @param {number} [params.bandwidth=0.3] - The loess bandwidth.\n */\nfunction Loess(params) {\n Transform.call(this, null, params);\n}\nLoess.Definition = {\n 'type': 'Loess',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'x',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'y',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'bandwidth',\n 'type': 'number',\n 'default': 0.3\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true\n }]\n};\ninherits(Loess, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n if (!this.value || pulse.changed() || _.modified()) {\n const source = pulse.materialize(pulse.SOURCE).source,\n groups = partition(source, _.groupby),\n names = (_.groupby || []).map(accessorName),\n m = names.length,\n as = _.as || [accessorName(_.x), accessorName(_.y)],\n values = [];\n groups.forEach(g => {\n regressionLoess(g, _.x, _.y, _.bandwidth || 0.3).forEach(p => {\n const t = {};\n for (let i = 0; i < m; ++i) {\n t[names[i]] = g.dims[i];\n }\n t[as[0]] = p[0];\n t[as[1]] = p[1];\n values.push(ingest(t));\n });\n });\n if (this.value) out.rem = this.value;\n this.value = out.add = out.source = values;\n }\n return out;\n }\n});\n\nconst Methods = {\n constant: regressionConstant,\n linear: regressionLinear,\n log: regressionLog,\n exp: regressionExp,\n pow: regressionPow,\n quad: regressionQuad,\n poly: regressionPoly\n};\nconst degreesOfFreedom = (method, order) => method === 'poly' ? order : method === 'quad' ? 2 : 1;\n\n/**\n * Compute regression fits for one or more data groups.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {function(object): *} params.x - An accessor for the predictor data field.\n * @param {function(object): *} params.y - An accessor for the predicted data field.\n * @param {string} [params.method='linear'] - The regression method to apply.\n * @param {Array} [params.groupby] - An array of accessors to groupby.\n * @param {Array} [params.extent] - The domain extent over which to plot the regression line.\n * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method.\n */\nfunction Regression(params) {\n Transform.call(this, null, params);\n}\nRegression.Definition = {\n 'type': 'Regression',\n 'metadata': {\n 'generates': true\n },\n 'params': [{\n 'name': 'x',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'y',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'groupby',\n 'type': 'field',\n 'array': true\n }, {\n 'name': 'method',\n 'type': 'string',\n 'default': 'linear',\n 'values': Object.keys(Methods)\n }, {\n 'name': 'order',\n 'type': 'number',\n 'default': 3\n }, {\n 'name': 'extent',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'params',\n 'type': 'boolean',\n 'default': false\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true\n }]\n};\ninherits(Regression, Transform, {\n transform(_, pulse) {\n const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);\n if (!this.value || pulse.changed() || _.modified()) {\n const source = pulse.materialize(pulse.SOURCE).source,\n groups = partition(source, _.groupby),\n names = (_.groupby || []).map(accessorName),\n method = _.method || 'linear',\n order = _.order == null ? 3 : _.order,\n dof = degreesOfFreedom(method, order),\n as = _.as || [accessorName(_.x), accessorName(_.y)],\n fit = Methods[method],\n values = [];\n let domain = _.extent;\n if (!hasOwnProperty(Methods, method)) {\n error('Invalid regression method: ' + method);\n }\n if (domain != null) {\n if (method === 'log' && domain[0] <= 0) {\n pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.');\n domain = null;\n }\n }\n groups.forEach(g => {\n const n = g.length;\n if (n <= dof) {\n pulse.dataflow.warn('Skipping regression with more parameters than data points.');\n return;\n }\n const model = fit(g, _.x, _.y, order);\n if (_.params) {\n // if parameter vectors requested return those\n values.push(ingest({\n keys: g.dims,\n coef: model.coef,\n rSquared: model.rSquared\n }));\n return;\n }\n const dom = domain || extent(g, _.x),\n add = p => {\n const t = {};\n for (let i = 0; i < names.length; ++i) {\n t[names[i]] = g.dims[i];\n }\n t[as[0]] = p[0];\n t[as[1]] = p[1];\n values.push(ingest(t));\n };\n if (method === 'linear' || method === 'constant') {\n // for linear or constant regression we only need the end points\n dom.forEach(x => add([x, model.predict(x)]));\n } else {\n // otherwise return trend line sample points\n sampleCurve(model.predict, dom, 25, 200).forEach(add);\n }\n });\n if (this.value) out.rem = this.value;\n this.value = out.add = out.source = values;\n }\n return out;\n }\n});\n\nexport { Loess as loess, Regression as regression };\n","export const epsilon = 1.1102230246251565e-16;\nexport const splitter = 134217729;\nexport const resulterrbound = (3 + 8 * epsilon) * epsilon;\n\n// fast_expansion_sum_zeroelim routine from oritinal code\nexport function sum(elen, e, flen, f, h) {\n let Q, Qnew, hh, bvirt;\n let enow = e[0];\n let fnow = f[0];\n let eindex = 0;\n let findex = 0;\n if ((fnow > enow) === (fnow > -enow)) {\n Q = enow;\n enow = e[++eindex];\n } else {\n Q = fnow;\n fnow = f[++findex];\n }\n let hindex = 0;\n if (eindex < elen && findex < flen) {\n if ((fnow > enow) === (fnow > -enow)) {\n Qnew = enow + Q;\n hh = Q - (Qnew - enow);\n enow = e[++eindex];\n } else {\n Qnew = fnow + Q;\n hh = Q - (Qnew - fnow);\n fnow = f[++findex];\n }\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n while (eindex < elen && findex < flen) {\n if ((fnow > enow) === (fnow > -enow)) {\n Qnew = Q + enow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (enow - bvirt);\n enow = e[++eindex];\n } else {\n Qnew = Q + fnow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n fnow = f[++findex];\n }\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n }\n while (eindex < elen) {\n Qnew = Q + enow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (enow - bvirt);\n enow = e[++eindex];\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n while (findex < flen) {\n Qnew = Q + fnow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n fnow = f[++findex];\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n if (Q !== 0 || hindex === 0) {\n h[hindex++] = Q;\n }\n return hindex;\n}\n\nexport function sum_three(alen, a, blen, b, clen, c, tmp, out) {\n return sum(sum(alen, a, blen, b, tmp), tmp, clen, c, out);\n}\n\n// scale_expansion_zeroelim routine from oritinal code\nexport function scale(elen, e, b, h) {\n let Q, sum, hh, product1, product0;\n let bvirt, c, ahi, alo, bhi, blo;\n\n c = splitter * b;\n bhi = c - (c - b);\n blo = b - bhi;\n let enow = e[0];\n Q = enow * b;\n c = splitter * enow;\n ahi = c - (c - enow);\n alo = enow - ahi;\n hh = alo * blo - (Q - ahi * bhi - alo * bhi - ahi * blo);\n let hindex = 0;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n for (let i = 1; i < elen; i++) {\n enow = e[i];\n product1 = enow * b;\n c = splitter * enow;\n ahi = c - (c - enow);\n alo = enow - ahi;\n product0 = alo * blo - (product1 - ahi * bhi - alo * bhi - ahi * blo);\n sum = Q + product0;\n bvirt = sum - Q;\n hh = Q - (sum - bvirt) + (product0 - bvirt);\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n Q = product1 + sum;\n hh = sum - (Q - product1);\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n if (Q !== 0 || hindex === 0) {\n h[hindex++] = Q;\n }\n return hindex;\n}\n\nexport function negate(elen, e) {\n for (let i = 0; i < elen; i++) e[i] = -e[i];\n return elen;\n}\n\nexport function estimate(elen, e) {\n let Q = e[0];\n for (let i = 1; i < elen; i++) Q += e[i];\n return Q;\n}\n\nexport function vec(n) {\n return new Float64Array(n);\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum} from './util.js';\n\nconst ccwerrboundA = (3 + 16 * epsilon) * epsilon;\nconst ccwerrboundB = (2 + 12 * epsilon) * epsilon;\nconst ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;\n\nconst B = vec(4);\nconst C1 = vec(8);\nconst C2 = vec(12);\nconst D = vec(16);\nconst u = vec(4);\n\nfunction orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {\n let acxtail, acytail, bcxtail, bcytail;\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;\n\n const acx = ax - cx;\n const bcx = bx - cx;\n const acy = ay - cy;\n const bcy = by - cy;\n\n s1 = acx * bcy;\n c = splitter * acx;\n ahi = c - (c - acx);\n alo = acx - ahi;\n c = splitter * bcy;\n bhi = c - (c - bcy);\n blo = bcy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acy * bcx;\n c = splitter * acy;\n ahi = c - (c - acy);\n alo = acy - ahi;\n c = splitter * bcx;\n bhi = c - (c - bcx);\n blo = bcx - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n B[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n B[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n B[2] = _j - (u3 - bvirt) + (_i - bvirt);\n B[3] = u3;\n\n let det = estimate(4, B);\n let errbound = ccwerrboundB * detsum;\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n bvirt = ax - acx;\n acxtail = ax - (acx + bvirt) + (bvirt - cx);\n bvirt = bx - bcx;\n bcxtail = bx - (bcx + bvirt) + (bvirt - cx);\n bvirt = ay - acy;\n acytail = ay - (acy + bvirt) + (bvirt - cy);\n bvirt = by - bcy;\n bcytail = by - (bcy + bvirt) + (bvirt - cy);\n\n if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {\n return det;\n }\n\n errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);\n det += (acx * bcytail + bcy * acxtail) - (acy * bcxtail + bcx * acytail);\n if (det >= errbound || -det >= errbound) return det;\n\n s1 = acxtail * bcy;\n c = splitter * acxtail;\n ahi = c - (c - acxtail);\n alo = acxtail - ahi;\n c = splitter * bcy;\n bhi = c - (c - bcy);\n blo = bcy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acytail * bcx;\n c = splitter * acytail;\n ahi = c - (c - acytail);\n alo = acytail - ahi;\n c = splitter * bcx;\n bhi = c - (c - bcx);\n blo = bcx - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const C1len = sum(4, B, 4, u, C1);\n\n s1 = acx * bcytail;\n c = splitter * acx;\n ahi = c - (c - acx);\n alo = acx - ahi;\n c = splitter * bcytail;\n bhi = c - (c - bcytail);\n blo = bcytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acy * bcxtail;\n c = splitter * acy;\n ahi = c - (c - acy);\n alo = acy - ahi;\n c = splitter * bcxtail;\n bhi = c - (c - bcxtail);\n blo = bcxtail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const C2len = sum(C1len, C1, 4, u, C2);\n\n s1 = acxtail * bcytail;\n c = splitter * acxtail;\n ahi = c - (c - acxtail);\n alo = acxtail - ahi;\n c = splitter * bcytail;\n bhi = c - (c - bcytail);\n blo = bcytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acytail * bcxtail;\n c = splitter * acytail;\n ahi = c - (c - acytail);\n alo = acytail - ahi;\n c = splitter * bcxtail;\n bhi = c - (c - bcxtail);\n blo = bcxtail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const Dlen = sum(C2len, C2, 4, u, D);\n\n return D[Dlen - 1];\n}\n\nexport function orient2d(ax, ay, bx, by, cx, cy) {\n const detleft = (ay - cy) * (bx - cx);\n const detright = (ax - cx) * (by - cy);\n const det = detleft - detright;\n\n const detsum = Math.abs(detleft + detright);\n if (Math.abs(det) >= ccwerrboundA * detsum) return det;\n\n return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);\n}\n\nexport function orient2dfast(ax, ay, bx, by, cx, cy) {\n return (ay - cy) * (bx - cx) - (ax - cx) * (by - cy);\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum, scale} from './util.js';\n\nconst o3derrboundA = (7 + 56 * epsilon) * epsilon;\nconst o3derrboundB = (3 + 28 * epsilon) * epsilon;\nconst o3derrboundC = (26 + 288 * epsilon) * epsilon * epsilon;\n\nconst bc = vec(4);\nconst ca = vec(4);\nconst ab = vec(4);\nconst at_b = vec(4);\nconst at_c = vec(4);\nconst bt_c = vec(4);\nconst bt_a = vec(4);\nconst ct_a = vec(4);\nconst ct_b = vec(4);\nconst bct = vec(8);\nconst cat = vec(8);\nconst abt = vec(8);\nconst u = vec(4);\n\nconst _8 = vec(8);\nconst _8b = vec(8);\nconst _16 = vec(8);\nconst _12 = vec(12);\n\nlet fin = vec(192);\nlet fin2 = vec(192);\n\nfunction finadd(finlen, alen, a) {\n finlen = sum(finlen, fin, alen, a, fin2);\n const tmp = fin; fin = fin2; fin2 = tmp;\n return finlen;\n}\n\nfunction tailinit(xtail, ytail, ax, ay, bx, by, a, b) {\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3, negate;\n if (xtail === 0) {\n if (ytail === 0) {\n a[0] = 0;\n b[0] = 0;\n return 1;\n } else {\n negate = -ytail;\n s1 = negate * ax;\n c = splitter * negate;\n ahi = c - (c - negate);\n alo = negate - ahi;\n c = splitter * ax;\n bhi = c - (c - ax);\n blo = ax - bhi;\n a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n a[1] = s1;\n s1 = ytail * bx;\n c = splitter * ytail;\n ahi = c - (c - ytail);\n alo = ytail - ahi;\n c = splitter * bx;\n bhi = c - (c - bx);\n blo = bx - bhi;\n b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n b[1] = s1;\n return 2;\n }\n } else {\n if (ytail === 0) {\n s1 = xtail * ay;\n c = splitter * xtail;\n ahi = c - (c - xtail);\n alo = xtail - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n a[1] = s1;\n negate = -xtail;\n s1 = negate * by;\n c = splitter * negate;\n ahi = c - (c - negate);\n alo = negate - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n b[1] = s1;\n return 2;\n } else {\n s1 = xtail * ay;\n c = splitter * xtail;\n ahi = c - (c - xtail);\n alo = xtail - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = ytail * ax;\n c = splitter * ytail;\n ahi = c - (c - ytail);\n alo = ytail - ahi;\n c = splitter * ax;\n bhi = c - (c - ax);\n blo = ax - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n a[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n a[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n a[2] = _j - (u3 - bvirt) + (_i - bvirt);\n a[3] = u3;\n s1 = ytail * bx;\n c = splitter * ytail;\n ahi = c - (c - ytail);\n alo = ytail - ahi;\n c = splitter * bx;\n bhi = c - (c - bx);\n blo = bx - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = xtail * by;\n c = splitter * xtail;\n ahi = c - (c - xtail);\n alo = xtail - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n b[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n b[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n b[2] = _j - (u3 - bvirt) + (_i - bvirt);\n b[3] = u3;\n return 4;\n }\n }\n}\n\nfunction tailadd(finlen, a, b, k, z) {\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, u3;\n s1 = a * b;\n c = splitter * a;\n ahi = c - (c - a);\n alo = a - ahi;\n c = splitter * b;\n bhi = c - (c - b);\n blo = b - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n c = splitter * k;\n bhi = c - (c - k);\n blo = k - bhi;\n _i = s0 * k;\n c = splitter * s0;\n ahi = c - (c - s0);\n alo = s0 - ahi;\n u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo);\n _j = s1 * k;\n c = splitter * s1;\n ahi = c - (c - s1);\n alo = s1 - ahi;\n _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo);\n _k = _i + _0;\n bvirt = _k - _i;\n u[1] = _i - (_k - bvirt) + (_0 - bvirt);\n u3 = _j + _k;\n u[2] = _k - (u3 - _j);\n u[3] = u3;\n finlen = finadd(finlen, 4, u);\n if (z !== 0) {\n c = splitter * z;\n bhi = c - (c - z);\n blo = z - bhi;\n _i = s0 * z;\n c = splitter * s0;\n ahi = c - (c - s0);\n alo = s0 - ahi;\n u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo);\n _j = s1 * z;\n c = splitter * s1;\n ahi = c - (c - s1);\n alo = s1 - ahi;\n _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo);\n _k = _i + _0;\n bvirt = _k - _i;\n u[1] = _i - (_k - bvirt) + (_0 - bvirt);\n u3 = _j + _k;\n u[2] = _k - (u3 - _j);\n u[3] = u3;\n finlen = finadd(finlen, 4, u);\n }\n return finlen;\n}\n\nfunction orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent) {\n let finlen;\n let adxtail, bdxtail, cdxtail;\n let adytail, bdytail, cdytail;\n let adztail, bdztail, cdztail;\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3;\n\n const adx = ax - dx;\n const bdx = bx - dx;\n const cdx = cx - dx;\n const ady = ay - dy;\n const bdy = by - dy;\n const cdy = cy - dy;\n const adz = az - dz;\n const bdz = bz - dz;\n const cdz = cz - dz;\n\n s1 = bdx * cdy;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * cdy;\n bhi = c - (c - cdy);\n blo = cdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cdx * bdy;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * bdy;\n bhi = c - (c - bdy);\n blo = bdy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bc[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bc[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bc[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bc[3] = u3;\n s1 = cdx * ady;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * ady;\n bhi = c - (c - ady);\n blo = ady - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = adx * cdy;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * cdy;\n bhi = c - (c - cdy);\n blo = cdy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ca[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ca[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ca[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ca[3] = u3;\n s1 = adx * bdy;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * bdy;\n bhi = c - (c - bdy);\n blo = bdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bdx * ady;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * ady;\n bhi = c - (c - ady);\n blo = ady - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ab[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ab[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ab[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ab[3] = u3;\n\n finlen = sum(\n sum(\n scale(4, bc, adz, _8), _8,\n scale(4, ca, bdz, _8b), _8b, _16), _16,\n scale(4, ab, cdz, _8), _8, fin);\n\n let det = estimate(finlen, fin);\n let errbound = o3derrboundB * permanent;\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n bvirt = ax - adx;\n adxtail = ax - (adx + bvirt) + (bvirt - dx);\n bvirt = bx - bdx;\n bdxtail = bx - (bdx + bvirt) + (bvirt - dx);\n bvirt = cx - cdx;\n cdxtail = cx - (cdx + bvirt) + (bvirt - dx);\n bvirt = ay - ady;\n adytail = ay - (ady + bvirt) + (bvirt - dy);\n bvirt = by - bdy;\n bdytail = by - (bdy + bvirt) + (bvirt - dy);\n bvirt = cy - cdy;\n cdytail = cy - (cdy + bvirt) + (bvirt - dy);\n bvirt = az - adz;\n adztail = az - (adz + bvirt) + (bvirt - dz);\n bvirt = bz - bdz;\n bdztail = bz - (bdz + bvirt) + (bvirt - dz);\n bvirt = cz - cdz;\n cdztail = cz - (cdz + bvirt) + (bvirt - dz);\n\n if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 &&\n adytail === 0 && bdytail === 0 && cdytail === 0 &&\n adztail === 0 && bdztail === 0 && cdztail === 0) {\n return det;\n }\n\n errbound = o3derrboundC * permanent + resulterrbound * Math.abs(det);\n det +=\n adz * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + adztail * (bdx * cdy - bdy * cdx) +\n bdz * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + bdztail * (cdx * ady - cdy * adx) +\n cdz * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + cdztail * (adx * bdy - ady * bdx);\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n const at_len = tailinit(adxtail, adytail, bdx, bdy, cdx, cdy, at_b, at_c);\n const bt_len = tailinit(bdxtail, bdytail, cdx, cdy, adx, ady, bt_c, bt_a);\n const ct_len = tailinit(cdxtail, cdytail, adx, ady, bdx, bdy, ct_a, ct_b);\n\n const bctlen = sum(bt_len, bt_c, ct_len, ct_b, bct);\n finlen = finadd(finlen, scale(bctlen, bct, adz, _16), _16);\n\n const catlen = sum(ct_len, ct_a, at_len, at_c, cat);\n finlen = finadd(finlen, scale(catlen, cat, bdz, _16), _16);\n\n const abtlen = sum(at_len, at_b, bt_len, bt_a, abt);\n finlen = finadd(finlen, scale(abtlen, abt, cdz, _16), _16);\n\n if (adztail !== 0) {\n finlen = finadd(finlen, scale(4, bc, adztail, _12), _12);\n finlen = finadd(finlen, scale(bctlen, bct, adztail, _16), _16);\n }\n if (bdztail !== 0) {\n finlen = finadd(finlen, scale(4, ca, bdztail, _12), _12);\n finlen = finadd(finlen, scale(catlen, cat, bdztail, _16), _16);\n }\n if (cdztail !== 0) {\n finlen = finadd(finlen, scale(4, ab, cdztail, _12), _12);\n finlen = finadd(finlen, scale(abtlen, abt, cdztail, _16), _16);\n }\n\n if (adxtail !== 0) {\n if (bdytail !== 0) {\n finlen = tailadd(finlen, adxtail, bdytail, cdz, cdztail);\n }\n if (cdytail !== 0) {\n finlen = tailadd(finlen, -adxtail, cdytail, bdz, bdztail);\n }\n }\n if (bdxtail !== 0) {\n if (cdytail !== 0) {\n finlen = tailadd(finlen, bdxtail, cdytail, adz, adztail);\n }\n if (adytail !== 0) {\n finlen = tailadd(finlen, -bdxtail, adytail, cdz, cdztail);\n }\n }\n if (cdxtail !== 0) {\n if (adytail !== 0) {\n finlen = tailadd(finlen, cdxtail, adytail, bdz, bdztail);\n }\n if (bdytail !== 0) {\n finlen = tailadd(finlen, -cdxtail, bdytail, adz, adztail);\n }\n }\n\n return fin[finlen - 1];\n}\n\nexport function orient3d(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) {\n const adx = ax - dx;\n const bdx = bx - dx;\n const cdx = cx - dx;\n const ady = ay - dy;\n const bdy = by - dy;\n const cdy = cy - dy;\n const adz = az - dz;\n const bdz = bz - dz;\n const cdz = cz - dz;\n\n const bdxcdy = bdx * cdy;\n const cdxbdy = cdx * bdy;\n\n const cdxady = cdx * ady;\n const adxcdy = adx * cdy;\n\n const adxbdy = adx * bdy;\n const bdxady = bdx * ady;\n\n const det =\n adz * (bdxcdy - cdxbdy) +\n bdz * (cdxady - adxcdy) +\n cdz * (adxbdy - bdxady);\n\n const permanent =\n (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * Math.abs(adz) +\n (Math.abs(cdxady) + Math.abs(adxcdy)) * Math.abs(bdz) +\n (Math.abs(adxbdy) + Math.abs(bdxady)) * Math.abs(cdz);\n\n const errbound = o3derrboundA * permanent;\n if (det > errbound || -det > errbound) {\n return det;\n }\n\n return orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent);\n}\n\nexport function orient3dfast(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) {\n const adx = ax - dx;\n const bdx = bx - dx;\n const cdx = cx - dx;\n const ady = ay - dy;\n const bdy = by - dy;\n const cdy = cy - dy;\n const adz = az - dz;\n const bdz = bz - dz;\n const cdz = cz - dz;\n\n return adx * (bdy * cdz - bdz * cdy) +\n bdx * (cdy * adz - cdz * ady) +\n cdx * (ady * bdz - adz * bdy);\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum, sum_three, scale} from './util.js';\n\nconst iccerrboundA = (10 + 96 * epsilon) * epsilon;\nconst iccerrboundB = (4 + 48 * epsilon) * epsilon;\nconst iccerrboundC = (44 + 576 * epsilon) * epsilon * epsilon;\n\nconst bc = vec(4);\nconst ca = vec(4);\nconst ab = vec(4);\nconst aa = vec(4);\nconst bb = vec(4);\nconst cc = vec(4);\nconst u = vec(4);\nconst v = vec(4);\nconst axtbc = vec(8);\nconst aytbc = vec(8);\nconst bxtca = vec(8);\nconst bytca = vec(8);\nconst cxtab = vec(8);\nconst cytab = vec(8);\nconst abt = vec(8);\nconst bct = vec(8);\nconst cat = vec(8);\nconst abtt = vec(4);\nconst bctt = vec(4);\nconst catt = vec(4);\n\nconst _8 = vec(8);\nconst _16 = vec(16);\nconst _16b = vec(16);\nconst _16c = vec(16);\nconst _32 = vec(32);\nconst _32b = vec(32);\nconst _48 = vec(48);\nconst _64 = vec(64);\n\nlet fin = vec(1152);\nlet fin2 = vec(1152);\n\nfunction finadd(finlen, a, alen) {\n finlen = sum(finlen, fin, a, alen, fin2);\n const tmp = fin; fin = fin2; fin2 = tmp;\n return finlen;\n}\n\nfunction incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent) {\n let finlen;\n let adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail;\n let axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen;\n let abtlen, bctlen, catlen;\n let abttlen, bcttlen, cattlen;\n let n1, n0;\n\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;\n\n const adx = ax - dx;\n const bdx = bx - dx;\n const cdx = cx - dx;\n const ady = ay - dy;\n const bdy = by - dy;\n const cdy = cy - dy;\n\n s1 = bdx * cdy;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * cdy;\n bhi = c - (c - cdy);\n blo = cdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cdx * bdy;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * bdy;\n bhi = c - (c - bdy);\n blo = bdy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bc[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bc[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bc[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bc[3] = u3;\n s1 = cdx * ady;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * ady;\n bhi = c - (c - ady);\n blo = ady - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = adx * cdy;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * cdy;\n bhi = c - (c - cdy);\n blo = cdy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ca[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ca[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ca[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ca[3] = u3;\n s1 = adx * bdy;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * bdy;\n bhi = c - (c - bdy);\n blo = bdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bdx * ady;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * ady;\n bhi = c - (c - ady);\n blo = ady - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ab[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ab[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ab[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ab[3] = u3;\n\n finlen = sum(\n sum(\n sum(\n scale(scale(4, bc, adx, _8), _8, adx, _16), _16,\n scale(scale(4, bc, ady, _8), _8, ady, _16b), _16b, _32), _32,\n sum(\n scale(scale(4, ca, bdx, _8), _8, bdx, _16), _16,\n scale(scale(4, ca, bdy, _8), _8, bdy, _16b), _16b, _32b), _32b, _64), _64,\n sum(\n scale(scale(4, ab, cdx, _8), _8, cdx, _16), _16,\n scale(scale(4, ab, cdy, _8), _8, cdy, _16b), _16b, _32), _32, fin);\n\n let det = estimate(finlen, fin);\n let errbound = iccerrboundB * permanent;\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n bvirt = ax - adx;\n adxtail = ax - (adx + bvirt) + (bvirt - dx);\n bvirt = ay - ady;\n adytail = ay - (ady + bvirt) + (bvirt - dy);\n bvirt = bx - bdx;\n bdxtail = bx - (bdx + bvirt) + (bvirt - dx);\n bvirt = by - bdy;\n bdytail = by - (bdy + bvirt) + (bvirt - dy);\n bvirt = cx - cdx;\n cdxtail = cx - (cdx + bvirt) + (bvirt - dx);\n bvirt = cy - cdy;\n cdytail = cy - (cdy + bvirt) + (bvirt - dy);\n if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0) {\n return det;\n }\n\n errbound = iccerrboundC * permanent + resulterrbound * Math.abs(det);\n det += ((adx * adx + ady * ady) * ((bdx * cdytail + cdy * bdxtail) - (bdy * cdxtail + cdx * bdytail)) +\n 2 * (adx * adxtail + ady * adytail) * (bdx * cdy - bdy * cdx)) +\n ((bdx * bdx + bdy * bdy) * ((cdx * adytail + ady * cdxtail) - (cdy * adxtail + adx * cdytail)) +\n 2 * (bdx * bdxtail + bdy * bdytail) * (cdx * ady - cdy * adx)) +\n ((cdx * cdx + cdy * cdy) * ((adx * bdytail + bdy * adxtail) - (ady * bdxtail + bdx * adytail)) +\n 2 * (cdx * cdxtail + cdy * cdytail) * (adx * bdy - ady * bdx));\n\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) {\n s1 = adx * adx;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo);\n t1 = ady * ady;\n c = splitter * ady;\n ahi = c - (c - ady);\n alo = ady - ahi;\n t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo);\n _i = s0 + t0;\n bvirt = _i - s0;\n aa[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n aa[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n aa[2] = _j - (u3 - bvirt) + (_i - bvirt);\n aa[3] = u3;\n }\n if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) {\n s1 = bdx * bdx;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo);\n t1 = bdy * bdy;\n c = splitter * bdy;\n ahi = c - (c - bdy);\n alo = bdy - ahi;\n t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo);\n _i = s0 + t0;\n bvirt = _i - s0;\n bb[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n bb[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bb[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bb[3] = u3;\n }\n if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) {\n s1 = cdx * cdx;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo);\n t1 = cdy * cdy;\n c = splitter * cdy;\n ahi = c - (c - cdy);\n alo = cdy - ahi;\n t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo);\n _i = s0 + t0;\n bvirt = _i - s0;\n cc[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n cc[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n cc[2] = _j - (u3 - bvirt) + (_i - bvirt);\n cc[3] = u3;\n }\n\n if (adxtail !== 0) {\n axtbclen = scale(4, bc, adxtail, axtbc);\n finlen = finadd(finlen, sum_three(\n scale(axtbclen, axtbc, 2 * adx, _16), _16,\n scale(scale(4, cc, adxtail, _8), _8, bdy, _16b), _16b,\n scale(scale(4, bb, adxtail, _8), _8, -cdy, _16c), _16c, _32, _48), _48);\n }\n if (adytail !== 0) {\n aytbclen = scale(4, bc, adytail, aytbc);\n finlen = finadd(finlen, sum_three(\n scale(aytbclen, aytbc, 2 * ady, _16), _16,\n scale(scale(4, bb, adytail, _8), _8, cdx, _16b), _16b,\n scale(scale(4, cc, adytail, _8), _8, -bdx, _16c), _16c, _32, _48), _48);\n }\n if (bdxtail !== 0) {\n bxtcalen = scale(4, ca, bdxtail, bxtca);\n finlen = finadd(finlen, sum_three(\n scale(bxtcalen, bxtca, 2 * bdx, _16), _16,\n scale(scale(4, aa, bdxtail, _8), _8, cdy, _16b), _16b,\n scale(scale(4, cc, bdxtail, _8), _8, -ady, _16c), _16c, _32, _48), _48);\n }\n if (bdytail !== 0) {\n bytcalen = scale(4, ca, bdytail, bytca);\n finlen = finadd(finlen, sum_three(\n scale(bytcalen, bytca, 2 * bdy, _16), _16,\n scale(scale(4, cc, bdytail, _8), _8, adx, _16b), _16b,\n scale(scale(4, aa, bdytail, _8), _8, -cdx, _16c), _16c, _32, _48), _48);\n }\n if (cdxtail !== 0) {\n cxtablen = scale(4, ab, cdxtail, cxtab);\n finlen = finadd(finlen, sum_three(\n scale(cxtablen, cxtab, 2 * cdx, _16), _16,\n scale(scale(4, bb, cdxtail, _8), _8, ady, _16b), _16b,\n scale(scale(4, aa, cdxtail, _8), _8, -bdy, _16c), _16c, _32, _48), _48);\n }\n if (cdytail !== 0) {\n cytablen = scale(4, ab, cdytail, cytab);\n finlen = finadd(finlen, sum_three(\n scale(cytablen, cytab, 2 * cdy, _16), _16,\n scale(scale(4, aa, cdytail, _8), _8, bdx, _16b), _16b,\n scale(scale(4, bb, cdytail, _8), _8, -adx, _16c), _16c, _32, _48), _48);\n }\n\n if (adxtail !== 0 || adytail !== 0) {\n if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) {\n s1 = bdxtail * cdy;\n c = splitter * bdxtail;\n ahi = c - (c - bdxtail);\n alo = bdxtail - ahi;\n c = splitter * cdy;\n bhi = c - (c - cdy);\n blo = cdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bdx * cdytail;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * cdytail;\n bhi = c - (c - cdytail);\n blo = cdytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n u[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n u[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n s1 = cdxtail * -bdy;\n c = splitter * cdxtail;\n ahi = c - (c - cdxtail);\n alo = cdxtail - ahi;\n c = splitter * -bdy;\n bhi = c - (c - -bdy);\n blo = -bdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cdx * -bdytail;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * -bdytail;\n bhi = c - (c - -bdytail);\n blo = -bdytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n v[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n v[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n v[2] = _j - (u3 - bvirt) + (_i - bvirt);\n v[3] = u3;\n bctlen = sum(4, u, 4, v, bct);\n s1 = bdxtail * cdytail;\n c = splitter * bdxtail;\n ahi = c - (c - bdxtail);\n alo = bdxtail - ahi;\n c = splitter * cdytail;\n bhi = c - (c - cdytail);\n blo = cdytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cdxtail * bdytail;\n c = splitter * cdxtail;\n ahi = c - (c - cdxtail);\n alo = cdxtail - ahi;\n c = splitter * bdytail;\n bhi = c - (c - bdytail);\n blo = bdytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bctt[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bctt[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bctt[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bctt[3] = u3;\n bcttlen = 4;\n } else {\n bct[0] = 0;\n bctlen = 1;\n bctt[0] = 0;\n bcttlen = 1;\n }\n if (adxtail !== 0) {\n const len = scale(bctlen, bct, adxtail, _16c);\n finlen = finadd(finlen, sum(\n scale(axtbclen, axtbc, adxtail, _16), _16,\n scale(len, _16c, 2 * adx, _32), _32, _48), _48);\n\n const len2 = scale(bcttlen, bctt, adxtail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * adx, _16), _16,\n scale(len2, _8, adxtail, _16b), _16b,\n scale(len, _16c, adxtail, _32), _32, _32b, _64), _64);\n\n if (bdytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, cc, adxtail, _8), _8, bdytail, _16), _16);\n }\n if (cdytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, bb, -adxtail, _8), _8, cdytail, _16), _16);\n }\n }\n if (adytail !== 0) {\n const len = scale(bctlen, bct, adytail, _16c);\n finlen = finadd(finlen, sum(\n scale(aytbclen, aytbc, adytail, _16), _16,\n scale(len, _16c, 2 * ady, _32), _32, _48), _48);\n\n const len2 = scale(bcttlen, bctt, adytail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * ady, _16), _16,\n scale(len2, _8, adytail, _16b), _16b,\n scale(len, _16c, adytail, _32), _32, _32b, _64), _64);\n }\n }\n if (bdxtail !== 0 || bdytail !== 0) {\n if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) {\n s1 = cdxtail * ady;\n c = splitter * cdxtail;\n ahi = c - (c - cdxtail);\n alo = cdxtail - ahi;\n c = splitter * ady;\n bhi = c - (c - ady);\n blo = ady - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cdx * adytail;\n c = splitter * cdx;\n ahi = c - (c - cdx);\n alo = cdx - ahi;\n c = splitter * adytail;\n bhi = c - (c - adytail);\n blo = adytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n u[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n u[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n n1 = -cdy;\n n0 = -cdytail;\n s1 = adxtail * n1;\n c = splitter * adxtail;\n ahi = c - (c - adxtail);\n alo = adxtail - ahi;\n c = splitter * n1;\n bhi = c - (c - n1);\n blo = n1 - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = adx * n0;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * n0;\n bhi = c - (c - n0);\n blo = n0 - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n v[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n v[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n v[2] = _j - (u3 - bvirt) + (_i - bvirt);\n v[3] = u3;\n catlen = sum(4, u, 4, v, cat);\n s1 = cdxtail * adytail;\n c = splitter * cdxtail;\n ahi = c - (c - cdxtail);\n alo = cdxtail - ahi;\n c = splitter * adytail;\n bhi = c - (c - adytail);\n blo = adytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = adxtail * cdytail;\n c = splitter * adxtail;\n ahi = c - (c - adxtail);\n alo = adxtail - ahi;\n c = splitter * cdytail;\n bhi = c - (c - cdytail);\n blo = cdytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n catt[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n catt[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n catt[2] = _j - (u3 - bvirt) + (_i - bvirt);\n catt[3] = u3;\n cattlen = 4;\n } else {\n cat[0] = 0;\n catlen = 1;\n catt[0] = 0;\n cattlen = 1;\n }\n if (bdxtail !== 0) {\n const len = scale(catlen, cat, bdxtail, _16c);\n finlen = finadd(finlen, sum(\n scale(bxtcalen, bxtca, bdxtail, _16), _16,\n scale(len, _16c, 2 * bdx, _32), _32, _48), _48);\n\n const len2 = scale(cattlen, catt, bdxtail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * bdx, _16), _16,\n scale(len2, _8, bdxtail, _16b), _16b,\n scale(len, _16c, bdxtail, _32), _32, _32b, _64), _64);\n\n if (cdytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, aa, bdxtail, _8), _8, cdytail, _16), _16);\n }\n if (adytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, cc, -bdxtail, _8), _8, adytail, _16), _16);\n }\n }\n if (bdytail !== 0) {\n const len = scale(catlen, cat, bdytail, _16c);\n finlen = finadd(finlen, sum(\n scale(bytcalen, bytca, bdytail, _16), _16,\n scale(len, _16c, 2 * bdy, _32), _32, _48), _48);\n\n const len2 = scale(cattlen, catt, bdytail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * bdy, _16), _16,\n scale(len2, _8, bdytail, _16b), _16b,\n scale(len, _16c, bdytail, _32), _32, _32b, _64), _64);\n }\n }\n if (cdxtail !== 0 || cdytail !== 0) {\n if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) {\n s1 = adxtail * bdy;\n c = splitter * adxtail;\n ahi = c - (c - adxtail);\n alo = adxtail - ahi;\n c = splitter * bdy;\n bhi = c - (c - bdy);\n blo = bdy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = adx * bdytail;\n c = splitter * adx;\n ahi = c - (c - adx);\n alo = adx - ahi;\n c = splitter * bdytail;\n bhi = c - (c - bdytail);\n blo = bdytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n u[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n u[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n n1 = -ady;\n n0 = -adytail;\n s1 = bdxtail * n1;\n c = splitter * bdxtail;\n ahi = c - (c - bdxtail);\n alo = bdxtail - ahi;\n c = splitter * n1;\n bhi = c - (c - n1);\n blo = n1 - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bdx * n0;\n c = splitter * bdx;\n ahi = c - (c - bdx);\n alo = bdx - ahi;\n c = splitter * n0;\n bhi = c - (c - n0);\n blo = n0 - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 + t0;\n bvirt = _i - s0;\n v[0] = s0 - (_i - bvirt) + (t0 - bvirt);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 + t1;\n bvirt = _i - _0;\n v[1] = _0 - (_i - bvirt) + (t1 - bvirt);\n u3 = _j + _i;\n bvirt = u3 - _j;\n v[2] = _j - (u3 - bvirt) + (_i - bvirt);\n v[3] = u3;\n abtlen = sum(4, u, 4, v, abt);\n s1 = adxtail * bdytail;\n c = splitter * adxtail;\n ahi = c - (c - adxtail);\n alo = adxtail - ahi;\n c = splitter * bdytail;\n bhi = c - (c - bdytail);\n blo = bdytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bdxtail * adytail;\n c = splitter * bdxtail;\n ahi = c - (c - bdxtail);\n alo = bdxtail - ahi;\n c = splitter * adytail;\n bhi = c - (c - adytail);\n blo = adytail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n abtt[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n abtt[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n abtt[2] = _j - (u3 - bvirt) + (_i - bvirt);\n abtt[3] = u3;\n abttlen = 4;\n } else {\n abt[0] = 0;\n abtlen = 1;\n abtt[0] = 0;\n abttlen = 1;\n }\n if (cdxtail !== 0) {\n const len = scale(abtlen, abt, cdxtail, _16c);\n finlen = finadd(finlen, sum(\n scale(cxtablen, cxtab, cdxtail, _16), _16,\n scale(len, _16c, 2 * cdx, _32), _32, _48), _48);\n\n const len2 = scale(abttlen, abtt, cdxtail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * cdx, _16), _16,\n scale(len2, _8, cdxtail, _16b), _16b,\n scale(len, _16c, cdxtail, _32), _32, _32b, _64), _64);\n\n if (adytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, bb, cdxtail, _8), _8, adytail, _16), _16);\n }\n if (bdytail !== 0) {\n finlen = finadd(finlen, scale(scale(4, aa, -cdxtail, _8), _8, bdytail, _16), _16);\n }\n }\n if (cdytail !== 0) {\n const len = scale(abtlen, abt, cdytail, _16c);\n finlen = finadd(finlen, sum(\n scale(cytablen, cytab, cdytail, _16), _16,\n scale(len, _16c, 2 * cdy, _32), _32, _48), _48);\n\n const len2 = scale(abttlen, abtt, cdytail, _8);\n finlen = finadd(finlen, sum_three(\n scale(len2, _8, 2 * cdy, _16), _16,\n scale(len2, _8, cdytail, _16b), _16b,\n scale(len, _16c, cdytail, _32), _32, _32b, _64), _64);\n }\n }\n\n return fin[finlen - 1];\n}\n\nexport function incircle(ax, ay, bx, by, cx, cy, dx, dy) {\n const adx = ax - dx;\n const bdx = bx - dx;\n const cdx = cx - dx;\n const ady = ay - dy;\n const bdy = by - dy;\n const cdy = cy - dy;\n\n const bdxcdy = bdx * cdy;\n const cdxbdy = cdx * bdy;\n const alift = adx * adx + ady * ady;\n\n const cdxady = cdx * ady;\n const adxcdy = adx * cdy;\n const blift = bdx * bdx + bdy * bdy;\n\n const adxbdy = adx * bdy;\n const bdxady = bdx * ady;\n const clift = cdx * cdx + cdy * cdy;\n\n const det =\n alift * (bdxcdy - cdxbdy) +\n blift * (cdxady - adxcdy) +\n clift * (adxbdy - bdxady);\n\n const permanent =\n (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * alift +\n (Math.abs(cdxady) + Math.abs(adxcdy)) * blift +\n (Math.abs(adxbdy) + Math.abs(bdxady)) * clift;\n\n const errbound = iccerrboundA * permanent;\n\n if (det > errbound || -det > errbound) {\n return det;\n }\n return incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent);\n}\n\nexport function incirclefast(ax, ay, bx, by, cx, cy, dx, dy) {\n const adx = ax - dx;\n const ady = ay - dy;\n const bdx = bx - dx;\n const bdy = by - dy;\n const cdx = cx - dx;\n const cdy = cy - dy;\n\n const abdet = adx * bdy - bdx * ady;\n const bcdet = bdx * cdy - cdx * bdy;\n const cadet = cdx * ady - adx * cdy;\n const alift = adx * adx + ady * ady;\n const blift = bdx * bdx + bdy * bdy;\n const clift = cdx * cdx + cdy * cdy;\n\n return alift * bcdet + blift * cadet + clift * abdet;\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum, sum_three, scale, negate} from './util.js';\n\nconst isperrboundA = (16 + 224 * epsilon) * epsilon;\nconst isperrboundB = (5 + 72 * epsilon) * epsilon;\nconst isperrboundC = (71 + 1408 * epsilon) * epsilon * epsilon;\n\nconst ab = vec(4);\nconst bc = vec(4);\nconst cd = vec(4);\nconst de = vec(4);\nconst ea = vec(4);\nconst ac = vec(4);\nconst bd = vec(4);\nconst ce = vec(4);\nconst da = vec(4);\nconst eb = vec(4);\n\nconst abc = vec(24);\nconst bcd = vec(24);\nconst cde = vec(24);\nconst dea = vec(24);\nconst eab = vec(24);\nconst abd = vec(24);\nconst bce = vec(24);\nconst cda = vec(24);\nconst deb = vec(24);\nconst eac = vec(24);\n\nconst adet = vec(1152);\nconst bdet = vec(1152);\nconst cdet = vec(1152);\nconst ddet = vec(1152);\nconst edet = vec(1152);\nconst abdet = vec(2304);\nconst cddet = vec(2304);\nconst cdedet = vec(3456);\nconst deter = vec(5760);\n\nconst _8 = vec(8);\nconst _8b = vec(8);\nconst _8c = vec(8);\nconst _16 = vec(16);\nconst _24 = vec(24);\nconst _48 = vec(48);\nconst _48b = vec(48);\nconst _96 = vec(96);\nconst _192 = vec(192);\nconst _384x = vec(384);\nconst _384y = vec(384);\nconst _384z = vec(384);\nconst _768 = vec(768);\n\nfunction sum_three_scale(a, b, c, az, bz, cz, out) {\n return sum_three(\n scale(4, a, az, _8), _8,\n scale(4, b, bz, _8b), _8b,\n scale(4, c, cz, _8c), _8c, _16, out);\n}\n\nfunction liftexact(alen, a, blen, b, clen, c, dlen, d, x, y, z, out) {\n const len = sum(\n sum(alen, a, blen, b, _48), _48,\n negate(sum(clen, c, dlen, d, _48b), _48b), _48b, _96);\n\n return sum_three(\n scale(scale(len, _96, x, _192), _192, x, _384x), _384x,\n scale(scale(len, _96, y, _192), _192, y, _384y), _384y,\n scale(scale(len, _96, z, _192), _192, z, _384z), _384z, _768, out);\n}\n\nfunction insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) {\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;\n\n s1 = ax * by;\n c = splitter * ax;\n ahi = c - (c - ax);\n alo = ax - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bx * ay;\n c = splitter * bx;\n ahi = c - (c - bx);\n alo = bx - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ab[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ab[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ab[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ab[3] = u3;\n s1 = bx * cy;\n c = splitter * bx;\n ahi = c - (c - bx);\n alo = bx - ahi;\n c = splitter * cy;\n bhi = c - (c - cy);\n blo = cy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cx * by;\n c = splitter * cx;\n ahi = c - (c - cx);\n alo = cx - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bc[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bc[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bc[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bc[3] = u3;\n s1 = cx * dy;\n c = splitter * cx;\n ahi = c - (c - cx);\n alo = cx - ahi;\n c = splitter * dy;\n bhi = c - (c - dy);\n blo = dy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = dx * cy;\n c = splitter * dx;\n ahi = c - (c - dx);\n alo = dx - ahi;\n c = splitter * cy;\n bhi = c - (c - cy);\n blo = cy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n cd[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n cd[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n cd[2] = _j - (u3 - bvirt) + (_i - bvirt);\n cd[3] = u3;\n s1 = dx * ey;\n c = splitter * dx;\n ahi = c - (c - dx);\n alo = dx - ahi;\n c = splitter * ey;\n bhi = c - (c - ey);\n blo = ey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = ex * dy;\n c = splitter * ex;\n ahi = c - (c - ex);\n alo = ex - ahi;\n c = splitter * dy;\n bhi = c - (c - dy);\n blo = dy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n de[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n de[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n de[2] = _j - (u3 - bvirt) + (_i - bvirt);\n de[3] = u3;\n s1 = ex * ay;\n c = splitter * ex;\n ahi = c - (c - ex);\n alo = ex - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = ax * ey;\n c = splitter * ax;\n ahi = c - (c - ax);\n alo = ax - ahi;\n c = splitter * ey;\n bhi = c - (c - ey);\n blo = ey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ea[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ea[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ea[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ea[3] = u3;\n s1 = ax * cy;\n c = splitter * ax;\n ahi = c - (c - ax);\n alo = ax - ahi;\n c = splitter * cy;\n bhi = c - (c - cy);\n blo = cy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cx * ay;\n c = splitter * cx;\n ahi = c - (c - cx);\n alo = cx - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ac[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ac[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ac[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ac[3] = u3;\n s1 = bx * dy;\n c = splitter * bx;\n ahi = c - (c - bx);\n alo = bx - ahi;\n c = splitter * dy;\n bhi = c - (c - dy);\n blo = dy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = dx * by;\n c = splitter * dx;\n ahi = c - (c - dx);\n alo = dx - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bd[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bd[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n bd[2] = _j - (u3 - bvirt) + (_i - bvirt);\n bd[3] = u3;\n s1 = cx * ey;\n c = splitter * cx;\n ahi = c - (c - cx);\n alo = cx - ahi;\n c = splitter * ey;\n bhi = c - (c - ey);\n blo = ey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = ex * cy;\n c = splitter * ex;\n ahi = c - (c - ex);\n alo = ex - ahi;\n c = splitter * cy;\n bhi = c - (c - cy);\n blo = cy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ce[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ce[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n ce[2] = _j - (u3 - bvirt) + (_i - bvirt);\n ce[3] = u3;\n s1 = dx * ay;\n c = splitter * dx;\n ahi = c - (c - dx);\n alo = dx - ahi;\n c = splitter * ay;\n bhi = c - (c - ay);\n blo = ay - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = ax * dy;\n c = splitter * ax;\n ahi = c - (c - ax);\n alo = ax - ahi;\n c = splitter * dy;\n bhi = c - (c - dy);\n blo = dy - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n da[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n da[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n da[2] = _j - (u3 - bvirt) + (_i - bvirt);\n da[3] = u3;\n s1 = ex * by;\n c = splitter * ex;\n ahi = c - (c - ex);\n alo = ex - ahi;\n c = splitter * by;\n bhi = c - (c - by);\n blo = by - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bx * ey;\n c = splitter * bx;\n ahi = c - (c - bx);\n alo = bx - ahi;\n c = splitter * ey;\n bhi = c - (c - ey);\n blo = ey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n eb[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n eb[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n eb[2] = _j - (u3 - bvirt) + (_i - bvirt);\n eb[3] = u3;\n\n const abclen = sum_three_scale(ab, bc, ac, cz, az, -bz, abc);\n const bcdlen = sum_three_scale(bc, cd, bd, dz, bz, -cz, bcd);\n const cdelen = sum_three_scale(cd, de, ce, ez, cz, -dz, cde);\n const dealen = sum_three_scale(de, ea, da, az, dz, -ez, dea);\n const eablen = sum_three_scale(ea, ab, eb, bz, ez, -az, eab);\n const abdlen = sum_three_scale(ab, bd, da, dz, az, bz, abd);\n const bcelen = sum_three_scale(bc, ce, eb, ez, bz, cz, bce);\n const cdalen = sum_three_scale(cd, da, ac, az, cz, dz, cda);\n const deblen = sum_three_scale(de, eb, bd, bz, dz, ez, deb);\n const eaclen = sum_three_scale(ea, ac, ce, cz, ez, az, eac);\n\n const deterlen = sum_three(\n liftexact(cdelen, cde, bcelen, bce, deblen, deb, bcdlen, bcd, ax, ay, az, adet), adet,\n liftexact(dealen, dea, cdalen, cda, eaclen, eac, cdelen, cde, bx, by, bz, bdet), bdet,\n sum_three(\n liftexact(eablen, eab, deblen, deb, abdlen, abd, dealen, dea, cx, cy, cz, cdet), cdet,\n liftexact(abclen, abc, eaclen, eac, bcelen, bce, eablen, eab, dx, dy, dz, ddet), ddet,\n liftexact(bcdlen, bcd, abdlen, abd, cdalen, cda, abclen, abc, ex, ey, ez, edet), edet, cddet, cdedet), cdedet, abdet, deter);\n\n return deter[deterlen - 1];\n}\n\nconst xdet = vec(96);\nconst ydet = vec(96);\nconst zdet = vec(96);\nconst fin = vec(1152);\n\nfunction liftadapt(a, b, c, az, bz, cz, x, y, z, out) {\n const len = sum_three_scale(a, b, c, az, bz, cz, _24);\n return sum_three(\n scale(scale(len, _24, x, _48), _48, x, xdet), xdet,\n scale(scale(len, _24, y, _48), _48, y, ydet), ydet,\n scale(scale(len, _24, z, _48), _48, z, zdet), zdet, _192, out);\n}\n\nfunction insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent) {\n let ab3, bc3, cd3, da3, ac3, bd3;\n\n let aextail, bextail, cextail, dextail;\n let aeytail, beytail, ceytail, deytail;\n let aeztail, beztail, ceztail, deztail;\n\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0;\n\n const aex = ax - ex;\n const bex = bx - ex;\n const cex = cx - ex;\n const dex = dx - ex;\n const aey = ay - ey;\n const bey = by - ey;\n const cey = cy - ey;\n const dey = dy - ey;\n const aez = az - ez;\n const bez = bz - ez;\n const cez = cz - ez;\n const dez = dz - ez;\n\n s1 = aex * bey;\n c = splitter * aex;\n ahi = c - (c - aex);\n alo = aex - ahi;\n c = splitter * bey;\n bhi = c - (c - bey);\n blo = bey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = bex * aey;\n c = splitter * bex;\n ahi = c - (c - bex);\n alo = bex - ahi;\n c = splitter * aey;\n bhi = c - (c - aey);\n blo = aey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ab[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ab[1] = _0 - (_i + bvirt) + (bvirt - t1);\n ab3 = _j + _i;\n bvirt = ab3 - _j;\n ab[2] = _j - (ab3 - bvirt) + (_i - bvirt);\n ab[3] = ab3;\n s1 = bex * cey;\n c = splitter * bex;\n ahi = c - (c - bex);\n alo = bex - ahi;\n c = splitter * cey;\n bhi = c - (c - cey);\n blo = cey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cex * bey;\n c = splitter * cex;\n ahi = c - (c - cex);\n alo = cex - ahi;\n c = splitter * bey;\n bhi = c - (c - bey);\n blo = bey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bc[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bc[1] = _0 - (_i + bvirt) + (bvirt - t1);\n bc3 = _j + _i;\n bvirt = bc3 - _j;\n bc[2] = _j - (bc3 - bvirt) + (_i - bvirt);\n bc[3] = bc3;\n s1 = cex * dey;\n c = splitter * cex;\n ahi = c - (c - cex);\n alo = cex - ahi;\n c = splitter * dey;\n bhi = c - (c - dey);\n blo = dey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = dex * cey;\n c = splitter * dex;\n ahi = c - (c - dex);\n alo = dex - ahi;\n c = splitter * cey;\n bhi = c - (c - cey);\n blo = cey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n cd[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n cd[1] = _0 - (_i + bvirt) + (bvirt - t1);\n cd3 = _j + _i;\n bvirt = cd3 - _j;\n cd[2] = _j - (cd3 - bvirt) + (_i - bvirt);\n cd[3] = cd3;\n s1 = dex * aey;\n c = splitter * dex;\n ahi = c - (c - dex);\n alo = dex - ahi;\n c = splitter * aey;\n bhi = c - (c - aey);\n blo = aey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = aex * dey;\n c = splitter * aex;\n ahi = c - (c - aex);\n alo = aex - ahi;\n c = splitter * dey;\n bhi = c - (c - dey);\n blo = dey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n da[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n da[1] = _0 - (_i + bvirt) + (bvirt - t1);\n da3 = _j + _i;\n bvirt = da3 - _j;\n da[2] = _j - (da3 - bvirt) + (_i - bvirt);\n da[3] = da3;\n s1 = aex * cey;\n c = splitter * aex;\n ahi = c - (c - aex);\n alo = aex - ahi;\n c = splitter * cey;\n bhi = c - (c - cey);\n blo = cey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = cex * aey;\n c = splitter * cex;\n ahi = c - (c - cex);\n alo = cex - ahi;\n c = splitter * aey;\n bhi = c - (c - aey);\n blo = aey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n ac[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n ac[1] = _0 - (_i + bvirt) + (bvirt - t1);\n ac3 = _j + _i;\n bvirt = ac3 - _j;\n ac[2] = _j - (ac3 - bvirt) + (_i - bvirt);\n ac[3] = ac3;\n s1 = bex * dey;\n c = splitter * bex;\n ahi = c - (c - bex);\n alo = bex - ahi;\n c = splitter * dey;\n bhi = c - (c - dey);\n blo = dey - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = dex * bey;\n c = splitter * dex;\n ahi = c - (c - dex);\n alo = dex - ahi;\n c = splitter * bey;\n bhi = c - (c - bey);\n blo = bey - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n bd[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n bd[1] = _0 - (_i + bvirt) + (bvirt - t1);\n bd3 = _j + _i;\n bvirt = bd3 - _j;\n bd[2] = _j - (bd3 - bvirt) + (_i - bvirt);\n bd[3] = bd3;\n\n const finlen = sum(\n sum(\n negate(liftadapt(bc, cd, bd, dez, bez, -cez, aex, aey, aez, adet), adet), adet,\n liftadapt(cd, da, ac, aez, cez, dez, bex, bey, bez, bdet), bdet, abdet), abdet,\n sum(\n negate(liftadapt(da, ab, bd, bez, dez, aez, cex, cey, cez, cdet), cdet), cdet,\n liftadapt(ab, bc, ac, cez, aez, -bez, dex, dey, dez, ddet), ddet, cddet), cddet, fin);\n\n let det = estimate(finlen, fin);\n let errbound = isperrboundB * permanent;\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n bvirt = ax - aex;\n aextail = ax - (aex + bvirt) + (bvirt - ex);\n bvirt = ay - aey;\n aeytail = ay - (aey + bvirt) + (bvirt - ey);\n bvirt = az - aez;\n aeztail = az - (aez + bvirt) + (bvirt - ez);\n bvirt = bx - bex;\n bextail = bx - (bex + bvirt) + (bvirt - ex);\n bvirt = by - bey;\n beytail = by - (bey + bvirt) + (bvirt - ey);\n bvirt = bz - bez;\n beztail = bz - (bez + bvirt) + (bvirt - ez);\n bvirt = cx - cex;\n cextail = cx - (cex + bvirt) + (bvirt - ex);\n bvirt = cy - cey;\n ceytail = cy - (cey + bvirt) + (bvirt - ey);\n bvirt = cz - cez;\n ceztail = cz - (cez + bvirt) + (bvirt - ez);\n bvirt = dx - dex;\n dextail = dx - (dex + bvirt) + (bvirt - ex);\n bvirt = dy - dey;\n deytail = dy - (dey + bvirt) + (bvirt - ey);\n bvirt = dz - dez;\n deztail = dz - (dez + bvirt) + (bvirt - ez);\n if (aextail === 0 && aeytail === 0 && aeztail === 0 &&\n bextail === 0 && beytail === 0 && beztail === 0 &&\n cextail === 0 && ceytail === 0 && ceztail === 0 &&\n dextail === 0 && deytail === 0 && deztail === 0) {\n return det;\n }\n\n errbound = isperrboundC * permanent + resulterrbound * Math.abs(det);\n\n const abeps = (aex * beytail + bey * aextail) - (aey * bextail + bex * aeytail);\n const bceps = (bex * ceytail + cey * bextail) - (bey * cextail + cex * beytail);\n const cdeps = (cex * deytail + dey * cextail) - (cey * dextail + dex * ceytail);\n const daeps = (dex * aeytail + aey * dextail) - (dey * aextail + aex * deytail);\n const aceps = (aex * ceytail + cey * aextail) - (aey * cextail + cex * aeytail);\n const bdeps = (bex * deytail + dey * bextail) - (bey * dextail + dex * beytail);\n det +=\n (((bex * bex + bey * bey + bez * bez) * ((cez * daeps + dez * aceps + aez * cdeps) +\n (ceztail * da3 + deztail * ac3 + aeztail * cd3)) + (dex * dex + dey * dey + dez * dez) *\n ((aez * bceps - bez * aceps + cez * abeps) + (aeztail * bc3 - beztail * ac3 + ceztail * ab3))) -\n ((aex * aex + aey * aey + aez * aez) * ((bez * cdeps - cez * bdeps + dez * bceps) +\n (beztail * cd3 - ceztail * bd3 + deztail * bc3)) + (cex * cex + cey * cey + cez * cez) *\n ((dez * abeps + aez * bdeps + bez * daeps) + (deztail * ab3 + aeztail * bd3 + beztail * da3)))) +\n 2 * (((bex * bextail + bey * beytail + bez * beztail) * (cez * da3 + dez * ac3 + aez * cd3) +\n (dex * dextail + dey * deytail + dez * deztail) * (aez * bc3 - bez * ac3 + cez * ab3)) -\n ((aex * aextail + aey * aeytail + aez * aeztail) * (bez * cd3 - cez * bd3 + dez * bc3) +\n (cex * cextail + cey * ceytail + cez * ceztail) * (dez * ab3 + aez * bd3 + bez * da3)));\n\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n return insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez);\n}\n\nexport function insphere(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) {\n const aex = ax - ex;\n const bex = bx - ex;\n const cex = cx - ex;\n const dex = dx - ex;\n const aey = ay - ey;\n const bey = by - ey;\n const cey = cy - ey;\n const dey = dy - ey;\n const aez = az - ez;\n const bez = bz - ez;\n const cez = cz - ez;\n const dez = dz - ez;\n\n const aexbey = aex * bey;\n const bexaey = bex * aey;\n const ab = aexbey - bexaey;\n const bexcey = bex * cey;\n const cexbey = cex * bey;\n const bc = bexcey - cexbey;\n const cexdey = cex * dey;\n const dexcey = dex * cey;\n const cd = cexdey - dexcey;\n const dexaey = dex * aey;\n const aexdey = aex * dey;\n const da = dexaey - aexdey;\n const aexcey = aex * cey;\n const cexaey = cex * aey;\n const ac = aexcey - cexaey;\n const bexdey = bex * dey;\n const dexbey = dex * bey;\n const bd = bexdey - dexbey;\n\n const alift = aex * aex + aey * aey + aez * aez;\n const blift = bex * bex + bey * bey + bez * bez;\n const clift = cex * cex + cey * cey + cez * cez;\n const dlift = dex * dex + dey * dey + dez * dez;\n\n const det =\n (clift * (dez * ab + aez * bd + bez * da) - dlift * (aez * bc - bez * ac + cez * ab)) +\n (alift * (bez * cd - cez * bd + dez * bc) - blift * (cez * da + dez * ac + aez * cd));\n\n const aezplus = Math.abs(aez);\n const bezplus = Math.abs(bez);\n const cezplus = Math.abs(cez);\n const dezplus = Math.abs(dez);\n const aexbeyplus = Math.abs(aexbey) + Math.abs(bexaey);\n const bexceyplus = Math.abs(bexcey) + Math.abs(cexbey);\n const cexdeyplus = Math.abs(cexdey) + Math.abs(dexcey);\n const dexaeyplus = Math.abs(dexaey) + Math.abs(aexdey);\n const aexceyplus = Math.abs(aexcey) + Math.abs(cexaey);\n const bexdeyplus = Math.abs(bexdey) + Math.abs(dexbey);\n const permanent =\n (cexdeyplus * bezplus + bexdeyplus * cezplus + bexceyplus * dezplus) * alift +\n (dexaeyplus * cezplus + aexceyplus * dezplus + cexdeyplus * aezplus) * blift +\n (aexbeyplus * dezplus + bexdeyplus * aezplus + dexaeyplus * bezplus) * clift +\n (bexceyplus * aezplus + aexceyplus * bezplus + aexbeyplus * cezplus) * dlift;\n\n const errbound = isperrboundA * permanent;\n if (det > errbound || -det > errbound) {\n return det;\n }\n return -insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent);\n}\n\nexport function inspherefast(pax, pay, paz, pbx, pby, pbz, pcx, pcy, pcz, pdx, pdy, pdz, pex, pey, pez) {\n const aex = pax - pex;\n const bex = pbx - pex;\n const cex = pcx - pex;\n const dex = pdx - pex;\n const aey = pay - pey;\n const bey = pby - pey;\n const cey = pcy - pey;\n const dey = pdy - pey;\n const aez = paz - pez;\n const bez = pbz - pez;\n const cez = pcz - pez;\n const dez = pdz - pez;\n\n const ab = aex * bey - bex * aey;\n const bc = bex * cey - cex * bey;\n const cd = cex * dey - dex * cey;\n const da = dex * aey - aex * dey;\n const ac = aex * cey - cex * aey;\n const bd = bex * dey - dex * bey;\n\n const abc = aez * bc - bez * ac + cez * ab;\n const bcd = bez * cd - cez * bd + dez * bc;\n const cda = cez * da + dez * ac + aez * cd;\n const dab = dez * ab + aez * bd + bez * da;\n\n const alift = aex * aex + aey * aey + aez * aez;\n const blift = bex * bex + bey * bey + bez * bez;\n const clift = cex * cex + cey * cey + cez * cez;\n const dlift = dex * dex + dey * dey + dez * dez;\n\n return (clift * dab - dlift * abc) + (alift * bcd - blift * cda);\n}\n","\nconst EPSILON = Math.pow(2, -52);\nconst EDGE_STACK = new Uint32Array(512);\n\nimport {orient2d} from 'robust-predicates';\n\nexport default class Delaunator {\n\n static from(points, getX = defaultGetX, getY = defaultGetY) {\n const n = points.length;\n const coords = new Float64Array(n * 2);\n\n for (let i = 0; i < n; i++) {\n const p = points[i];\n coords[2 * i] = getX(p);\n coords[2 * i + 1] = getY(p);\n }\n\n return new Delaunator(coords);\n }\n\n constructor(coords) {\n const n = coords.length >> 1;\n if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.');\n\n this.coords = coords;\n\n // arrays that will store the triangulation graph\n const maxTriangles = Math.max(2 * n - 5, 0);\n this._triangles = new Uint32Array(maxTriangles * 3);\n this._halfedges = new Int32Array(maxTriangles * 3);\n\n // temporary arrays for tracking the edges of the advancing convex hull\n this._hashSize = Math.ceil(Math.sqrt(n));\n this._hullPrev = new Uint32Array(n); // edge to prev edge\n this._hullNext = new Uint32Array(n); // edge to next edge\n this._hullTri = new Uint32Array(n); // edge to adjacent triangle\n this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash\n\n // temporary arrays for sorting points\n this._ids = new Uint32Array(n);\n this._dists = new Float64Array(n);\n\n this.update();\n }\n\n update() {\n const {coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash} = this;\n const n = coords.length >> 1;\n\n // populate an array of point indices; calculate input data bbox\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n for (let i = 0; i < n; i++) {\n const x = coords[2 * i];\n const y = coords[2 * i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n this._ids[i] = i;\n }\n const cx = (minX + maxX) / 2;\n const cy = (minY + maxY) / 2;\n\n let minDist = Infinity;\n let i0, i1, i2;\n\n // pick a seed point close to the center\n for (let i = 0; i < n; i++) {\n const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]);\n if (d < minDist) {\n i0 = i;\n minDist = d;\n }\n }\n const i0x = coords[2 * i0];\n const i0y = coords[2 * i0 + 1];\n\n minDist = Infinity;\n\n // find the point closest to the seed\n for (let i = 0; i < n; i++) {\n if (i === i0) continue;\n const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]);\n if (d < minDist && d > 0) {\n i1 = i;\n minDist = d;\n }\n }\n let i1x = coords[2 * i1];\n let i1y = coords[2 * i1 + 1];\n\n let minRadius = Infinity;\n\n // find the third point which forms the smallest circumcircle with the first two\n for (let i = 0; i < n; i++) {\n if (i === i0 || i === i1) continue;\n const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]);\n if (r < minRadius) {\n i2 = i;\n minRadius = r;\n }\n }\n let i2x = coords[2 * i2];\n let i2y = coords[2 * i2 + 1];\n\n if (minRadius === Infinity) {\n // order collinear points by dx (or dy if all x are identical)\n // and return the list as a hull\n for (let i = 0; i < n; i++) {\n this._dists[i] = (coords[2 * i] - coords[0]) || (coords[2 * i + 1] - coords[1]);\n }\n quicksort(this._ids, this._dists, 0, n - 1);\n const hull = new Uint32Array(n);\n let j = 0;\n for (let i = 0, d0 = -Infinity; i < n; i++) {\n const id = this._ids[i];\n if (this._dists[id] > d0) {\n hull[j++] = id;\n d0 = this._dists[id];\n }\n }\n this.hull = hull.subarray(0, j);\n this.triangles = new Uint32Array(0);\n this.halfedges = new Uint32Array(0);\n return;\n }\n\n // swap the order of the seed points for counter-clockwise orientation\n if (orient2d(i0x, i0y, i1x, i1y, i2x, i2y) < 0) {\n const i = i1;\n const x = i1x;\n const y = i1y;\n i1 = i2;\n i1x = i2x;\n i1y = i2y;\n i2 = i;\n i2x = x;\n i2y = y;\n }\n\n const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y);\n this._cx = center.x;\n this._cy = center.y;\n\n for (let i = 0; i < n; i++) {\n this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y);\n }\n\n // sort the points by distance from the seed triangle circumcenter\n quicksort(this._ids, this._dists, 0, n - 1);\n\n // set up the seed triangle as the starting hull\n this._hullStart = i0;\n let hullSize = 3;\n\n hullNext[i0] = hullPrev[i2] = i1;\n hullNext[i1] = hullPrev[i0] = i2;\n hullNext[i2] = hullPrev[i1] = i0;\n\n hullTri[i0] = 0;\n hullTri[i1] = 1;\n hullTri[i2] = 2;\n\n hullHash.fill(-1);\n hullHash[this._hashKey(i0x, i0y)] = i0;\n hullHash[this._hashKey(i1x, i1y)] = i1;\n hullHash[this._hashKey(i2x, i2y)] = i2;\n\n this.trianglesLen = 0;\n this._addTriangle(i0, i1, i2, -1, -1, -1);\n\n for (let k = 0, xp, yp; k < this._ids.length; k++) {\n const i = this._ids[k];\n const x = coords[2 * i];\n const y = coords[2 * i + 1];\n\n // skip near-duplicate points\n if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) continue;\n xp = x;\n yp = y;\n\n // skip seed triangle points\n if (i === i0 || i === i1 || i === i2) continue;\n\n // find a visible edge on the convex hull using edge hash\n let start = 0;\n for (let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++) {\n start = hullHash[(key + j) % this._hashSize];\n if (start !== -1 && start !== hullNext[start]) break;\n }\n\n start = hullPrev[start];\n let e = start, q;\n while (q = hullNext[e], orient2d(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0) {\n e = q;\n if (e === start) {\n e = -1;\n break;\n }\n }\n if (e === -1) continue; // likely a near-duplicate point; skip it\n\n // add the first triangle from the point\n let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]);\n\n // recursively flip triangles from the point until they satisfy the Delaunay condition\n hullTri[i] = this._legalize(t + 2);\n hullTri[e] = t; // keep track of boundary triangles on the hull\n hullSize++;\n\n // walk forward through the hull, adding more triangles and flipping recursively\n let n = hullNext[e];\n while (q = hullNext[n], orient2d(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1]) < 0) {\n t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]);\n hullTri[i] = this._legalize(t + 2);\n hullNext[n] = n; // mark as removed\n hullSize--;\n n = q;\n }\n\n // walk backward from the other side, adding more triangles and flipping\n if (e === start) {\n while (q = hullPrev[e], orient2d(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0) {\n t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]);\n this._legalize(t + 2);\n hullTri[q] = t;\n hullNext[e] = e; // mark as removed\n hullSize--;\n e = q;\n }\n }\n\n // update the hull indices\n this._hullStart = hullPrev[i] = e;\n hullNext[e] = hullPrev[n] = i;\n hullNext[i] = n;\n\n // save the two new edges in the hash table\n hullHash[this._hashKey(x, y)] = i;\n hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e;\n }\n\n this.hull = new Uint32Array(hullSize);\n for (let i = 0, e = this._hullStart; i < hullSize; i++) {\n this.hull[i] = e;\n e = hullNext[e];\n }\n\n // trim typed triangle mesh arrays\n this.triangles = this._triangles.subarray(0, this.trianglesLen);\n this.halfedges = this._halfedges.subarray(0, this.trianglesLen);\n }\n\n _hashKey(x, y) {\n return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize;\n }\n\n _legalize(a) {\n const {_triangles: triangles, _halfedges: halfedges, coords} = this;\n\n let i = 0;\n let ar = 0;\n\n // recursion eliminated with a fixed-size stack\n while (true) {\n const b = halfedges[a];\n\n /* if the pair of triangles doesn't satisfy the Delaunay condition\n * (p1 is inside the circumcircle of [p0, pl, pr]), flip them,\n * then do the same check/flip recursively for the new pair of triangles\n *\n * pl pl\n * /||\\ / \\\n * al/ || \\bl al/ \\a\n * / || \\ / \\\n * / a||b \\ flip /___ar___\\\n * p0\\ || /p1 => p0\\---bl---/p1\n * \\ || / \\ /\n * ar\\ || /br b\\ /br\n * \\||/ \\ /\n * pr pr\n */\n const a0 = a - a % 3;\n ar = a0 + (a + 2) % 3;\n\n if (b === -1) { // convex hull edge\n if (i === 0) break;\n a = EDGE_STACK[--i];\n continue;\n }\n\n const b0 = b - b % 3;\n const al = a0 + (a + 1) % 3;\n const bl = b0 + (b + 2) % 3;\n\n const p0 = triangles[ar];\n const pr = triangles[a];\n const pl = triangles[al];\n const p1 = triangles[bl];\n\n const illegal = inCircle(\n coords[2 * p0], coords[2 * p0 + 1],\n coords[2 * pr], coords[2 * pr + 1],\n coords[2 * pl], coords[2 * pl + 1],\n coords[2 * p1], coords[2 * p1 + 1]);\n\n if (illegal) {\n triangles[a] = p1;\n triangles[b] = p0;\n\n const hbl = halfedges[bl];\n\n // edge swapped on the other side of the hull (rare); fix the halfedge reference\n if (hbl === -1) {\n let e = this._hullStart;\n do {\n if (this._hullTri[e] === bl) {\n this._hullTri[e] = a;\n break;\n }\n e = this._hullPrev[e];\n } while (e !== this._hullStart);\n }\n this._link(a, hbl);\n this._link(b, halfedges[ar]);\n this._link(ar, bl);\n\n const br = b0 + (b + 1) % 3;\n\n // don't worry about hitting the cap: it can only happen on extremely degenerate input\n if (i < EDGE_STACK.length) {\n EDGE_STACK[i++] = br;\n }\n } else {\n if (i === 0) break;\n a = EDGE_STACK[--i];\n }\n }\n\n return ar;\n }\n\n _link(a, b) {\n this._halfedges[a] = b;\n if (b !== -1) this._halfedges[b] = a;\n }\n\n // add a new triangle given vertex indices and adjacent half-edge ids\n _addTriangle(i0, i1, i2, a, b, c) {\n const t = this.trianglesLen;\n\n this._triangles[t] = i0;\n this._triangles[t + 1] = i1;\n this._triangles[t + 2] = i2;\n\n this._link(t, a);\n this._link(t + 1, b);\n this._link(t + 2, c);\n\n this.trianglesLen += 3;\n\n return t;\n }\n}\n\n// monotonically increases with real angle, but doesn't need expensive trigonometry\nfunction pseudoAngle(dx, dy) {\n const p = dx / (Math.abs(dx) + Math.abs(dy));\n return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1]\n}\n\nfunction dist(ax, ay, bx, by) {\n const dx = ax - bx;\n const dy = ay - by;\n return dx * dx + dy * dy;\n}\n\nfunction inCircle(ax, ay, bx, by, cx, cy, px, py) {\n const dx = ax - px;\n const dy = ay - py;\n const ex = bx - px;\n const ey = by - py;\n const fx = cx - px;\n const fy = cy - py;\n\n const ap = dx * dx + dy * dy;\n const bp = ex * ex + ey * ey;\n const cp = fx * fx + fy * fy;\n\n return dx * (ey * cp - bp * fy) -\n dy * (ex * cp - bp * fx) +\n ap * (ex * fy - ey * fx) < 0;\n}\n\nfunction circumradius(ax, ay, bx, by, cx, cy) {\n const dx = bx - ax;\n const dy = by - ay;\n const ex = cx - ax;\n const ey = cy - ay;\n\n const bl = dx * dx + dy * dy;\n const cl = ex * ex + ey * ey;\n const d = 0.5 / (dx * ey - dy * ex);\n\n const x = (ey * bl - dy * cl) * d;\n const y = (dx * cl - ex * bl) * d;\n\n return x * x + y * y;\n}\n\nfunction circumcenter(ax, ay, bx, by, cx, cy) {\n const dx = bx - ax;\n const dy = by - ay;\n const ex = cx - ax;\n const ey = cy - ay;\n\n const bl = dx * dx + dy * dy;\n const cl = ex * ex + ey * ey;\n const d = 0.5 / (dx * ey - dy * ex);\n\n const x = ax + (ey * bl - dy * cl) * d;\n const y = ay + (dx * cl - ex * bl) * d;\n\n return {x, y};\n}\n\nfunction quicksort(ids, dists, left, right) {\n if (right - left <= 20) {\n for (let i = left + 1; i <= right; i++) {\n const temp = ids[i];\n const tempDist = dists[temp];\n let j = i - 1;\n while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--];\n ids[j + 1] = temp;\n }\n } else {\n const median = (left + right) >> 1;\n let i = left + 1;\n let j = right;\n swap(ids, median, i);\n if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right);\n if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right);\n if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i);\n\n const temp = ids[i];\n const tempDist = dists[temp];\n while (true) {\n do i++; while (dists[ids[i]] < tempDist);\n do j--; while (dists[ids[j]] > tempDist);\n if (j < i) break;\n swap(ids, i, j);\n }\n ids[left + 1] = ids[j];\n ids[j] = temp;\n\n if (right - i + 1 >= j - left) {\n quicksort(ids, dists, i, right);\n quicksort(ids, dists, left, j - 1);\n } else {\n quicksort(ids, dists, left, j - 1);\n quicksort(ids, dists, i, right);\n }\n }\n}\n\nfunction swap(arr, i, j) {\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n\nfunction defaultGetX(p) {\n return p[0];\n}\nfunction defaultGetY(p) {\n return p[1];\n}\n","const epsilon = 1e-6;\n\nexport default class Path {\n constructor() {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n }\n moveTo(x, y) {\n this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._ += \"Z\";\n }\n }\n lineTo(x, y) {\n this._ += `L${this._x1 = +x},${this._y1 = +y}`;\n }\n arc(x, y, r) {\n x = +x, y = +y, r = +r;\n const x0 = x + r;\n const y0 = y;\n if (r < 0) throw new Error(\"negative radius\");\n if (this._x1 === null) this._ += `M${x0},${y0}`;\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += \"L\" + x0 + \",\" + y0;\n if (!r) return;\n this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`;\n }\n rect(x, y, w, h) {\n this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`;\n }\n value() {\n return this._ || null;\n }\n}\n","export default class Polygon {\n constructor() {\n this._ = [];\n }\n moveTo(x, y) {\n this._.push([x, y]);\n }\n closePath() {\n this._.push(this._[0].slice());\n }\n lineTo(x, y) {\n this._.push([x, y]);\n }\n value() {\n return this._.length ? this._ : null;\n }\n}\n","import Path from \"./path.js\";\nimport Polygon from \"./polygon.js\";\n\nexport default class Voronoi {\n constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) {\n if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error(\"invalid bounds\");\n this.delaunay = delaunay;\n this._circumcenters = new Float64Array(delaunay.points.length * 2);\n this.vectors = new Float64Array(delaunay.points.length * 2);\n this.xmax = xmax, this.xmin = xmin;\n this.ymax = ymax, this.ymin = ymin;\n this._init();\n }\n update() {\n this.delaunay.update();\n this._init();\n return this;\n }\n _init() {\n const {delaunay: {points, hull, triangles}, vectors} = this;\n let bx, by; // lazily computed barycenter of the hull\n\n // Compute circumcenters.\n const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2);\n for (let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2) {\n const t1 = triangles[i] * 2;\n const t2 = triangles[i + 1] * 2;\n const t3 = triangles[i + 2] * 2;\n const x1 = points[t1];\n const y1 = points[t1 + 1];\n const x2 = points[t2];\n const y2 = points[t2 + 1];\n const x3 = points[t3];\n const y3 = points[t3 + 1];\n\n const dx = x2 - x1;\n const dy = y2 - y1;\n const ex = x3 - x1;\n const ey = y3 - y1;\n const ab = (dx * ey - dy * ex) * 2;\n\n if (Math.abs(ab) < 1e-9) {\n // For a degenerate triangle, the circumcenter is at the infinity, in a\n // direction orthogonal to the halfedge and away from the “center” of\n // the diagram , defined as the hull’s barycenter.\n if (bx === undefined) {\n bx = by = 0;\n for (const i of hull) bx += points[i * 2], by += points[i * 2 + 1];\n bx /= hull.length, by /= hull.length;\n }\n const a = 1e9 * Math.sign((bx - x1) * ey - (by - y1) * ex);\n x = (x1 + x3) / 2 - a * ey;\n y = (y1 + y3) / 2 + a * ex;\n } else {\n const d = 1 / ab;\n const bl = dx * dx + dy * dy;\n const cl = ex * ex + ey * ey;\n x = x1 + (ey * bl - dy * cl) * d;\n y = y1 + (dx * cl - ex * bl) * d;\n }\n circumcenters[j] = x;\n circumcenters[j + 1] = y;\n }\n\n // Compute exterior cell rays.\n let h = hull[hull.length - 1];\n let p0, p1 = h * 4;\n let x0, x1 = points[2 * h];\n let y0, y1 = points[2 * h + 1];\n vectors.fill(0);\n for (let i = 0; i < hull.length; ++i) {\n h = hull[i];\n p0 = p1, x0 = x1, y0 = y1;\n p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1];\n vectors[p0 + 2] = vectors[p1] = y0 - y1;\n vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0;\n }\n }\n render(context) {\n const buffer = context == null ? context = new Path : undefined;\n const {delaunay: {halfedges, inedges, hull}, circumcenters, vectors} = this;\n if (hull.length <= 1) return null;\n for (let i = 0, n = halfedges.length; i < n; ++i) {\n const j = halfedges[i];\n if (j < i) continue;\n const ti = Math.floor(i / 3) * 2;\n const tj = Math.floor(j / 3) * 2;\n const xi = circumcenters[ti];\n const yi = circumcenters[ti + 1];\n const xj = circumcenters[tj];\n const yj = circumcenters[tj + 1];\n this._renderSegment(xi, yi, xj, yj, context);\n }\n let h0, h1 = hull[hull.length - 1];\n for (let i = 0; i < hull.length; ++i) {\n h0 = h1, h1 = hull[i];\n const t = Math.floor(inedges[h1] / 3) * 2;\n const x = circumcenters[t];\n const y = circumcenters[t + 1];\n const v = h0 * 4;\n const p = this._project(x, y, vectors[v + 2], vectors[v + 3]);\n if (p) this._renderSegment(x, y, p[0], p[1], context);\n }\n return buffer && buffer.value();\n }\n renderBounds(context) {\n const buffer = context == null ? context = new Path : undefined;\n context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin);\n return buffer && buffer.value();\n }\n renderCell(i, context) {\n const buffer = context == null ? context = new Path : undefined;\n const points = this._clip(i);\n if (points === null || !points.length) return;\n context.moveTo(points[0], points[1]);\n let n = points.length;\n while (points[0] === points[n-2] && points[1] === points[n-1] && n > 1) n -= 2;\n for (let i = 2; i < n; i += 2) {\n if (points[i] !== points[i-2] || points[i+1] !== points[i-1])\n context.lineTo(points[i], points[i + 1]);\n }\n context.closePath();\n return buffer && buffer.value();\n }\n *cellPolygons() {\n const {delaunay: {points}} = this;\n for (let i = 0, n = points.length / 2; i < n; ++i) {\n const cell = this.cellPolygon(i);\n if (cell) cell.index = i, yield cell;\n }\n }\n cellPolygon(i) {\n const polygon = new Polygon;\n this.renderCell(i, polygon);\n return polygon.value();\n }\n _renderSegment(x0, y0, x1, y1, context) {\n let S;\n const c0 = this._regioncode(x0, y0);\n const c1 = this._regioncode(x1, y1);\n if (c0 === 0 && c1 === 0) {\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) {\n context.moveTo(S[0], S[1]);\n context.lineTo(S[2], S[3]);\n }\n }\n contains(i, x, y) {\n if ((x = +x, x !== x) || (y = +y, y !== y)) return false;\n return this.delaunay._step(i, x, y) === i;\n }\n *neighbors(i) {\n const ci = this._clip(i);\n if (ci) for (const j of this.delaunay.neighbors(i)) {\n const cj = this._clip(j);\n // find the common edge\n if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) {\n for (let aj = 0, lj = cj.length; aj < lj; aj += 2) {\n if (ci[ai] === cj[aj]\n && ci[ai + 1] === cj[aj + 1]\n && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj]\n && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) {\n yield j;\n break loop;\n }\n }\n }\n }\n }\n _cell(i) {\n const {circumcenters, delaunay: {inedges, halfedges, triangles}} = this;\n const e0 = inedges[i];\n if (e0 === -1) return null; // coincident point\n const points = [];\n let e = e0;\n do {\n const t = Math.floor(e / 3);\n points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]);\n e = e % 3 === 2 ? e - 2 : e + 1;\n if (triangles[e] !== i) break; // bad triangulation\n e = halfedges[e];\n } while (e !== e0 && e !== -1);\n return points;\n }\n _clip(i) {\n // degenerate case (1 valid point: return the box)\n if (i === 0 && this.delaunay.hull.length === 1) {\n return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];\n }\n const points = this._cell(i);\n if (points === null) return null;\n const {vectors: V} = this;\n const v = i * 4;\n return this._simplify(V[v] || V[v + 1]\n ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3])\n : this._clipFinite(i, points));\n }\n _clipFinite(i, points) {\n const n = points.length;\n let P = null;\n let x0, y0, x1 = points[n - 2], y1 = points[n - 1];\n let c0, c1 = this._regioncode(x1, y1);\n let e0, e1 = 0;\n for (let j = 0; j < n; j += 2) {\n x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1];\n c0 = c1, c1 = this._regioncode(x1, y1);\n if (c0 === 0 && c1 === 0) {\n e0 = e1, e1 = 0;\n if (P) P.push(x1, y1);\n else P = [x1, y1];\n } else {\n let S, sx0, sy0, sx1, sy1;\n if (c0 === 0) {\n if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue;\n [sx0, sy0, sx1, sy1] = S;\n } else {\n if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue;\n [sx1, sy1, sx0, sy0] = S;\n e0 = e1, e1 = this._edgecode(sx0, sy0);\n if (e0 && e1) this._edge(i, e0, e1, P, P.length);\n if (P) P.push(sx0, sy0);\n else P = [sx0, sy0];\n }\n e0 = e1, e1 = this._edgecode(sx1, sy1);\n if (e0 && e1) this._edge(i, e0, e1, P, P.length);\n if (P) P.push(sx1, sy1);\n else P = [sx1, sy1];\n }\n }\n if (P) {\n e0 = e1, e1 = this._edgecode(P[0], P[1]);\n if (e0 && e1) this._edge(i, e0, e1, P, P.length);\n } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) {\n return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];\n }\n return P;\n }\n _clipSegment(x0, y0, x1, y1, c0, c1) {\n // for more robustness, always consider the segment in the same order\n const flip = c0 < c1;\n if (flip) [x0, y0, x1, y1, c0, c1] = [x1, y1, x0, y0, c1, c0];\n while (true) {\n if (c0 === 0 && c1 === 0) return flip ? [x1, y1, x0, y0] : [x0, y0, x1, y1];\n if (c0 & c1) return null;\n let x, y, c = c0 || c1;\n if (c & 0b1000) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax;\n else if (c & 0b0100) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin;\n else if (c & 0b0010) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax;\n else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin;\n if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0);\n else x1 = x, y1 = y, c1 = this._regioncode(x1, y1);\n }\n }\n _clipInfinite(i, points, vx0, vy0, vxn, vyn) {\n let P = Array.from(points), p;\n if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]);\n if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]);\n if (P = this._clipFinite(i, P)) {\n for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) {\n c0 = c1, c1 = this._edgecode(P[j], P[j + 1]);\n if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length;\n }\n } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) {\n P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax];\n }\n return P;\n }\n _edge(i, e0, e1, P, j) {\n while (e0 !== e1) {\n let x, y;\n switch (e0) {\n case 0b0101: e0 = 0b0100; continue; // top-left\n case 0b0100: e0 = 0b0110, x = this.xmax, y = this.ymin; break; // top\n case 0b0110: e0 = 0b0010; continue; // top-right\n case 0b0010: e0 = 0b1010, x = this.xmax, y = this.ymax; break; // right\n case 0b1010: e0 = 0b1000; continue; // bottom-right\n case 0b1000: e0 = 0b1001, x = this.xmin, y = this.ymax; break; // bottom\n case 0b1001: e0 = 0b0001; continue; // bottom-left\n case 0b0001: e0 = 0b0101, x = this.xmin, y = this.ymin; break; // left\n }\n // Note: this implicitly checks for out of bounds: if P[j] or P[j+1] are\n // undefined, the conditional statement will be executed.\n if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) {\n P.splice(j, 0, x, y), j += 2;\n }\n }\n return j;\n }\n _project(x0, y0, vx, vy) {\n let t = Infinity, c, x, y;\n if (vy < 0) { // top\n if (y0 <= this.ymin) return null;\n if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx;\n } else if (vy > 0) { // bottom\n if (y0 >= this.ymax) return null;\n if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx;\n }\n if (vx > 0) { // right\n if (x0 >= this.xmax) return null;\n if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy;\n } else if (vx < 0) { // left\n if (x0 <= this.xmin) return null;\n if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy;\n }\n return [x, y];\n }\n _edgecode(x, y) {\n return (x === this.xmin ? 0b0001\n : x === this.xmax ? 0b0010 : 0b0000)\n | (y === this.ymin ? 0b0100\n : y === this.ymax ? 0b1000 : 0b0000);\n }\n _regioncode(x, y) {\n return (x < this.xmin ? 0b0001\n : x > this.xmax ? 0b0010 : 0b0000)\n | (y < this.ymin ? 0b0100\n : y > this.ymax ? 0b1000 : 0b0000);\n }\n _simplify(P) {\n if (P && P.length > 4) {\n for (let i = 0; i < P.length; i+= 2) {\n const j = (i + 2) % P.length, k = (i + 4) % P.length;\n if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) {\n P.splice(j, 2), i -= 2;\n }\n }\n if (!P.length) P = null;\n }\n return P;\n }\n}\n","import Delaunator from \"delaunator\";\nimport Path from \"./path.js\";\nimport Polygon from \"./polygon.js\";\nimport Voronoi from \"./voronoi.js\";\n\nconst tau = 2 * Math.PI, pow = Math.pow;\n\nfunction pointX(p) {\n return p[0];\n}\n\nfunction pointY(p) {\n return p[1];\n}\n\n// A triangulation is collinear if all its triangles have a non-null area\nfunction collinear(d) {\n const {triangles, coords} = d;\n for (let i = 0; i < triangles.length; i += 3) {\n const a = 2 * triangles[i],\n b = 2 * triangles[i + 1],\n c = 2 * triangles[i + 2],\n cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1])\n - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]);\n if (cross > 1e-10) return false;\n }\n return true;\n}\n\nfunction jitter(x, y, r) {\n return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r];\n}\n\nexport default class Delaunay {\n static from(points, fx = pointX, fy = pointY, that) {\n return new Delaunay(\"length\" in points\n ? flatArray(points, fx, fy, that)\n : Float64Array.from(flatIterable(points, fx, fy, that)));\n }\n constructor(points) {\n this._delaunator = new Delaunator(points);\n this.inedges = new Int32Array(points.length / 2);\n this._hullIndex = new Int32Array(points.length / 2);\n this.points = this._delaunator.coords;\n this._init();\n }\n update() {\n this._delaunator.update();\n this._init();\n return this;\n }\n _init() {\n const d = this._delaunator, points = this.points;\n\n // check for collinear\n if (d.hull && d.hull.length > 2 && collinear(d)) {\n this.collinear = Int32Array.from({length: points.length/2}, (_,i) => i)\n .sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors\n const e = this.collinear[0], f = this.collinear[this.collinear.length - 1],\n bounds = [ points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1] ],\n r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]);\n for (let i = 0, n = points.length / 2; i < n; ++i) {\n const p = jitter(points[2 * i], points[2 * i + 1], r);\n points[2 * i] = p[0];\n points[2 * i + 1] = p[1];\n }\n this._delaunator = new Delaunator(points);\n } else {\n delete this.collinear;\n }\n\n const halfedges = this.halfedges = this._delaunator.halfedges;\n const hull = this.hull = this._delaunator.hull;\n const triangles = this.triangles = this._delaunator.triangles;\n const inedges = this.inedges.fill(-1);\n const hullIndex = this._hullIndex.fill(-1);\n\n // Compute an index from each point to an (arbitrary) incoming halfedge\n // Used to give the first neighbor of each point; for this reason,\n // on the hull we give priority to exterior halfedges\n for (let e = 0, n = halfedges.length; e < n; ++e) {\n const p = triangles[e % 3 === 2 ? e - 2 : e + 1];\n if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e;\n }\n for (let i = 0, n = hull.length; i < n; ++i) {\n hullIndex[hull[i]] = i;\n }\n\n // degenerate case: 1 or 2 (distinct) points\n if (hull.length <= 2 && hull.length > 0) {\n this.triangles = new Int32Array(3).fill(-1);\n this.halfedges = new Int32Array(3).fill(-1);\n this.triangles[0] = hull[0];\n inedges[hull[0]] = 1;\n if (hull.length === 2) {\n inedges[hull[1]] = 0;\n this.triangles[1] = hull[1];\n this.triangles[2] = hull[1];\n }\n }\n }\n voronoi(bounds) {\n return new Voronoi(this, bounds);\n }\n *neighbors(i) {\n const {inedges, hull, _hullIndex, halfedges, triangles, collinear} = this;\n\n // degenerate case with several collinear points\n if (collinear) {\n const l = collinear.indexOf(i);\n if (l > 0) yield collinear[l - 1];\n if (l < collinear.length - 1) yield collinear[l + 1];\n return;\n }\n\n const e0 = inedges[i];\n if (e0 === -1) return; // coincident point\n let e = e0, p0 = -1;\n do {\n yield p0 = triangles[e];\n e = e % 3 === 2 ? e - 2 : e + 1;\n if (triangles[e] !== i) return; // bad triangulation\n e = halfedges[e];\n if (e === -1) {\n const p = hull[(_hullIndex[i] + 1) % hull.length];\n if (p !== p0) yield p;\n return;\n }\n } while (e !== e0);\n }\n find(x, y, i = 0) {\n if ((x = +x, x !== x) || (y = +y, y !== y)) return -1;\n const i0 = i;\n let c;\n while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) i = c;\n return c;\n }\n _step(i, x, y) {\n const {inedges, hull, _hullIndex, halfedges, triangles, points} = this;\n if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1);\n let c = i;\n let dc = pow(x - points[i * 2], 2) + pow(y - points[i * 2 + 1], 2);\n const e0 = inedges[i];\n let e = e0;\n do {\n let t = triangles[e];\n const dt = pow(x - points[t * 2], 2) + pow(y - points[t * 2 + 1], 2);\n if (dt < dc) dc = dt, c = t;\n e = e % 3 === 2 ? e - 2 : e + 1;\n if (triangles[e] !== i) break; // bad triangulation\n e = halfedges[e];\n if (e === -1) {\n e = hull[(_hullIndex[i] + 1) % hull.length];\n if (e !== t) {\n if (pow(x - points[e * 2], 2) + pow(y - points[e * 2 + 1], 2) < dc) return e;\n }\n break;\n }\n } while (e !== e0);\n return c;\n }\n render(context) {\n const buffer = context == null ? context = new Path : undefined;\n const {points, halfedges, triangles} = this;\n for (let i = 0, n = halfedges.length; i < n; ++i) {\n const j = halfedges[i];\n if (j < i) continue;\n const ti = triangles[i] * 2;\n const tj = triangles[j] * 2;\n context.moveTo(points[ti], points[ti + 1]);\n context.lineTo(points[tj], points[tj + 1]);\n }\n this.renderHull(context);\n return buffer && buffer.value();\n }\n renderPoints(context, r) {\n if (r === undefined && (!context || typeof context.moveTo !== \"function\")) r = context, context = null;\n r = r == undefined ? 2 : +r;\n const buffer = context == null ? context = new Path : undefined;\n const {points} = this;\n for (let i = 0, n = points.length; i < n; i += 2) {\n const x = points[i], y = points[i + 1];\n context.moveTo(x + r, y);\n context.arc(x, y, r, 0, tau);\n }\n return buffer && buffer.value();\n }\n renderHull(context) {\n const buffer = context == null ? context = new Path : undefined;\n const {hull, points} = this;\n const h = hull[0] * 2, n = hull.length;\n context.moveTo(points[h], points[h + 1]);\n for (let i = 1; i < n; ++i) {\n const h = 2 * hull[i];\n context.lineTo(points[h], points[h + 1]);\n }\n context.closePath();\n return buffer && buffer.value();\n }\n hullPolygon() {\n const polygon = new Polygon;\n this.renderHull(polygon);\n return polygon.value();\n }\n renderTriangle(i, context) {\n const buffer = context == null ? context = new Path : undefined;\n const {points, triangles} = this;\n const t0 = triangles[i *= 3] * 2;\n const t1 = triangles[i + 1] * 2;\n const t2 = triangles[i + 2] * 2;\n context.moveTo(points[t0], points[t0 + 1]);\n context.lineTo(points[t1], points[t1 + 1]);\n context.lineTo(points[t2], points[t2 + 1]);\n context.closePath();\n return buffer && buffer.value();\n }\n *trianglePolygons() {\n const {triangles} = this;\n for (let i = 0, n = triangles.length / 3; i < n; ++i) {\n yield this.trianglePolygon(i);\n }\n }\n trianglePolygon(i) {\n const polygon = new Polygon;\n this.renderTriangle(i, polygon);\n return polygon.value();\n }\n}\n\nfunction flatArray(points, fx, fy, that) {\n const n = points.length;\n const array = new Float64Array(n * 2);\n for (let i = 0; i < n; ++i) {\n const p = points[i];\n array[i * 2] = fx.call(that, p, i, points);\n array[i * 2 + 1] = fy.call(that, p, i, points);\n }\n return array;\n}\n\nfunction* flatIterable(points, fx, fy, that) {\n let i = 0;\n for (const p of points) {\n yield fx.call(that, p, i, points);\n yield fy.call(that, p, i, points);\n ++i;\n }\n}\n","import { Transform } from 'vega-dataflow';\nimport { inherits } from 'vega-util';\nimport { Delaunay } from 'd3-delaunay';\n\nfunction Voronoi(params) {\n Transform.call(this, null, params);\n}\nVoronoi.Definition = {\n 'type': 'Voronoi',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'x',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'y',\n 'type': 'field',\n 'required': true\n }, {\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'extent',\n 'type': 'array',\n 'array': true,\n 'length': 2,\n 'default': [[-1e5, -1e5], [1e5, 1e5]],\n 'content': {\n 'type': 'number',\n 'array': true,\n 'length': 2\n }\n }, {\n 'name': 'as',\n 'type': 'string',\n 'default': 'path'\n }]\n};\nconst defaultExtent = [-1e5, -1e5, 1e5, 1e5];\ninherits(Voronoi, Transform, {\n transform(_, pulse) {\n const as = _.as || 'path',\n data = pulse.source;\n\n // nothing to do if no data\n if (!data || !data.length) return pulse;\n\n // configure and construct voronoi diagram\n let s = _.size;\n s = s ? [0, 0, s[0], s[1]] : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] : defaultExtent;\n const voronoi = this.value = Delaunay.from(data, _.x, _.y).voronoi(s);\n\n // map polygons to paths\n for (let i = 0, n = data.length; i < n; ++i) {\n const polygon = voronoi.cellPolygon(i);\n data[i][as] = polygon && !isPoint(polygon) ? toPathString(polygon) : null;\n }\n return pulse.reflow(_.modified()).modifies(as);\n }\n});\n\n// suppress duplicated end point vertices\nfunction toPathString(p) {\n const x = p[0][0],\n y = p[0][1];\n let n = p.length - 1;\n for (; p[n][0] === x && p[n][1] === y; --n);\n return 'M' + p.slice(0, n + 1).join('L') + 'Z';\n}\nfunction isPoint(p) {\n return p.length === 2 && p[0][0] === p[1][0] && p[0][1] === p[1][1];\n}\n\nexport { Voronoi as voronoi };\n","import { canvas } from 'vega-canvas';\nimport { Transform } from 'vega-dataflow';\nimport { inherits, error, isFunction, constant, extent } from 'vega-util';\nimport { scale } from 'vega-scale';\nimport { random } from 'vega-statistics';\n\n/*\nCopyright (c) 2013, Jason Davies.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n * The name Jason Davies may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL JASON DAVIES BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\nOR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\nADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n// Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/\n// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf\n\nvar cloudRadians = Math.PI / 180,\n cw = 1 << 11 >> 5,\n ch = 1 << 11;\nfunction cloud () {\n var size = [256, 256],\n text,\n font,\n fontSize,\n fontStyle,\n fontWeight,\n rotate,\n padding,\n spiral = archimedeanSpiral,\n words = [],\n random = Math.random,\n cloud = {};\n cloud.layout = function () {\n var contextAndRatio = getContext(canvas()),\n board = zeroArray((size[0] >> 5) * size[1]),\n bounds = null,\n n = words.length,\n i = -1,\n tags = [],\n data = words.map(d => ({\n text: text(d),\n font: font(d),\n style: fontStyle(d),\n weight: fontWeight(d),\n rotate: rotate(d),\n size: ~~(fontSize(d) + 1e-14),\n padding: padding(d),\n xoff: 0,\n yoff: 0,\n x1: 0,\n y1: 0,\n x0: 0,\n y0: 0,\n hasText: false,\n sprite: null,\n datum: d\n })).sort((a, b) => b.size - a.size);\n while (++i < n) {\n var d = data[i];\n d.x = size[0] * (random() + .5) >> 1;\n d.y = size[1] * (random() + .5) >> 1;\n cloudSprite(contextAndRatio, d, data, i);\n if (d.hasText && place(board, d, bounds)) {\n tags.push(d);\n if (bounds) cloudBounds(bounds, d);else bounds = [{\n x: d.x + d.x0,\n y: d.y + d.y0\n }, {\n x: d.x + d.x1,\n y: d.y + d.y1\n }];\n // Temporary hack\n d.x -= size[0] >> 1;\n d.y -= size[1] >> 1;\n }\n }\n return tags;\n };\n function getContext(canvas) {\n canvas.width = canvas.height = 1;\n var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2);\n canvas.width = (cw << 5) / ratio;\n canvas.height = ch / ratio;\n var context = canvas.getContext('2d');\n context.fillStyle = context.strokeStyle = 'red';\n context.textAlign = 'center';\n return {\n context: context,\n ratio: ratio\n };\n }\n function place(board, tag, bounds) {\n var startX = tag.x,\n startY = tag.y,\n maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]),\n s = spiral(size),\n dt = random() < .5 ? 1 : -1,\n t = -dt,\n dxdy,\n dx,\n dy;\n while (dxdy = s(t += dt)) {\n dx = ~~dxdy[0];\n dy = ~~dxdy[1];\n if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break;\n tag.x = startX + dx;\n tag.y = startY + dy;\n if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue;\n // TODO only check for collisions within current bounds.\n if (!bounds || !cloudCollide(tag, board, size[0])) {\n if (!bounds || collideRects(tag, bounds)) {\n var sprite = tag.sprite,\n w = tag.width >> 5,\n sw = size[0] >> 5,\n lx = tag.x - (w << 4),\n sx = lx & 0x7f,\n msx = 32 - sx,\n h = tag.y1 - tag.y0,\n x = (tag.y + tag.y0) * sw + (lx >> 5),\n last;\n for (var j = 0; j < h; j++) {\n last = 0;\n for (var i = 0; i <= w; i++) {\n board[x + i] |= last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);\n }\n x += sw;\n }\n tag.sprite = null;\n return true;\n }\n }\n }\n return false;\n }\n cloud.words = function (_) {\n if (arguments.length) {\n words = _;\n return cloud;\n } else {\n return words;\n }\n };\n cloud.size = function (_) {\n if (arguments.length) {\n size = [+_[0], +_[1]];\n return cloud;\n } else {\n return size;\n }\n };\n cloud.font = function (_) {\n if (arguments.length) {\n font = functor(_);\n return cloud;\n } else {\n return font;\n }\n };\n cloud.fontStyle = function (_) {\n if (arguments.length) {\n fontStyle = functor(_);\n return cloud;\n } else {\n return fontStyle;\n }\n };\n cloud.fontWeight = function (_) {\n if (arguments.length) {\n fontWeight = functor(_);\n return cloud;\n } else {\n return fontWeight;\n }\n };\n cloud.rotate = function (_) {\n if (arguments.length) {\n rotate = functor(_);\n return cloud;\n } else {\n return rotate;\n }\n };\n cloud.text = function (_) {\n if (arguments.length) {\n text = functor(_);\n return cloud;\n } else {\n return text;\n }\n };\n cloud.spiral = function (_) {\n if (arguments.length) {\n spiral = spirals[_] || _;\n return cloud;\n } else {\n return spiral;\n }\n };\n cloud.fontSize = function (_) {\n if (arguments.length) {\n fontSize = functor(_);\n return cloud;\n } else {\n return fontSize;\n }\n };\n cloud.padding = function (_) {\n if (arguments.length) {\n padding = functor(_);\n return cloud;\n } else {\n return padding;\n }\n };\n cloud.random = function (_) {\n if (arguments.length) {\n random = _;\n return cloud;\n } else {\n return random;\n }\n };\n return cloud;\n}\n\n// Fetches a monochrome sprite bitmap for the specified text.\n// Load in batches for speed.\nfunction cloudSprite(contextAndRatio, d, data, di) {\n if (d.sprite) return;\n var c = contextAndRatio.context,\n ratio = contextAndRatio.ratio;\n c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);\n var x = 0,\n y = 0,\n maxh = 0,\n n = data.length,\n w,\n w32,\n h,\n i,\n j;\n --di;\n while (++di < n) {\n d = data[di];\n c.save();\n c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font;\n w = c.measureText(d.text + 'm').width * ratio;\n h = d.size << 1;\n if (d.rotate) {\n var sr = Math.sin(d.rotate * cloudRadians),\n cr = Math.cos(d.rotate * cloudRadians),\n wcr = w * cr,\n wsr = w * sr,\n hcr = h * cr,\n hsr = h * sr;\n w = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f >> 5 << 5;\n h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));\n } else {\n w = w + 0x1f >> 5 << 5;\n }\n if (h > maxh) maxh = h;\n if (x + w >= cw << 5) {\n x = 0;\n y += maxh;\n maxh = 0;\n }\n if (y + h >= ch) break;\n c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);\n if (d.rotate) c.rotate(d.rotate * cloudRadians);\n c.fillText(d.text, 0, 0);\n if (d.padding) {\n c.lineWidth = 2 * d.padding;\n c.strokeText(d.text, 0, 0);\n }\n c.restore();\n d.width = w;\n d.height = h;\n d.xoff = x;\n d.yoff = y;\n d.x1 = w >> 1;\n d.y1 = h >> 1;\n d.x0 = -d.x1;\n d.y0 = -d.y1;\n d.hasText = true;\n x += w;\n }\n var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data,\n sprite = [];\n while (--di >= 0) {\n d = data[di];\n if (!d.hasText) continue;\n w = d.width;\n w32 = w >> 5;\n h = d.y1 - d.y0;\n // Zero the buffer\n for (i = 0; i < h * w32; i++) sprite[i] = 0;\n x = d.xoff;\n if (x == null) return;\n y = d.yoff;\n var seen = 0,\n seenRow = -1;\n for (j = 0; j < h; j++) {\n for (i = 0; i < w; i++) {\n var k = w32 * j + (i >> 5),\n m = pixels[(y + j) * (cw << 5) + (x + i) << 2] ? 1 << 31 - i % 32 : 0;\n sprite[k] |= m;\n seen |= m;\n }\n if (seen) seenRow = j;else {\n d.y0++;\n h--;\n j--;\n y++;\n }\n }\n d.y1 = d.y0 + seenRow;\n d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);\n }\n}\n\n// Use mask-based collision detection.\nfunction cloudCollide(tag, board, sw) {\n sw >>= 5;\n var sprite = tag.sprite,\n w = tag.width >> 5,\n lx = tag.x - (w << 4),\n sx = lx & 0x7f,\n msx = 32 - sx,\n h = tag.y1 - tag.y0,\n x = (tag.y + tag.y0) * sw + (lx >> 5),\n last;\n for (var j = 0; j < h; j++) {\n last = 0;\n for (var i = 0; i <= w; i++) {\n if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true;\n }\n x += sw;\n }\n return false;\n}\nfunction cloudBounds(bounds, d) {\n var b0 = bounds[0],\n b1 = bounds[1];\n if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;\n if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;\n if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;\n if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;\n}\nfunction collideRects(a, b) {\n return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;\n}\nfunction archimedeanSpiral(size) {\n var e = size[0] / size[1];\n return function (t) {\n return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)];\n };\n}\nfunction rectangularSpiral(size) {\n var dy = 4,\n dx = dy * size[0] / size[1],\n x = 0,\n y = 0;\n return function (t) {\n var sign = t < 0 ? -1 : 1;\n // See triangular numbers: T_n = n * (n + 1) / 2.\n switch (Math.sqrt(1 + 4 * sign * t) - sign & 3) {\n case 0:\n x += dx;\n break;\n case 1:\n y += dy;\n break;\n case 2:\n x -= dx;\n break;\n default:\n y -= dy;\n break;\n }\n return [x, y];\n };\n}\n\n// TODO reuse arrays?\nfunction zeroArray(n) {\n var a = [],\n i = -1;\n while (++i < n) a[i] = 0;\n return a;\n}\nfunction functor(d) {\n return typeof d === 'function' ? d : function () {\n return d;\n };\n}\nvar spirals = {\n archimedean: archimedeanSpiral,\n rectangular: rectangularSpiral\n};\n\nconst Output = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle'];\nconst Params = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight'];\nfunction Wordcloud(params) {\n Transform.call(this, cloud(), params);\n}\nWordcloud.Definition = {\n 'type': 'Wordcloud',\n 'metadata': {\n 'modifies': true\n },\n 'params': [{\n 'name': 'size',\n 'type': 'number',\n 'array': true,\n 'length': 2\n }, {\n 'name': 'font',\n 'type': 'string',\n 'expr': true,\n 'default': 'sans-serif'\n }, {\n 'name': 'fontStyle',\n 'type': 'string',\n 'expr': true,\n 'default': 'normal'\n }, {\n 'name': 'fontWeight',\n 'type': 'string',\n 'expr': true,\n 'default': 'normal'\n }, {\n 'name': 'fontSize',\n 'type': 'number',\n 'expr': true,\n 'default': 14\n }, {\n 'name': 'fontSizeRange',\n 'type': 'number',\n 'array': 'nullable',\n 'default': [10, 50]\n }, {\n 'name': 'rotate',\n 'type': 'number',\n 'expr': true,\n 'default': 0\n }, {\n 'name': 'text',\n 'type': 'field'\n }, {\n 'name': 'spiral',\n 'type': 'string',\n 'values': ['archimedean', 'rectangular']\n }, {\n 'name': 'padding',\n 'type': 'number',\n 'expr': true\n }, {\n 'name': 'as',\n 'type': 'string',\n 'array': true,\n 'length': 7,\n 'default': Output\n }]\n};\ninherits(Wordcloud, Transform, {\n transform(_, pulse) {\n if (_.size && !(_.size[0] && _.size[1])) {\n error('Wordcloud size dimensions must be non-zero.');\n }\n function modp(param) {\n const p = _[param];\n return isFunction(p) && pulse.modified(p.fields);\n }\n const mod = _.modified();\n if (!(mod || pulse.changed(pulse.ADD_REM) || Params.some(modp))) return;\n const data = pulse.materialize(pulse.SOURCE).source,\n layout = this.value,\n as = _.as || Output;\n let fontSize = _.fontSize || 14,\n range;\n isFunction(fontSize) ? range = _.fontSizeRange : fontSize = constant(fontSize);\n\n // create font size scaling function as needed\n if (range) {\n const fsize = fontSize,\n sizeScale = scale('sqrt')().domain(extent(data, fsize)).range(range);\n fontSize = x => sizeScale(fsize(x));\n }\n data.forEach(t => {\n t[as[0]] = NaN;\n t[as[1]] = NaN;\n t[as[3]] = 0;\n });\n\n // configure layout\n const words = layout.words(data).text(_.text).size(_.size || [500, 500]).padding(_.padding || 1).spiral(_.spiral || 'archimedean').rotate(_.rotate || 0).font(_.font || 'sans-serif').fontStyle(_.fontStyle || 'normal').fontWeight(_.fontWeight || 'normal').fontSize(fontSize).random(random).layout();\n const size = layout.size(),\n dx = size[0] >> 1,\n dy = size[1] >> 1,\n n = words.length;\n for (let i = 0, w, t; i < n; ++i) {\n w = words[i];\n t = w.datum;\n t[as[0]] = w.x + dx;\n t[as[1]] = w.y + dy;\n t[as[2]] = w.font;\n t[as[3]] = w.size;\n t[as[4]] = w.style;\n t[as[5]] = w.weight;\n t[as[6]] = w.rotate;\n }\n return pulse.reflow(mod).modifies(as);\n }\n});\n\nexport { Wordcloud as wordcloud };\n","import { bisectLeft, bisectRight, permute } from 'd3-array';\nimport { Transform } from 'vega-dataflow';\nimport { inherits } from 'vega-util';\n\nconst array8 = n => new Uint8Array(n);\nconst array16 = n => new Uint16Array(n);\nconst array32 = n => new Uint32Array(n);\n\n/**\n * Maintains CrossFilter state.\n */\nfunction Bitmaps() {\n let width = 8,\n data = [],\n seen = array32(0),\n curr = array(0, width),\n prev = array(0, width);\n return {\n data: () => data,\n seen: () => seen = lengthen(seen, data.length),\n add(array) {\n for (let i = 0, j = data.length, n = array.length, t; i < n; ++i) {\n t = array[i];\n t._index = j++;\n data.push(t);\n }\n },\n remove(num, map) {\n // map: index -> boolean (true => remove)\n const n = data.length,\n copy = Array(n - num),\n reindex = data; // reuse old data array for index map\n let t, i, j;\n\n // seek forward to first removal\n for (i = 0; !map[i] && i < n; ++i) {\n copy[i] = data[i];\n reindex[i] = i;\n }\n\n // condense arrays\n for (j = i; i < n; ++i) {\n t = data[i];\n if (!map[i]) {\n reindex[i] = j;\n curr[j] = curr[i];\n prev[j] = prev[i];\n copy[j] = t;\n t._index = j++;\n } else {\n reindex[i] = -1;\n }\n curr[i] = 0; // clear unused bits\n }\n\n data = copy;\n return reindex;\n },\n size: () => data.length,\n curr: () => curr,\n prev: () => prev,\n reset: k => prev[k] = curr[k],\n all: () => width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff,\n set(k, one) {\n curr[k] |= one;\n },\n clear(k, one) {\n curr[k] &= ~one;\n },\n resize(n, m) {\n const k = curr.length;\n if (n > k || m > width) {\n width = Math.max(m, width);\n curr = array(n, width, curr);\n prev = array(n, width);\n }\n }\n };\n}\nfunction lengthen(array, length, copy) {\n if (array.length >= length) return array;\n copy = copy || new array.constructor(length);\n copy.set(array);\n return copy;\n}\nfunction array(n, m, array) {\n const copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n);\n if (array) copy.set(array);\n return copy;\n}\n\nfunction Dimension (index, i, query) {\n const bit = 1 << i;\n return {\n one: bit,\n zero: ~bit,\n range: query.slice(),\n bisect: index.bisect,\n index: index.index,\n size: index.size,\n onAdd(added, curr) {\n const dim = this,\n range = dim.bisect(dim.range, added.value),\n idx = added.index,\n lo = range[0],\n hi = range[1],\n n1 = idx.length;\n let i;\n for (i = 0; i < lo; ++i) curr[idx[i]] |= bit;\n for (i = hi; i < n1; ++i) curr[idx[i]] |= bit;\n return dim;\n }\n };\n}\n\n/**\n * Maintains a list of values, sorted by key.\n */\nfunction SortedIndex() {\n let index = array32(0),\n value = [],\n size = 0;\n function insert(key, data, base) {\n if (!data.length) return [];\n const n0 = size,\n n1 = data.length,\n addi = array32(n1);\n let addv = Array(n1),\n oldv,\n oldi,\n i;\n for (i = 0; i < n1; ++i) {\n addv[i] = key(data[i]);\n addi[i] = i;\n }\n addv = sort(addv, addi);\n if (n0) {\n oldv = value;\n oldi = index;\n value = Array(n0 + n1);\n index = array32(n0 + n1);\n merge(base, oldv, oldi, n0, addv, addi, n1, value, index);\n } else {\n if (base > 0) for (i = 0; i < n1; ++i) {\n addi[i] += base;\n }\n value = addv;\n index = addi;\n }\n size = n0 + n1;\n return {\n index: addi,\n value: addv\n };\n }\n function remove(num, map) {\n // map: index -> remove\n const n = size;\n let idx, i, j;\n\n // seek forward to first removal\n for (i = 0; !map[index[i]] && i < n; ++i);\n\n // condense index and value arrays\n for (j = i; i < n; ++i) {\n if (!map[idx = index[i]]) {\n index[j] = idx;\n value[j] = value[i];\n ++j;\n }\n }\n size = n - num;\n }\n function reindex(map) {\n for (let i = 0, n = size; i < n; ++i) {\n index[i] = map[index[i]];\n }\n }\n function bisect(range, array) {\n let n;\n if (array) {\n n = array.length;\n } else {\n array = value;\n n = size;\n }\n return [bisectLeft(array, range[0], 0, n), bisectRight(array, range[1], 0, n)];\n }\n return {\n insert: insert,\n remove: remove,\n bisect: bisect,\n reindex: reindex,\n index: () => index,\n size: () => size\n };\n}\nfunction sort(values, index) {\n values.sort.call(index, (a, b) => {\n const x = values[a],\n y = values[b];\n return x < y ? -1 : x > y ? 1 : 0;\n });\n return permute(values, index);\n}\nfunction merge(base, value0, index0, n0, value1, index1, n1, value, index) {\n let i0 = 0,\n i1 = 0,\n i;\n for (i = 0; i0 < n0 && i1 < n1; ++i) {\n if (value0[i0] < value1[i1]) {\n value[i] = value0[i0];\n index[i] = index0[i0++];\n } else {\n value[i] = value1[i1];\n index[i] = index1[i1++] + base;\n }\n }\n for (; i0 < n0; ++i0, ++i) {\n value[i] = value0[i0];\n index[i] = index0[i0];\n }\n for (; i1 < n1; ++i1, ++i) {\n value[i] = value1[i1];\n index[i] = index1[i1] + base;\n }\n}\n\n/**\n * An indexed multi-dimensional filter.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {Array} params.fields - An array of dimension accessors to filter.\n * @param {Array} params.query - An array of per-dimension range queries.\n */\nfunction CrossFilter(params) {\n Transform.call(this, Bitmaps(), params);\n this._indices = null;\n this._dims = null;\n}\nCrossFilter.Definition = {\n 'type': 'CrossFilter',\n 'metadata': {},\n 'params': [{\n 'name': 'fields',\n 'type': 'field',\n 'array': true,\n 'required': true\n }, {\n 'name': 'query',\n 'type': 'array',\n 'array': true,\n 'required': true,\n 'content': {\n 'type': 'number',\n 'array': true,\n 'length': 2\n }\n }]\n};\ninherits(CrossFilter, Transform, {\n transform(_, pulse) {\n if (!this._dims) {\n return this.init(_, pulse);\n } else {\n var init = _.modified('fields') || _.fields.some(f => pulse.modified(f.fields));\n return init ? this.reinit(_, pulse) : this.eval(_, pulse);\n }\n },\n init(_, pulse) {\n const fields = _.fields,\n query = _.query,\n indices = this._indices = {},\n dims = this._dims = [],\n m = query.length;\n let i = 0,\n key,\n index;\n\n // instantiate indices and dimensions\n for (; i < m; ++i) {\n key = fields[i].fname;\n index = indices[key] || (indices[key] = SortedIndex());\n dims.push(Dimension(index, i, query[i]));\n }\n return this.eval(_, pulse);\n },\n reinit(_, pulse) {\n const output = pulse.materialize().fork(),\n fields = _.fields,\n query = _.query,\n indices = this._indices,\n dims = this._dims,\n bits = this.value,\n curr = bits.curr(),\n prev = bits.prev(),\n all = bits.all(),\n out = output.rem = output.add,\n mod = output.mod,\n m = query.length,\n adds = {};\n let add, index, key, mods, remMap, modMap, i, n, f;\n\n // set prev to current state\n prev.set(curr);\n\n // if pulse has remove tuples, process them first\n if (pulse.rem.length) {\n remMap = this.remove(_, pulse, output);\n }\n\n // if pulse has added tuples, add them to state\n if (pulse.add.length) {\n bits.add(pulse.add);\n }\n\n // if pulse has modified tuples, create an index map\n if (pulse.mod.length) {\n modMap = {};\n for (mods = pulse.mod, i = 0, n = mods.length; i < n; ++i) {\n modMap[mods[i]._index] = 1;\n }\n }\n\n // re-initialize indices as needed, update curr bitmap\n for (i = 0; i < m; ++i) {\n f = fields[i];\n if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) {\n key = f.fname;\n if (!(add = adds[key])) {\n indices[key] = index = SortedIndex();\n adds[key] = add = index.insert(f, pulse.source, 0);\n }\n dims[i] = Dimension(index, i, query[i]).onAdd(add, curr);\n }\n }\n\n // visit each tuple\n // if filter state changed, push index to add/rem\n // else if in mod and passes a filter, push index to mod\n for (i = 0, n = bits.data().length; i < n; ++i) {\n if (remMap[i]) {\n // skip if removed tuple\n continue;\n } else if (prev[i] !== curr[i]) {\n // add if state changed\n out.push(i);\n } else if (modMap[i] && curr[i] !== all) {\n // otherwise, pass mods through\n mod.push(i);\n }\n }\n bits.mask = (1 << m) - 1;\n return output;\n },\n eval(_, pulse) {\n const output = pulse.materialize().fork(),\n m = this._dims.length;\n let mask = 0;\n if (pulse.rem.length) {\n this.remove(_, pulse, output);\n mask |= (1 << m) - 1;\n }\n if (_.modified('query') && !_.modified('fields')) {\n mask |= this.update(_, pulse, output);\n }\n if (pulse.add.length) {\n this.insert(_, pulse, output);\n mask |= (1 << m) - 1;\n }\n if (pulse.mod.length) {\n this.modify(pulse, output);\n mask |= (1 << m) - 1;\n }\n this.value.mask = mask;\n return output;\n },\n insert(_, pulse, output) {\n const tuples = pulse.add,\n bits = this.value,\n dims = this._dims,\n indices = this._indices,\n fields = _.fields,\n adds = {},\n out = output.add,\n n = bits.size() + tuples.length,\n m = dims.length;\n let k = bits.size(),\n j,\n key,\n add;\n\n // resize bitmaps and add tuples as needed\n bits.resize(n, m);\n bits.add(tuples);\n const curr = bits.curr(),\n prev = bits.prev(),\n all = bits.all();\n\n // add to dimensional indices\n for (j = 0; j < m; ++j) {\n key = fields[j].fname;\n add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k));\n dims[j].onAdd(add, curr);\n }\n\n // set previous filters, output if passes at least one filter\n for (; k < n; ++k) {\n prev[k] = all;\n if (curr[k] !== all) out.push(k);\n }\n },\n modify(pulse, output) {\n const out = output.mod,\n bits = this.value,\n curr = bits.curr(),\n all = bits.all(),\n tuples = pulse.mod;\n let i, n, k;\n for (i = 0, n = tuples.length; i < n; ++i) {\n k = tuples[i]._index;\n if (curr[k] !== all) out.push(k);\n }\n },\n remove(_, pulse, output) {\n const indices = this._indices,\n bits = this.value,\n curr = bits.curr(),\n prev = bits.prev(),\n all = bits.all(),\n map = {},\n out = output.rem,\n tuples = pulse.rem;\n let i, n, k, f;\n\n // process tuples, output if passes at least one filter\n for (i = 0, n = tuples.length; i < n; ++i) {\n k = tuples[i]._index;\n map[k] = 1; // build index map\n prev[k] = f = curr[k];\n curr[k] = all;\n if (f !== all) out.push(k);\n }\n\n // remove from dimensional indices\n for (k in indices) {\n indices[k].remove(n, map);\n }\n this.reindex(pulse, n, map);\n return map;\n },\n // reindex filters and indices after propagation completes\n reindex(pulse, num, map) {\n const indices = this._indices,\n bits = this.value;\n pulse.runAfter(() => {\n const indexMap = bits.remove(num, map);\n for (const key in indices) indices[key].reindex(indexMap);\n });\n },\n update(_, pulse, output) {\n const dims = this._dims,\n query = _.query,\n stamp = pulse.stamp,\n m = dims.length;\n let mask = 0,\n i,\n q;\n\n // survey how many queries have changed\n output.filters = 0;\n for (q = 0; q < m; ++q) {\n if (_.modified('query', q)) {\n i = q;\n ++mask;\n }\n }\n if (mask === 1) {\n // only one query changed, use more efficient update\n mask = dims[i].one;\n this.incrementOne(dims[i], query[i], output.add, output.rem);\n } else {\n // multiple queries changed, perform full record keeping\n for (q = 0, mask = 0; q < m; ++q) {\n if (!_.modified('query', q)) continue;\n mask |= dims[q].one;\n this.incrementAll(dims[q], query[q], stamp, output.add);\n output.rem = output.add; // duplicate add/rem for downstream resolve\n }\n }\n\n return mask;\n },\n incrementAll(dim, query, stamp, out) {\n const bits = this.value,\n seen = bits.seen(),\n curr = bits.curr(),\n prev = bits.prev(),\n index = dim.index(),\n old = dim.bisect(dim.range),\n range = dim.bisect(query),\n lo1 = range[0],\n hi1 = range[1],\n lo0 = old[0],\n hi0 = old[1],\n one = dim.one;\n let i, j, k;\n\n // Fast incremental update based on previous lo index.\n if (lo1 < lo0) {\n for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {\n k = index[i];\n if (seen[k] !== stamp) {\n prev[k] = curr[k];\n seen[k] = stamp;\n out.push(k);\n }\n curr[k] ^= one;\n }\n } else if (lo1 > lo0) {\n for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {\n k = index[i];\n if (seen[k] !== stamp) {\n prev[k] = curr[k];\n seen[k] = stamp;\n out.push(k);\n }\n curr[k] ^= one;\n }\n }\n\n // Fast incremental update based on previous hi index.\n if (hi1 > hi0) {\n for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {\n k = index[i];\n if (seen[k] !== stamp) {\n prev[k] = curr[k];\n seen[k] = stamp;\n out.push(k);\n }\n curr[k] ^= one;\n }\n } else if (hi1 < hi0) {\n for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {\n k = index[i];\n if (seen[k] !== stamp) {\n prev[k] = curr[k];\n seen[k] = stamp;\n out.push(k);\n }\n curr[k] ^= one;\n }\n }\n dim.range = query.slice();\n },\n incrementOne(dim, query, add, rem) {\n const bits = this.value,\n curr = bits.curr(),\n index = dim.index(),\n old = dim.bisect(dim.range),\n range = dim.bisect(query),\n lo1 = range[0],\n hi1 = range[1],\n lo0 = old[0],\n hi0 = old[1],\n one = dim.one;\n let i, j, k;\n\n // Fast incremental update based on previous lo index.\n if (lo1 < lo0) {\n for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {\n k = index[i];\n curr[k] ^= one;\n add.push(k);\n }\n } else if (lo1 > lo0) {\n for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {\n k = index[i];\n curr[k] ^= one;\n rem.push(k);\n }\n }\n\n // Fast incremental update based on previous hi index.\n if (hi1 > hi0) {\n for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {\n k = index[i];\n curr[k] ^= one;\n add.push(k);\n }\n } else if (hi1 < hi0) {\n for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {\n k = index[i];\n curr[k] ^= one;\n rem.push(k);\n }\n }\n dim.range = query.slice();\n }\n});\n\n/**\n * Selectively filters tuples by resolving against a filter bitmap.\n * Useful for processing the output of a cross-filter transform.\n * @constructor\n * @param {object} params - The parameters for this operator.\n * @param {object} params.ignore - A bit mask indicating which filters to ignore.\n * @param {object} params.filter - The per-tuple filter bitmaps. Typically this\n * parameter value is a reference to a {@link CrossFilter} transform.\n */\nfunction ResolveFilter(params) {\n Transform.call(this, null, params);\n}\nResolveFilter.Definition = {\n 'type': 'ResolveFilter',\n 'metadata': {},\n 'params': [{\n 'name': 'ignore',\n 'type': 'number',\n 'required': true,\n 'description': 'A bit mask indicating which filters to ignore.'\n }, {\n 'name': 'filter',\n 'type': 'object',\n 'required': true,\n 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.'\n }]\n};\ninherits(ResolveFilter, Transform, {\n transform(_, pulse) {\n const ignore = ~(_.ignore || 0),\n // bit mask where zeros -> dims to ignore\n bitmap = _.filter,\n mask = bitmap.mask;\n\n // exit early if no relevant filter changes\n if ((mask & ignore) === 0) return pulse.StopPropagation;\n const output = pulse.fork(pulse.ALL),\n data = bitmap.data(),\n curr = bitmap.curr(),\n prev = bitmap.prev(),\n pass = k => !(curr[k] & ignore) ? data[k] : null;\n\n // propagate all mod tuples that pass the filter\n output.filter(output.MOD, pass);\n\n // determine add & rem tuples via filter functions\n // for efficiency, we do *not* populate new arrays,\n // instead we add filter functions applied downstream\n\n if (!(mask & mask - 1)) {\n // only one filter changed\n output.filter(output.ADD, pass);\n output.filter(output.REM, k => (curr[k] & ignore) === mask ? data[k] : null);\n } else {\n // multiple filters changed\n output.filter(output.ADD, k => {\n const c = curr[k] & ignore,\n f = !c && c ^ prev[k] & ignore;\n return f ? data[k] : null;\n });\n output.filter(output.REM, k => {\n const c = curr[k] & ignore,\n f = c && !(c ^ (c ^ prev[k] & ignore));\n return f ? data[k] : null;\n });\n }\n\n // add filter to source data in case of reflow...\n return output.filter(output.SOURCE, t => pass(t._index));\n }\n});\n\nexport { CrossFilter as crossfilter, ResolveFilter as resolvefilter };\n","export default function permute(source, keys) {\n return Array.from(keys, key => source[key]);\n}\n","import { error, toSet, isFunction, isString, hasOwnProperty } from 'vega-util';\n\nconst RawCode = 'RawCode';\nconst Literal = 'Literal';\nconst Property = 'Property';\nconst Identifier = 'Identifier';\nconst ArrayExpression = 'ArrayExpression';\nconst BinaryExpression = 'BinaryExpression';\nconst CallExpression = 'CallExpression';\nconst ConditionalExpression = 'ConditionalExpression';\nconst LogicalExpression = 'LogicalExpression';\nconst MemberExpression = 'MemberExpression';\nconst ObjectExpression = 'ObjectExpression';\nconst UnaryExpression = 'UnaryExpression';\nfunction ASTNode(type) {\n this.type = type;\n}\nASTNode.prototype.visit = function (visitor) {\n let c, i, n;\n if (visitor(this)) return 1;\n for (c = children(this), i = 0, n = c.length; i < n; ++i) {\n if (c[i].visit(visitor)) return 1;\n }\n};\nfunction children(node) {\n switch (node.type) {\n case ArrayExpression:\n return node.elements;\n case BinaryExpression:\n case LogicalExpression:\n return [node.left, node.right];\n case CallExpression:\n return [node.callee].concat(node.arguments);\n case ConditionalExpression:\n return [node.test, node.consequent, node.alternate];\n case MemberExpression:\n return [node.object, node.property];\n case ObjectExpression:\n return node.properties;\n case Property:\n return [node.key, node.value];\n case UnaryExpression:\n return [node.argument];\n case Identifier:\n case Literal:\n case RawCode:\n default:\n return [];\n }\n}\n\n/*\n The following expression parser is based on Esprima (http://esprima.org/).\n Original header comment and license for Esprima is included here:\n\n Copyright (C) 2013 Ariya Hidayat \n Copyright (C) 2013 Thaddee Tyl \n Copyright (C) 2013 Mathias Bynens \n Copyright (C) 2012 Ariya Hidayat \n Copyright (C) 2012 Mathias Bynens \n Copyright (C) 2012 Joost-Wim Boekesteijn \n Copyright (C) 2012 Kris Kowal \n Copyright (C) 2012 Yusuke Suzuki \n Copyright (C) 2012 Arpad Borsos \n Copyright (C) 2011 Ariya Hidayat \n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\nvar TokenName, source, index, length, lookahead;\nvar TokenBooleanLiteral = 1,\n TokenEOF = 2,\n TokenIdentifier = 3,\n TokenKeyword = 4,\n TokenNullLiteral = 5,\n TokenNumericLiteral = 6,\n TokenPunctuator = 7,\n TokenStringLiteral = 8,\n TokenRegularExpression = 9;\nTokenName = {};\nTokenName[TokenBooleanLiteral] = 'Boolean';\nTokenName[TokenEOF] = '';\nTokenName[TokenIdentifier] = 'Identifier';\nTokenName[TokenKeyword] = 'Keyword';\nTokenName[TokenNullLiteral] = 'Null';\nTokenName[TokenNumericLiteral] = 'Numeric';\nTokenName[TokenPunctuator] = 'Punctuator';\nTokenName[TokenStringLiteral] = 'String';\nTokenName[TokenRegularExpression] = 'RegularExpression';\nvar SyntaxArrayExpression = 'ArrayExpression',\n SyntaxBinaryExpression = 'BinaryExpression',\n SyntaxCallExpression = 'CallExpression',\n SyntaxConditionalExpression = 'ConditionalExpression',\n SyntaxIdentifier = 'Identifier',\n SyntaxLiteral = 'Literal',\n SyntaxLogicalExpression = 'LogicalExpression',\n SyntaxMemberExpression = 'MemberExpression',\n SyntaxObjectExpression = 'ObjectExpression',\n SyntaxProperty = 'Property',\n SyntaxUnaryExpression = 'UnaryExpression';\n\n// Error messages should be identical to V8.\nvar MessageUnexpectedToken = 'Unexpected token %0',\n MessageUnexpectedNumber = 'Unexpected number',\n MessageUnexpectedString = 'Unexpected string',\n MessageUnexpectedIdentifier = 'Unexpected identifier',\n MessageUnexpectedReserved = 'Unexpected reserved word',\n MessageUnexpectedEOS = 'Unexpected end of input',\n MessageInvalidRegExp = 'Invalid regular expression',\n MessageUnterminatedRegExp = 'Invalid regular expression: missing /',\n MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.',\n MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode';\nvar ILLEGAL = 'ILLEGAL',\n DISABLED = 'Disabled.';\n\n// See also tools/generate-unicode-regex.py.\nvar RegexNonAsciiIdentifierStart = new RegExp('[\\\\xAA\\\\xB5\\\\xBA\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0370-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u037F\\\\u0386\\\\u0388-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u048A-\\\\u052F\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0620-\\\\u064A\\\\u066E\\\\u066F\\\\u0671-\\\\u06D3\\\\u06D5\\\\u06E5\\\\u06E6\\\\u06EE\\\\u06EF\\\\u06FA-\\\\u06FC\\\\u06FF\\\\u0710\\\\u0712-\\\\u072F\\\\u074D-\\\\u07A5\\\\u07B1\\\\u07CA-\\\\u07EA\\\\u07F4\\\\u07F5\\\\u07FA\\\\u0800-\\\\u0815\\\\u081A\\\\u0824\\\\u0828\\\\u0840-\\\\u0858\\\\u08A0-\\\\u08B2\\\\u0904-\\\\u0939\\\\u093D\\\\u0950\\\\u0958-\\\\u0961\\\\u0971-\\\\u0980\\\\u0985-\\\\u098C\\\\u098F\\\\u0990\\\\u0993-\\\\u09A8\\\\u09AA-\\\\u09B0\\\\u09B2\\\\u09B6-\\\\u09B9\\\\u09BD\\\\u09CE\\\\u09DC\\\\u09DD\\\\u09DF-\\\\u09E1\\\\u09F0\\\\u09F1\\\\u0A05-\\\\u0A0A\\\\u0A0F\\\\u0A10\\\\u0A13-\\\\u0A28\\\\u0A2A-\\\\u0A30\\\\u0A32\\\\u0A33\\\\u0A35\\\\u0A36\\\\u0A38\\\\u0A39\\\\u0A59-\\\\u0A5C\\\\u0A5E\\\\u0A72-\\\\u0A74\\\\u0A85-\\\\u0A8D\\\\u0A8F-\\\\u0A91\\\\u0A93-\\\\u0AA8\\\\u0AAA-\\\\u0AB0\\\\u0AB2\\\\u0AB3\\\\u0AB5-\\\\u0AB9\\\\u0ABD\\\\u0AD0\\\\u0AE0\\\\u0AE1\\\\u0B05-\\\\u0B0C\\\\u0B0F\\\\u0B10\\\\u0B13-\\\\u0B28\\\\u0B2A-\\\\u0B30\\\\u0B32\\\\u0B33\\\\u0B35-\\\\u0B39\\\\u0B3D\\\\u0B5C\\\\u0B5D\\\\u0B5F-\\\\u0B61\\\\u0B71\\\\u0B83\\\\u0B85-\\\\u0B8A\\\\u0B8E-\\\\u0B90\\\\u0B92-\\\\u0B95\\\\u0B99\\\\u0B9A\\\\u0B9C\\\\u0B9E\\\\u0B9F\\\\u0BA3\\\\u0BA4\\\\u0BA8-\\\\u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\\\u1250-\\\\u1256\\\\u1258\\\\u125A-\\\\u125D\\\\u1260-\\\\u1288\\\\u128A-\\\\u128D\\\\u1290-\\\\u12B0\\\\u12B2-\\\\u12B5\\\\u12B8-\\\\u12BE\\\\u12C0\\\\u12C2-\\\\u12C5\\\\u12C8-\\\\u12D6\\\\u12D8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F4\\\\u1401-\\\\u166C\\\\u166F-\\\\u167F\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u16EE-\\\\u16F8\\\\u1700-\\\\u170C\\\\u170E-\\\\u1711\\\\u1720-\\\\u1731\\\\u1740-\\\\u1751\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1780-\\\\u17B3\\\\u17D7\\\\u17DC\\\\u1820-\\\\u1877\\\\u1880-\\\\u18A8\\\\u18AA\\\\u18B0-\\\\u18F5\\\\u1900-\\\\u191E\\\\u1950-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19AB\\\\u19C1-\\\\u19C7\\\\u1A00-\\\\u1A16\\\\u1A20-\\\\u1A54\\\\u1AA7\\\\u1B05-\\\\u1B33\\\\u1B45-\\\\u1B4B\\\\u1B83-\\\\u1BA0\\\\u1BAE\\\\u1BAF\\\\u1BBA-\\\\u1BE5\\\\u1C00-\\\\u1C23\\\\u1C4D-\\\\u1C4F\\\\u1C5A-\\\\u1C7D\\\\u1CE9-\\\\u1CEC\\\\u1CEE-\\\\u1CF1\\\\u1CF5\\\\u1CF6\\\\u1D00-\\\\u1DBF\\\\u1E00-\\\\u1F15\\\\u1F18-\\\\u1F1D\\\\u1F20-\\\\u1F45\\\\u1F48-\\\\u1F4D\\\\u1F50-\\\\u1F57\\\\u1F59\\\\u1F5B\\\\u1F5D\\\\u1F5F-\\\\u1F7D\\\\u1F80-\\\\u1FB4\\\\u1FB6-\\\\u1FBC\\\\u1FBE\\\\u1FC2-\\\\u1FC4\\\\u1FC6-\\\\u1FCC\\\\u1FD0-\\\\u1FD3\\\\u1FD6-\\\\u1FDB\\\\u1FE0-\\\\u1FEC\\\\u1FF2-\\\\u1FF4\\\\u1FF6-\\\\u1FFC\\\\u2071\\\\u207F\\\\u2090-\\\\u209C\\\\u2102\\\\u2107\\\\u210A-\\\\u2113\\\\u2115\\\\u2119-\\\\u211D\\\\u2124\\\\u2126\\\\u2128\\\\u212A-\\\\u212D\\\\u212F-\\\\u2139\\\\u213C-\\\\u213F\\\\u2145-\\\\u2149\\\\u214E\\\\u2160-\\\\u2188\\\\u2C00-\\\\u2C2E\\\\u2C30-\\\\u2C5E\\\\u2C60-\\\\u2CE4\\\\u2CEB-\\\\u2CEE\\\\u2CF2\\\\u2CF3\\\\u2D00-\\\\u2D25\\\\u2D27\\\\u2D2D\\\\u2D30-\\\\u2D67\\\\u2D6F\\\\u2D80-\\\\u2D96\\\\u2DA0-\\\\u2DA6\\\\u2DA8-\\\\u2DAE\\\\u2DB0-\\\\u2DB6\\\\u2DB8-\\\\u2DBE\\\\u2DC0-\\\\u2DC6\\\\u2DC8-\\\\u2DCE\\\\u2DD0-\\\\u2DD6\\\\u2DD8-\\\\u2DDE\\\\u2E2F\\\\u3005-\\\\u3007\\\\u3021-\\\\u3029\\\\u3031-\\\\u3035\\\\u3038-\\\\u303C\\\\u3041-\\\\u3096\\\\u309D-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31BA\\\\u31F0-\\\\u31FF\\\\u3400-\\\\u4DB5\\\\u4E00-\\\\u9FCC\\\\uA000-\\\\uA48C\\\\uA4D0-\\\\uA4FD\\\\uA500-\\\\uA60C\\\\uA610-\\\\uA61F\\\\uA62A\\\\uA62B\\\\uA640-\\\\uA66E\\\\uA67F-\\\\uA69D\\\\uA6A0-\\\\uA6EF\\\\uA717-\\\\uA71F\\\\uA722-\\\\uA788\\\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\\uFEFC\\\\uFF21-\\\\uFF3A\\\\uFF41-\\\\uFF5A\\\\uFF66-\\\\uFFBE\\\\uFFC2-\\\\uFFC7\\\\uFFCA-\\\\uFFCF\\\\uFFD2-\\\\uFFD7\\\\uFFDA-\\\\uFFDC]'),\n // eslint-disable-next-line no-misleading-character-class\n RegexNonAsciiIdentifierPart = new RegExp('[\\\\xAA\\\\xB5\\\\xBA\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0300-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u037F\\\\u0386\\\\u0388-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u0483-\\\\u0487\\\\u048A-\\\\u052F\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u0591-\\\\u05BD\\\\u05BF\\\\u05C1\\\\u05C2\\\\u05C4\\\\u05C5\\\\u05C7\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0610-\\\\u061A\\\\u0620-\\\\u0669\\\\u066E-\\\\u06D3\\\\u06D5-\\\\u06DC\\\\u06DF-\\\\u06E8\\\\u06EA-\\\\u06FC\\\\u06FF\\\\u0710-\\\\u074A\\\\u074D-\\\\u07B1\\\\u07C0-\\\\u07F5\\\\u07FA\\\\u0800-\\\\u082D\\\\u0840-\\\\u085B\\\\u08A0-\\\\u08B2\\\\u08E4-\\\\u0963\\\\u0966-\\\\u096F\\\\u0971-\\\\u0983\\\\u0985-\\\\u098C\\\\u098F\\\\u0990\\\\u0993-\\\\u09A8\\\\u09AA-\\\\u09B0\\\\u09B2\\\\u09B6-\\\\u09B9\\\\u09BC-\\\\u09C4\\\\u09C7\\\\u09C8\\\\u09CB-\\\\u09CE\\\\u09D7\\\\u09DC\\\\u09DD\\\\u09DF-\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\\\u0EAB\\\\u0EAD-\\\\u0EB9\\\\u0EBB-\\\\u0EBD\\\\u0EC0-\\\\u0EC4\\\\u0EC6\\\\u0EC8-\\\\u0ECD\\\\u0ED0-\\\\u0ED9\\\\u0EDC-\\\\u0EDF\\\\u0F00\\\\u0F18\\\\u0F19\\\\u0F20-\\\\u0F29\\\\u0F35\\\\u0F37\\\\u0F39\\\\u0F3E-\\\\u0F47\\\\u0F49-\\\\u0F6C\\\\u0F71-\\\\u0F84\\\\u0F86-\\\\u0F97\\\\u0F99-\\\\u0FBC\\\\u0FC6\\\\u1000-\\\\u1049\\\\u1050-\\\\u109D\\\\u10A0-\\\\u10C5\\\\u10C7\\\\u10CD\\\\u10D0-\\\\u10FA\\\\u10FC-\\\\u1248\\\\u124A-\\\\u124D\\\\u1250-\\\\u1256\\\\u1258\\\\u125A-\\\\u125D\\\\u1260-\\\\u1288\\\\u128A-\\\\u128D\\\\u1290-\\\\u12B0\\\\u12B2-\\\\u12B5\\\\u12B8-\\\\u12BE\\\\u12C0\\\\u12C2-\\\\u12C5\\\\u12C8-\\\\u12D6\\\\u12D8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u135D-\\\\u135F\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F4\\\\u1401-\\\\u166C\\\\u166F-\\\\u167F\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u16EE-\\\\u16F8\\\\u1700-\\\\u170C\\\\u170E-\\\\u1714\\\\u1720-\\\\u1734\\\\u1740-\\\\u1753\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1772\\\\u1773\\\\u1780-\\\\u17D3\\\\u17D7\\\\u17DC\\\\u17DD\\\\u17E0-\\\\u17E9\\\\u180B-\\\\u180D\\\\u1810-\\\\u1819\\\\u1820-\\\\u1877\\\\u1880-\\\\u18AA\\\\u18B0-\\\\u18F5\\\\u1900-\\\\u191E\\\\u1920-\\\\u192B\\\\u1930-\\\\u193B\\\\u1946-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19AB\\\\u19B0-\\\\u19C9\\\\u19D0-\\\\u19D9\\\\u1A00-\\\\u1A1B\\\\u1A20-\\\\u1A5E\\\\u1A60-\\\\u1A7C\\\\u1A7F-\\\\u1A89\\\\u1A90-\\\\u1A99\\\\u1AA7\\\\u1AB0-\\\\u1ABD\\\\u1B00-\\\\u1B4B\\\\u1B50-\\\\u1B59\\\\u1B6B-\\\\u1B73\\\\u1B80-\\\\u1BF3\\\\u1C00-\\\\u1C37\\\\u1C40-\\\\u1C49\\\\u1C4D-\\\\u1C7D\\\\u1CD0-\\\\u1CD2\\\\u1CD4-\\\\u1CF6\\\\u1CF8\\\\u1CF9\\\\u1D00-\\\\u1DF5\\\\u1DFC-\\\\u1F15\\\\u1F18-\\\\u1F1D\\\\u1F20-\\\\u1F45\\\\u1F48-\\\\u1F4D\\\\u1F50-\\\\u1F57\\\\u1F59\\\\u1F5B\\\\u1F5D\\\\u1F5F-\\\\u1F7D\\\\u1F80-\\\\u1FB4\\\\u1FB6-\\\\u1FBC\\\\u1FBE\\\\u1FC2-\\\\u1FC4\\\\u1FC6-\\\\u1FCC\\\\u1FD0-\\\\u1FD3\\\\u1FD6-\\\\u1FDB\\\\u1FE0-\\\\u1FEC\\\\u1FF2-\\\\u1FF4\\\\u1FF6-\\\\u1FFC\\\\u200C\\\\u200D\\\\u203F\\\\u2040\\\\u2054\\\\u2071\\\\u207F\\\\u2090-\\\\u209C\\\\u20D0-\\\\u20DC\\\\u20E1\\\\u20E5-\\\\u20F0\\\\u2102\\\\u2107\\\\u210A-\\\\u2113\\\\u2115\\\\u2119-\\\\u211D\\\\u2124\\\\u2126\\\\u2128\\\\u212A-\\\\u212D\\\\u212F-\\\\u2139\\\\u213C-\\\\u213F\\\\u2145-\\\\u2149\\\\u214E\\\\u2160-\\\\u2188\\\\u2C00-\\\\u2C2E\\\\u2C30-\\\\u2C5E\\\\u2C60-\\\\u2CE4\\\\u2CEB-\\\\u2CF3\\\\u2D00-\\\\u2D25\\\\u2D27\\\\u2D2D\\\\u2D30-\\\\u2D67\\\\u2D6F\\\\u2D7F-\\\\u2D96\\\\u2DA0-\\\\u2DA6\\\\u2DA8-\\\\u2DAE\\\\u2DB0-\\\\u2DB6\\\\u2DB8-\\\\u2DBE\\\\u2DC0-\\\\u2DC6\\\\u2DC8-\\\\u2DCE\\\\u2DD0-\\\\u2DD6\\\\u2DD8-\\\\u2DDE\\\\u2DE0-\\\\u2DFF\\\\u2E2F\\\\u3005-\\\\u3007\\\\u3021-\\\\u302F\\\\u3031-\\\\u3035\\\\u3038-\\\\u303C\\\\u3041-\\\\u3096\\\\u3099\\\\u309A\\\\u309D-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31BA\\\\u31F0-\\\\u31FF\\\\u3400-\\\\u4DB5\\\\u4E00-\\\\u9FCC\\\\uA000-\\\\uA48C\\\\uA4D0-\\\\uA4FD\\\\uA500-\\\\uA60C\\\\uA610-\\\\uA62B\\\\uA640-\\\\uA66F\\\\uA674-\\\\uA67D\\\\uA67F-\\\\uA69D\\\\uA69F-\\\\uA6F1\\\\uA717-\\\\uA71F\\\\uA722-\\\\uA788\\\\uA78B-\\\\uA78E\\\\uA790-\\\\uA7AD\\\\uA7B0\\\\uA7B1\\\\uA7F7-\\\\uA827\\\\uA840-\\\\uA873\\\\uA880-\\\\uA8C4\\\\uA8D0-\\\\uA8D9\\\\uA8E0-\\\\uA8F7\\\\uA8FB\\\\uA900-\\\\uA92D\\\\uA930-\\\\uA953\\\\uA960-\\\\uA97C\\\\uA980-\\\\uA9C0\\\\uA9CF-\\\\uA9D9\\\\uA9E0-\\\\uA9FE\\\\uAA00-\\\\uAA36\\\\uAA40-\\\\uAA4D\\\\uAA50-\\\\uAA59\\\\uAA60-\\\\uAA76\\\\uAA7A-\\\\uAAC2\\\\uAADB-\\\\uAADD\\\\uAAE0-\\\\uAAEF\\\\uAAF2-\\\\uAAF6\\\\uAB01-\\\\uAB06\\\\uAB09-\\\\uAB0E\\\\uAB11-\\\\uAB16\\\\uAB20-\\\\uAB26\\\\uAB28-\\\\uAB2E\\\\uAB30-\\\\uAB5A\\\\uAB5C-\\\\uAB5F\\\\uAB64\\\\uAB65\\\\uABC0-\\\\uABEA\\\\uABEC\\\\uABED\\\\uABF0-\\\\uABF9\\\\uAC00-\\\\uD7A3\\\\uD7B0-\\\\uD7C6\\\\uD7CB-\\\\uD7FB\\\\uF900-\\\\uFA6D\\\\uFA70-\\\\uFAD9\\\\uFB00-\\\\uFB06\\\\uFB13-\\\\uFB17\\\\uFB1D-\\\\uFB28\\\\uFB2A-\\\\uFB36\\\\uFB38-\\\\uFB3C\\\\uFB3E\\\\uFB40\\\\uFB41\\\\uFB43\\\\uFB44\\\\uFB46-\\\\uFBB1\\\\uFBD3-\\\\uFD3D\\\\uFD50-\\\\uFD8F\\\\uFD92-\\\\uFDC7\\\\uFDF0-\\\\uFDFB\\\\uFE00-\\\\uFE0F\\\\uFE20-\\\\uFE2D\\\\uFE33\\\\uFE34\\\\uFE4D-\\\\uFE4F\\\\uFE70-\\\\uFE74\\\\uFE76-\\\\uFEFC\\\\uFF10-\\\\uFF19\\\\uFF21-\\\\uFF3A\\\\uFF3F\\\\uFF41-\\\\uFF5A\\\\uFF66-\\\\uFFBE\\\\uFFC2-\\\\uFFC7\\\\uFFCA-\\\\uFFCF\\\\uFFD2-\\\\uFFD7\\\\uFFDA-\\\\uFFDC]');\n\n// Ensure the condition is true, otherwise throw an error.\n// This is only to have a better contract semantic, i.e. another safety net\n// to catch a logic error. The condition shall be fulfilled in normal case.\n// Do NOT use this to enforce a certain condition on any user input.\n\nfunction assert(condition, message) {\n /* istanbul ignore next */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n}\nfunction isDecimalDigit(ch) {\n return ch >= 0x30 && ch <= 0x39; // 0..9\n}\n\nfunction isHexDigit(ch) {\n return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n}\nfunction isOctalDigit(ch) {\n return '01234567'.indexOf(ch) >= 0;\n}\n\n// 7.2 White Space\n\nfunction isWhiteSpace(ch) {\n return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0;\n}\n\n// 7.3 Line Terminators\n\nfunction isLineTerminator(ch) {\n return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;\n}\n\n// 7.6 Identifier Names and Identifiers\n\nfunction isIdentifierStart(ch) {\n return ch === 0x24 || ch === 0x5F ||\n // $ (dollar) and _ (underscore)\n ch >= 0x41 && ch <= 0x5A ||\n // A..Z\n ch >= 0x61 && ch <= 0x7A ||\n // a..z\n ch === 0x5C ||\n // \\ (backslash)\n ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));\n}\nfunction isIdentifierPart(ch) {\n return ch === 0x24 || ch === 0x5F ||\n // $ (dollar) and _ (underscore)\n ch >= 0x41 && ch <= 0x5A ||\n // A..Z\n ch >= 0x61 && ch <= 0x7A ||\n // a..z\n ch >= 0x30 && ch <= 0x39 ||\n // 0..9\n ch === 0x5C ||\n // \\ (backslash)\n ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));\n}\n\n// 7.6.1.1 Keywords\n\nconst keywords = {\n 'if': 1,\n 'in': 1,\n 'do': 1,\n 'var': 1,\n 'for': 1,\n 'new': 1,\n 'try': 1,\n 'let': 1,\n 'this': 1,\n 'else': 1,\n 'case': 1,\n 'void': 1,\n 'with': 1,\n 'enum': 1,\n 'while': 1,\n 'break': 1,\n 'catch': 1,\n 'throw': 1,\n 'const': 1,\n 'yield': 1,\n 'class': 1,\n 'super': 1,\n 'return': 1,\n 'typeof': 1,\n 'delete': 1,\n 'switch': 1,\n 'export': 1,\n 'import': 1,\n 'public': 1,\n 'static': 1,\n 'default': 1,\n 'finally': 1,\n 'extends': 1,\n 'package': 1,\n 'private': 1,\n 'function': 1,\n 'continue': 1,\n 'debugger': 1,\n 'interface': 1,\n 'protected': 1,\n 'instanceof': 1,\n 'implements': 1\n};\nfunction skipComment() {\n while (index < length) {\n const ch = source.charCodeAt(index);\n if (isWhiteSpace(ch) || isLineTerminator(ch)) {\n ++index;\n } else {\n break;\n }\n }\n}\nfunction scanHexEscape(prefix) {\n var i,\n len,\n ch,\n code = 0;\n len = prefix === 'u' ? 4 : 2;\n for (i = 0; i < len; ++i) {\n if (index < length && isHexDigit(source[index])) {\n ch = source[index++];\n code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n } else {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n return String.fromCharCode(code);\n}\nfunction scanUnicodeCodePointEscape() {\n var ch, code, cu1, cu2;\n ch = source[index];\n code = 0;\n\n // At least, one hex digit is required.\n if (ch === '}') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n while (index < length) {\n ch = source[index++];\n if (!isHexDigit(ch)) {\n break;\n }\n code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n }\n if (code > 0x10FFFF || ch !== '}') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n // UTF-16 Encoding\n if (code <= 0xFFFF) {\n return String.fromCharCode(code);\n }\n cu1 = (code - 0x10000 >> 10) + 0xD800;\n cu2 = (code - 0x10000 & 1023) + 0xDC00;\n return String.fromCharCode(cu1, cu2);\n}\nfunction getEscapedIdentifier() {\n var ch, id;\n ch = source.charCodeAt(index++);\n id = String.fromCharCode(ch);\n\n // '\\u' (U+005C, U+0075) denotes an escaped character.\n if (ch === 0x5C) {\n if (source.charCodeAt(index) !== 0x75) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierStart(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n id = ch;\n }\n while (index < length) {\n ch = source.charCodeAt(index);\n if (!isIdentifierPart(ch)) {\n break;\n }\n ++index;\n id += String.fromCharCode(ch);\n\n // '\\u' (U+005C, U+0075) denotes an escaped character.\n if (ch === 0x5C) {\n id = id.substr(0, id.length - 1);\n if (source.charCodeAt(index) !== 0x75) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierPart(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n id += ch;\n }\n }\n return id;\n}\nfunction getIdentifier() {\n var start, ch;\n start = index++;\n while (index < length) {\n ch = source.charCodeAt(index);\n if (ch === 0x5C) {\n // Blackslash (U+005C) marks Unicode escape sequence.\n index = start;\n return getEscapedIdentifier();\n }\n if (isIdentifierPart(ch)) {\n ++index;\n } else {\n break;\n }\n }\n return source.slice(start, index);\n}\nfunction scanIdentifier() {\n var start, id, type;\n start = index;\n\n // Backslash (U+005C) starts an escaped character.\n id = source.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier();\n\n // There is no keyword or literal with only one character.\n // Thus, it must be an identifier.\n if (id.length === 1) {\n type = TokenIdentifier;\n } else if (keywords.hasOwnProperty(id)) {\n // eslint-disable-line no-prototype-builtins\n type = TokenKeyword;\n } else if (id === 'null') {\n type = TokenNullLiteral;\n } else if (id === 'true' || id === 'false') {\n type = TokenBooleanLiteral;\n } else {\n type = TokenIdentifier;\n }\n return {\n type: type,\n value: id,\n start: start,\n end: index\n };\n}\n\n// 7.7 Punctuators\n\nfunction scanPunctuator() {\n var start = index,\n code = source.charCodeAt(index),\n code2,\n ch1 = source[index],\n ch2,\n ch3,\n ch4;\n switch (code) {\n // Check for most common single-character punctuators.\n case 0x2E: // . dot\n case 0x28: // ( open bracket\n case 0x29: // ) close bracket\n case 0x3B: // ; semicolon\n case 0x2C: // , comma\n case 0x7B: // { open curly brace\n case 0x7D: // } close curly brace\n case 0x5B: // [\n case 0x5D: // ]\n case 0x3A: // :\n case 0x3F: // ?\n case 0x7E:\n // ~\n ++index;\n return {\n type: TokenPunctuator,\n value: String.fromCharCode(code),\n start: start,\n end: index\n };\n default:\n code2 = source.charCodeAt(index + 1);\n\n // '=' (U+003D) marks an assignment or comparison operator.\n if (code2 === 0x3D) {\n switch (code) {\n case 0x2B: // +\n case 0x2D: // -\n case 0x2F: // /\n case 0x3C: // <\n case 0x3E: // >\n case 0x5E: // ^\n case 0x7C: // |\n case 0x25: // %\n case 0x26: // &\n case 0x2A:\n // *\n index += 2;\n return {\n type: TokenPunctuator,\n value: String.fromCharCode(code) + String.fromCharCode(code2),\n start: start,\n end: index\n };\n case 0x21: // !\n case 0x3D:\n // =\n index += 2;\n\n // !== and ===\n if (source.charCodeAt(index) === 0x3D) {\n ++index;\n }\n return {\n type: TokenPunctuator,\n value: source.slice(start, index),\n start: start,\n end: index\n };\n }\n }\n }\n\n // 4-character punctuator: >>>=\n\n ch4 = source.substr(index, 4);\n if (ch4 === '>>>=') {\n index += 4;\n return {\n type: TokenPunctuator,\n value: ch4,\n start: start,\n end: index\n };\n }\n\n // 3-character punctuators: === !== >>> <<= >>=\n\n ch3 = ch4.substr(0, 3);\n if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {\n index += 3;\n return {\n type: TokenPunctuator,\n value: ch3,\n start: start,\n end: index\n };\n }\n\n // Other 2-character punctuators: ++ -- << >> && ||\n ch2 = ch3.substr(0, 2);\n if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') {\n index += 2;\n return {\n type: TokenPunctuator,\n value: ch2,\n start: start,\n end: index\n };\n }\n if (ch2 === '//') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n\n // 1-character punctuators: < > = ! + - * % & | ^ /\n\n if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {\n ++index;\n return {\n type: TokenPunctuator,\n value: ch1,\n start: start,\n end: index\n };\n }\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n}\n\n// 7.8.3 Numeric Literals\n\nfunction scanHexLiteral(start) {\n let number = '';\n while (index < length) {\n if (!isHexDigit(source[index])) {\n break;\n }\n number += source[index++];\n }\n if (number.length === 0) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n return {\n type: TokenNumericLiteral,\n value: parseInt('0x' + number, 16),\n start: start,\n end: index\n };\n}\nfunction scanOctalLiteral(start) {\n let number = '0' + source[index++];\n while (index < length) {\n if (!isOctalDigit(source[index])) {\n break;\n }\n number += source[index++];\n }\n if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n return {\n type: TokenNumericLiteral,\n value: parseInt(number, 8),\n octal: true,\n start: start,\n end: index\n };\n}\nfunction scanNumericLiteral() {\n var number, start, ch;\n ch = source[index];\n assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point');\n start = index;\n number = '';\n if (ch !== '.') {\n number = source[index++];\n ch = source[index];\n\n // Hex number starts with '0x'.\n // Octal number starts with '0'.\n if (number === '0') {\n if (ch === 'x' || ch === 'X') {\n ++index;\n return scanHexLiteral(start);\n }\n if (isOctalDigit(ch)) {\n return scanOctalLiteral(start);\n }\n\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDecimalDigit(ch.charCodeAt(0))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n ch = source[index];\n }\n if (ch === '.') {\n number += source[index++];\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n ch = source[index];\n }\n if (ch === 'e' || ch === 'E') {\n number += source[index++];\n ch = source[index];\n if (ch === '+' || ch === '-') {\n number += source[index++];\n }\n if (isDecimalDigit(source.charCodeAt(index))) {\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n } else {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n }\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n return {\n type: TokenNumericLiteral,\n value: parseFloat(number),\n start: start,\n end: index\n };\n}\n\n// 7.8.4 String Literals\n\nfunction scanStringLiteral() {\n var str = '',\n quote,\n start,\n ch,\n code,\n octal = false;\n quote = source[index];\n assert(quote === '\\'' || quote === '\"', 'String literal must starts with a quote');\n start = index;\n ++index;\n while (index < length) {\n ch = source[index++];\n if (ch === quote) {\n quote = '';\n break;\n } else if (ch === '\\\\') {\n ch = source[index++];\n if (!ch || !isLineTerminator(ch.charCodeAt(0))) {\n switch (ch) {\n case 'u':\n case 'x':\n if (source[index] === '{') {\n ++index;\n str += scanUnicodeCodePointEscape();\n } else {\n str += scanHexEscape(ch);\n }\n break;\n case 'n':\n str += '\\n';\n break;\n case 'r':\n str += '\\r';\n break;\n case 't':\n str += '\\t';\n break;\n case 'b':\n str += '\\b';\n break;\n case 'f':\n str += '\\f';\n break;\n case 'v':\n str += '\\x0B';\n break;\n default:\n if (isOctalDigit(ch)) {\n code = '01234567'.indexOf(ch);\n\n // \\0 is not octal escape sequence\n if (code !== 0) {\n octal = true;\n }\n if (index < length && isOctalDigit(source[index])) {\n octal = true;\n code = code * 8 + '01234567'.indexOf(source[index++]);\n\n // 3 digits are only allowed when string starts\n // with 0, 1, 2, 3\n if ('0123'.indexOf(ch) >= 0 && index < length && isOctalDigit(source[index])) {\n code = code * 8 + '01234567'.indexOf(source[index++]);\n }\n }\n str += String.fromCharCode(code);\n } else {\n str += ch;\n }\n break;\n }\n } else {\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n break;\n } else {\n str += ch;\n }\n }\n if (quote !== '') {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n }\n return {\n type: TokenStringLiteral,\n value: str,\n octal: octal,\n start: start,\n end: index\n };\n}\nfunction testRegExp(pattern, flags) {\n let tmp = pattern;\n if (flags.indexOf('u') >= 0) {\n // Replace each astral symbol and every Unicode code point\n // escape sequence with a single ASCII symbol to avoid throwing on\n // regular expressions that are only valid in combination with the\n // `/u` flag.\n // Note: replacing with the ASCII symbol `x` might cause false\n // negatives in unlikely scenarios. For example, `[\\u{61}-b]` is a\n // perfectly valid pattern that is equivalent to `[a-b]`, but it\n // would be replaced by `[x-b]` which throws an error.\n tmp = tmp.replace(/\\\\u\\{([0-9a-fA-F]+)\\}/g, ($0, $1) => {\n if (parseInt($1, 16) <= 0x10FFFF) {\n return 'x';\n }\n throwError({}, MessageInvalidRegExp);\n }).replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, 'x');\n }\n\n // First, detect invalid regular expressions.\n try {\n new RegExp(tmp);\n } catch (e) {\n throwError({}, MessageInvalidRegExp);\n }\n\n // Return a regular expression object for this pattern-flag pair, or\n // `null` in case the current environment doesn't support the flags it\n // uses.\n try {\n return new RegExp(pattern, flags);\n } catch (exception) {\n return null;\n }\n}\nfunction scanRegExpBody() {\n var ch, str, classMarker, terminated, body;\n ch = source[index];\n assert(ch === '/', 'Regular expression literal must start with a slash');\n str = source[index++];\n classMarker = false;\n terminated = false;\n while (index < length) {\n ch = source[index++];\n str += ch;\n if (ch === '\\\\') {\n ch = source[index++];\n // ECMA-262 7.8.5\n if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, MessageUnterminatedRegExp);\n }\n str += ch;\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, MessageUnterminatedRegExp);\n } else if (classMarker) {\n if (ch === ']') {\n classMarker = false;\n }\n } else {\n if (ch === '/') {\n terminated = true;\n break;\n } else if (ch === '[') {\n classMarker = true;\n }\n }\n }\n if (!terminated) {\n throwError({}, MessageUnterminatedRegExp);\n }\n\n // Exclude leading and trailing slash.\n body = str.substr(1, str.length - 2);\n return {\n value: body,\n literal: str\n };\n}\nfunction scanRegExpFlags() {\n var ch, str, flags;\n str = '';\n flags = '';\n while (index < length) {\n ch = source[index];\n if (!isIdentifierPart(ch.charCodeAt(0))) {\n break;\n }\n ++index;\n if (ch === '\\\\' && index < length) {\n throwError({}, MessageUnexpectedToken, ILLEGAL);\n } else {\n flags += ch;\n str += ch;\n }\n }\n if (flags.search(/[^gimuy]/g) >= 0) {\n throwError({}, MessageInvalidRegExp, flags);\n }\n return {\n value: flags,\n literal: str\n };\n}\nfunction scanRegExp() {\n var start, body, flags, value;\n lookahead = null;\n skipComment();\n start = index;\n body = scanRegExpBody();\n flags = scanRegExpFlags();\n value = testRegExp(body.value, flags.value);\n return {\n literal: body.literal + flags.literal,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n start: start,\n end: index\n };\n}\nfunction isIdentifierName(token) {\n return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral;\n}\nfunction advance() {\n skipComment();\n if (index >= length) {\n return {\n type: TokenEOF,\n start: index,\n end: index\n };\n }\n const ch = source.charCodeAt(index);\n if (isIdentifierStart(ch)) {\n return scanIdentifier();\n }\n\n // Very common: ( and ) and ;\n if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {\n return scanPunctuator();\n }\n\n // String literal starts with single quote (U+0027) or double quote (U+0022).\n if (ch === 0x27 || ch === 0x22) {\n return scanStringLiteral();\n }\n\n // Dot (.) U+002E can also start a floating-point number, hence the need\n // to check the next character.\n if (ch === 0x2E) {\n if (isDecimalDigit(source.charCodeAt(index + 1))) {\n return scanNumericLiteral();\n }\n return scanPunctuator();\n }\n if (isDecimalDigit(ch)) {\n return scanNumericLiteral();\n }\n return scanPunctuator();\n}\nfunction lex() {\n const token = lookahead;\n index = token.end;\n lookahead = advance();\n index = token.end;\n return token;\n}\nfunction peek() {\n const pos = index;\n lookahead = advance();\n index = pos;\n}\nfunction finishArrayExpression(elements) {\n const node = new ASTNode(SyntaxArrayExpression);\n node.elements = elements;\n return node;\n}\nfunction finishBinaryExpression(operator, left, right) {\n const node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression);\n node.operator = operator;\n node.left = left;\n node.right = right;\n return node;\n}\nfunction finishCallExpression(callee, args) {\n const node = new ASTNode(SyntaxCallExpression);\n node.callee = callee;\n node.arguments = args;\n return node;\n}\nfunction finishConditionalExpression(test, consequent, alternate) {\n const node = new ASTNode(SyntaxConditionalExpression);\n node.test = test;\n node.consequent = consequent;\n node.alternate = alternate;\n return node;\n}\nfunction finishIdentifier(name) {\n const node = new ASTNode(SyntaxIdentifier);\n node.name = name;\n return node;\n}\nfunction finishLiteral(token) {\n const node = new ASTNode(SyntaxLiteral);\n node.value = token.value;\n node.raw = source.slice(token.start, token.end);\n if (token.regex) {\n if (node.raw === '//') {\n node.raw = '/(?:)/';\n }\n node.regex = token.regex;\n }\n return node;\n}\nfunction finishMemberExpression(accessor, object, property) {\n const node = new ASTNode(SyntaxMemberExpression);\n node.computed = accessor === '[';\n node.object = object;\n node.property = property;\n if (!node.computed) property.member = true;\n return node;\n}\nfunction finishObjectExpression(properties) {\n const node = new ASTNode(SyntaxObjectExpression);\n node.properties = properties;\n return node;\n}\nfunction finishProperty(kind, key, value) {\n const node = new ASTNode(SyntaxProperty);\n node.key = key;\n node.value = value;\n node.kind = kind;\n return node;\n}\nfunction finishUnaryExpression(operator, argument) {\n const node = new ASTNode(SyntaxUnaryExpression);\n node.operator = operator;\n node.argument = argument;\n node.prefix = true;\n return node;\n}\n\n// Throw an exception\n\nfunction throwError(token, messageFormat) {\n var error,\n args = Array.prototype.slice.call(arguments, 2),\n msg = messageFormat.replace(/%(\\d)/g, (whole, index) => {\n assert(index < args.length, 'Message reference must be in range');\n return args[index];\n });\n error = new Error(msg);\n error.index = index;\n error.description = msg;\n throw error;\n}\n\n// Throw an exception because of the token.\n\nfunction throwUnexpected(token) {\n if (token.type === TokenEOF) {\n throwError(token, MessageUnexpectedEOS);\n }\n if (token.type === TokenNumericLiteral) {\n throwError(token, MessageUnexpectedNumber);\n }\n if (token.type === TokenStringLiteral) {\n throwError(token, MessageUnexpectedString);\n }\n if (token.type === TokenIdentifier) {\n throwError(token, MessageUnexpectedIdentifier);\n }\n if (token.type === TokenKeyword) {\n throwError(token, MessageUnexpectedReserved);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, MessageUnexpectedToken, token.value);\n}\n\n// Expect the next token to match the specified punctuator.\n// If not, an exception will be thrown.\n\nfunction expect(value) {\n const token = lex();\n if (token.type !== TokenPunctuator || token.value !== value) {\n throwUnexpected(token);\n }\n}\n\n// Return true if the next token matches the specified punctuator.\n\nfunction match(value) {\n return lookahead.type === TokenPunctuator && lookahead.value === value;\n}\n\n// Return true if the next token matches the specified keyword\n\nfunction matchKeyword(keyword) {\n return lookahead.type === TokenKeyword && lookahead.value === keyword;\n}\n\n// 11.1.4 Array Initialiser\n\nfunction parseArrayInitialiser() {\n const elements = [];\n index = lookahead.start;\n expect('[');\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else {\n elements.push(parseConditionalExpression());\n if (!match(']')) {\n expect(',');\n }\n }\n }\n lex();\n return finishArrayExpression(elements);\n}\n\n// 11.1.5 Object Initialiser\n\nfunction parseObjectPropertyKey() {\n index = lookahead.start;\n const token = lex();\n\n // Note: This function is called only from parseObjectProperty(), where\n // EOF and Punctuator tokens are already filtered out.\n\n if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) {\n if (token.octal) {\n throwError(token, MessageStrictOctalLiteral);\n }\n return finishLiteral(token);\n }\n return finishIdentifier(token.value);\n}\nfunction parseObjectProperty() {\n var token, key, id, value;\n index = lookahead.start;\n token = lookahead;\n if (token.type === TokenIdentifier) {\n id = parseObjectPropertyKey();\n expect(':');\n value = parseConditionalExpression();\n return finishProperty('init', id, value);\n }\n if (token.type === TokenEOF || token.type === TokenPunctuator) {\n throwUnexpected(token);\n } else {\n key = parseObjectPropertyKey();\n expect(':');\n value = parseConditionalExpression();\n return finishProperty('init', key, value);\n }\n}\nfunction parseObjectInitialiser() {\n var properties = [],\n property,\n name,\n key,\n map = {},\n toString = String;\n index = lookahead.start;\n expect('{');\n while (!match('}')) {\n property = parseObjectProperty();\n if (property.key.type === SyntaxIdentifier) {\n name = property.key.name;\n } else {\n name = toString(property.key.value);\n }\n key = '$' + name;\n if (Object.prototype.hasOwnProperty.call(map, key)) {\n throwError({}, MessageStrictDuplicateProperty);\n } else {\n map[key] = true;\n }\n properties.push(property);\n if (!match('}')) {\n expect(',');\n }\n }\n expect('}');\n return finishObjectExpression(properties);\n}\n\n// 11.1.6 The Grouping Operator\n\nfunction parseGroupExpression() {\n expect('(');\n const expr = parseExpression();\n expect(')');\n return expr;\n}\n\n// 11.1 Primary Expressions\n\nconst legalKeywords = {\n 'if': 1\n};\nfunction parsePrimaryExpression() {\n var type, token, expr;\n if (match('(')) {\n return parseGroupExpression();\n }\n if (match('[')) {\n return parseArrayInitialiser();\n }\n if (match('{')) {\n return parseObjectInitialiser();\n }\n type = lookahead.type;\n index = lookahead.start;\n if (type === TokenIdentifier || legalKeywords[lookahead.value]) {\n expr = finishIdentifier(lex().value);\n } else if (type === TokenStringLiteral || type === TokenNumericLiteral) {\n if (lookahead.octal) {\n throwError(lookahead, MessageStrictOctalLiteral);\n }\n expr = finishLiteral(lex());\n } else if (type === TokenKeyword) {\n throw new Error(DISABLED);\n } else if (type === TokenBooleanLiteral) {\n token = lex();\n token.value = token.value === 'true';\n expr = finishLiteral(token);\n } else if (type === TokenNullLiteral) {\n token = lex();\n token.value = null;\n expr = finishLiteral(token);\n } else if (match('/') || match('/=')) {\n expr = finishLiteral(scanRegExp());\n peek();\n } else {\n throwUnexpected(lex());\n }\n return expr;\n}\n\n// 11.2 Left-Hand-Side Expressions\n\nfunction parseArguments() {\n const args = [];\n expect('(');\n if (!match(')')) {\n while (index < length) {\n args.push(parseConditionalExpression());\n if (match(')')) {\n break;\n }\n expect(',');\n }\n }\n expect(')');\n return args;\n}\nfunction parseNonComputedProperty() {\n index = lookahead.start;\n const token = lex();\n if (!isIdentifierName(token)) {\n throwUnexpected(token);\n }\n return finishIdentifier(token.value);\n}\nfunction parseNonComputedMember() {\n expect('.');\n return parseNonComputedProperty();\n}\nfunction parseComputedMember() {\n expect('[');\n const expr = parseExpression();\n expect(']');\n return expr;\n}\nfunction parseLeftHandSideExpressionAllowCall() {\n var expr, args, property;\n expr = parsePrimaryExpression();\n for (;;) {\n if (match('.')) {\n property = parseNonComputedMember();\n expr = finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n args = parseArguments();\n expr = finishCallExpression(expr, args);\n } else if (match('[')) {\n property = parseComputedMember();\n expr = finishMemberExpression('[', expr, property);\n } else {\n break;\n }\n }\n return expr;\n}\n\n// 11.3 Postfix Expressions\n\nfunction parsePostfixExpression() {\n const expr = parseLeftHandSideExpressionAllowCall();\n if (lookahead.type === TokenPunctuator) {\n if (match('++') || match('--')) {\n throw new Error(DISABLED);\n }\n }\n return expr;\n}\n\n// 11.4 Unary Operators\n\nfunction parseUnaryExpression() {\n var token, expr;\n if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) {\n expr = parsePostfixExpression();\n } else if (match('++') || match('--')) {\n throw new Error(DISABLED);\n } else if (match('+') || match('-') || match('~') || match('!')) {\n token = lex();\n expr = parseUnaryExpression();\n expr = finishUnaryExpression(token.value, expr);\n } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {\n throw new Error(DISABLED);\n } else {\n expr = parsePostfixExpression();\n }\n return expr;\n}\nfunction binaryPrecedence(token) {\n let prec = 0;\n if (token.type !== TokenPunctuator && token.type !== TokenKeyword) {\n return 0;\n }\n switch (token.value) {\n case '||':\n prec = 1;\n break;\n case '&&':\n prec = 2;\n break;\n case '|':\n prec = 3;\n break;\n case '^':\n prec = 4;\n break;\n case '&':\n prec = 5;\n break;\n case '==':\n case '!=':\n case '===':\n case '!==':\n prec = 6;\n break;\n case '<':\n case '>':\n case '<=':\n case '>=':\n case 'instanceof':\n case 'in':\n prec = 7;\n break;\n case '<<':\n case '>>':\n case '>>>':\n prec = 8;\n break;\n case '+':\n case '-':\n prec = 9;\n break;\n case '*':\n case '/':\n case '%':\n prec = 11;\n break;\n }\n return prec;\n}\n\n// 11.5 Multiplicative Operators\n// 11.6 Additive Operators\n// 11.7 Bitwise Shift Operators\n// 11.8 Relational Operators\n// 11.9 Equality Operators\n// 11.10 Binary Bitwise Operators\n// 11.11 Binary Logical Operators\n\nfunction parseBinaryExpression() {\n var marker, markers, expr, token, prec, stack, right, operator, left, i;\n marker = lookahead;\n left = parseUnaryExpression();\n token = lookahead;\n prec = binaryPrecedence(token);\n if (prec === 0) {\n return left;\n }\n token.prec = prec;\n lex();\n markers = [marker, lookahead];\n right = parseUnaryExpression();\n stack = [left, token, right];\n while ((prec = binaryPrecedence(lookahead)) > 0) {\n // Reduce: make a binary expression from the three topmost entries.\n while (stack.length > 2 && prec <= stack[stack.length - 2].prec) {\n right = stack.pop();\n operator = stack.pop().value;\n left = stack.pop();\n markers.pop();\n expr = finishBinaryExpression(operator, left, right);\n stack.push(expr);\n }\n\n // Shift.\n token = lex();\n token.prec = prec;\n stack.push(token);\n markers.push(lookahead);\n expr = parseUnaryExpression();\n stack.push(expr);\n }\n\n // Final reduce to clean-up the stack.\n i = stack.length - 1;\n expr = stack[i];\n markers.pop();\n while (i > 1) {\n markers.pop();\n expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);\n i -= 2;\n }\n return expr;\n}\n\n// 11.12 Conditional Operator\n\nfunction parseConditionalExpression() {\n var expr, consequent, alternate;\n expr = parseBinaryExpression();\n if (match('?')) {\n lex();\n consequent = parseConditionalExpression();\n expect(':');\n alternate = parseConditionalExpression();\n expr = finishConditionalExpression(expr, consequent, alternate);\n }\n return expr;\n}\n\n// 11.14 Comma Operator\n\nfunction parseExpression() {\n const expr = parseConditionalExpression();\n if (match(',')) {\n throw new Error(DISABLED); // no sequence expressions\n }\n\n return expr;\n}\nfunction parser (code) {\n source = code;\n index = 0;\n length = source.length;\n lookahead = null;\n peek();\n const expr = parseExpression();\n if (lookahead.type !== TokenEOF) {\n throw new Error('Unexpect token after expression.');\n }\n return expr;\n}\n\nvar Constants = {\n NaN: 'NaN',\n E: 'Math.E',\n LN2: 'Math.LN2',\n LN10: 'Math.LN10',\n LOG2E: 'Math.LOG2E',\n LOG10E: 'Math.LOG10E',\n PI: 'Math.PI',\n SQRT1_2: 'Math.SQRT1_2',\n SQRT2: 'Math.SQRT2',\n MIN_VALUE: 'Number.MIN_VALUE',\n MAX_VALUE: 'Number.MAX_VALUE'\n};\n\nfunction Functions (codegen) {\n function fncall(name, args, cast, type) {\n let obj = codegen(args[0]);\n if (cast) {\n obj = cast + '(' + obj + ')';\n if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';\n }\n return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')');\n }\n function fn(name, cast, type) {\n return args => fncall(name, args, cast, type);\n }\n const DATE = 'new Date',\n STRING = 'String',\n REGEXP = 'RegExp';\n return {\n // MATH functions\n isNaN: 'Number.isNaN',\n isFinite: 'Number.isFinite',\n abs: 'Math.abs',\n acos: 'Math.acos',\n asin: 'Math.asin',\n atan: 'Math.atan',\n atan2: 'Math.atan2',\n ceil: 'Math.ceil',\n cos: 'Math.cos',\n exp: 'Math.exp',\n floor: 'Math.floor',\n hypot: 'Math.hypot',\n log: 'Math.log',\n max: 'Math.max',\n min: 'Math.min',\n pow: 'Math.pow',\n random: 'Math.random',\n round: 'Math.round',\n sin: 'Math.sin',\n sqrt: 'Math.sqrt',\n tan: 'Math.tan',\n clamp: function (args) {\n if (args.length < 3) error('Missing arguments to clamp function.');\n if (args.length > 3) error('Too many arguments to clamp function.');\n const a = args.map(codegen);\n return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))';\n },\n // DATE functions\n now: 'Date.now',\n utc: 'Date.UTC',\n datetime: DATE,\n date: fn('getDate', DATE, 0),\n day: fn('getDay', DATE, 0),\n year: fn('getFullYear', DATE, 0),\n month: fn('getMonth', DATE, 0),\n hours: fn('getHours', DATE, 0),\n minutes: fn('getMinutes', DATE, 0),\n seconds: fn('getSeconds', DATE, 0),\n milliseconds: fn('getMilliseconds', DATE, 0),\n time: fn('getTime', DATE, 0),\n timezoneoffset: fn('getTimezoneOffset', DATE, 0),\n utcdate: fn('getUTCDate', DATE, 0),\n utcday: fn('getUTCDay', DATE, 0),\n utcyear: fn('getUTCFullYear', DATE, 0),\n utcmonth: fn('getUTCMonth', DATE, 0),\n utchours: fn('getUTCHours', DATE, 0),\n utcminutes: fn('getUTCMinutes', DATE, 0),\n utcseconds: fn('getUTCSeconds', DATE, 0),\n utcmilliseconds: fn('getUTCMilliseconds', DATE, 0),\n // sequence functions\n length: fn('length', null, -1),\n // STRING functions\n parseFloat: 'parseFloat',\n parseInt: 'parseInt',\n upper: fn('toUpperCase', STRING, 0),\n lower: fn('toLowerCase', STRING, 0),\n substring: fn('substring', STRING),\n split: fn('split', STRING),\n trim: fn('trim', STRING, 0),\n // REGEXP functions\n regexp: REGEXP,\n test: fn('test', REGEXP),\n // Control Flow functions\n if: function (args) {\n if (args.length < 3) error('Missing arguments to if function.');\n if (args.length > 3) error('Too many arguments to if function.');\n const a = args.map(codegen);\n return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')';\n }\n };\n}\n\nfunction stripQuotes(s) {\n const n = s && s.length - 1;\n return n && (s[0] === '\"' && s[n] === '\"' || s[0] === '\\'' && s[n] === '\\'') ? s.slice(1, -1) : s;\n}\nfunction codegen (opt) {\n opt = opt || {};\n const allowed = opt.allowed ? toSet(opt.allowed) : {},\n forbidden = opt.forbidden ? toSet(opt.forbidden) : {},\n constants = opt.constants || Constants,\n functions = (opt.functions || Functions)(visit),\n globalvar = opt.globalvar,\n fieldvar = opt.fieldvar,\n outputGlobal = isFunction(globalvar) ? globalvar : id => `${globalvar}[\"${id}\"]`;\n let globals = {},\n fields = {},\n memberDepth = 0;\n function visit(ast) {\n if (isString(ast)) return ast;\n const generator = Generators[ast.type];\n if (generator == null) error('Unsupported type: ' + ast.type);\n return generator(ast);\n }\n const Generators = {\n Literal: n => n.raw,\n Identifier: n => {\n const id = n.name;\n if (memberDepth > 0) {\n return id;\n } else if (hasOwnProperty(forbidden, id)) {\n return error('Illegal identifier: ' + id);\n } else if (hasOwnProperty(constants, id)) {\n return constants[id];\n } else if (hasOwnProperty(allowed, id)) {\n return id;\n } else {\n globals[id] = 1;\n return outputGlobal(id);\n }\n },\n MemberExpression: n => {\n const d = !n.computed,\n o = visit(n.object);\n if (d) memberDepth += 1;\n const p = visit(n.property);\n if (o === fieldvar) {\n // strip quotes to sanitize field name (#1653)\n fields[stripQuotes(p)] = 1;\n }\n if (d) memberDepth -= 1;\n return o + (d ? '.' + p : '[' + p + ']');\n },\n CallExpression: n => {\n if (n.callee.type !== 'Identifier') {\n error('Illegal callee type: ' + n.callee.type);\n }\n const callee = n.callee.name,\n args = n.arguments,\n fn = hasOwnProperty(functions, callee) && functions[callee];\n if (!fn) error('Unrecognized function: ' + callee);\n return isFunction(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')';\n },\n ArrayExpression: n => '[' + n.elements.map(visit).join(',') + ']',\n BinaryExpression: n => '(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')',\n UnaryExpression: n => '(' + n.operator + visit(n.argument) + ')',\n ConditionalExpression: n => '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')',\n LogicalExpression: n => '(' + visit(n.left) + n.operator + visit(n.right) + ')',\n ObjectExpression: n => '{' + n.properties.map(visit).join(',') + '}',\n Property: n => {\n memberDepth += 1;\n const k = visit(n.key);\n memberDepth -= 1;\n return k + ':' + visit(n.value);\n }\n };\n function codegen(ast) {\n const result = {\n code: visit(ast),\n globals: Object.keys(globals),\n fields: Object.keys(fields)\n };\n globals = {};\n fields = {};\n return result;\n }\n codegen.functions = functions;\n codegen.constants = constants;\n return codegen;\n}\n\nexport { ASTNode, ArrayExpression, BinaryExpression, CallExpression, ConditionalExpression, Identifier, Literal, LogicalExpression, MemberExpression, ObjectExpression, Property, RawCode, UnaryExpression, codegen as codegenExpression, Constants as constants, Functions as functions, parser as parseExpression };\n","import {Adder} from \"d3-array\";\nimport {atan2, cos, quarterPi, radians, sin, tau} from \"./math.js\";\nimport noop from \"./noop.js\";\nimport stream from \"./stream.js\";\n\nexport var areaRingSum = new Adder();\n\n// hello?\n\nvar areaSum = new Adder(),\n lambda00,\n phi00,\n lambda0,\n cosPhi0,\n sinPhi0;\n\nexport var areaStream = {\n point: noop,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: function() {\n areaRingSum = new Adder();\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function() {\n var areaRing = +areaRingSum;\n areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);\n this.lineStart = this.lineEnd = this.point = noop;\n },\n sphere: function() {\n areaSum.add(tau);\n }\n};\n\nfunction areaRingStart() {\n areaStream.point = areaPointFirst;\n}\n\nfunction areaRingEnd() {\n areaPoint(lambda00, phi00);\n}\n\nfunction areaPointFirst(lambda, phi) {\n areaStream.point = areaPoint;\n lambda00 = lambda, phi00 = phi;\n lambda *= radians, phi *= radians;\n lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);\n}\n\nfunction areaPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n phi = phi / 2 + quarterPi; // half the angular distance from south pole\n\n // Spherical excess E for a spherical triangle with vertices: south pole,\n // previous point, current point. Uses a formula derived from Cagnoli’s\n // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).\n var dLambda = lambda - lambda0,\n sdLambda = dLambda >= 0 ? 1 : -1,\n adLambda = sdLambda * dLambda,\n cosPhi = cos(phi),\n sinPhi = sin(phi),\n k = sinPhi0 * sinPhi,\n u = cosPhi0 * cosPhi + k * cos(adLambda),\n v = k * sdLambda * sin(adLambda);\n areaRingSum.add(atan2(v, u));\n\n // Advance the previous points.\n lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;\n}\n\nexport default function(object) {\n areaSum = new Adder();\n stream(object, areaStream);\n return areaSum * 2;\n}\n","import {Adder} from \"d3-array\";\nimport {areaStream, areaRingSum} from \"./area.js\";\nimport {cartesian, cartesianCross, cartesianNormalizeInPlace, spherical} from \"./cartesian.js\";\nimport {abs, degrees, epsilon, radians} from \"./math.js\";\nimport stream from \"./stream.js\";\n\nvar lambda0, phi0, lambda1, phi1, // bounds\n lambda2, // previous lambda-coordinate\n lambda00, phi00, // first point\n p0, // previous 3D point\n deltaSum,\n ranges,\n range;\n\nvar boundsStream = {\n point: boundsPoint,\n lineStart: boundsLineStart,\n lineEnd: boundsLineEnd,\n polygonStart: function() {\n boundsStream.point = boundsRingPoint;\n boundsStream.lineStart = boundsRingStart;\n boundsStream.lineEnd = boundsRingEnd;\n deltaSum = new Adder();\n areaStream.polygonStart();\n },\n polygonEnd: function() {\n areaStream.polygonEnd();\n boundsStream.point = boundsPoint;\n boundsStream.lineStart = boundsLineStart;\n boundsStream.lineEnd = boundsLineEnd;\n if (areaRingSum < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);\n else if (deltaSum > epsilon) phi1 = 90;\n else if (deltaSum < -epsilon) phi0 = -90;\n range[0] = lambda0, range[1] = lambda1;\n },\n sphere: function() {\n lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);\n }\n};\n\nfunction boundsPoint(lambda, phi) {\n ranges.push(range = [lambda0 = lambda, lambda1 = lambda]);\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n}\n\nfunction linePoint(lambda, phi) {\n var p = cartesian([lambda * radians, phi * radians]);\n if (p0) {\n var normal = cartesianCross(p0, p),\n equatorial = [normal[1], -normal[0], 0],\n inflection = cartesianCross(equatorial, normal);\n cartesianNormalizeInPlace(inflection);\n inflection = spherical(inflection);\n var delta = lambda - lambda2,\n sign = delta > 0 ? 1 : -1,\n lambdai = inflection[0] * degrees * sign,\n phii,\n antimeridian = abs(delta) > 180;\n if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {\n phii = inflection[1] * degrees;\n if (phii > phi1) phi1 = phii;\n } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {\n phii = -inflection[1] * degrees;\n if (phii < phi0) phi0 = phii;\n } else {\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n }\n if (antimeridian) {\n if (lambda < lambda2) {\n if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda;\n }\n } else {\n if (lambda1 >= lambda0) {\n if (lambda < lambda0) lambda0 = lambda;\n if (lambda > lambda1) lambda1 = lambda;\n } else {\n if (lambda > lambda2) {\n if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda;\n }\n }\n }\n } else {\n ranges.push(range = [lambda0 = lambda, lambda1 = lambda]);\n }\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n p0 = p, lambda2 = lambda;\n}\n\nfunction boundsLineStart() {\n boundsStream.point = linePoint;\n}\n\nfunction boundsLineEnd() {\n range[0] = lambda0, range[1] = lambda1;\n boundsStream.point = boundsPoint;\n p0 = null;\n}\n\nfunction boundsRingPoint(lambda, phi) {\n if (p0) {\n var delta = lambda - lambda2;\n deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);\n } else {\n lambda00 = lambda, phi00 = phi;\n }\n areaStream.point(lambda, phi);\n linePoint(lambda, phi);\n}\n\nfunction boundsRingStart() {\n areaStream.lineStart();\n}\n\nfunction boundsRingEnd() {\n boundsRingPoint(lambda00, phi00);\n areaStream.lineEnd();\n if (abs(deltaSum) > epsilon) lambda0 = -(lambda1 = 180);\n range[0] = lambda0, range[1] = lambda1;\n p0 = null;\n}\n\n// Finds the left-right distance between two longitudes.\n// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want\n// the distance between ±180° to be 360°.\nfunction angle(lambda0, lambda1) {\n return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1;\n}\n\nfunction rangeCompare(a, b) {\n return a[0] - b[0];\n}\n\nfunction rangeContains(range, x) {\n return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;\n}\n\nexport default function(feature) {\n var i, n, a, b, merged, deltaMax, delta;\n\n phi1 = lambda1 = -(lambda0 = phi0 = Infinity);\n ranges = [];\n stream(feature, boundsStream);\n\n // First, sort ranges by their minimum longitudes.\n if (n = ranges.length) {\n ranges.sort(rangeCompare);\n\n // Then, merge any ranges that overlap.\n for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) {\n b = ranges[i];\n if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {\n if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];\n if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];\n } else {\n merged.push(a = b);\n }\n }\n\n // Finally, find the largest gap between the merged ranges.\n // The final bounding box will be the inverse of this gap.\n for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) {\n b = merged[i];\n if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0 = b[0], lambda1 = a[1];\n }\n }\n\n ranges = range = null;\n\n return lambda0 === Infinity || phi0 === Infinity\n ? [[NaN, NaN], [NaN, NaN]]\n : [[lambda0, phi0], [lambda1, phi1]];\n}\n","import {Adder} from \"d3-array\";\nimport {asin, atan2, cos, degrees, epsilon, epsilon2, hypot, radians, sin, sqrt} from \"./math.js\";\nimport noop from \"./noop.js\";\nimport stream from \"./stream.js\";\n\nvar W0, W1,\n X0, Y0, Z0,\n X1, Y1, Z1,\n X2, Y2, Z2,\n lambda00, phi00, // first point\n x0, y0, z0; // previous point\n\nvar centroidStream = {\n sphere: noop,\n point: centroidPoint,\n lineStart: centroidLineStart,\n lineEnd: centroidLineEnd,\n polygonStart: function() {\n centroidStream.lineStart = centroidRingStart;\n centroidStream.lineEnd = centroidRingEnd;\n },\n polygonEnd: function() {\n centroidStream.lineStart = centroidLineStart;\n centroidStream.lineEnd = centroidLineEnd;\n }\n};\n\n// Arithmetic mean of Cartesian vectors.\nfunction centroidPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos(phi);\n centroidPointCartesian(cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi));\n}\n\nfunction centroidPointCartesian(x, y, z) {\n ++W0;\n X0 += (x - X0) / W0;\n Y0 += (y - Y0) / W0;\n Z0 += (z - Z0) / W0;\n}\n\nfunction centroidLineStart() {\n centroidStream.point = centroidLinePointFirst;\n}\n\nfunction centroidLinePointFirst(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos(phi);\n x0 = cosPhi * cos(lambda);\n y0 = cosPhi * sin(lambda);\n z0 = sin(phi);\n centroidStream.point = centroidLinePoint;\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidLinePoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos(phi),\n x = cosPhi * cos(lambda),\n y = cosPhi * sin(lambda),\n z = sin(phi),\n w = atan2(sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);\n W1 += w;\n X1 += w * (x0 + (x0 = x));\n Y1 += w * (y0 + (y0 = y));\n Z1 += w * (z0 + (z0 = z));\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidLineEnd() {\n centroidStream.point = centroidPoint;\n}\n\n// See J. E. Brock, The Inertia Tensor for a Spherical Triangle,\n// J. Applied Mechanics 42, 239 (1975).\nfunction centroidRingStart() {\n centroidStream.point = centroidRingPointFirst;\n}\n\nfunction centroidRingEnd() {\n centroidRingPoint(lambda00, phi00);\n centroidStream.point = centroidPoint;\n}\n\nfunction centroidRingPointFirst(lambda, phi) {\n lambda00 = lambda, phi00 = phi;\n lambda *= radians, phi *= radians;\n centroidStream.point = centroidRingPoint;\n var cosPhi = cos(phi);\n x0 = cosPhi * cos(lambda);\n y0 = cosPhi * sin(lambda);\n z0 = sin(phi);\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidRingPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos(phi),\n x = cosPhi * cos(lambda),\n y = cosPhi * sin(lambda),\n z = sin(phi),\n cx = y0 * z - z0 * y,\n cy = z0 * x - x0 * z,\n cz = x0 * y - y0 * x,\n m = hypot(cx, cy, cz),\n w = asin(m), // line weight = angle\n v = m && -w / m; // area weight multiplier\n X2.add(v * cx);\n Y2.add(v * cy);\n Z2.add(v * cz);\n W1 += w;\n X1 += w * (x0 + (x0 = x));\n Y1 += w * (y0 + (y0 = y));\n Z1 += w * (z0 + (z0 = z));\n centroidPointCartesian(x0, y0, z0);\n}\n\nexport default function(object) {\n W0 = W1 =\n X0 = Y0 = Z0 =\n X1 = Y1 = Z1 = 0;\n X2 = new Adder();\n Y2 = new Adder();\n Z2 = new Adder();\n stream(object, centroidStream);\n\n var x = +X2,\n y = +Y2,\n z = +Z2,\n m = hypot(x, y, z);\n\n // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid.\n if (m < epsilon2) {\n x = X1, y = Y1, z = Z1;\n // If the feature has zero length, fall back to arithmetic mean of point vectors.\n if (W1 < epsilon) x = X0, y = Y0, z = Z0;\n m = hypot(x, y, z);\n // If the feature still has an undefined ccentroid, then return.\n if (m < epsilon2) return [NaN, NaN];\n }\n\n return [atan2(y, x) * degrees, asin(z / m) * degrees];\n}\n","import {InternSet} from \"internmap\";\n\nexport default function intersection(values, ...others) {\n values = new InternSet(values);\n others = others.map(set);\n out: for (const value of values) {\n for (const other of others) {\n if (!other.has(value)) {\n values.delete(value);\n continue out;\n }\n }\n }\n return values;\n}\n\nfunction set(values) {\n return values instanceof InternSet ? values : new InternSet(values);\n}\n","import { bisector, union, intersection } from 'd3-array';\nimport { field, isDate, toNumber, isArray, inrange, extend, array, error, peek, hasOwnProperty } from 'vega-util';\nimport { Literal } from 'vega-expression';\n\n// Registers vega-util field accessors to protect against XSS attacks\nconst SELECTION_GETTER = Symbol('vega_selection_getter');\nfunction getter(f) {\n if (!f.getter || !f.getter[SELECTION_GETTER]) {\n f.getter = field(f.field);\n f.getter[SELECTION_GETTER] = true;\n }\n return f.getter;\n}\nconst Intersect = 'intersect';\nconst Union = 'union';\nconst VlMulti = 'vlMulti';\nconst VlPoint = 'vlPoint';\nconst Or = 'or';\nconst And = 'and';\nconst SelectionId = '_vgsid_';\nconst $selectionId = field(SelectionId);\n\nconst TYPE_ENUM = 'E',\n TYPE_RANGE_INC = 'R',\n TYPE_RANGE_EXC = 'R-E',\n TYPE_RANGE_LE = 'R-LE',\n TYPE_RANGE_RE = 'R-RE',\n UNIT_INDEX = 'index:unit';\n\n// TODO: revisit date coercion?\nfunction testPoint(datum, entry) {\n var fields = entry.fields,\n values = entry.values,\n n = fields.length,\n i = 0,\n dval,\n f;\n for (; i < n; ++i) {\n f = fields[i];\n dval = getter(f)(datum);\n if (isDate(dval)) dval = toNumber(dval);\n if (isDate(values[i])) values[i] = toNumber(values[i]);\n if (isArray(values[i]) && isDate(values[i][0])) values[i] = values[i].map(toNumber);\n if (f.type === TYPE_ENUM) {\n // Enumerated fields can either specify individual values (single/multi selections)\n // or an array of values (interval selections).\n if (isArray(values[i]) ? values[i].indexOf(dval) < 0 : dval !== values[i]) {\n return false;\n }\n } else {\n if (f.type === TYPE_RANGE_INC) {\n if (!inrange(dval, values[i])) return false;\n } else if (f.type === TYPE_RANGE_RE) {\n // Discrete selection of bins test within the range [bin_start, bin_end).\n if (!inrange(dval, values[i], true, false)) return false;\n } else if (f.type === TYPE_RANGE_EXC) {\n // 'R-E'/'R-LE' included for completeness.\n if (!inrange(dval, values[i], false, false)) return false;\n } else if (f.type === TYPE_RANGE_LE) {\n if (!inrange(dval, values[i], false, true)) return false;\n }\n }\n }\n return true;\n}\n\n/**\n * Tests if a tuple is contained within an interactive selection.\n * @param {string} name - The name of the data set representing the selection.\n * Tuples in the dataset are of the form\n * {unit: string, fields: array, values: array<*>}.\n * Fielddef is of the form\n * {field: string, channel: string, type: 'E' | 'R'} where\n * 'type' identifies whether tuples in the dataset enumerate\n * values for the field, or specify a continuous range.\n * @param {object} datum - The tuple to test for inclusion.\n * @param {string} op - The set operation for combining selections.\n * One of 'intersect' or 'union' (default).\n * @return {boolean} - True if the datum is in the selection, false otherwise.\n */\nfunction selectionTest(name, datum, op) {\n var data = this.context.data[name],\n entries = data ? data.values.value : [],\n unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined,\n intersect = op === Intersect,\n n = entries.length,\n i = 0,\n entry,\n miss,\n count,\n unit,\n b;\n for (; i < n; ++i) {\n entry = entries[i];\n if (unitIdx && intersect) {\n // multi selections union within the same unit and intersect across units.\n miss = miss || {};\n count = miss[unit = entry.unit] || 0;\n\n // if we've already matched this unit, skip.\n if (count === -1) continue;\n b = testPoint(datum, entry);\n miss[unit] = b ? -1 : ++count;\n\n // if we match and there are no other units return true\n // if we've missed against all tuples in this unit return false\n if (b && unitIdx.size === 1) return true;\n if (!b && count === unitIdx.get(unit).count) return false;\n } else {\n b = testPoint(datum, entry);\n\n // if we find a miss and we do require intersection return false\n // if we find a match and we don't require intersection return true\n if (intersect ^ b) return b;\n }\n }\n\n // if intersecting and we made it here, then we saw no misses\n // if not intersecting, then we saw no matches\n // if no active selections, return false\n return n && intersect;\n}\nconst bisect = bisector($selectionId),\n bisectLeft = bisect.left,\n bisectRight = bisect.right;\nfunction selectionIdTest(name, datum, op) {\n const data = this.context.data[name],\n entries = data ? data.values.value : [],\n unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined,\n intersect = op === Intersect,\n value = $selectionId(datum),\n index = bisectLeft(entries, value);\n if (index === entries.length) return false;\n if ($selectionId(entries[index]) !== value) return false;\n if (unitIdx && intersect) {\n if (unitIdx.size === 1) return true;\n if (bisectRight(entries, value) - index < unitIdx.size) return false;\n }\n return true;\n}\n\n/**\n * Maps an array of scene graph items to an array of selection tuples.\n * @param {string} name - The name of the dataset representing the selection.\n * @param {string} base - The base object that generated tuples extend.\n *\n * @returns {array} An array of selection entries for the given unit.\n */\nfunction selectionTuples(array, base) {\n return array.map(x => extend(base.fields ? {\n values: base.fields.map(f => getter(f)(x.datum))\n } : {\n [SelectionId]: $selectionId(x.datum)\n }, base));\n}\n\n/**\n * Resolves selection for use as a scale domain or reads via the API.\n * @param {string} name - The name of the dataset representing the selection\n * @param {string} [op='union'] - The set operation for combining selections.\n * One of 'intersect' or 'union' (default).\n * @param {boolean} isMulti - Identifies a \"multi\" selection to perform more\n * expensive resolution computation.\n * @param {boolean} vl5 - With Vega-Lite v5, \"multi\" selections are now called \"point\"\n * selections, and thus the resolved tuple should reflect this name.\n * This parameter allows us to reflect this change without triggering\n * a major version bump for Vega.\n * @returns {object} An object of selected fields and values.\n */\nfunction selectionResolve(name, op, isMulti, vl5) {\n var data = this.context.data[name],\n entries = data ? data.values.value : [],\n resolved = {},\n multiRes = {},\n types = {},\n entry,\n fields,\n values,\n unit,\n field,\n value,\n res,\n resUnit,\n type,\n union,\n n = entries.length,\n i = 0,\n j,\n m;\n\n // First union all entries within the same unit.\n for (; i < n; ++i) {\n entry = entries[i];\n unit = entry.unit;\n fields = entry.fields;\n values = entry.values;\n if (fields && values) {\n // Intentional selection stores\n for (j = 0, m = fields.length; j < m; ++j) {\n field = fields[j];\n res = resolved[field.field] || (resolved[field.field] = {});\n resUnit = res[unit] || (res[unit] = []);\n types[field.field] = type = field.type.charAt(0);\n union = ops[`${type}_union`];\n res[unit] = union(resUnit, array(values[j]));\n }\n\n // If the same multi-selection is repeated over views and projected over\n // an encoding, it may operate over different fields making it especially\n // tricky to reliably resolve it. At best, we can de-dupe identical entries\n // but doing so may be more computationally expensive than it is worth.\n // Instead, for now, we simply transform our store representation into\n // a more human-friendly one.\n if (isMulti) {\n resUnit = multiRes[unit] || (multiRes[unit] = []);\n resUnit.push(array(values).reduce((obj, curr, j) => (obj[fields[j].field] = curr, obj), {}));\n }\n } else {\n // Short circuit extensional selectionId stores which hold sorted IDs unique to each unit.\n field = SelectionId;\n value = $selectionId(entry);\n res = resolved[field] || (resolved[field] = {});\n resUnit = res[unit] || (res[unit] = []);\n resUnit.push(value);\n if (isMulti) {\n resUnit = multiRes[unit] || (multiRes[unit] = []);\n resUnit.push({\n [SelectionId]: value\n });\n }\n }\n }\n\n // Then resolve fields across units as per the op.\n op = op || Union;\n if (resolved[SelectionId]) {\n resolved[SelectionId] = ops[`${SelectionId}_${op}`](...Object.values(resolved[SelectionId]));\n } else {\n Object.keys(resolved).forEach(field => {\n resolved[field] = Object.keys(resolved[field]).map(unit => resolved[field][unit]).reduce((acc, curr) => acc === undefined ? curr : ops[`${types[field]}_${op}`](acc, curr));\n });\n }\n entries = Object.keys(multiRes);\n if (isMulti && entries.length) {\n const key = vl5 ? VlPoint : VlMulti;\n resolved[key] = op === Union ? {\n [Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), [])\n } : {\n [And]: entries.map(k => ({\n [Or]: multiRes[k]\n }))\n };\n }\n return resolved;\n}\nvar ops = {\n [`${SelectionId}_union`]: union,\n [`${SelectionId}_intersect`]: intersection,\n E_union: function (base, value) {\n if (!base.length) return value;\n var i = 0,\n n = value.length;\n for (; i < n; ++i) if (base.indexOf(value[i]) < 0) base.push(value[i]);\n return base;\n },\n E_intersect: function (base, value) {\n return !base.length ? value : base.filter(v => value.indexOf(v) >= 0);\n },\n R_union: function (base, value) {\n var lo = toNumber(value[0]),\n hi = toNumber(value[1]);\n if (lo > hi) {\n lo = value[1];\n hi = value[0];\n }\n if (!base.length) return [lo, hi];\n if (base[0] > lo) base[0] = lo;\n if (base[1] < hi) base[1] = hi;\n return base;\n },\n R_intersect: function (base, value) {\n var lo = toNumber(value[0]),\n hi = toNumber(value[1]);\n if (lo > hi) {\n lo = value[1];\n hi = value[0];\n }\n if (!base.length) return [lo, hi];\n if (hi < base[0] || base[1] < lo) {\n return [];\n } else {\n if (base[0] < lo) base[0] = lo;\n if (base[1] > hi) base[1] = hi;\n }\n return base;\n }\n};\n\nconst DataPrefix = ':',\n IndexPrefix = '@';\nfunction selectionVisitor(name, args, scope, params) {\n if (args[0].type !== Literal) error('First argument to selection functions must be a string literal.');\n const data = args[0].value,\n op = args.length >= 2 && peek(args).value,\n field = 'unit',\n indexName = IndexPrefix + field,\n dataName = DataPrefix + data;\n\n // eslint-disable-next-line no-prototype-builtins\n if (op === Intersect && !hasOwnProperty(params, indexName)) {\n params[indexName] = scope.getData(data).indataRef(scope, field);\n }\n\n // eslint-disable-next-line no-prototype-builtins\n if (!hasOwnProperty(params, dataName)) {\n params[dataName] = scope.getData(data).tuplesRef();\n }\n}\n\nexport { selectionIdTest, selectionResolve, selectionTest, selectionTuples, selectionVisitor };\n","import {InternSet} from \"internmap\";\n\nexport default function union(...others) {\n const set = new InternSet();\n for (const other of others) {\n for (const o of other) {\n set.add(o);\n }\n }\n return set;\n}\n","import { truthy, error, hasOwnProperty, isFunction, isString, stringValue, extend, isArray, isObject, field, peek, identity, array as array$1, isBoolean, isDate, isNumber, isRegExp, toBoolean, toDate, toNumber, toString, flush, lerp, pad, span, inrange, truncate, quarter, utcquarter, extent, clampRange, panLinear, panLog, panPow, panSymlog, zoomLinear, zoomLog, zoomPow, zoomSymlog } from 'vega-util';\nimport { Literal, codegenExpression, constants, functions, parseExpression, CallExpression } from 'vega-expression';\nimport { isRegisteredScale, bandSpace, scale as scale$1, scaleFraction } from 'vega-scale';\nimport { geoArea as geoArea$1, geoBounds as geoBounds$1, geoCentroid as geoCentroid$1 } from 'd3-geo';\nimport { rgb, lab, hcl, hsl } from 'd3-color';\nimport { isTuple } from 'vega-dataflow';\nimport { Gradient, pathRender, pathParse, Bounds, intersect as intersect$1 } from 'vega-scenegraph';\nimport { selectionVisitor, selectionTest, selectionIdTest, selectionResolve, selectionTuples } from 'vega-selections';\nimport { random, cumulativeNormal, cumulativeLogNormal, cumulativeUniform, densityNormal, densityLogNormal, densityUniform, quantileNormal, quantileLogNormal, quantileUniform, sampleNormal, sampleLogNormal, sampleUniform } from 'vega-statistics';\nimport { utcOffset, utcSequence, timeOffset, timeSequence, timeUnitSpecifier, week, utcweek, dayofyear, utcdayofyear } from 'vega-time';\nimport { range as range$1 } from 'd3-array';\n\nfunction data(name) {\n const data = this.context.data[name];\n return data ? data.values.value : [];\n}\nfunction indata(name, field, value) {\n const index = this.context.data[name]['index:' + field],\n entry = index ? index.value.get(value) : undefined;\n return entry ? entry.count : entry;\n}\nfunction setdata(name, tuples) {\n const df = this.context.dataflow,\n data = this.context.data[name],\n input = data.input;\n df.pulse(input, df.changeset().remove(truthy).insert(tuples));\n return 1;\n}\n\nfunction encode (item, name, retval) {\n if (item) {\n const df = this.context.dataflow,\n target = item.mark.source;\n df.pulse(target, df.changeset().encode(item, name));\n }\n return retval !== undefined ? retval : item;\n}\n\nconst wrap = method => function (value, spec) {\n const locale = this.context.dataflow.locale();\n return locale[method](spec)(value);\n};\nconst format = wrap('format');\nconst timeFormat = wrap('timeFormat');\nconst utcFormat = wrap('utcFormat');\nconst timeParse = wrap('timeParse');\nconst utcParse = wrap('utcParse');\nconst dateObj = new Date(2000, 0, 1);\nfunction time(month, day, specifier) {\n if (!Number.isInteger(month) || !Number.isInteger(day)) return '';\n dateObj.setYear(2000);\n dateObj.setMonth(month);\n dateObj.setDate(day);\n return timeFormat.call(this, dateObj, specifier);\n}\nfunction monthFormat(month) {\n return time.call(this, month, 1, '%B');\n}\nfunction monthAbbrevFormat(month) {\n return time.call(this, month, 1, '%b');\n}\nfunction dayFormat(day) {\n return time.call(this, 0, 2 + day, '%A');\n}\nfunction dayAbbrevFormat(day) {\n return time.call(this, 0, 2 + day, '%a');\n}\n\nconst DataPrefix = ':';\nconst IndexPrefix = '@';\nconst ScalePrefix = '%';\nconst SignalPrefix = '$';\n\nfunction dataVisitor(name, args, scope, params) {\n if (args[0].type !== Literal) {\n error('First argument to data functions must be a string literal.');\n }\n const data = args[0].value,\n dataName = DataPrefix + data;\n if (!hasOwnProperty(dataName, params)) {\n try {\n params[dataName] = scope.getData(data).tuplesRef();\n } catch (err) {\n // if data set does not exist, there's nothing to track\n }\n }\n}\nfunction indataVisitor(name, args, scope, params) {\n if (args[0].type !== Literal) error('First argument to indata must be a string literal.');\n if (args[1].type !== Literal) error('Second argument to indata must be a string literal.');\n const data = args[0].value,\n field = args[1].value,\n indexName = IndexPrefix + field;\n if (!hasOwnProperty(indexName, params)) {\n params[indexName] = scope.getData(data).indataRef(scope, field);\n }\n}\nfunction scaleVisitor(name, args, scope, params) {\n if (args[0].type === Literal) {\n // add scale dependency\n addScaleDependency(scope, params, args[0].value);\n } else {\n // indirect scale lookup; add all scales as parameters\n for (name in scope.scales) {\n addScaleDependency(scope, params, name);\n }\n }\n}\nfunction addScaleDependency(scope, params, name) {\n const scaleName = ScalePrefix + name;\n if (!hasOwnProperty(params, scaleName)) {\n try {\n params[scaleName] = scope.scaleRef(name);\n } catch (err) {\n // TODO: error handling? warning?\n }\n }\n}\n\nfunction getScale(nameOrFunction, ctx) {\n if (isFunction(nameOrFunction)) {\n return nameOrFunction;\n }\n if (isString(nameOrFunction)) {\n const maybeScale = ctx.scales[nameOrFunction];\n return maybeScale && isRegisteredScale(maybeScale.value) ? maybeScale.value : undefined;\n }\n return undefined;\n}\nfunction internalScaleFunctions(codegen, fnctx, visitors) {\n // add helper method to the 'this' expression function context\n fnctx.__bandwidth = s => s && s.bandwidth ? s.bandwidth() : 0;\n\n // register AST visitors for internal scale functions\n visitors._bandwidth = scaleVisitor;\n visitors._range = scaleVisitor;\n visitors._scale = scaleVisitor;\n\n // resolve scale reference directly to the signal hash argument\n const ref = arg => '_[' + (arg.type === Literal ? stringValue(ScalePrefix + arg.value) : stringValue(ScalePrefix) + '+' + codegen(arg)) + ']';\n\n // define and return internal scale function code generators\n // these internal functions are called by mark encoders\n return {\n _bandwidth: args => `this.__bandwidth(${ref(args[0])})`,\n _range: args => `${ref(args[0])}.range()`,\n _scale: args => `${ref(args[0])}(${codegen(args[1])})`\n };\n}\n\nfunction geoMethod(methodName, globalMethod) {\n return function (projection, geojson, group) {\n if (projection) {\n // projection defined, use it\n const p = getScale(projection, (group || this).context);\n return p && p.path[methodName](geojson);\n } else {\n // projection undefined, use global method\n return globalMethod(geojson);\n }\n };\n}\nconst geoArea = geoMethod('area', geoArea$1);\nconst geoBounds = geoMethod('bounds', geoBounds$1);\nconst geoCentroid = geoMethod('centroid', geoCentroid$1);\nfunction geoScale(projection, group) {\n const p = getScale(projection, (group || this).context);\n return p && p.scale();\n}\n\nfunction inScope (item) {\n const group = this.context.group;\n let value = false;\n if (group) while (item) {\n if (item === group) {\n value = true;\n break;\n }\n item = item.mark.group;\n }\n return value;\n}\n\nfunction log(df, method, args) {\n try {\n df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args)));\n } catch (err) {\n df.warn(err);\n }\n return args[args.length - 1];\n}\nfunction warn() {\n return log(this.context.dataflow, 'warn', arguments);\n}\nfunction info() {\n return log(this.context.dataflow, 'info', arguments);\n}\nfunction debug() {\n return log(this.context.dataflow, 'debug', arguments);\n}\n\n// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\nfunction channel_luminance_value(channelValue) {\n const val = channelValue / 255;\n if (val <= 0.03928) {\n return val / 12.92;\n }\n return Math.pow((val + 0.055) / 1.055, 2.4);\n}\nfunction luminance(color) {\n const c = rgb(color),\n r = channel_luminance_value(c.r),\n g = channel_luminance_value(c.g),\n b = channel_luminance_value(c.b);\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n}\n\n// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef\nfunction contrast(color1, color2) {\n const lum1 = luminance(color1),\n lum2 = luminance(color2),\n lumL = Math.max(lum1, lum2),\n lumD = Math.min(lum1, lum2);\n return (lumL + 0.05) / (lumD + 0.05);\n}\n\nfunction merge () {\n const args = [].slice.call(arguments);\n args.unshift({});\n return extend(...args);\n}\n\nfunction equal(a, b) {\n return a === b || a !== a && b !== b ? true : isArray(a) ? isArray(b) && a.length === b.length ? equalArray(a, b) : false : isObject(a) && isObject(b) ? equalObject(a, b) : false;\n}\nfunction equalArray(a, b) {\n for (let i = 0, n = a.length; i < n; ++i) {\n if (!equal(a[i], b[i])) return false;\n }\n return true;\n}\nfunction equalObject(a, b) {\n for (const key in a) {\n if (!equal(a[key], b[key])) return false;\n }\n return true;\n}\nfunction removePredicate(props) {\n return _ => equalObject(props, _);\n}\nfunction modify (name, insert, remove, toggle, modify, values) {\n const df = this.context.dataflow,\n data = this.context.data[name],\n input = data.input,\n stamp = df.stamp();\n let changes = data.changes,\n predicate,\n key;\n if (df._trigger === false || !(input.value.length || insert || toggle)) {\n // nothing to do!\n return 0;\n }\n if (!changes || changes.stamp < stamp) {\n data.changes = changes = df.changeset();\n changes.stamp = stamp;\n df.runAfter(() => {\n data.modified = true;\n df.pulse(input, changes).run();\n }, true, 1);\n }\n if (remove) {\n predicate = remove === true ? truthy : isArray(remove) || isTuple(remove) ? remove : removePredicate(remove);\n changes.remove(predicate);\n }\n if (insert) {\n changes.insert(insert);\n }\n if (toggle) {\n predicate = removePredicate(toggle);\n if (input.value.some(predicate)) {\n changes.remove(predicate);\n } else {\n changes.insert(toggle);\n }\n }\n if (modify) {\n for (key in values) {\n changes.modify(modify, key, values[key]);\n }\n }\n return 1;\n}\n\nfunction pinchDistance(event) {\n const t = event.touches,\n dx = t[0].clientX - t[1].clientX,\n dy = t[0].clientY - t[1].clientY;\n return Math.hypot(dx, dy);\n}\nfunction pinchAngle(event) {\n const t = event.touches;\n return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX);\n}\n\n// memoize accessor functions\nconst accessors = {};\nfunction pluck (data, name) {\n const accessor = accessors[name] || (accessors[name] = field(name));\n return isArray(data) ? data.map(accessor) : accessor(data);\n}\n\nfunction array(seq) {\n return isArray(seq) || ArrayBuffer.isView(seq) ? seq : null;\n}\nfunction sequence(seq) {\n return array(seq) || (isString(seq) ? seq : null);\n}\nfunction join(seq) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n return array(seq).join(...args);\n}\nfunction indexof(seq) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n return sequence(seq).indexOf(...args);\n}\nfunction lastindexof(seq) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n return sequence(seq).lastIndexOf(...args);\n}\nfunction slice(seq) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n return sequence(seq).slice(...args);\n}\nfunction replace(str, pattern, repl) {\n if (isFunction(repl)) error('Function argument passed to replace.');\n return String(str).replace(pattern, repl);\n}\nfunction reverse(seq) {\n return array(seq).slice().reverse();\n}\n\nfunction bandspace(count, paddingInner, paddingOuter) {\n return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0);\n}\nfunction bandwidth(name, group) {\n const s = getScale(name, (group || this).context);\n return s && s.bandwidth ? s.bandwidth() : 0;\n}\nfunction copy(name, group) {\n const s = getScale(name, (group || this).context);\n return s ? s.copy() : undefined;\n}\nfunction domain(name, group) {\n const s = getScale(name, (group || this).context);\n return s ? s.domain() : [];\n}\nfunction invert(name, range, group) {\n const s = getScale(name, (group || this).context);\n return !s ? undefined : isArray(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range);\n}\nfunction range(name, group) {\n const s = getScale(name, (group || this).context);\n return s && s.range ? s.range() : [];\n}\nfunction scale(name, value, group) {\n const s = getScale(name, (group || this).context);\n return s ? s(value) : undefined;\n}\n\nfunction scaleGradient (scale, p0, p1, count, group) {\n scale = getScale(scale, (group || this).context);\n const gradient = Gradient(p0, p1);\n let stops = scale.domain(),\n min = stops[0],\n max = peek(stops),\n fraction = identity;\n if (!(max - min)) {\n // expand scale if domain has zero span, fix #1479\n scale = (scale.interpolator ? scale$1('sequential')().interpolator(scale.interpolator()) : scale$1('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([min = 0, max = 1]);\n } else {\n fraction = scaleFraction(scale, min, max);\n }\n if (scale.ticks) {\n stops = scale.ticks(+count || 15);\n if (min !== stops[0]) stops.unshift(min);\n if (max !== peek(stops)) stops.push(max);\n }\n stops.forEach(_ => gradient.stop(fraction(_), scale(_)));\n return gradient;\n}\n\nfunction geoShape(projection, geojson, group) {\n const p = getScale(projection, (group || this).context);\n return function (context) {\n return p ? p.path.context(context)(geojson) : '';\n };\n}\nfunction pathShape(path) {\n let p = null;\n return function (context) {\n return context ? pathRender(context, p = p || pathParse(path)) : path;\n };\n}\n\nconst datum = d => d.data;\nfunction treeNodes(name, context) {\n const tree = data.call(context, name);\n return tree.root && tree.root.lookup || {};\n}\nfunction treePath(name, source, target) {\n const nodes = treeNodes(name, this),\n s = nodes[source],\n t = nodes[target];\n return s && t ? s.path(t).map(datum) : undefined;\n}\nfunction treeAncestors(name, node) {\n const n = treeNodes(name, this)[node];\n return n ? n.ancestors().map(datum) : undefined;\n}\n\nconst _window = () => typeof window !== 'undefined' && window || null;\nfunction screen() {\n const w = _window();\n return w ? w.screen : {};\n}\nfunction windowSize() {\n const w = _window();\n return w ? [w.innerWidth, w.innerHeight] : [undefined, undefined];\n}\nfunction containerSize() {\n const view = this.context.dataflow,\n el = view.container && view.container();\n return el ? [el.clientWidth, el.clientHeight] : [undefined, undefined];\n}\n\nfunction intersect (b, opt, group) {\n if (!b) return [];\n const [u, v] = b,\n box = new Bounds().set(u[0], u[1], v[0], v[1]),\n scene = group || this.context.dataflow.scenegraph().root;\n return intersect$1(scene, box, filter(opt));\n}\nfunction filter(opt) {\n let p = null;\n if (opt) {\n const types = array$1(opt.marktype),\n names = array$1(opt.markname);\n p = _ => (!types.length || types.some(t => _.marktype === t)) && (!names.length || names.some(s => _.name === s));\n }\n return p;\n}\n\n/**\n * Appends a new point to the lasso\n *\n * @param {*} lasso the lasso in pixel space\n * @param {*} x the x coordinate in pixel space\n * @param {*} y the y coordinate in pixel space\n * @param {*} minDist the minimum distance, in pixels, that thenew point needs to be apart from the last point\n * @returns a new array containing the lasso with the new point\n */\nfunction lassoAppend(lasso, x, y) {\n let minDist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5;\n lasso = array$1(lasso);\n const last = lasso[lasso.length - 1];\n\n // Add point to lasso if its the first point or distance to last point exceed minDist\n return last === undefined || Math.hypot(last[0] - x, last[1] - y) > minDist ? [...lasso, [x, y]] : lasso;\n}\n\n/**\n * Generates a svg path command which draws a lasso\n *\n * @param {*} lasso the lasso in pixel space in the form [[x,y], [x,y], ...]\n * @returns the svg path command that draws the lasso\n */\nfunction lassoPath(lasso) {\n return array$1(lasso).reduce((svg, _ref, i) => {\n let [x, y] = _ref;\n return svg += i == 0 ? `M ${x},${y} ` : i === lasso.length - 1 ? ' Z' : `L ${x},${y} `;\n }, '');\n}\n\n/**\n * Inverts the lasso from pixel space to an array of vega scenegraph tuples\n *\n * @param {*} data the dataset\n * @param {*} pixelLasso the lasso in pixel space, [[x,y], [x,y], ...]\n * @param {*} unit the unit where the lasso is defined\n *\n * @returns an array of vega scenegraph tuples\n */\nfunction intersectLasso(markname, pixelLasso, unit) {\n const {\n x,\n y,\n mark\n } = unit;\n const bb = new Bounds().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER);\n\n // Get bounding box around lasso\n for (const [px, py] of pixelLasso) {\n if (px < bb.x1) bb.x1 = px;\n if (px > bb.x2) bb.x2 = px;\n if (py < bb.y1) bb.y1 = py;\n if (py > bb.y2) bb.y2 = py;\n }\n\n // Translate bb against unit coordinates\n bb.translate(x, y);\n const intersection = intersect([[bb.x1, bb.y1], [bb.x2, bb.y2]], markname, mark);\n\n // Check every point against the lasso\n return intersection.filter(tuple => pointInPolygon(tuple.x, tuple.y, pixelLasso));\n}\n\n/**\n * Performs a test if a point is inside a polygon based on the idea from\n * https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html\n *\n * This method will not need the same start/end point since it wraps around the edges of the array\n *\n * @param {*} test a point to test against\n * @param {*} polygon a polygon in the form [[x,y], [x,y], ...]\n * @returns true if the point lies inside the polygon, false otherwise\n */\nfunction pointInPolygon(testx, testy, polygon) {\n let intersections = 0;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const [prevX, prevY] = polygon[j];\n const [x, y] = polygon[i];\n\n // count intersections\n if (y > testy != prevY > testy && testx < (prevX - x) * (testy - y) / (prevY - y) + x) {\n intersections++;\n }\n }\n\n // point is in polygon if intersection count is odd\n return intersections & 1;\n}\n\n// Expression function context object\nconst functionContext = {\n random() {\n return random();\n },\n // override default\n cumulativeNormal,\n cumulativeLogNormal,\n cumulativeUniform,\n densityNormal,\n densityLogNormal,\n densityUniform,\n quantileNormal,\n quantileLogNormal,\n quantileUniform,\n sampleNormal,\n sampleLogNormal,\n sampleUniform,\n isArray,\n isBoolean,\n isDate,\n isDefined(_) {\n return _ !== undefined;\n },\n isNumber,\n isObject,\n isRegExp,\n isString,\n isTuple,\n isValid(_) {\n return _ != null && _ === _;\n },\n toBoolean,\n toDate(_) {\n return toDate(_);\n },\n // suppress extra arguments\n toNumber,\n toString,\n indexof,\n join,\n lastindexof,\n replace,\n reverse,\n slice,\n flush,\n lerp,\n merge,\n pad,\n peek,\n pluck,\n span,\n inrange,\n truncate,\n rgb,\n lab,\n hcl,\n hsl,\n luminance,\n contrast,\n sequence: range$1,\n format,\n utcFormat,\n utcParse,\n utcOffset,\n utcSequence,\n timeFormat,\n timeParse,\n timeOffset,\n timeSequence,\n timeUnitSpecifier,\n monthFormat,\n monthAbbrevFormat,\n dayFormat,\n dayAbbrevFormat,\n quarter,\n utcquarter,\n week,\n utcweek,\n dayofyear,\n utcdayofyear,\n warn,\n info,\n debug,\n extent(_) {\n return extent(_);\n },\n // suppress extra arguments\n inScope,\n intersect,\n clampRange,\n pinchDistance,\n pinchAngle,\n screen,\n containerSize,\n windowSize,\n bandspace,\n setdata,\n pathShape,\n panLinear,\n panLog,\n panPow,\n panSymlog,\n zoomLinear,\n zoomLog,\n zoomPow,\n zoomSymlog,\n encode,\n modify,\n lassoAppend,\n lassoPath,\n intersectLasso\n};\nconst eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'],\n // event functions\n eventPrefix = 'event.vega.',\n // event function prefix\n thisPrefix = 'this.',\n // function context prefix\n astVisitors = {}; // AST visitors for dependency analysis\n\n// export code generator parameters\nconst codegenParams = {\n forbidden: ['_'],\n allowed: ['datum', 'event', 'item'],\n fieldvar: 'datum',\n globalvar: id => `_[${stringValue(SignalPrefix + id)}]`,\n functions: buildFunctions,\n constants: constants,\n visitors: astVisitors\n};\n\n// export code generator\nconst codeGenerator = codegenExpression(codegenParams);\n\n// Build expression function registry\nfunction buildFunctions(codegen) {\n const fn = functions(codegen);\n eventFunctions.forEach(name => fn[name] = eventPrefix + name);\n for (const name in functionContext) {\n fn[name] = thisPrefix + name;\n }\n extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors));\n return fn;\n}\n\n// Register an expression function\nfunction expressionFunction(name, fn, visitor) {\n if (arguments.length === 1) {\n return functionContext[name];\n }\n\n // register with the functionContext\n functionContext[name] = fn;\n\n // if there is an astVisitor register that, too\n if (visitor) astVisitors[name] = visitor;\n\n // if the code generator has already been initialized,\n // we need to also register the function with it\n if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name;\n return this;\n}\n\n// register expression functions with ast visitors\nexpressionFunction('bandwidth', bandwidth, scaleVisitor);\nexpressionFunction('copy', copy, scaleVisitor);\nexpressionFunction('domain', domain, scaleVisitor);\nexpressionFunction('range', range, scaleVisitor);\nexpressionFunction('invert', invert, scaleVisitor);\nexpressionFunction('scale', scale, scaleVisitor);\nexpressionFunction('gradient', scaleGradient, scaleVisitor);\nexpressionFunction('geoArea', geoArea, scaleVisitor);\nexpressionFunction('geoBounds', geoBounds, scaleVisitor);\nexpressionFunction('geoCentroid', geoCentroid, scaleVisitor);\nexpressionFunction('geoShape', geoShape, scaleVisitor);\nexpressionFunction('geoScale', geoScale, scaleVisitor);\nexpressionFunction('indata', indata, indataVisitor);\nexpressionFunction('data', data, dataVisitor);\nexpressionFunction('treePath', treePath, dataVisitor);\nexpressionFunction('treeAncestors', treeAncestors, dataVisitor);\n\n// register Vega-Lite selection functions\nexpressionFunction('vlSelectionTest', selectionTest, selectionVisitor);\nexpressionFunction('vlSelectionIdTest', selectionIdTest, selectionVisitor);\nexpressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor);\nexpressionFunction('vlSelectionTuples', selectionTuples);\n\nfunction parser (expr, scope) {\n const params = {};\n\n // parse the expression to an abstract syntax tree (ast)\n let ast;\n try {\n expr = isString(expr) ? expr : stringValue(expr) + '';\n ast = parseExpression(expr);\n } catch (err) {\n error('Expression parse error: ' + expr);\n }\n\n // analyze ast function calls for dependencies\n ast.visit(node => {\n if (node.type !== CallExpression) return;\n const name = node.callee.name,\n visit = codegenParams.visitors[name];\n if (visit) visit(name, node.arguments, scope, params);\n });\n\n // perform code generation\n const gen = codeGenerator(ast);\n\n // collect signal dependencies\n gen.globals.forEach(name => {\n const signalName = SignalPrefix + name;\n if (!hasOwnProperty(params, signalName) && scope.getSignal(name)) {\n params[signalName] = scope.signalRef(name);\n }\n });\n\n // return generated expression code and dependencies\n return {\n $expr: extend({\n code: gen.code\n }, scope.options.ast ? {\n ast\n } : null),\n $fields: gen.fields,\n $params: params\n };\n}\n\nexport { DataPrefix, IndexPrefix, ScalePrefix, SignalPrefix, bandspace, bandwidth, codeGenerator, codegenParams, containerSize, contrast, copy, data, dataVisitor, dayAbbrevFormat, dayFormat, debug, domain, encode, expressionFunction, format, functionContext, geoArea, geoBounds, geoCentroid, geoScale, geoShape, inScope, indata, indataVisitor, indexof, info, invert, join, lastindexof, luminance, merge, modify, monthAbbrevFormat, monthFormat, parser as parseExpression, pathShape, pinchAngle, pinchDistance, pluck, range, replace, reverse, scale, scaleGradient, scaleVisitor, screen, setdata, slice, timeFormat, timeParse, treeAncestors, treePath, utcFormat, utcParse, warn, windowSize };\n","import { toSet, stringValue, error, isArray, isObject, hasOwnProperty, accessor, key, field, array, compare, truthy } from 'vega-util';\nimport { tupleid } from 'vega-dataflow';\n\n/**\n * Parse a serialized dataflow specification.\n */\nfunction parse (spec) {\n const ctx = this,\n operators = spec.operators || [];\n\n // parse background\n if (spec.background) {\n ctx.background = spec.background;\n }\n\n // parse event configuration\n if (spec.eventConfig) {\n ctx.eventConfig = spec.eventConfig;\n }\n\n // parse locale configuration\n if (spec.locale) {\n ctx.locale = spec.locale;\n }\n\n // parse operators\n operators.forEach(entry => ctx.parseOperator(entry));\n\n // parse operator parameters\n operators.forEach(entry => ctx.parseOperatorParameters(entry));\n\n // parse streams\n (spec.streams || []).forEach(entry => ctx.parseStream(entry));\n\n // parse updates\n (spec.updates || []).forEach(entry => ctx.parseUpdate(entry));\n return ctx.resolve();\n}\n\nconst Skip = toSet(['rule']),\n Swap = toSet(['group', 'image', 'rect']);\nfunction adjustSpatial(encode, marktype) {\n let code = '';\n if (Skip[marktype]) return code;\n if (encode.x2) {\n if (encode.x) {\n if (Swap[marktype]) {\n code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;';\n }\n code += 'o.width=o.x2-o.x;';\n } else {\n code += 'o.x=o.x2-(o.width||0);';\n }\n }\n if (encode.xc) {\n code += 'o.x=o.xc-(o.width||0)/2;';\n }\n if (encode.y2) {\n if (encode.y) {\n if (Swap[marktype]) {\n code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;';\n }\n code += 'o.height=o.y2-o.y;';\n } else {\n code += 'o.y=o.y2-(o.height||0);';\n }\n }\n if (encode.yc) {\n code += 'o.y=o.yc-(o.height||0)/2;';\n }\n return code;\n}\nfunction canonicalType(type) {\n return (type + '').toLowerCase();\n}\nfunction isOperator(type) {\n return canonicalType(type) === 'operator';\n}\nfunction isCollect(type) {\n return canonicalType(type) === 'collect';\n}\n\nfunction expression(ctx, args, code) {\n // wrap code in return statement if expression does not terminate\n if (!code.endsWith(';')) {\n code = 'return(' + code + ');';\n }\n const fn = Function(...args.concat(code));\n return ctx && ctx.functions ? fn.bind(ctx.functions) : fn;\n}\n\n// generate code for comparing a single field\nfunction _compare(u, v, lt, gt) {\n return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt}\n : (u > v || v == null) && u != null ? ${gt}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt}\n : v !== v && u === u ? ${gt} : `;\n}\nvar expressionCodegen = {\n /**\n * Parse an expression used to update an operator value.\n */\n operator: (ctx, expr) => expression(ctx, ['_'], expr.code),\n /**\n * Parse an expression provided as an operator parameter value.\n */\n parameter: (ctx, expr) => expression(ctx, ['datum', '_'], expr.code),\n /**\n * Parse an expression applied to an event stream.\n */\n event: (ctx, expr) => expression(ctx, ['event'], expr.code),\n /**\n * Parse an expression used to handle an event-driven operator update.\n */\n handler: (ctx, expr) => {\n const code = `var datum=event.item&&event.item.datum;return ${expr.code};`;\n return expression(ctx, ['_', 'event'], code);\n },\n /**\n * Parse an expression that performs visual encoding.\n */\n encode: (ctx, encode) => {\n const {\n marktype,\n channels\n } = encode;\n let code = 'var o=item,datum=o.datum,m=0,$;';\n for (const name in channels) {\n const o = 'o[' + stringValue(name) + ']';\n code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`;\n }\n code += adjustSpatial(channels, marktype);\n code += 'return m;';\n return expression(ctx, ['item', '_'], code);\n },\n /**\n * Optimized code generators for access and comparison.\n */\n codegen: {\n get(path) {\n const ref = `[${path.map(stringValue).join('][')}]`;\n const get = Function('_', `return _${ref};`);\n get.path = ref;\n return get;\n },\n comparator(fields, orders) {\n let t;\n const map = (f, i) => {\n const o = orders[i];\n let u, v;\n if (f.path) {\n u = `a${f.path}`;\n v = `b${f.path}`;\n } else {\n (t = t || {})['f' + i] = f;\n u = `this.f${i}(a)`;\n v = `this.f${i}(b)`;\n }\n return _compare(u, v, -o, o);\n };\n const fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;');\n return t ? fn.bind(t) : fn;\n }\n }\n};\n\n/**\n * Parse a dataflow operator.\n */\nfunction parseOperator(spec) {\n const ctx = this;\n if (isOperator(spec.type) || !spec.type) {\n ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null);\n } else {\n ctx.transform(spec, spec.type);\n }\n}\n\n/**\n * Parse and assign operator parameters.\n */\nfunction parseOperatorParameters(spec) {\n const ctx = this;\n if (spec.params) {\n const op = ctx.get(spec.id);\n if (!op) error('Invalid operator id: ' + spec.id);\n ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly));\n }\n}\n\n/**\n * Parse a set of operator parameters.\n */\nfunction parseParameters(spec, params) {\n params = params || {};\n const ctx = this;\n for (const key in spec) {\n const value = spec[key];\n params[key] = isArray(value) ? value.map(v => parseParameter(v, ctx, params)) : parseParameter(value, ctx, params);\n }\n return params;\n}\n\n/**\n * Parse a single parameter.\n */\nfunction parseParameter(spec, ctx, params) {\n if (!spec || !isObject(spec)) return spec;\n for (let i = 0, n = PARSERS.length, p; i < n; ++i) {\n p = PARSERS[i];\n if (hasOwnProperty(spec, p.key)) {\n return p.parse(spec, ctx, params);\n }\n }\n return spec;\n}\n\n/** Reference parsers. */\nvar PARSERS = [{\n key: '$ref',\n parse: getOperator\n}, {\n key: '$key',\n parse: getKey\n}, {\n key: '$expr',\n parse: getExpression\n}, {\n key: '$field',\n parse: getField\n}, {\n key: '$encode',\n parse: getEncode\n}, {\n key: '$compare',\n parse: getCompare\n}, {\n key: '$context',\n parse: getContext\n}, {\n key: '$subflow',\n parse: getSubflow\n}, {\n key: '$tupleid',\n parse: getTupleId\n}];\n\n/**\n * Resolve an operator reference.\n */\nfunction getOperator(_, ctx) {\n return ctx.get(_.$ref) || error('Operator not defined: ' + _.$ref);\n}\n\n/**\n * Resolve an expression reference.\n */\nfunction getExpression(_, ctx, params) {\n if (_.$params) {\n // parse expression parameters\n ctx.parseParameters(_.$params, params);\n }\n const k = 'e:' + _.$expr.code;\n return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields));\n}\n\n/**\n * Resolve a key accessor reference.\n */\nfunction getKey(_, ctx) {\n const k = 'k:' + _.$key + '_' + !!_.$flat;\n return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat, ctx.expr.codegen));\n}\n\n/**\n * Resolve a field accessor reference.\n */\nfunction getField(_, ctx) {\n if (!_.$field) return null;\n const k = 'f:' + _.$field + '_' + _.$name;\n return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name, ctx.expr.codegen));\n}\n\n/**\n * Resolve a comparator function reference.\n */\nfunction getCompare(_, ctx) {\n // As of Vega 5.5.3, $tupleid sort is no longer used.\n // Keep here for now for backwards compatibility.\n const k = 'c:' + _.$compare + '_' + _.$order,\n c = array(_.$compare).map(_ => _ && _.$tupleid ? tupleid : _);\n return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen));\n}\n\n/**\n * Resolve an encode operator reference.\n */\nfunction getEncode(_, ctx) {\n const spec = _.$encode,\n encode = {};\n for (const name in spec) {\n const enc = spec[name];\n encode[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields);\n encode[name].output = enc.$output;\n }\n return encode;\n}\n\n/**\n * Resolve a context reference.\n */\nfunction getContext(_, ctx) {\n return ctx;\n}\n\n/**\n * Resolve a recursive subflow specification.\n */\nfunction getSubflow(_, ctx) {\n const spec = _.$subflow;\n return function (dataflow, key, parent) {\n const subctx = ctx.fork().parse(spec),\n op = subctx.get(spec.operators[0].id),\n p = subctx.signals.parent;\n if (p) p.set(parent);\n op.detachSubflow = () => ctx.detach(subctx);\n return op;\n };\n}\n\n/**\n * Resolve a tuple id reference.\n */\nfunction getTupleId() {\n return tupleid;\n}\n\n/**\n * Parse an event stream specification.\n */\nfunction parseStream (spec) {\n var ctx = this,\n filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined,\n stream = spec.stream != null ? ctx.get(spec.stream) : undefined,\n args;\n if (spec.source) {\n stream = ctx.events(spec.source, spec.type, filter);\n } else if (spec.merge) {\n args = spec.merge.map(_ => ctx.get(_));\n stream = args[0].merge.apply(args[0], args.slice(1));\n }\n if (spec.between) {\n args = spec.between.map(_ => ctx.get(_));\n stream = stream.between(args[0], args[1]);\n }\n if (spec.filter) {\n stream = stream.filter(filter);\n }\n if (spec.throttle != null) {\n stream = stream.throttle(+spec.throttle);\n }\n if (spec.debounce != null) {\n stream = stream.debounce(+spec.debounce);\n }\n if (stream == null) {\n error('Invalid stream definition: ' + JSON.stringify(spec));\n }\n if (spec.consume) stream.consume(true);\n ctx.stream(spec, stream);\n}\n\n/**\n * Parse an event-driven operator update.\n */\nfunction parseUpdate (spec) {\n var ctx = this,\n srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid,\n source = ctx.get(srcid),\n target = null,\n update = spec.update,\n params = undefined;\n if (!source) error('Source not defined: ' + spec.source);\n target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target);\n if (update && update.$expr) {\n if (update.$params) {\n params = ctx.parseParameters(update.$params);\n }\n update = ctx.handlerExpression(update.$expr);\n }\n ctx.update(spec, source, target, update, params);\n}\n\nconst SKIP = {\n skip: true\n};\nfunction getState(options) {\n var ctx = this,\n state = {};\n if (options.signals) {\n var signals = state.signals = {};\n Object.keys(ctx.signals).forEach(key => {\n const op = ctx.signals[key];\n if (options.signals(key, op)) {\n signals[key] = op.value;\n }\n });\n }\n if (options.data) {\n var data = state.data = {};\n Object.keys(ctx.data).forEach(key => {\n const dataset = ctx.data[key];\n if (options.data(key, dataset)) {\n data[key] = dataset.input.value;\n }\n });\n }\n if (ctx.subcontext && options.recurse !== false) {\n state.subcontext = ctx.subcontext.map(ctx => ctx.getState(options));\n }\n return state;\n}\nfunction setState(state) {\n var ctx = this,\n df = ctx.dataflow,\n data = state.data,\n signals = state.signals;\n Object.keys(signals || {}).forEach(key => {\n df.update(ctx.signals[key], signals[key], SKIP);\n });\n Object.keys(data || {}).forEach(key => {\n df.pulse(ctx.data[key].input, df.changeset().remove(truthy).insert(data[key]));\n });\n (state.subcontext || []).forEach((substate, i) => {\n const subctx = ctx.subcontext[i];\n if (subctx) subctx.setState(substate);\n });\n}\n\n/**\n * Context objects store the current parse state.\n * Enables lookup of parsed operators, event streams, accessors, etc.\n * Provides a 'fork' method for creating child contexts for subflows.\n */\nfunction context (df, transforms, functions, expr) {\n return new Context(df, transforms, functions, expr);\n}\nfunction Context(df, transforms, functions, expr) {\n this.dataflow = df;\n this.transforms = transforms;\n this.events = df.events.bind(df);\n this.expr = expr || expressionCodegen, this.signals = {};\n this.scales = {};\n this.nodes = {};\n this.data = {};\n this.fn = {};\n if (functions) {\n this.functions = Object.create(functions);\n this.functions.context = this;\n }\n}\nfunction Subcontext(ctx) {\n this.dataflow = ctx.dataflow;\n this.transforms = ctx.transforms;\n this.events = ctx.events;\n this.expr = ctx.expr;\n this.signals = Object.create(ctx.signals);\n this.scales = Object.create(ctx.scales);\n this.nodes = Object.create(ctx.nodes);\n this.data = Object.create(ctx.data);\n this.fn = Object.create(ctx.fn);\n if (ctx.functions) {\n this.functions = Object.create(ctx.functions);\n this.functions.context = this;\n }\n}\nContext.prototype = Subcontext.prototype = {\n fork() {\n const ctx = new Subcontext(this);\n (this.subcontext || (this.subcontext = [])).push(ctx);\n return ctx;\n },\n detach(ctx) {\n this.subcontext = this.subcontext.filter(c => c !== ctx);\n\n // disconnect all nodes in the subcontext\n // wipe out targets first for better efficiency\n const keys = Object.keys(ctx.nodes);\n for (const key of keys) ctx.nodes[key]._targets = null;\n for (const key of keys) ctx.nodes[key].detach();\n ctx.nodes = null;\n },\n get(id) {\n return this.nodes[id];\n },\n set(id, node) {\n return this.nodes[id] = node;\n },\n add(spec, op) {\n const ctx = this,\n df = ctx.dataflow,\n data = spec.value;\n ctx.set(spec.id, op);\n if (isCollect(spec.type) && data) {\n if (data.$ingest) {\n df.ingest(op, data.$ingest, data.$format);\n } else if (data.$request) {\n df.preload(op, data.$request, data.$format);\n } else {\n df.pulse(op, df.changeset().insert(data));\n }\n }\n if (spec.root) {\n ctx.root = op;\n }\n if (spec.parent) {\n let p = ctx.get(spec.parent.$ref);\n if (p) {\n df.connect(p, [op]);\n op.targets().add(p);\n } else {\n (ctx.unresolved = ctx.unresolved || []).push(() => {\n p = ctx.get(spec.parent.$ref);\n df.connect(p, [op]);\n op.targets().add(p);\n });\n }\n }\n if (spec.signal) {\n ctx.signals[spec.signal] = op;\n }\n if (spec.scale) {\n ctx.scales[spec.scale] = op;\n }\n if (spec.data) {\n for (const name in spec.data) {\n const data = ctx.data[name] || (ctx.data[name] = {});\n spec.data[name].forEach(role => data[role] = op);\n }\n }\n },\n resolve() {\n (this.unresolved || []).forEach(fn => fn());\n delete this.unresolved;\n return this;\n },\n operator(spec, update) {\n this.add(spec, this.dataflow.add(spec.value, update));\n },\n transform(spec, type) {\n this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)]));\n },\n stream(spec, stream) {\n this.set(spec.id, stream);\n },\n update(spec, stream, target, update, params) {\n this.dataflow.on(stream, target, update, params, spec.options);\n },\n // expression parsing\n operatorExpression(expr) {\n return this.expr.operator(this, expr);\n },\n parameterExpression(expr) {\n return this.expr.parameter(this, expr);\n },\n eventExpression(expr) {\n return this.expr.event(this, expr);\n },\n handlerExpression(expr) {\n return this.expr.handler(this, expr);\n },\n encodeExpression(encode) {\n return this.expr.encode(this, encode);\n },\n // parse methods\n parse,\n parseOperator,\n parseOperatorParameters,\n parseParameters,\n parseStream,\n parseUpdate,\n // state methods\n getState,\n setState\n};\n\nexport { context };\n","import { isString, hasOwnProperty, error, truthy, constant, extend, array, isObject, isArray, toSet, debounce, isDate, inherits, stringValue } from 'vega-util';\nimport { changeset, isChangeSet, EventStream, transforms, Dataflow, asyncCallback } from 'vega-dataflow';\nimport { point, renderModule, CanvasHandler, RenderType, Scenegraph } from 'vega-scenegraph';\nimport { tickStep } from 'd3-array';\nimport { functionContext } from 'vega-functions';\nimport { context } from 'vega-runtime';\nimport { interval } from 'd3-timer';\nimport { locale } from 'vega-format';\n\n// initialize aria role and label attributes\nfunction initializeAria(view) {\n const el = view.container();\n if (el) {\n el.setAttribute('role', 'graphics-document');\n el.setAttribute('aria-roleDescription', 'visualization');\n ariaLabel(el, view.description());\n }\n}\n\n// update aria-label if we have a DOM container element\nfunction ariaLabel(el, desc) {\n if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc);\n}\n\nfunction background (view) {\n // respond to background signal\n view.add(null, _ => {\n view._background = _.bg;\n view._resize = 1;\n return _.bg;\n }, {\n bg: view._signals.background\n });\n}\n\nconst Default = 'default';\nfunction cursor (view) {\n // get cursor signal, add to dataflow if needed\n const cursor = view._signals.cursor || (view._signals.cursor = view.add({\n user: Default,\n item: null\n }));\n\n // evaluate cursor on each mousemove event\n view.on(view.events('view', 'mousemove'), cursor, (_, event) => {\n const value = cursor.value,\n user = value ? isString(value) ? value : value.user : Default,\n item = event.item && event.item.cursor || null;\n return value && user === value.user && item == value.item ? value : {\n user: user,\n item: item\n };\n });\n\n // when cursor signal updates, set visible cursor\n view.add(null, function (_) {\n let user = _.cursor,\n item = this.value;\n if (!isString(user)) {\n item = user.item;\n user = user.user;\n }\n setCursor(view, user && user !== Default ? user : item || user);\n return item;\n }, {\n cursor: cursor\n });\n}\nfunction setCursor(view, cursor) {\n const el = view.globalCursor() ? typeof document !== 'undefined' && document.body : view.container();\n if (el) {\n return cursor == null ? el.style.removeProperty('cursor') : el.style.cursor = cursor;\n }\n}\n\nfunction dataref(view, name) {\n var data = view._runtime.data;\n if (!hasOwnProperty(data, name)) {\n error('Unrecognized data set: ' + name);\n }\n return data[name];\n}\nfunction data(name, values) {\n return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(truthy).insert(values));\n}\nfunction change(name, changes) {\n if (!isChangeSet(changes)) {\n error('Second argument to changes must be a changeset.');\n }\n const dataset = dataref(this, name);\n dataset.modified = true;\n return this.pulse(dataset.input, changes);\n}\nfunction insert(name, _) {\n return change.call(this, name, changeset().insert(_));\n}\nfunction remove(name, _) {\n return change.call(this, name, changeset().remove(_));\n}\n\nfunction width(view) {\n var padding = view.padding();\n return Math.max(0, view._viewWidth + padding.left + padding.right);\n}\nfunction height(view) {\n var padding = view.padding();\n return Math.max(0, view._viewHeight + padding.top + padding.bottom);\n}\nfunction offset(view) {\n var padding = view.padding(),\n origin = view._origin;\n return [padding.left + origin[0], padding.top + origin[1]];\n}\nfunction resizeRenderer(view) {\n var origin = offset(view),\n w = width(view),\n h = height(view);\n view._renderer.background(view.background());\n view._renderer.resize(w, h, origin);\n view._handler.origin(origin);\n view._resizeListeners.forEach(handler => {\n try {\n handler(w, h);\n } catch (error) {\n view.error(error);\n }\n });\n}\n\n/**\n * Extend an event with additional view-specific methods.\n * Adds a new property ('vega') to an event that provides a number\n * of methods for querying information about the current interaction.\n * The vega object provides the following methods:\n * view - Returns the backing View instance.\n * item - Returns the currently active scenegraph item (if any).\n * group - Returns the currently active scenegraph group (if any).\n * This method accepts a single string-typed argument indicating the name\n * of the desired parent group. The scenegraph will be traversed from\n * the item up towards the root to search for a matching group. If no\n * argument is provided the enclosing group for the active item is\n * returned, unless the item it itself a group, in which case it is\n * returned directly.\n * xy - Returns a two-element array containing the x and y coordinates for\n * mouse or touch events. For touch events, this is based on the first\n * elements in the changedTouches array. This method accepts a single\n * argument: either an item instance or mark name that should serve as\n * the reference coordinate system. If no argument is provided the\n * top-level view coordinate system is assumed.\n * x - Returns the current x-coordinate, accepts the same arguments as xy.\n * y - Returns the current y-coordinate, accepts the same arguments as xy.\n * @param {Event} event - The input event to extend.\n * @param {Item} item - The currently active scenegraph item (if any).\n * @return {Event} - The extended input event.\n */\nfunction eventExtend (view, event, item) {\n var r = view._renderer,\n el = r && r.canvas(),\n p,\n e,\n translate;\n if (el) {\n translate = offset(view);\n e = event.changedTouches ? event.changedTouches[0] : event;\n p = point(e, el);\n p[0] -= translate[0];\n p[1] -= translate[1];\n }\n event.dataflow = view;\n event.item = item;\n event.vega = extension(view, item, p);\n return event;\n}\nfunction extension(view, item, point) {\n const itemGroup = item ? item.mark.marktype === 'group' ? item : item.mark.group : null;\n function group(name) {\n var g = itemGroup,\n i;\n if (name) for (i = item; i; i = i.mark.group) {\n if (i.mark.name === name) {\n g = i;\n break;\n }\n }\n return g && g.mark && g.mark.interactive ? g : {};\n }\n function xy(item) {\n if (!item) return point;\n if (isString(item)) item = group(item);\n const p = point.slice();\n while (item) {\n p[0] -= item.x || 0;\n p[1] -= item.y || 0;\n item = item.mark && item.mark.group;\n }\n return p;\n }\n return {\n view: constant(view),\n item: constant(item || {}),\n group: group,\n xy: xy,\n x: item => xy(item)[0],\n y: item => xy(item)[1]\n };\n}\n\nconst VIEW = 'view',\n TIMER = 'timer',\n WINDOW = 'window',\n NO_TRAP = {\n trap: false\n };\n\n/**\n * Initialize event handling configuration.\n * @param {object} config - The configuration settings.\n * @return {object}\n */\nfunction initializeEventConfig(config) {\n const events = extend({\n defaults: {}\n }, config);\n const unpack = (obj, keys) => {\n keys.forEach(k => {\n if (isArray(obj[k])) obj[k] = toSet(obj[k]);\n });\n };\n unpack(events.defaults, ['prevent', 'allow']);\n unpack(events, ['view', 'window', 'selector']);\n return events;\n}\nfunction trackEventListener(view, sources, type, handler) {\n view._eventListeners.push({\n type: type,\n sources: array(sources),\n handler: handler\n });\n}\nfunction prevent(view, type) {\n var def = view._eventConfig.defaults,\n prevent = def.prevent,\n allow = def.allow;\n return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault();\n}\nfunction permit(view, key, type) {\n const rule = view._eventConfig && view._eventConfig[key];\n if (rule === false || isObject(rule) && !rule[type]) {\n view.warn(`Blocked ${key} ${type} event listener.`);\n return false;\n }\n return true;\n}\n\n/**\n * Create a new event stream from an event source.\n * @param {object} source - The event source to monitor.\n * @param {string} type - The event type.\n * @param {function(object): boolean} [filter] - Event filter function.\n * @return {EventStream}\n */\nfunction events(source, type, filter) {\n var view = this,\n s = new EventStream(filter),\n send = function (e, item) {\n view.runAsync(null, () => {\n if (source === VIEW && prevent(view, type)) {\n e.preventDefault();\n }\n s.receive(eventExtend(view, e, item));\n });\n },\n sources;\n if (source === TIMER) {\n if (permit(view, 'timer', type)) {\n view.timer(send, type);\n }\n } else if (source === VIEW) {\n if (permit(view, 'view', type)) {\n // send traps errors, so use {trap: false} option\n view.addEventListener(type, send, NO_TRAP);\n }\n } else {\n if (source === WINDOW) {\n if (permit(view, 'window', type) && typeof window !== 'undefined') {\n sources = [window];\n }\n } else if (typeof document !== 'undefined') {\n if (permit(view, 'selector', type)) {\n sources = Array.from(document.querySelectorAll(source));\n }\n }\n if (!sources) {\n view.warn('Can not resolve event source: ' + source);\n } else {\n for (var i = 0, n = sources.length; i < n; ++i) {\n sources[i].addEventListener(type, send);\n }\n trackEventListener(view, sources, type, send);\n }\n }\n return s;\n}\n\nfunction itemFilter(event) {\n return event.item;\n}\nfunction markTarget(event) {\n // grab upstream collector feeding the mark operator\n return event.item.mark.source;\n}\nfunction invoke(name) {\n return function (_, event) {\n return event.vega.view().changeset().encode(event.item, name);\n };\n}\nfunction hover (hoverSet, leaveSet) {\n hoverSet = [hoverSet || 'hover'];\n leaveSet = [leaveSet || 'update', hoverSet[0]];\n\n // invoke hover set upon mouseover\n this.on(this.events('view', 'mouseover', itemFilter), markTarget, invoke(hoverSet));\n\n // invoke leave set upon mouseout\n this.on(this.events('view', 'mouseout', itemFilter), markTarget, invoke(leaveSet));\n return this;\n}\n\n/**\n * Finalize a View instance that is being removed.\n * Cancel any running timers.\n * Remove all external event listeners.\n * Remove any currently displayed tooltip.\n */\nfunction finalize () {\n var tooltip = this._tooltip,\n timers = this._timers,\n listeners = this._eventListeners,\n n,\n m,\n e;\n n = timers.length;\n while (--n >= 0) {\n timers[n].stop();\n }\n n = listeners.length;\n while (--n >= 0) {\n e = listeners[n];\n m = e.sources.length;\n while (--m >= 0) {\n e.sources[m].removeEventListener(e.type, e.handler);\n }\n }\n if (tooltip) {\n tooltip.call(this, this._handler, null, null, null);\n }\n return this;\n}\n\nfunction element (tag, attr, text) {\n const el = document.createElement(tag);\n for (const key in attr) el.setAttribute(key, attr[key]);\n if (text != null) el.textContent = text;\n return el;\n}\n\nconst BindClass = 'vega-bind',\n NameClass = 'vega-bind-name',\n RadioClass = 'vega-bind-radio';\n\n/**\n * Bind a signal to an external HTML input element. The resulting two-way\n * binding will propagate input changes to signals, and propagate signal\n * changes to the input element state. If this view instance has no parent\n * element, we assume the view is headless and no bindings are created.\n * @param {Element|string} el - The parent DOM element to which the input\n * element should be appended as a child. If string-valued, this argument\n * will be treated as a CSS selector. If null or undefined, the parent\n * element of this view will be used as the element.\n * @param {object} param - The binding parameters which specify the signal\n * to bind to, the input element type, and type-specific configuration.\n * @return {View} - This view instance.\n */\nfunction bind (view, el, binding) {\n if (!el) return;\n const param = binding.param;\n let bind = binding.state;\n if (!bind) {\n bind = binding.state = {\n elements: null,\n active: false,\n set: null,\n update: value => {\n if (value != view.signal(param.signal)) {\n view.runAsync(null, () => {\n bind.source = true;\n view.signal(param.signal, value);\n });\n }\n }\n };\n if (param.debounce) {\n bind.update = debounce(param.debounce, bind.update);\n }\n }\n const create = param.input == null && param.element ? target : generate;\n create(bind, el, param, view);\n if (!bind.active) {\n view.on(view._signals[param.signal], null, () => {\n bind.source ? bind.source = false : bind.set(view.signal(param.signal));\n });\n bind.active = true;\n }\n return bind;\n}\n\n/**\n * Bind the signal to an external EventTarget.\n */\nfunction target(bind, node, param, view) {\n const type = param.event || 'input';\n const handler = () => bind.update(node.value);\n\n // initialize signal value to external input value\n view.signal(param.signal, node.value);\n\n // listen for changes on the element\n node.addEventListener(type, handler);\n\n // register with view, so we can remove it upon finalization\n trackEventListener(view, node, type, handler);\n\n // propagate change to element\n bind.set = value => {\n node.value = value;\n node.dispatchEvent(event(type));\n };\n}\nfunction event(type) {\n return typeof Event !== 'undefined' ? new Event(type) : {\n type\n };\n}\n\n/**\n * Generate an HTML input form element and bind it to a signal.\n */\nfunction generate(bind, el, param, view) {\n const value = view.signal(param.signal);\n const div = element('div', {\n 'class': BindClass\n });\n const wrapper = param.input === 'radio' ? div : div.appendChild(element('label'));\n wrapper.appendChild(element('span', {\n 'class': NameClass\n }, param.name || param.signal));\n el.appendChild(div);\n let input = form;\n switch (param.input) {\n case 'checkbox':\n input = checkbox;\n break;\n case 'select':\n input = select;\n break;\n case 'radio':\n input = radio;\n break;\n case 'range':\n input = range;\n break;\n }\n input(bind, wrapper, param, value);\n}\n\n/**\n * Generates an arbitrary input form element.\n * The input type is controlled via user-provided parameters.\n */\nfunction form(bind, el, param, value) {\n const node = element('input');\n for (const key in param) {\n if (key !== 'signal' && key !== 'element') {\n node.setAttribute(key === 'input' ? 'type' : key, param[key]);\n }\n }\n node.setAttribute('name', param.signal);\n node.value = value;\n el.appendChild(node);\n node.addEventListener('input', () => bind.update(node.value));\n bind.elements = [node];\n bind.set = value => node.value = value;\n}\n\n/**\n * Generates a checkbox input element.\n */\nfunction checkbox(bind, el, param, value) {\n const attr = {\n type: 'checkbox',\n name: param.signal\n };\n if (value) attr.checked = true;\n const node = element('input', attr);\n el.appendChild(node);\n node.addEventListener('change', () => bind.update(node.checked));\n bind.elements = [node];\n bind.set = value => node.checked = !!value || null;\n}\n\n/**\n * Generates a selection list input element.\n */\nfunction select(bind, el, param, value) {\n const node = element('select', {\n name: param.signal\n }),\n labels = param.labels || [];\n param.options.forEach((option, i) => {\n const attr = {\n value: option\n };\n if (valuesEqual(option, value)) attr.selected = true;\n node.appendChild(element('option', attr, (labels[i] || option) + ''));\n });\n el.appendChild(node);\n node.addEventListener('change', () => {\n bind.update(param.options[node.selectedIndex]);\n });\n bind.elements = [node];\n bind.set = value => {\n for (let i = 0, n = param.options.length; i < n; ++i) {\n if (valuesEqual(param.options[i], value)) {\n node.selectedIndex = i;\n return;\n }\n }\n };\n}\n\n/**\n * Generates a radio button group.\n */\nfunction radio(bind, el, param, value) {\n const group = element('span', {\n 'class': RadioClass\n }),\n labels = param.labels || [];\n el.appendChild(group);\n bind.elements = param.options.map((option, i) => {\n const attr = {\n type: 'radio',\n name: param.signal,\n value: option\n };\n if (valuesEqual(option, value)) attr.checked = true;\n const input = element('input', attr);\n input.addEventListener('change', () => bind.update(option));\n const label = element('label', {}, (labels[i] || option) + '');\n label.prepend(input);\n group.appendChild(label);\n return input;\n });\n bind.set = value => {\n const nodes = bind.elements,\n n = nodes.length;\n for (let i = 0; i < n; ++i) {\n if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true;\n }\n };\n}\n\n/**\n * Generates a slider input element.\n */\nfunction range(bind, el, param, value) {\n value = value !== undefined ? value : (+param.max + +param.min) / 2;\n const max = param.max != null ? param.max : Math.max(100, +value) || 100,\n min = param.min || Math.min(0, max, +value) || 0,\n step = param.step || tickStep(min, max, 100);\n const node = element('input', {\n type: 'range',\n name: param.signal,\n min: min,\n max: max,\n step: step\n });\n node.value = value;\n const span = element('span', {}, +value);\n el.appendChild(node);\n el.appendChild(span);\n const update = () => {\n span.textContent = node.value;\n bind.update(+node.value);\n };\n\n // subscribe to both input and change\n node.addEventListener('input', update);\n node.addEventListener('change', update);\n bind.elements = [node];\n bind.set = value => {\n node.value = value;\n span.textContent = value;\n };\n}\nfunction valuesEqual(a, b) {\n return a === b || a + '' === b + '';\n}\n\nfunction initializeRenderer (view, r, el, constructor, scaleFactor, opt) {\n r = r || new constructor(view.loader());\n return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background());\n}\n\nfunction trap (view, fn) {\n return !fn ? null : function () {\n try {\n fn.apply(this, arguments);\n } catch (error) {\n view.error(error);\n }\n };\n}\n\nfunction initializeHandler (view, prevHandler, el, constructor) {\n // instantiate scenegraph handler\n const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view);\n\n // transfer event handlers\n if (prevHandler) {\n prevHandler.handlers().forEach(h => {\n handler.on(h.type, h.handler);\n });\n }\n return handler;\n}\n\nfunction initialize (el, elBind) {\n const view = this,\n type = view._renderType,\n config = view._eventConfig.bind,\n module = renderModule(type);\n\n // containing dom element\n el = view._el = el ? lookup(view, el, true) : null;\n\n // initialize aria attributes\n initializeAria(view);\n\n // select appropriate renderer & handler\n if (!module) view.error('Unrecognized renderer type: ' + type);\n const Handler = module.handler || CanvasHandler,\n Renderer = el ? module.renderer : module.headless;\n\n // initialize renderer and input handler\n view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer);\n view._handler = initializeHandler(view, view._handler, el, Handler);\n view._redraw = true;\n\n // initialize signal bindings\n if (el && config !== 'none') {\n elBind = elBind ? view._elBind = lookup(view, elBind, true) : el.appendChild(element('form', {\n 'class': 'vega-bindings'\n }));\n view._bind.forEach(_ => {\n if (_.param.element && config !== 'container') {\n _.element = lookup(view, _.param.element, !!_.param.input);\n }\n });\n view._bind.forEach(_ => {\n bind(view, _.element || elBind, _);\n });\n }\n return view;\n}\nfunction lookup(view, el, clear) {\n if (typeof el === 'string') {\n if (typeof document !== 'undefined') {\n el = document.querySelector(el);\n if (!el) {\n view.error('Signal bind element not found: ' + el);\n return null;\n }\n } else {\n view.error('DOM document instance not found.');\n return null;\n }\n }\n if (el && clear) {\n try {\n el.textContent = '';\n } catch (e) {\n el = null;\n view.error(e);\n }\n }\n return el;\n}\n\nconst number = _ => +_ || 0;\nconst paddingObject = _ => ({\n top: _,\n bottom: _,\n left: _,\n right: _\n});\nfunction padding (_) {\n return isObject(_) ? {\n top: number(_.top),\n bottom: number(_.bottom),\n left: number(_.left),\n right: number(_.right)\n } : paddingObject(number(_));\n}\n\n/**\n * Render the current scene in a headless fashion.\n * This method is asynchronous, returning a Promise instance.\n * @return {Promise} - A Promise that resolves to a renderer.\n */\nasync function renderHeadless (view, type, scaleFactor, opt) {\n const module = renderModule(type),\n ctr = module && module.headless;\n if (!ctr) error('Unrecognized renderer type: ' + type);\n await view.runAsync();\n return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root);\n}\n\n/**\n * Produce an image URL for the visualization. Depending on the type\n * parameter, the generated URL contains data for either a PNG or SVG image.\n * The URL can be used (for example) to download images of the visualization.\n * This method is asynchronous, returning a Promise instance.\n * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'.\n * The 'canvas' and 'png' types are synonyms for a PNG image.\n * @return {Promise} - A promise that resolves to an image URL.\n */\nasync function renderToImageURL (type, scaleFactor) {\n if (type !== RenderType.Canvas && type !== RenderType.SVG && type !== RenderType.PNG) {\n error('Unrecognized image type: ' + type);\n }\n const r = await renderHeadless(this, type, scaleFactor);\n return type === RenderType.SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png');\n}\nfunction toBlobURL(data, mime) {\n const blob = new Blob([data], {\n type: mime\n });\n return window.URL.createObjectURL(blob);\n}\n\n/**\n * Produce a Canvas instance containing a rendered visualization.\n * This method is asynchronous, returning a Promise instance.\n * @return {Promise} - A promise that resolves to a Canvas instance.\n */\nasync function renderToCanvas (scaleFactor, opt) {\n const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt);\n return r.canvas();\n}\n\n/**\n * Produce a rendered SVG string of the visualization.\n * This method is asynchronous, returning a Promise instance.\n * @return {Promise} - A promise that resolves to an SVG string.\n */\nasync function renderToSVG (scaleFactor) {\n const r = await renderHeadless(this, RenderType.SVG, scaleFactor);\n return r.svg();\n}\n\nfunction runtime (view, spec, expr) {\n return context(view, transforms, functionContext, expr).parse(spec);\n}\n\nfunction scale(name) {\n var scales = this._runtime.scales;\n if (!hasOwnProperty(scales, name)) {\n error('Unrecognized scale or projection: ' + name);\n }\n return scales[name].value;\n}\n\nvar Width = 'width',\n Height = 'height',\n Padding = 'padding',\n Skip = {\n skip: true\n };\nfunction viewWidth(view, width) {\n var a = view.autosize(),\n p = view.padding();\n return width - (a && a.contains === Padding ? p.left + p.right : 0);\n}\nfunction viewHeight(view, height) {\n var a = view.autosize(),\n p = view.padding();\n return height - (a && a.contains === Padding ? p.top + p.bottom : 0);\n}\nfunction initializeResize(view) {\n var s = view._signals,\n w = s[Width],\n h = s[Height],\n p = s[Padding];\n function resetSize() {\n view._autosize = view._resize = 1;\n }\n\n // respond to width signal\n view._resizeWidth = view.add(null, _ => {\n view._width = _.size;\n view._viewWidth = viewWidth(view, _.size);\n resetSize();\n }, {\n size: w\n });\n\n // respond to height signal\n view._resizeHeight = view.add(null, _ => {\n view._height = _.size;\n view._viewHeight = viewHeight(view, _.size);\n resetSize();\n }, {\n size: h\n });\n\n // respond to padding signal\n const resizePadding = view.add(null, resetSize, {\n pad: p\n });\n\n // set rank to run immediately after source signal\n view._resizeWidth.rank = w.rank + 1;\n view._resizeHeight.rank = h.rank + 1;\n resizePadding.rank = p.rank + 1;\n}\nfunction resizeView(viewWidth, viewHeight, width, height, origin, auto) {\n this.runAfter(view => {\n let rerun = 0;\n\n // reset autosize flag\n view._autosize = 0;\n\n // width value changed: update signal, skip resize op\n if (view.width() !== width) {\n rerun = 1;\n view.signal(Width, width, Skip); // set width, skip update calc\n view._resizeWidth.skip(true); // skip width resize handler\n }\n\n // height value changed: update signal, skip resize op\n if (view.height() !== height) {\n rerun = 1;\n view.signal(Height, height, Skip); // set height, skip update calc\n view._resizeHeight.skip(true); // skip height resize handler\n }\n\n // view width changed: update view property, set resize flag\n if (view._viewWidth !== viewWidth) {\n view._resize = 1;\n view._viewWidth = viewWidth;\n }\n\n // view height changed: update view property, set resize flag\n if (view._viewHeight !== viewHeight) {\n view._resize = 1;\n view._viewHeight = viewHeight;\n }\n\n // origin changed: update view property, set resize flag\n if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) {\n view._resize = 1;\n view._origin = origin;\n }\n\n // run dataflow on width/height signal change\n if (rerun) view.run('enter');\n if (auto) view.runAfter(v => v.resize());\n }, false, 1);\n}\n\n/**\n * Get the current view state, consisting of signal values and/or data sets.\n * @param {object} [options] - Options flags indicating which state to export.\n * If unspecified, all signals and data sets will be exported.\n * @param {function(string, Operator):boolean} [options.signals] - Optional\n * predicate function for testing if a signal should be included in the\n * exported state. If unspecified, all signals will be included, except for\n * those named 'parent' or those which refer to a Transform value.\n * @param {function(string, object):boolean} [options.data] - Optional\n * predicate function for testing if a data set's input should be included\n * in the exported state. If unspecified, all data sets that have been\n * explicitly modified will be included.\n * @param {boolean} [options.recurse=true] - Flag indicating if the exported\n * state should recursively include state from group mark sub-contexts.\n * @return {object} - An object containing the exported state values.\n */\nfunction getState(options) {\n return this._runtime.getState(options || {\n data: dataTest,\n signals: signalTest,\n recurse: true\n });\n}\nfunction dataTest(name, data) {\n return data.modified && isArray(data.input.value) && name.indexOf('_:vega:_');\n}\nfunction signalTest(name, op) {\n return !(name === 'parent' || op instanceof transforms.proxy);\n}\n\n/**\n * Sets the current view state and updates the view by invoking run.\n * @param {object} state - A state object containing signal and/or\n * data set values, following the format used by the getState method.\n * @return {View} - This view instance.\n */\nfunction setState(state) {\n this.runAsync(null, v => {\n v._trigger = false;\n v._runtime.setState(state);\n }, v => {\n v._trigger = true;\n });\n return this;\n}\n\nfunction timer (callback, delay) {\n function tick(elapsed) {\n callback({\n timestamp: Date.now(),\n elapsed: elapsed\n });\n }\n this._timers.push(interval(tick, delay));\n}\n\nfunction defaultTooltip (handler, event, item, value) {\n const el = handler.element();\n if (el) el.setAttribute('title', formatTooltip(value));\n}\nfunction formatTooltip(value) {\n return value == null ? '' : isArray(value) ? formatArray(value) : isObject(value) && !isDate(value) ? formatObject(value) : value + '';\n}\nfunction formatObject(obj) {\n return Object.keys(obj).map(key => {\n const v = obj[key];\n return key + ': ' + (isArray(v) ? formatArray(v) : formatValue(v));\n }).join('\\n');\n}\nfunction formatArray(value) {\n return '[' + value.map(formatValue).join(', ') + ']';\n}\nfunction formatValue(value) {\n return isArray(value) ? '[\\u2026]' : isObject(value) && !isDate(value) ? '{\\u2026}' : value;\n}\n\n/**\n * Create a new View instance from a Vega dataflow runtime specification.\n * The generated View will not immediately be ready for display. Callers\n * should also invoke the initialize method (e.g., to set the parent\n * DOM element in browser-based deployment) and then invoke the run\n * method to evaluate the dataflow graph. Rendering will automatically\n * be performed upon dataflow runs.\n * @constructor\n * @param {object} spec - The Vega dataflow runtime specification.\n */\nfunction View(spec, options) {\n const view = this;\n options = options || {};\n Dataflow.call(view);\n if (options.loader) view.loader(options.loader);\n if (options.logger) view.logger(options.logger);\n if (options.logLevel != null) view.logLevel(options.logLevel);\n if (options.locale || spec.locale) {\n const loc = extend({}, spec.locale, options.locale);\n view.locale(locale(loc.number, loc.time));\n }\n view._el = null;\n view._elBind = null;\n view._renderType = options.renderer || RenderType.Canvas;\n view._scenegraph = new Scenegraph();\n const root = view._scenegraph.root;\n\n // initialize renderer, handler and event management\n view._renderer = null;\n view._tooltip = options.tooltip || defaultTooltip, view._redraw = true;\n view._handler = new CanvasHandler().scene(root);\n view._globalCursor = false;\n view._preventDefault = false;\n view._timers = [];\n view._eventListeners = [];\n view._resizeListeners = [];\n\n // initialize event configuration\n view._eventConfig = initializeEventConfig(spec.eventConfig);\n view.globalCursor(view._eventConfig.globalCursor);\n\n // initialize dataflow graph\n const ctx = runtime(view, spec, options.expr);\n view._runtime = ctx;\n view._signals = ctx.signals;\n view._bind = (spec.bindings || []).map(_ => ({\n state: null,\n param: extend({}, _)\n }));\n\n // initialize scenegraph\n if (ctx.root) ctx.root.set(root);\n root.source = ctx.data.root.input;\n view.pulse(ctx.data.root.input, view.changeset().insert(root.items));\n\n // initialize view size\n view._width = view.width();\n view._height = view.height();\n view._viewWidth = viewWidth(view, view._width);\n view._viewHeight = viewHeight(view, view._height);\n view._origin = [0, 0];\n view._resize = 0;\n view._autosize = 1;\n initializeResize(view);\n\n // initialize background color\n background(view);\n\n // initialize cursor\n cursor(view);\n\n // initialize view description\n view.description(spec.description);\n\n // initialize hover proessing, if requested\n if (options.hover) view.hover();\n\n // initialize DOM container(s) and renderer\n if (options.container) view.initialize(options.container, options.bind);\n}\nfunction lookupSignal(view, name) {\n return hasOwnProperty(view._signals, name) ? view._signals[name] : error('Unrecognized signal name: ' + stringValue(name));\n}\nfunction findOperatorHandler(op, handler) {\n const h = (op._targets || []).filter(op => op._update && op._update.handler === handler);\n return h.length ? h[0] : null;\n}\nfunction addOperatorListener(view, name, op, handler) {\n let h = findOperatorHandler(op, handler);\n if (!h) {\n h = trap(view, () => handler(name, op.value));\n h.handler = handler;\n view.on(op, null, h);\n }\n return view;\n}\nfunction removeOperatorListener(view, op, handler) {\n const h = findOperatorHandler(op, handler);\n if (h) op._targets.remove(h);\n return view;\n}\ninherits(View, Dataflow, {\n // -- DATAFLOW / RENDERING ----\n\n async evaluate(encode, prerun, postrun) {\n // evaluate dataflow and prerun\n await Dataflow.prototype.evaluate.call(this, encode, prerun);\n\n // render as needed\n if (this._redraw || this._resize) {\n try {\n if (this._renderer) {\n if (this._resize) {\n this._resize = 0;\n resizeRenderer(this);\n }\n await this._renderer.renderAsync(this._scenegraph.root);\n }\n this._redraw = false;\n } catch (e) {\n this.error(e);\n }\n }\n\n // evaluate postrun\n if (postrun) asyncCallback(this, postrun);\n return this;\n },\n dirty(item) {\n this._redraw = true;\n this._renderer && this._renderer.dirty(item);\n },\n // -- GET / SET ----\n\n description(text) {\n if (arguments.length) {\n const desc = text != null ? text + '' : null;\n if (desc !== this._desc) ariaLabel(this._el, this._desc = desc);\n return this;\n }\n return this._desc;\n },\n container() {\n return this._el;\n },\n scenegraph() {\n return this._scenegraph;\n },\n origin() {\n return this._origin.slice();\n },\n signal(name, value, options) {\n const op = lookupSignal(this, name);\n return arguments.length === 1 ? op.value : this.update(op, value, options);\n },\n width(_) {\n return arguments.length ? this.signal('width', _) : this.signal('width');\n },\n height(_) {\n return arguments.length ? this.signal('height', _) : this.signal('height');\n },\n padding(_) {\n return arguments.length ? this.signal('padding', padding(_)) : padding(this.signal('padding'));\n },\n autosize(_) {\n return arguments.length ? this.signal('autosize', _) : this.signal('autosize');\n },\n background(_) {\n return arguments.length ? this.signal('background', _) : this.signal('background');\n },\n renderer(type) {\n if (!arguments.length) return this._renderType;\n if (!renderModule(type)) error('Unrecognized renderer type: ' + type);\n if (type !== this._renderType) {\n this._renderType = type;\n this._resetRenderer();\n }\n return this;\n },\n tooltip(handler) {\n if (!arguments.length) return this._tooltip;\n if (handler !== this._tooltip) {\n this._tooltip = handler;\n this._resetRenderer();\n }\n return this;\n },\n loader(loader) {\n if (!arguments.length) return this._loader;\n if (loader !== this._loader) {\n Dataflow.prototype.loader.call(this, loader);\n this._resetRenderer();\n }\n return this;\n },\n resize() {\n // set flag to perform autosize\n this._autosize = 1;\n // touch autosize signal to ensure top-level ViewLayout runs\n return this.touch(lookupSignal(this, 'autosize'));\n },\n _resetRenderer() {\n if (this._renderer) {\n this._renderer = null;\n this.initialize(this._el, this._elBind);\n }\n },\n // -- SIZING ----\n _resizeView: resizeView,\n // -- EVENT HANDLING ----\n\n addEventListener(type, handler, options) {\n let callback = handler;\n if (!(options && options.trap === false)) {\n // wrap callback in error handler\n callback = trap(this, handler);\n callback.raw = handler;\n }\n this._handler.on(type, callback);\n return this;\n },\n removeEventListener(type, handler) {\n var handlers = this._handler.handlers(type),\n i = handlers.length,\n h,\n t;\n\n // search registered handlers, remove if match found\n while (--i >= 0) {\n t = handlers[i].type;\n h = handlers[i].handler;\n if (type === t && (handler === h || handler === h.raw)) {\n this._handler.off(t, h);\n break;\n }\n }\n return this;\n },\n addResizeListener(handler) {\n const l = this._resizeListeners;\n if (l.indexOf(handler) < 0) {\n // add handler if it isn't already registered\n // note: error trapping handled elsewhere, so\n // no need to wrap handlers here\n l.push(handler);\n }\n return this;\n },\n removeResizeListener(handler) {\n var l = this._resizeListeners,\n i = l.indexOf(handler);\n if (i >= 0) {\n l.splice(i, 1);\n }\n return this;\n },\n addSignalListener(name, handler) {\n return addOperatorListener(this, name, lookupSignal(this, name), handler);\n },\n removeSignalListener(name, handler) {\n return removeOperatorListener(this, lookupSignal(this, name), handler);\n },\n addDataListener(name, handler) {\n return addOperatorListener(this, name, dataref(this, name).values, handler);\n },\n removeDataListener(name, handler) {\n return removeOperatorListener(this, dataref(this, name).values, handler);\n },\n globalCursor(_) {\n if (arguments.length) {\n if (this._globalCursor !== !!_) {\n const prev = setCursor(this, null); // clear previous cursor\n this._globalCursor = !!_;\n if (prev) setCursor(this, prev); // swap cursor\n }\n\n return this;\n } else {\n return this._globalCursor;\n }\n },\n preventDefault(_) {\n if (arguments.length) {\n this._preventDefault = _;\n return this;\n } else {\n return this._preventDefault;\n }\n },\n timer,\n events,\n finalize,\n hover,\n // -- DATA ----\n data,\n change,\n insert,\n remove,\n // -- SCALES --\n scale,\n // -- INITIALIZATION ----\n initialize,\n // -- HEADLESS RENDERING ----\n toImageURL: renderToImageURL,\n toCanvas: renderToCanvas,\n toSVG: renderToSVG,\n // -- SAVE / RESTORE STATE ----\n getState,\n setState\n});\n\nexport { View };\n","import {Timer, now} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer, total = delay;\n if (delay == null) return t.restart(callback, delay, time), t;\n t._restart = t.restart;\n t.restart = function(callback, delay, time) {\n delay = +delay, time = time == null ? now() : +time;\n t._restart(function tick(elapsed) {\n elapsed += total;\n t._restart(tick, total += delay, time);\n callback(elapsed);\n }, delay, time);\n }\n t.restart(callback, delay, time);\n return t;\n}\n","const VIEW = 'view',\n LBRACK = '[',\n RBRACK = ']',\n LBRACE = '{',\n RBRACE = '}',\n COLON = ':',\n COMMA = ',',\n NAME = '@',\n GT = '>',\n ILLEGAL = /[[\\]{}]/,\n DEFAULT_MARKS = {\n '*': 1,\n arc: 1,\n area: 1,\n group: 1,\n image: 1,\n line: 1,\n path: 1,\n rect: 1,\n rule: 1,\n shape: 1,\n symbol: 1,\n text: 1,\n trail: 1\n };\nlet DEFAULT_SOURCE, MARKS;\n\n/**\n * Parse an event selector string.\n * Returns an array of event stream definitions.\n */\nfunction eventSelector (selector, source, marks) {\n DEFAULT_SOURCE = source || VIEW;\n MARKS = marks || DEFAULT_MARKS;\n return parseMerge(selector.trim()).map(parseSelector);\n}\nfunction isMarkType(type) {\n return MARKS[type];\n}\nfunction find(s, i, endChar, pushChar, popChar) {\n const n = s.length;\n let count = 0,\n c;\n for (; i < n; ++i) {\n c = s[i];\n if (!count && c === endChar) return i;else if (popChar && popChar.indexOf(c) >= 0) --count;else if (pushChar && pushChar.indexOf(c) >= 0) ++count;\n }\n return i;\n}\nfunction parseMerge(s) {\n const output = [],\n n = s.length;\n let start = 0,\n i = 0;\n while (i < n) {\n i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE);\n output.push(s.substring(start, i).trim());\n start = ++i;\n }\n if (output.length === 0) {\n throw 'Empty event selector: ' + s;\n }\n return output;\n}\nfunction parseSelector(s) {\n return s[0] === '[' ? parseBetween(s) : parseStream(s);\n}\nfunction parseBetween(s) {\n const n = s.length;\n let i = 1,\n b;\n i = find(s, i, RBRACK, LBRACK, RBRACK);\n if (i === n) {\n throw 'Empty between selector: ' + s;\n }\n b = parseMerge(s.substring(1, i));\n if (b.length !== 2) {\n throw 'Between selector must have two elements: ' + s;\n }\n s = s.slice(i + 1).trim();\n if (s[0] !== GT) {\n throw 'Expected \\'>\\' after between selector: ' + s;\n }\n b = b.map(parseSelector);\n const stream = parseSelector(s.slice(1).trim());\n if (stream.between) {\n return {\n between: b,\n stream: stream\n };\n } else {\n stream.between = b;\n }\n return stream;\n}\nfunction parseStream(s) {\n const stream = {\n source: DEFAULT_SOURCE\n },\n source = [];\n let throttle = [0, 0],\n markname = 0,\n start = 0,\n n = s.length,\n i = 0,\n j,\n filter;\n\n // extract throttle from end\n if (s[n - 1] === RBRACE) {\n i = s.lastIndexOf(LBRACE);\n if (i >= 0) {\n try {\n throttle = parseThrottle(s.substring(i + 1, n - 1));\n } catch (e) {\n throw 'Invalid throttle specification: ' + s;\n }\n s = s.slice(0, i).trim();\n n = s.length;\n } else throw 'Unmatched right brace: ' + s;\n i = 0;\n }\n if (!n) throw s;\n\n // set name flag based on first char\n if (s[0] === NAME) markname = ++i;\n\n // extract first part of multi-part stream selector\n j = find(s, i, COLON);\n if (j < n) {\n source.push(s.substring(start, j).trim());\n start = i = ++j;\n }\n\n // extract remaining part of stream selector\n i = find(s, i, LBRACK);\n if (i === n) {\n source.push(s.substring(start, n).trim());\n } else {\n source.push(s.substring(start, i).trim());\n filter = [];\n start = ++i;\n if (start === n) throw 'Unmatched left bracket: ' + s;\n }\n\n // extract filters\n while (i < n) {\n i = find(s, i, RBRACK);\n if (i === n) throw 'Unmatched left bracket: ' + s;\n filter.push(s.substring(start, i).trim());\n if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s;\n start = ++i;\n }\n\n // marshall event stream specification\n if (!(n = source.length) || ILLEGAL.test(source[n - 1])) {\n throw 'Invalid event selector: ' + s;\n }\n if (n > 1) {\n stream.type = source[1];\n if (markname) {\n stream.markname = source[0].slice(1);\n } else if (isMarkType(source[0])) {\n stream.marktype = source[0];\n } else {\n stream.source = source[0];\n }\n } else {\n stream.type = source[0];\n }\n if (stream.type.slice(-1) === '!') {\n stream.consume = true;\n stream.type = stream.type.slice(0, -1);\n }\n if (filter != null) stream.filter = filter;\n if (throttle[0]) stream.throttle = throttle[0];\n if (throttle[1]) stream.debounce = throttle[1];\n return stream;\n}\nfunction parseThrottle(s) {\n const a = s.split(COMMA);\n if (!s.length || a.length > 2) throw s;\n return a.map(_ => {\n const x = +_;\n if (x !== x) throw s;\n return x;\n });\n}\n\nexport { eventSelector as parseSelector };\n","import { isObject, isArray, extend, hasOwnProperty, array, stringValue, peek, error, isString, splitAccessPath, mergeConfig } from 'vega-util';\nimport { parseExpression } from 'vega-functions';\nimport { parseSelector } from 'vega-event-selector';\nimport { isValidScaleType, isDiscrete, isQuantile, isContinuous, isDiscretizing } from 'vega-scale';\nimport { definition as definition$1 } from 'vega-dataflow';\n\nfunction parseAutosize (spec) {\n return isObject(spec) ? spec : {\n type: spec || 'pad'\n };\n}\n\nconst number = _ => +_ || 0;\nconst paddingObject = _ => ({\n top: _,\n bottom: _,\n left: _,\n right: _\n});\nfunction parsePadding (spec) {\n return !isObject(spec) ? paddingObject(number(spec)) : spec.signal ? spec : {\n top: number(spec.top),\n bottom: number(spec.bottom),\n left: number(spec.left),\n right: number(spec.right)\n };\n}\n\nconst encoder = _ => isObject(_) && !isArray(_) ? extend({}, _) : {\n value: _\n};\nfunction addEncode(object, name, value, set) {\n if (value != null) {\n const isEncoder = isObject(value) && !isArray(value) || isArray(value) && value.length && isObject(value[0]);\n\n // Always assign signal to update, even if the signal is from the enter block\n if (isEncoder) {\n object.update[name] = value;\n } else {\n object[set || 'enter'][name] = {\n value: value\n };\n }\n return 1;\n } else {\n return 0;\n }\n}\nfunction addEncoders(object, enter, update) {\n for (const name in enter) {\n addEncode(object, name, enter[name]);\n }\n for (const name in update) {\n addEncode(object, name, update[name], 'update');\n }\n}\nfunction extendEncode(encode, extra, skip) {\n for (const name in extra) {\n if (skip && hasOwnProperty(skip, name)) continue;\n encode[name] = extend(encode[name] || {}, extra[name]);\n }\n return encode;\n}\nfunction has(key, encode) {\n return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]);\n}\n\nconst MarkRole = 'mark';\nconst FrameRole = 'frame';\nconst ScopeRole = 'scope';\nconst AxisRole = 'axis';\nconst AxisDomainRole = 'axis-domain';\nconst AxisGridRole = 'axis-grid';\nconst AxisLabelRole = 'axis-label';\nconst AxisTickRole = 'axis-tick';\nconst AxisTitleRole = 'axis-title';\nconst LegendRole = 'legend';\nconst LegendBandRole = 'legend-band';\nconst LegendEntryRole = 'legend-entry';\nconst LegendGradientRole = 'legend-gradient';\nconst LegendLabelRole = 'legend-label';\nconst LegendSymbolRole = 'legend-symbol';\nconst LegendTitleRole = 'legend-title';\nconst TitleRole = 'title';\nconst TitleTextRole = 'title-text';\nconst TitleSubtitleRole = 'title-subtitle';\n\nfunction applyDefaults (encode, type, role, style, config) {\n const defaults = {},\n enter = {};\n let update, key, skip, props;\n\n // if text mark, apply global lineBreak settings (#2370)\n key = 'lineBreak';\n if (type === 'text' && config[key] != null && !has(key, encode)) {\n applyDefault(defaults, key, config[key]);\n }\n\n // ignore legend and axis roles\n if (role == 'legend' || String(role).startsWith('axis')) {\n role = null;\n }\n\n // resolve mark config\n props = role === FrameRole ? config.group : role === MarkRole ? extend({}, config.mark, config[type]) : null;\n for (key in props) {\n // do not apply defaults if relevant fields are defined\n skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode));\n if (!skip) applyDefault(defaults, key, props[key]);\n }\n\n // resolve styles, apply with increasing precedence\n array(style).forEach(name => {\n const props = config.style && config.style[name];\n for (const key in props) {\n if (!has(key, encode)) {\n applyDefault(defaults, key, props[key]);\n }\n }\n });\n encode = extend({}, encode); // defensive copy\n for (key in defaults) {\n props = defaults[key];\n if (props.signal) {\n (update = update || {})[key] = props;\n } else {\n enter[key] = props;\n }\n }\n encode.enter = extend(enter, encode.enter);\n if (update) encode.update = extend(update, encode.update);\n return encode;\n}\nfunction applyDefault(defaults, key, value) {\n defaults[key] = value && value.signal ? {\n signal: value.signal\n } : {\n value: value\n };\n}\n\nconst scaleRef = scale => isString(scale) ? stringValue(scale) : scale.signal ? `(${scale.signal})` : field(scale);\nfunction entry$1(enc) {\n if (enc.gradient != null) {\n return gradient(enc);\n }\n let value = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== undefined ? stringValue(enc.value) : undefined;\n if (enc.scale != null) {\n value = scale(enc, value);\n }\n if (value === undefined) {\n value = null;\n }\n if (enc.exponent != null) {\n value = `pow(${value},${property(enc.exponent)})`;\n }\n if (enc.mult != null) {\n value += `*${property(enc.mult)}`;\n }\n if (enc.offset != null) {\n value += `+${property(enc.offset)}`;\n }\n if (enc.round) {\n value = `round(${value})`;\n }\n return value;\n}\nconst _color = (type, x, y, z) => `(${type}(${[x, y, z].map(entry$1).join(',')})+'')`;\nfunction color(enc) {\n return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null;\n}\nfunction gradient(enc) {\n // map undefined to null; expression lang does not allow undefined\n const args = [enc.start, enc.stop, enc.count].map(_ => _ == null ? null : stringValue(_));\n\n // trim null inputs from the end\n while (args.length && peek(args) == null) args.pop();\n args.unshift(scaleRef(enc.gradient));\n return `gradient(${args.join(',')})`;\n}\nfunction property(property) {\n return isObject(property) ? '(' + entry$1(property) + ')' : property;\n}\nfunction field(ref) {\n return resolveField(isObject(ref) ? ref : {\n datum: ref\n });\n}\nfunction resolveField(ref) {\n let object, level, field;\n if (ref.signal) {\n object = 'datum';\n field = ref.signal;\n } else if (ref.group || ref.parent) {\n level = Math.max(1, ref.level || 1);\n object = 'item';\n while (level-- > 0) {\n object += '.mark.group';\n }\n if (ref.parent) {\n field = ref.parent;\n object += '.datum';\n } else {\n field = ref.group;\n }\n } else if (ref.datum) {\n object = 'datum';\n field = ref.datum;\n } else {\n error('Invalid field reference: ' + stringValue(ref));\n }\n if (!ref.signal) {\n field = isString(field) ? splitAccessPath(field).map(stringValue).join('][') : resolveField(field);\n }\n return object + '[' + field + ']';\n}\nfunction scale(enc, value) {\n const scale = scaleRef(enc.scale);\n if (enc.range != null) {\n // pull value from scale range\n value = `lerp(_range(${scale}), ${+enc.range})`;\n } else {\n // run value through scale and/or pull scale bandwidth\n if (value !== undefined) value = `_scale(${scale}, ${value})`;\n if (enc.band) {\n value = (value ? value + '+' : '') + `_bandwidth(${scale})` + (+enc.band === 1 ? '' : '*' + property(enc.band));\n if (enc.extra) {\n // include logic to handle extraneous elements\n value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`;\n }\n }\n if (value == null) value = '0';\n }\n return value;\n}\n\nfunction rule (enc) {\n let code = '';\n enc.forEach(rule => {\n const value = entry$1(rule);\n code += rule.test ? `(${rule.test})?${value}:` : value;\n });\n\n // if no else clause, terminate with null (#1366)\n if (peek(code) === ':') {\n code += 'null';\n }\n return code;\n}\n\nfunction parseEncode (encode, type, role, style, scope, params) {\n const enc = {};\n params = params || {};\n params.encoders = {\n $encode: enc\n };\n encode = applyDefaults(encode, type, role, style, scope.config);\n for (const key in encode) {\n enc[key] = parseBlock(encode[key], type, params, scope);\n }\n return params;\n}\nfunction parseBlock(block, marktype, params, scope) {\n const channels = {},\n fields = {};\n for (const name in block) {\n if (block[name] != null) {\n // skip any null entries\n channels[name] = parse$1(expr(block[name]), scope, params, fields);\n }\n }\n return {\n $expr: {\n marktype,\n channels\n },\n $fields: Object.keys(fields),\n $output: Object.keys(block)\n };\n}\nfunction expr(enc) {\n return isArray(enc) ? rule(enc) : entry$1(enc);\n}\nfunction parse$1(code, scope, params, fields) {\n const expr = parseExpression(code, scope);\n expr.$fields.forEach(name => fields[name] = 1);\n extend(params, expr.$params);\n return expr.$expr;\n}\n\nconst OUTER = 'outer',\n OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind'];\nfunction outerError(prefix, name) {\n error(prefix + ' for \"outer\" push: ' + stringValue(name));\n}\nfunction parseSignal (signal, scope) {\n const name = signal.name;\n if (signal.push === OUTER) {\n // signal must already be defined, raise error if not\n if (!scope.signals[name]) outerError('No prior signal definition', name);\n // signal push must not use properties reserved for standard definition\n OUTER_INVALID.forEach(prop => {\n if (signal[prop] !== undefined) outerError('Invalid property ', prop);\n });\n } else {\n // define a new signal in the current scope\n const op = scope.addSignal(name, signal.value);\n if (signal.react === false) op.react = false;\n if (signal.bind) scope.addBinding(name, signal.bind);\n }\n}\n\nfunction Entry(type, value, params, parent) {\n this.id = -1;\n this.type = type;\n this.value = value;\n this.params = params;\n if (parent) this.parent = parent;\n}\nfunction entry(type, value, params, parent) {\n return new Entry(type, value, params, parent);\n}\nfunction operator(value, params) {\n return entry('operator', value, params);\n}\n\n// -----\n\nfunction ref(op) {\n const ref = {\n $ref: op.id\n };\n // if operator not yet registered, cache ref to resolve later\n if (op.id < 0) (op.refs = op.refs || []).push(ref);\n return ref;\n}\nfunction fieldRef$1(field, name) {\n return name ? {\n $field: field,\n $name: name\n } : {\n $field: field\n };\n}\nconst keyFieldRef = fieldRef$1('key');\nfunction compareRef(fields, orders) {\n return {\n $compare: fields,\n $order: orders\n };\n}\nfunction keyRef(fields, flat) {\n const ref = {\n $key: fields\n };\n if (flat) ref.$flat = true;\n return ref;\n}\n\n// -----\n\nconst Ascending = 'ascending';\nconst Descending = 'descending';\nfunction sortKey(sort) {\n return !isObject(sort) ? '' : (sort.order === Descending ? '-' : '+') + aggrField(sort.op, sort.field);\n}\nfunction aggrField(op, field) {\n return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || '');\n}\n\n// -----\n\nconst Scope$1 = 'scope';\nconst View = 'view';\nfunction isSignal(_) {\n return _ && _.signal;\n}\nfunction isExpr$1(_) {\n return _ && _.expr;\n}\nfunction hasSignal(_) {\n if (isSignal(_)) return true;\n if (isObject(_)) for (const key in _) {\n if (hasSignal(_[key])) return true;\n }\n return false;\n}\nfunction value(specValue, defaultValue) {\n return specValue != null ? specValue : defaultValue;\n}\nfunction deref(v) {\n return v && v.signal || v;\n}\n\nconst Timer = 'timer';\nfunction parseStream(stream, scope) {\n const method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : error('Invalid stream specification: ' + stringValue(stream));\n return method(stream, scope);\n}\nfunction eventSource(source) {\n return source === Scope$1 ? View : source || View;\n}\nfunction mergeStream(stream, scope) {\n const list = stream.merge.map(s => parseStream(s, scope)),\n entry = streamParameters({\n merge: list\n }, stream, scope);\n return scope.addStream(entry).id;\n}\nfunction nestedStream(stream, scope) {\n const id = parseStream(stream.stream, scope),\n entry = streamParameters({\n stream: id\n }, stream, scope);\n return scope.addStream(entry).id;\n}\nfunction eventStream(stream, scope) {\n let id;\n if (stream.type === Timer) {\n id = scope.event(Timer, stream.throttle);\n stream = {\n between: stream.between,\n filter: stream.filter\n };\n } else {\n id = scope.event(eventSource(stream.source), stream.type);\n }\n const entry = streamParameters({\n stream: id\n }, stream, scope);\n return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id;\n}\nfunction streamParameters(entry, stream, scope) {\n let param = stream.between;\n if (param) {\n if (param.length !== 2) {\n error('Stream \"between\" parameter must have 2 entries: ' + stringValue(stream));\n }\n entry.between = [parseStream(param[0], scope), parseStream(param[1], scope)];\n }\n param = stream.filter ? [].concat(stream.filter) : [];\n if (stream.marktype || stream.markname || stream.markrole) {\n // add filter for mark type, name and/or role\n param.push(filterMark(stream.marktype, stream.markname, stream.markrole));\n }\n if (stream.source === Scope$1) {\n // add filter to limit events from sub-scope only\n param.push('inScope(event.item)');\n }\n if (param.length) {\n entry.filter = parseExpression('(' + param.join(')&&(') + ')', scope).$expr;\n }\n if ((param = stream.throttle) != null) {\n entry.throttle = +param;\n }\n if ((param = stream.debounce) != null) {\n entry.debounce = +param;\n }\n if (stream.consume) {\n entry.consume = true;\n }\n return entry;\n}\nfunction filterMark(type, name, role) {\n const item = 'event.item';\n return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\\'' + type + '\\'' : '') + (role ? '&&' + item + '.mark.role===\\'' + role + '\\'' : '') + (name ? '&&' + item + '.mark.name===\\'' + name + '\\'' : '');\n}\n\n// bypass expression parser for internal operator references\nconst OP_VALUE_EXPR = {\n code: '_.$value',\n ast: {\n type: 'Identifier',\n value: 'value'\n }\n};\nfunction parseUpdate (spec, scope, target) {\n const encode = spec.encode,\n entry = {\n target: target\n };\n let events = spec.events,\n update = spec.update,\n sources = [];\n if (!events) {\n error('Signal update missing events specification.');\n }\n\n // interpret as an event selector string\n if (isString(events)) {\n events = parseSelector(events, scope.isSubscope() ? Scope$1 : View);\n }\n\n // separate event streams from signal updates\n events = array(events).filter(s => s.signal || s.scale ? (sources.push(s), 0) : 1);\n\n // merge internal operator listeners\n if (sources.length > 1) {\n sources = [mergeSources(sources)];\n }\n\n // merge event streams, include as source\n if (events.length) {\n sources.push(events.length > 1 ? {\n merge: events\n } : events[0]);\n }\n if (encode != null) {\n if (update) error('Signal encode and update are mutually exclusive.');\n update = 'encode(item(),' + stringValue(encode) + ')';\n }\n\n // resolve update value\n entry.update = isString(update) ? parseExpression(update, scope) : update.expr != null ? parseExpression(update.expr, scope) : update.value != null ? update.value : update.signal != null ? {\n $expr: OP_VALUE_EXPR,\n $params: {\n $value: scope.signalRef(update.signal)\n }\n } : error('Invalid signal update specification.');\n if (spec.force) {\n entry.options = {\n force: true\n };\n }\n sources.forEach(source => scope.addUpdate(extend(streamSource(source, scope), entry)));\n}\nfunction streamSource(stream, scope) {\n return {\n source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream(stream, scope)\n };\n}\nfunction mergeSources(sources) {\n return {\n signal: '[' + sources.map(s => s.scale ? 'scale(\"' + s.scale + '\")' : s.signal) + ']'\n };\n}\n\nfunction parseSignalUpdates (signal, scope) {\n const op = scope.getSignal(signal.name);\n let expr = signal.update;\n if (signal.init) {\n if (expr) {\n error('Signals can not include both init and update expressions.');\n } else {\n expr = signal.init;\n op.initonly = true;\n }\n }\n if (expr) {\n expr = parseExpression(expr, scope);\n op.update = expr.$expr;\n op.params = expr.$params;\n }\n if (signal.on) {\n signal.on.forEach(_ => parseUpdate(_, scope, op.id));\n }\n}\n\nconst transform = name => (params, value, parent) => entry(name, value, params || undefined, parent);\nconst Aggregate = transform('aggregate');\nconst AxisTicks = transform('axisticks');\nconst Bound = transform('bound');\nconst Collect = transform('collect');\nconst Compare = transform('compare');\nconst DataJoin = transform('datajoin');\nconst Encode = transform('encode');\nconst Expression = transform('expression');\nconst Facet = transform('facet');\nconst Field = transform('field');\nconst Key = transform('key');\nconst LegendEntries = transform('legendentries');\nconst Load = transform('load');\nconst Mark = transform('mark');\nconst MultiExtent = transform('multiextent');\nconst MultiValues = transform('multivalues');\nconst Overlap = transform('overlap');\nconst Params = transform('params');\nconst PreFacet = transform('prefacet');\nconst Projection = transform('projection');\nconst Proxy = transform('proxy');\nconst Relay = transform('relay');\nconst Render = transform('render');\nconst Scale = transform('scale');\nconst Sieve = transform('sieve');\nconst SortItems = transform('sortitems');\nconst ViewLayout = transform('viewlayout');\nconst Values = transform('values');\n\nlet FIELD_REF_ID = 0;\nconst MULTIDOMAIN_SORT_OPS = {\n min: 'min',\n max: 'max',\n count: 'sum'\n};\nfunction initScale(spec, scope) {\n const type = spec.type || 'linear';\n if (!isValidScaleType(type)) {\n error('Unrecognized scale type: ' + stringValue(type));\n }\n scope.addScale(spec.name, {\n type,\n domain: undefined\n });\n}\nfunction parseScale(spec, scope) {\n const params = scope.getScale(spec.name).params;\n let key;\n params.domain = parseScaleDomain(spec.domain, spec, scope);\n if (spec.range != null) {\n params.range = parseScaleRange(spec, scope, params);\n }\n if (spec.interpolate != null) {\n parseScaleInterpolate(spec.interpolate, params);\n }\n if (spec.nice != null) {\n params.nice = parseScaleNice(spec.nice);\n }\n if (spec.bins != null) {\n params.bins = parseScaleBins(spec.bins, scope);\n }\n for (key in spec) {\n if (hasOwnProperty(params, key) || key === 'name') continue;\n params[key] = parseLiteral(spec[key], scope);\n }\n}\nfunction parseLiteral(v, scope) {\n return !isObject(v) ? v : v.signal ? scope.signalRef(v.signal) : error('Unsupported object: ' + stringValue(v));\n}\nfunction parseArray(v, scope) {\n return v.signal ? scope.signalRef(v.signal) : v.map(v => parseLiteral(v, scope));\n}\nfunction dataLookupError(name) {\n error('Can not find data set: ' + stringValue(name));\n}\n\n// -- SCALE DOMAIN ----\n\nfunction parseScaleDomain(domain, spec, scope) {\n if (!domain) {\n if (spec.domainMin != null || spec.domainMax != null) {\n error('No scale domain defined for domainMin/domainMax to override.');\n }\n return; // default domain\n }\n\n return domain.signal ? scope.signalRef(domain.signal) : (isArray(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope);\n}\nfunction explicitDomain(domain, spec, scope) {\n return domain.map(v => parseLiteral(v, scope));\n}\nfunction singularDomain(domain, spec, scope) {\n const data = scope.getData(domain.data);\n if (!data) dataLookupError(domain.data);\n return isDiscrete(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : isQuantile(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field);\n}\nfunction multipleDomain(domain, spec, scope) {\n const data = domain.data,\n fields = domain.fields.reduce((dom, d) => {\n d = isString(d) ? {\n data: data,\n field: d\n } : isArray(d) || d.signal ? fieldRef(d, scope) : d;\n dom.push(d);\n return dom;\n }, []);\n return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields);\n}\nfunction fieldRef(data, scope) {\n const name = '_:vega:_' + FIELD_REF_ID++,\n coll = Collect({});\n if (isArray(data)) {\n coll.value = {\n $ingest: data\n };\n } else if (data.signal) {\n const code = 'setdata(' + stringValue(name) + ',' + data.signal + ')';\n coll.params.input = scope.signalRef(code);\n }\n scope.addDataPipeline(name, [coll, Sieve({})]);\n return {\n data: name,\n field: 'data'\n };\n}\nfunction ordinalMultipleDomain(domain, scope, fields) {\n const sort = parseSort(domain.sort, true);\n let a, v;\n\n // get value counts for each domain field\n const counts = fields.map(f => {\n const data = scope.getData(f.data);\n if (!data) dataLookupError(f.data);\n return data.countsRef(scope, f.field, sort);\n });\n\n // aggregate the results from each domain field\n const p = {\n groupby: keyFieldRef,\n pulse: counts\n };\n if (sort) {\n a = sort.op || 'count';\n v = sort.field ? aggrField(a, sort.field) : 'count';\n p.ops = [MULTIDOMAIN_SORT_OPS[a]];\n p.fields = [scope.fieldRef(v)];\n p.as = [v];\n }\n a = scope.add(Aggregate(p));\n\n // collect aggregate output\n const c = scope.add(Collect({\n pulse: ref(a)\n }));\n\n // extract values for combined domain\n v = scope.add(Values({\n field: keyFieldRef,\n sort: scope.sortRef(sort),\n pulse: ref(c)\n }));\n return ref(v);\n}\nfunction parseSort(sort, multidomain) {\n if (sort) {\n if (!sort.field && !sort.op) {\n if (isObject(sort)) sort.field = 'key';else sort = {\n field: 'key'\n };\n } else if (!sort.field && sort.op !== 'count') {\n error('No field provided for sort aggregate op: ' + sort.op);\n } else if (multidomain && sort.field) {\n if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) {\n error('Multiple domain scales can not be sorted using ' + sort.op);\n }\n }\n }\n return sort;\n}\nfunction quantileMultipleDomain(domain, scope, fields) {\n // get value arrays for each domain field\n const values = fields.map(f => {\n const data = scope.getData(f.data);\n if (!data) dataLookupError(f.data);\n return data.domainRef(scope, f.field);\n });\n\n // combine value arrays\n return ref(scope.add(MultiValues({\n values: values\n })));\n}\nfunction numericMultipleDomain(domain, scope, fields) {\n // get extents for each domain field\n const extents = fields.map(f => {\n const data = scope.getData(f.data);\n if (!data) dataLookupError(f.data);\n return data.extentRef(scope, f.field);\n });\n\n // combine extents\n return ref(scope.add(MultiExtent({\n extents: extents\n })));\n}\n\n// -- SCALE BINS -----\n\nfunction parseScaleBins(v, scope) {\n return v.signal || isArray(v) ? parseArray(v, scope) : scope.objectProperty(v);\n}\n\n// -- SCALE NICE -----\n\nfunction parseScaleNice(nice) {\n return isObject(nice) ? {\n interval: parseLiteral(nice.interval),\n step: parseLiteral(nice.step)\n } : parseLiteral(nice);\n}\n\n// -- SCALE INTERPOLATION -----\n\nfunction parseScaleInterpolate(interpolate, params) {\n params.interpolate = parseLiteral(interpolate.type || interpolate);\n if (interpolate.gamma != null) {\n params.interpolateGamma = parseLiteral(interpolate.gamma);\n }\n}\n\n// -- SCALE RANGE -----\n\nfunction parseScaleRange(spec, scope, params) {\n const config = scope.config.range;\n let range = spec.range;\n if (range.signal) {\n return scope.signalRef(range.signal);\n } else if (isString(range)) {\n if (config && hasOwnProperty(config, range)) {\n spec = extend({}, spec, {\n range: config[range]\n });\n return parseScaleRange(spec, scope, params);\n } else if (range === 'width') {\n range = [0, {\n signal: 'width'\n }];\n } else if (range === 'height') {\n range = isDiscrete(spec.type) ? [0, {\n signal: 'height'\n }] : [{\n signal: 'height'\n }, 0];\n } else {\n error('Unrecognized scale range value: ' + stringValue(range));\n }\n } else if (range.scheme) {\n params.scheme = isArray(range.scheme) ? parseArray(range.scheme, scope) : parseLiteral(range.scheme, scope);\n if (range.extent) params.schemeExtent = parseArray(range.extent, scope);\n if (range.count) params.schemeCount = parseLiteral(range.count, scope);\n return;\n } else if (range.step) {\n params.rangeStep = parseLiteral(range.step, scope);\n return;\n } else if (isDiscrete(spec.type) && !isArray(range)) {\n return parseScaleDomain(range, spec, scope);\n } else if (!isArray(range)) {\n error('Unsupported range type: ' + stringValue(range));\n }\n return range.map(v => (isArray(v) ? parseArray : parseLiteral)(v, scope));\n}\n\nfunction parseProjection (proj, scope) {\n const config = scope.config.projection || {},\n params = {};\n for (const name in proj) {\n if (name === 'name') continue;\n params[name] = parseParameter$1(proj[name], name, scope);\n }\n\n // apply projection defaults from config\n for (const name in config) {\n if (params[name] == null) {\n params[name] = parseParameter$1(config[name], name, scope);\n }\n }\n scope.addProjection(proj.name, params);\n}\nfunction parseParameter$1(_, name, scope) {\n return isArray(_) ? _.map(_ => parseParameter$1(_, name, scope)) : !isObject(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : error('Unsupported parameter object: ' + stringValue(_));\n}\n\nconst Top = 'top';\nconst Left = 'left';\nconst Right = 'right';\nconst Bottom = 'bottom';\nconst Center = 'center';\nconst Vertical = 'vertical';\nconst Start = 'start';\nconst Middle = 'middle';\nconst End = 'end';\nconst Index = 'index';\nconst Label = 'label';\nconst Offset = 'offset';\nconst Perc = 'perc';\nconst Perc2 = 'perc2';\nconst Value = 'value';\nconst GuideLabelStyle = 'guide-label';\nconst GuideTitleStyle = 'guide-title';\nconst GroupTitleStyle = 'group-title';\nconst GroupSubtitleStyle = 'group-subtitle';\nconst Symbols = 'symbol';\nconst Gradient = 'gradient';\nconst Discrete = 'discrete';\nconst Size = 'size';\nconst Shape = 'shape';\nconst Fill = 'fill';\nconst Stroke = 'stroke';\nconst StrokeWidth = 'strokeWidth';\nconst StrokeDash = 'strokeDash';\nconst Opacity = 'opacity';\n\n// Encoding channels supported by legends\n// In priority order of 'canonical' scale\nconst LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity];\nconst Skip = {\n name: 1,\n style: 1,\n interactive: 1\n};\nconst zero = {\n value: 0\n};\nconst one = {\n value: 1\n};\n\nconst GroupMark = 'group';\nconst RectMark = 'rect';\nconst RuleMark = 'rule';\nconst SymbolMark = 'symbol';\nconst TextMark = 'text';\n\nfunction guideGroup (mark) {\n mark.type = GroupMark;\n mark.interactive = mark.interactive || false;\n return mark;\n}\n\nfunction lookup(spec, config) {\n const _ = (name, dflt) => value(spec[name], value(config[name], dflt));\n _.isVertical = s => Vertical === value(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection));\n _.gradientLength = () => value(spec.gradientLength, config.gradientLength || config.gradientWidth);\n _.gradientThickness = () => value(spec.gradientThickness, config.gradientThickness || config.gradientHeight);\n _.entryColumns = () => value(spec.columns, value(config.columns, +_.isVertical(true)));\n return _;\n}\nfunction getEncoding(name, encode) {\n const v = encode && (encode.update && encode.update[name] || encode.enter && encode.enter[name]);\n return v && v.signal ? v : v ? v.value : null;\n}\nfunction getStyle(name, scope, style) {\n const s = scope.config.style[style];\n return s && s[name];\n}\nfunction anchorExpr(s, e, m) {\n return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m}`;\n}\nconst alignExpr$1 = anchorExpr(stringValue(Left), stringValue(Right), stringValue(Center));\nfunction tickBand(_) {\n const v = _('tickBand');\n let offset = _('tickOffset'),\n band,\n extra;\n if (!v) {\n // if no tick band entry, fall back on other properties\n band = _('bandPosition');\n extra = _('tickExtra');\n } else if (v.signal) {\n // if signal, augment code to interpret values\n band = {\n signal: `(${v.signal}) === 'extent' ? 1 : 0.5`\n };\n extra = {\n signal: `(${v.signal}) === 'extent'`\n };\n if (!isObject(offset)) {\n offset = {\n signal: `(${v.signal}) === 'extent' ? 0 : ${offset}`\n };\n }\n } else if (v === 'extent') {\n // if constant, simply set values\n band = 1;\n extra = true;\n offset = 0;\n } else {\n band = 0.5;\n extra = false;\n }\n return {\n extra,\n band,\n offset\n };\n}\nfunction extendOffset(value, offset) {\n return !offset ? value : !value ? offset : !isObject(value) ? {\n value,\n offset\n } : Object.assign({}, value, {\n offset: extendOffset(value.offset, offset)\n });\n}\n\nfunction guideMark (mark, extras) {\n if (extras) {\n mark.name = extras.name;\n mark.style = extras.style || mark.style;\n mark.interactive = !!extras.interactive;\n mark.encode = extendEncode(mark.encode, extras, Skip);\n } else {\n mark.interactive = false;\n }\n return mark;\n}\n\nfunction legendGradient (spec, scale, config, userEncode) {\n const _ = lookup(spec, config),\n vertical = _.isVertical(),\n thickness = _.gradientThickness(),\n length = _.gradientLength();\n let enter, start, stop, width, height;\n if (vertical) {\n start = [0, 1];\n stop = [0, 0];\n width = thickness;\n height = length;\n } else {\n start = [0, 0];\n stop = [1, 0];\n width = length;\n height = thickness;\n }\n const encode = {\n enter: enter = {\n opacity: zero,\n x: zero,\n y: zero,\n width: encoder(width),\n height: encoder(height)\n },\n update: extend({}, enter, {\n opacity: one,\n fill: {\n gradient: scale,\n start: start,\n stop: stop\n }\n }),\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n stroke: _('gradientStrokeColor'),\n strokeWidth: _('gradientStrokeWidth')\n }, {\n // update\n opacity: _('gradientOpacity')\n });\n return guideMark({\n type: RectMark,\n role: LegendGradientRole,\n encode\n }, userEncode);\n}\n\nfunction legendGradientDiscrete (spec, scale, config, userEncode, dataRef) {\n const _ = lookup(spec, config),\n vertical = _.isVertical(),\n thickness = _.gradientThickness(),\n length = _.gradientLength();\n let u,\n v,\n uu,\n vv,\n adjust = '';\n vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height');\n const enter = {\n opacity: zero,\n fill: {\n scale: scale,\n field: Value\n }\n };\n enter[u] = {\n signal: adjust + 'datum.' + Perc,\n mult: length\n };\n enter[v] = zero;\n enter[uu] = {\n signal: adjust + 'datum.' + Perc2,\n mult: length\n };\n enter[vv] = encoder(thickness);\n const encode = {\n enter: enter,\n update: extend({}, enter, {\n opacity: one\n }),\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n stroke: _('gradientStrokeColor'),\n strokeWidth: _('gradientStrokeWidth')\n }, {\n // update\n opacity: _('gradientOpacity')\n });\n return guideMark({\n type: RectMark,\n role: LegendBandRole,\n key: Value,\n from: dataRef,\n encode\n }, userEncode);\n}\n\nconst alignExpr = `datum.${Perc}<=0?\"${Left}\":datum.${Perc}>=1?\"${Right}\":\"${Center}\"`,\n baselineExpr = `datum.${Perc}<=0?\"${Bottom}\":datum.${Perc}>=1?\"${Top}\":\"${Middle}\"`;\nfunction legendGradientLabels (spec, config, userEncode, dataRef) {\n const _ = lookup(spec, config),\n vertical = _.isVertical(),\n thickness = encoder(_.gradientThickness()),\n length = _.gradientLength();\n let overlap = _('labelOverlap'),\n enter,\n update,\n u,\n v,\n adjust = '';\n const encode = {\n enter: enter = {\n opacity: zero\n },\n update: update = {\n opacity: one,\n text: {\n field: Label\n }\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n fill: _('labelColor'),\n fillOpacity: _('labelOpacity'),\n font: _('labelFont'),\n fontSize: _('labelFontSize'),\n fontStyle: _('labelFontStyle'),\n fontWeight: _('labelFontWeight'),\n limit: value(spec.labelLimit, config.gradientLabelLimit)\n });\n if (vertical) {\n enter.align = {\n value: 'left'\n };\n enter.baseline = update.baseline = {\n signal: baselineExpr\n };\n u = 'y';\n v = 'x';\n adjust = '1-';\n } else {\n enter.align = update.align = {\n signal: alignExpr\n };\n enter.baseline = {\n value: 'top'\n };\n u = 'x';\n v = 'y';\n }\n enter[u] = update[u] = {\n signal: adjust + 'datum.' + Perc,\n mult: length\n };\n enter[v] = update[v] = thickness;\n thickness.offset = value(spec.labelOffset, config.gradientLabelOffset) || 0;\n overlap = overlap ? {\n separation: _('labelSeparation'),\n method: overlap,\n order: 'datum.' + Index\n } : undefined;\n\n // type, role, style, key, dataRef, encode, extras\n return guideMark({\n type: TextMark,\n role: LegendLabelRole,\n style: GuideLabelStyle,\n key: Value,\n from: dataRef,\n encode,\n overlap\n }, userEncode);\n}\n\n// userEncode is top-level, includes entries, symbols, labels\nfunction legendSymbolGroups (spec, config, userEncode, dataRef, columns) {\n const _ = lookup(spec, config),\n entries = userEncode.entries,\n interactive = !!(entries && entries.interactive),\n name = entries ? entries.name : undefined,\n height = _('clipHeight'),\n symbolOffset = _('symbolOffset'),\n valueRef = {\n data: 'value'\n },\n xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`,\n yEncode = height ? encoder(height) : {\n field: Size\n },\n index = `datum.${Index}`,\n ncols = `max(1, ${columns})`;\n let encode, enter, update, nrows, sort;\n yEncode.mult = 0.5;\n\n // -- LEGEND SYMBOLS --\n encode = {\n enter: enter = {\n opacity: zero,\n x: {\n signal: xSignal,\n mult: 0.5,\n offset: symbolOffset\n },\n y: yEncode\n },\n update: update = {\n opacity: one,\n x: enter.x,\n y: enter.y\n },\n exit: {\n opacity: zero\n }\n };\n let baseFill = null,\n baseStroke = null;\n if (!spec.fill) {\n baseFill = config.symbolBaseFillColor;\n baseStroke = config.symbolBaseStrokeColor;\n }\n addEncoders(encode, {\n fill: _('symbolFillColor', baseFill),\n shape: _('symbolType'),\n size: _('symbolSize'),\n stroke: _('symbolStrokeColor', baseStroke),\n strokeDash: _('symbolDash'),\n strokeDashOffset: _('symbolDashOffset'),\n strokeWidth: _('symbolStrokeWidth')\n }, {\n // update\n opacity: _('symbolOpacity')\n });\n LegendScales.forEach(scale => {\n if (spec[scale]) {\n update[scale] = enter[scale] = {\n scale: spec[scale],\n field: Value\n };\n }\n });\n const symbols = guideMark({\n type: SymbolMark,\n role: LegendSymbolRole,\n key: Value,\n from: valueRef,\n clip: height ? true : undefined,\n encode\n }, userEncode.symbols);\n\n // -- LEGEND LABELS --\n const labelOffset = encoder(symbolOffset);\n labelOffset.offset = _('labelOffset');\n encode = {\n enter: enter = {\n opacity: zero,\n x: {\n signal: xSignal,\n offset: labelOffset\n },\n y: yEncode\n },\n update: update = {\n opacity: one,\n text: {\n field: Label\n },\n x: enter.x,\n y: enter.y\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n align: _('labelAlign'),\n baseline: _('labelBaseline'),\n fill: _('labelColor'),\n fillOpacity: _('labelOpacity'),\n font: _('labelFont'),\n fontSize: _('labelFontSize'),\n fontStyle: _('labelFontStyle'),\n fontWeight: _('labelFontWeight'),\n limit: _('labelLimit')\n });\n const labels = guideMark({\n type: TextMark,\n role: LegendLabelRole,\n style: GuideLabelStyle,\n key: Value,\n from: valueRef,\n encode\n }, userEncode.labels);\n\n // -- LEGEND ENTRY GROUPS --\n encode = {\n enter: {\n noBound: {\n value: !height\n },\n // ignore width/height in bounds calc\n width: zero,\n height: height ? encoder(height) : zero,\n opacity: zero\n },\n exit: {\n opacity: zero\n },\n update: update = {\n opacity: one,\n row: {\n signal: null\n },\n column: {\n signal: null\n }\n }\n };\n\n // annotate and sort groups to ensure correct ordering\n if (_.isVertical(true)) {\n nrows = `ceil(item.mark.items.length / ${ncols})`;\n update.row.signal = `${index}%${nrows}`;\n update.column.signal = `floor(${index} / ${nrows})`;\n sort = {\n field: ['row', index]\n };\n } else {\n update.row.signal = `floor(${index} / ${ncols})`;\n update.column.signal = `${index} % ${ncols}`;\n sort = {\n field: index\n };\n }\n // handle zero column case (implies infinite columns)\n update.column.signal = `(${columns})?${update.column.signal}:${index}`;\n\n // facet legend entries into sub-groups\n dataRef = {\n facet: {\n data: dataRef,\n name: 'value',\n groupby: Index\n }\n };\n return guideGroup({\n role: ScopeRole,\n from: dataRef,\n encode: extendEncode(encode, entries, Skip),\n marks: [symbols, labels],\n name,\n interactive,\n sort\n });\n}\nfunction legendSymbolLayout(spec, config) {\n const _ = lookup(spec, config);\n\n // layout parameters for legend entries\n return {\n align: _('gridAlign'),\n columns: _.entryColumns(),\n center: {\n row: true,\n column: false\n },\n padding: {\n row: _('rowPadding'),\n column: _('columnPadding')\n }\n };\n}\n\n// expression logic for align, anchor, angle, and baseline calculation\nconst isL = 'item.orient === \"left\"',\n isR = 'item.orient === \"right\"',\n isLR = `(${isL} || ${isR})`,\n isVG = `datum.vgrad && ${isLR}`,\n baseline = anchorExpr('\"top\"', '\"bottom\"', '\"middle\"'),\n alignFlip = anchorExpr('\"right\"', '\"left\"', '\"center\"'),\n exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? \"left\" : ${alignExpr$1}`,\n exprAnchor = `item._anchor || (${isLR} ? \"middle\" : \"start\")`,\n exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`,\n exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? \"bottom\" : \"top\") : ${baseline}) : \"top\"`;\nfunction legendTitle (spec, config, userEncode, dataRef) {\n const _ = lookup(spec, config);\n const encode = {\n enter: {\n opacity: zero\n },\n update: {\n opacity: one,\n x: {\n field: {\n group: 'padding'\n }\n },\n y: {\n field: {\n group: 'padding'\n }\n }\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n orient: _('titleOrient'),\n _anchor: _('titleAnchor'),\n anchor: {\n signal: exprAnchor\n },\n angle: {\n signal: exprAngle\n },\n align: {\n signal: exprAlign\n },\n baseline: {\n signal: exprBaseline\n },\n text: spec.title,\n fill: _('titleColor'),\n fillOpacity: _('titleOpacity'),\n font: _('titleFont'),\n fontSize: _('titleFontSize'),\n fontStyle: _('titleFontStyle'),\n fontWeight: _('titleFontWeight'),\n limit: _('titleLimit'),\n lineHeight: _('titleLineHeight')\n }, {\n // require update\n align: _('titleAlign'),\n baseline: _('titleBaseline')\n });\n return guideMark({\n type: TextMark,\n role: LegendTitleRole,\n style: GuideTitleStyle,\n from: dataRef,\n encode\n }, userEncode);\n}\n\nfunction clip (clip, scope) {\n let expr;\n if (isObject(clip)) {\n if (clip.signal) {\n expr = clip.signal;\n } else if (clip.path) {\n expr = 'pathShape(' + param(clip.path) + ')';\n } else if (clip.sphere) {\n expr = 'geoShape(' + param(clip.sphere) + ', {type: \"Sphere\"})';\n }\n }\n return expr ? scope.signalRef(expr) : !!clip;\n}\nfunction param(value) {\n return isObject(value) && value.signal ? value.signal : stringValue(value);\n}\n\nfunction getRole (spec) {\n const role = spec.role || '';\n return !role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title') ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole;\n}\n\nfunction definition (spec) {\n return {\n marktype: spec.type,\n name: spec.name || undefined,\n role: spec.role || getRole(spec),\n zindex: +spec.zindex || undefined,\n aria: spec.aria,\n description: spec.description\n };\n}\n\nfunction interactive (spec, scope) {\n return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true;\n}\n\n/**\n * Parse a data transform specification.\n */\nfunction parseTransform (spec, scope) {\n const def = definition$1(spec.type);\n if (!def) error('Unrecognized transform type: ' + stringValue(spec.type));\n const t = entry(def.type.toLowerCase(), null, parseParameters(def, spec, scope));\n if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t));\n t.metadata = def.metadata || {};\n return t;\n}\n\n/**\n * Parse all parameters of a data transform.\n */\nfunction parseParameters(def, spec, scope) {\n const params = {},\n n = def.params.length;\n for (let i = 0; i < n; ++i) {\n const pdef = def.params[i];\n params[pdef.name] = parseParameter(pdef, spec, scope);\n }\n return params;\n}\n\n/**\n * Parse a data transform parameter.\n */\nfunction parseParameter(def, spec, scope) {\n const type = def.type,\n value = spec[def.name];\n if (type === 'index') {\n return parseIndexParameter(def, spec, scope);\n } else if (value === undefined) {\n if (def.required) {\n error('Missing required ' + stringValue(spec.type) + ' parameter: ' + stringValue(def.name));\n }\n return;\n } else if (type === 'param') {\n return parseSubParameters(def, spec, scope);\n } else if (type === 'projection') {\n return scope.projectionRef(spec[def.name]);\n }\n return def.array && !isSignal(value) ? value.map(v => parameterValue(def, v, scope)) : parameterValue(def, value, scope);\n}\n\n/**\n * Parse a single parameter value.\n */\nfunction parameterValue(def, value, scope) {\n const type = def.type;\n if (isSignal(value)) {\n return isExpr(type) ? error('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal);\n } else {\n const expr = def.expr || isField(type);\n return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef$1(value.field, value.as) : isExpr(type) ? parseExpression(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef$1(value) : isCompare(type) ? scope.compareRef(value) : value;\n }\n}\n\n/**\n * Parse parameter for accessing an index of another data set.\n */\nfunction parseIndexParameter(def, spec, scope) {\n if (!isString(spec.from)) {\n error('Lookup \"from\" parameter must be a string literal.');\n }\n return scope.getData(spec.from).lookupRef(scope, spec.key);\n}\n\n/**\n * Parse a parameter that contains one or more sub-parameter objects.\n */\nfunction parseSubParameters(def, spec, scope) {\n const value = spec[def.name];\n if (def.array) {\n if (!isArray(value)) {\n // signals not allowed!\n error('Expected an array of sub-parameters. Instead: ' + stringValue(value));\n }\n return value.map(v => parseSubParameter(def, v, scope));\n } else {\n return parseSubParameter(def, value, scope);\n }\n}\n\n/**\n * Parse a sub-parameter object.\n */\nfunction parseSubParameter(def, value, scope) {\n const n = def.params.length;\n let pdef;\n\n // loop over defs to find matching key\n for (let i = 0; i < n; ++i) {\n pdef = def.params[i];\n for (const k in pdef.key) {\n if (pdef.key[k] !== value[k]) {\n pdef = null;\n break;\n }\n }\n if (pdef) break;\n }\n // raise error if matching key not found\n if (!pdef) error('Unsupported parameter: ' + stringValue(value));\n\n // parse params, create Params transform, return ref\n const params = extend(parseParameters(pdef, value, scope), pdef.key);\n return ref(scope.add(Params(params)));\n}\n\n// -- Utilities -----\n\nconst outerExpr = _ => _ && _.expr;\nconst outerField = _ => _ && _.field;\nconst isData = _ => _ === 'data';\nconst isExpr = _ => _ === 'expr';\nconst isField = _ => _ === 'field';\nconst isCompare = _ => _ === 'compare';\n\nfunction parseData$1 (from, group, scope) {\n let facet, key, op, dataRef, parent;\n\n // if no source data, generate singleton datum\n if (!from) {\n dataRef = ref(scope.add(Collect(null, [{}])));\n }\n\n // if faceted, process facet specification\n else if (facet = from.facet) {\n if (!group) error('Only group marks can be faceted.');\n\n // use pre-faceted source data, if available\n if (facet.field != null) {\n dataRef = parent = getDataRef(facet, scope);\n } else {\n // generate facet aggregates if no direct data specification\n if (!from.data) {\n op = parseTransform(extend({\n type: 'aggregate',\n groupby: array(facet.groupby)\n }, facet.aggregate), scope);\n op.params.key = scope.keyRef(facet.groupby);\n op.params.pulse = getDataRef(facet, scope);\n dataRef = parent = ref(scope.add(op));\n } else {\n parent = ref(scope.getData(from.data).aggregate);\n }\n key = scope.keyRef(facet.groupby, true);\n }\n }\n\n // if not yet defined, get source data reference\n if (!dataRef) {\n dataRef = getDataRef(from, scope);\n }\n return {\n key: key,\n pulse: dataRef,\n parent: parent\n };\n}\nfunction getDataRef(from, scope) {\n return from.$ref ? from : from.data && from.data.$ref ? from.data : ref(scope.getData(from.data).output);\n}\n\nfunction DataScope(scope, input, output, values, aggr) {\n this.scope = scope; // parent scope object\n this.input = input; // first operator in pipeline (tuple input)\n this.output = output; // last operator in pipeline (tuple output)\n this.values = values; // operator for accessing tuples (but not tuple flow)\n\n // last aggregate in transform pipeline\n this.aggregate = aggr;\n\n // lookup table of field indices\n this.index = {};\n}\nDataScope.fromEntries = function (scope, entries) {\n const n = entries.length,\n values = entries[n - 1],\n output = entries[n - 2];\n let input = entries[0],\n aggr = null,\n i = 1;\n if (input && input.type === 'load') {\n input = entries[1];\n }\n\n // add operator entries to this scope, wire up pulse chain\n scope.add(entries[0]);\n for (; i < n; ++i) {\n entries[i].params.pulse = ref(entries[i - 1]);\n scope.add(entries[i]);\n if (entries[i].type === 'aggregate') aggr = entries[i];\n }\n return new DataScope(scope, input, output, values, aggr);\n};\nfunction fieldKey(field) {\n return isString(field) ? field : null;\n}\nfunction addSortField(scope, p, sort) {\n const as = aggrField(sort.op, sort.field);\n let s;\n if (p.ops) {\n for (let i = 0, n = p.as.length; i < n; ++i) {\n if (p.as[i] === as) return;\n }\n } else {\n p.ops = ['count'];\n p.fields = [null];\n p.as = ['count'];\n }\n if (sort.op) {\n p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op);\n p.fields.push(scope.fieldRef(sort.field));\n p.as.push(as);\n }\n}\nfunction cache(scope, ds, name, optype, field, counts, index) {\n const cache = ds[name] || (ds[name] = {}),\n sort = sortKey(counts);\n let k = fieldKey(field),\n v,\n op;\n if (k != null) {\n scope = ds.scope;\n k = k + (sort ? '|' + sort : '');\n v = cache[k];\n }\n if (!v) {\n const params = counts ? {\n field: keyFieldRef,\n pulse: ds.countsRef(scope, field, counts)\n } : {\n field: scope.fieldRef(field),\n pulse: ref(ds.output)\n };\n if (sort) params.sort = scope.sortRef(counts);\n op = scope.add(entry(optype, undefined, params));\n if (index) ds.index[field] = op;\n v = ref(op);\n if (k != null) cache[k] = v;\n }\n return v;\n}\nDataScope.prototype = {\n countsRef(scope, field, sort) {\n const ds = this,\n cache = ds.counts || (ds.counts = {}),\n k = fieldKey(field);\n let v, a, p;\n if (k != null) {\n scope = ds.scope;\n v = cache[k];\n }\n if (!v) {\n p = {\n groupby: scope.fieldRef(field, 'key'),\n pulse: ref(ds.output)\n };\n if (sort && sort.field) addSortField(scope, p, sort);\n a = scope.add(Aggregate(p));\n v = scope.add(Collect({\n pulse: ref(a)\n }));\n v = {\n agg: a,\n ref: ref(v)\n };\n if (k != null) cache[k] = v;\n } else if (sort && sort.field) {\n addSortField(scope, v.agg.params, sort);\n }\n return v.ref;\n },\n tuplesRef() {\n return ref(this.values);\n },\n extentRef(scope, field) {\n return cache(scope, this, 'extent', 'extent', field, false);\n },\n domainRef(scope, field) {\n return cache(scope, this, 'domain', 'values', field, false);\n },\n valuesRef(scope, field, sort) {\n return cache(scope, this, 'vals', 'values', field, sort || true);\n },\n lookupRef(scope, field) {\n return cache(scope, this, 'lookup', 'tupleindex', field, false);\n },\n indataRef(scope, field) {\n return cache(scope, this, 'indata', 'tupleindex', field, true, true);\n }\n};\n\nfunction parseFacet (spec, scope, group) {\n const facet = spec.from.facet,\n name = facet.name,\n data = getDataRef(facet, scope);\n let op;\n if (!facet.name) {\n error('Facet must have a name: ' + stringValue(facet));\n }\n if (!facet.data) {\n error('Facet must reference a data set: ' + stringValue(facet));\n }\n if (facet.field) {\n op = scope.add(PreFacet({\n field: scope.fieldRef(facet.field),\n pulse: data\n }));\n } else if (facet.groupby) {\n op = scope.add(Facet({\n key: scope.keyRef(facet.groupby),\n group: ref(scope.proxy(group.parent)),\n pulse: data\n }));\n } else {\n error('Facet must specify groupby or field: ' + stringValue(facet));\n }\n\n // initialize facet subscope\n const subscope = scope.fork(),\n source = subscope.add(Collect()),\n values = subscope.add(Sieve({\n pulse: ref(source)\n }));\n subscope.addData(name, new DataScope(subscope, source, source, values));\n subscope.addSignal('parent', null);\n\n // parse faceted subflow\n op.params.subflow = {\n $subflow: subscope.parse(spec).toRuntime()\n };\n}\n\nfunction parseSubflow (spec, scope, input) {\n const op = scope.add(PreFacet({\n pulse: input.pulse\n })),\n subscope = scope.fork();\n subscope.add(Sieve());\n subscope.addSignal('parent', null);\n\n // parse group mark subflow\n op.params.subflow = {\n $subflow: subscope.parse(spec).toRuntime()\n };\n}\n\nfunction parseTrigger (spec, scope, name) {\n const remove = spec.remove,\n insert = spec.insert,\n toggle = spec.toggle,\n modify = spec.modify,\n values = spec.values,\n op = scope.add(operator());\n const update = 'if(' + spec.trigger + ',modify(\"' + name + '\",' + [insert, remove, toggle, modify, values].map(_ => _ == null ? 'null' : _).join(',') + '),0)';\n const expr = parseExpression(update, scope);\n op.update = expr.$expr;\n op.params = expr.$params;\n}\n\nfunction parseMark (spec, scope) {\n const role = getRole(spec),\n group = spec.type === GroupMark,\n facet = spec.from && spec.from.facet,\n overlap = spec.overlap;\n let layout = spec.layout || role === ScopeRole || role === FrameRole,\n ops,\n op,\n store,\n enc,\n name,\n layoutRef,\n boundRef;\n const nested = role === MarkRole || layout || facet;\n\n // resolve input data\n const input = parseData$1(spec.from, group, scope);\n\n // data join to map tuples to visual items\n op = scope.add(DataJoin({\n key: input.key || (spec.key ? fieldRef$1(spec.key) : undefined),\n pulse: input.pulse,\n clean: !group\n }));\n const joinRef = ref(op);\n\n // collect visual items\n op = store = scope.add(Collect({\n pulse: joinRef\n }));\n\n // connect visual items to scenegraph\n op = scope.add(Mark({\n markdef: definition(spec),\n interactive: interactive(spec.interactive, scope),\n clip: clip(spec.clip, scope),\n context: {\n $context: true\n },\n groups: scope.lookup(),\n parent: scope.signals.parent ? scope.signalRef('parent') : null,\n index: scope.markpath(),\n pulse: ref(op)\n }));\n const markRef = ref(op);\n\n // add visual encoders\n op = enc = scope.add(Encode(parseEncode(spec.encode, spec.type, role, spec.style, scope, {\n mod: false,\n pulse: markRef\n })));\n\n // monitor parent marks to propagate changes\n op.params.parent = scope.encode();\n\n // add post-encoding transforms, if defined\n if (spec.transform) {\n spec.transform.forEach(_ => {\n const tx = parseTransform(_, scope),\n md = tx.metadata;\n if (md.generates || md.changes) {\n error('Mark transforms should not generate new data.');\n }\n if (!md.nomod) enc.params.mod = true; // update encode mod handling\n tx.params.pulse = ref(op);\n scope.add(op = tx);\n });\n }\n\n // if item sort specified, perform post-encoding\n if (spec.sort) {\n op = scope.add(SortItems({\n sort: scope.compareRef(spec.sort),\n pulse: ref(op)\n }));\n }\n const encodeRef = ref(op);\n\n // add view layout operator if needed\n if (facet || layout) {\n layout = scope.add(ViewLayout({\n layout: scope.objectProperty(spec.layout),\n legends: scope.legends,\n mark: markRef,\n pulse: encodeRef\n }));\n layoutRef = ref(layout);\n }\n\n // compute bounding boxes\n const bound = scope.add(Bound({\n mark: markRef,\n pulse: layoutRef || encodeRef\n }));\n boundRef = ref(bound);\n\n // if group mark, recurse to parse nested content\n if (group) {\n // juggle layout & bounds to ensure they run *after* any faceting transforms\n if (nested) {\n ops = scope.operators;\n ops.pop();\n if (layout) ops.pop();\n }\n scope.pushState(encodeRef, layoutRef || boundRef, joinRef);\n facet ? parseFacet(spec, scope, input) // explicit facet\n : nested ? parseSubflow(spec, scope, input) // standard mark group\n : scope.parse(spec); // guide group, we can avoid nested scopes\n scope.popState();\n if (nested) {\n if (layout) ops.push(layout);\n ops.push(bound);\n }\n }\n\n // if requested, add overlap removal transform\n if (overlap) {\n boundRef = parseOverlap(overlap, boundRef, scope);\n }\n\n // render / sieve items\n const render = scope.add(Render({\n pulse: boundRef\n })),\n sieve = scope.add(Sieve({\n pulse: ref(render)\n }, undefined, scope.parent()));\n\n // if mark is named, make accessible as reactive geometry\n // add trigger updates if defined\n if (spec.name != null) {\n name = spec.name;\n scope.addData(name, new DataScope(scope, store, render, sieve));\n if (spec.on) spec.on.forEach(on => {\n if (on.insert || on.remove || on.toggle) {\n error('Marks only support modify triggers.');\n }\n parseTrigger(on, scope, name);\n });\n }\n}\nfunction parseOverlap(overlap, source, scope) {\n const method = overlap.method,\n bound = overlap.bound,\n sep = overlap.separation;\n const params = {\n separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep,\n method: isSignal(method) ? scope.signalRef(method.signal) : method,\n pulse: source\n };\n if (overlap.order) {\n params.sort = scope.compareRef({\n field: overlap.order\n });\n }\n if (bound) {\n const tol = bound.tolerance;\n params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol;\n params.boundScale = scope.scaleRef(bound.scale);\n params.boundOrient = bound.orient;\n }\n return ref(scope.add(Overlap(params)));\n}\n\nfunction parseLegend (spec, scope) {\n const config = scope.config.legend,\n encode = spec.encode || {},\n _ = lookup(spec, config),\n legendEncode = encode.legend || {},\n name = legendEncode.name || undefined,\n interactive = legendEncode.interactive,\n style = legendEncode.style,\n scales = {};\n let scale = 0,\n entryLayout,\n params,\n children;\n\n // resolve scales and 'canonical' scale name\n LegendScales.forEach(s => spec[s] ? (scales[s] = spec[s], scale = scale || spec[s]) : 0);\n if (!scale) error('Missing valid scale for legend.');\n\n // resolve legend type (symbol, gradient, or discrete gradient)\n const type = legendType(spec, scope.scaleType(scale));\n\n // single-element data source for legend group\n const datum = {\n title: spec.title != null,\n scales: scales,\n type: type,\n vgrad: type !== 'symbol' && _.isVertical()\n };\n const dataRef = ref(scope.add(Collect(null, [datum])));\n\n // encoding properties for legend entry sub-group\n const entryEncode = {\n enter: {\n x: {\n value: 0\n },\n y: {\n value: 0\n }\n }\n };\n\n // data source for legend values\n const entryRef = ref(scope.add(LegendEntries(params = {\n type: type,\n scale: scope.scaleRef(scale),\n count: scope.objectProperty(_('tickCount')),\n limit: scope.property(_('symbolLimit')),\n values: scope.objectProperty(spec.values),\n minstep: scope.property(spec.tickMinStep),\n formatType: scope.property(spec.formatType),\n formatSpecifier: scope.property(spec.format)\n })));\n\n // continuous gradient legend\n if (type === Gradient) {\n children = [legendGradient(spec, scale, config, encode.gradient), legendGradientLabels(spec, config, encode.labels, entryRef)];\n // adjust default tick count based on the gradient length\n params.count = params.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`);\n }\n\n // discrete gradient legend\n else if (type === Discrete) {\n children = [legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), legendGradientLabels(spec, config, encode.labels, entryRef)];\n }\n\n // symbol legend\n else {\n // determine legend symbol group layout\n entryLayout = legendSymbolLayout(spec, config);\n children = [legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns))];\n // pass symbol size information to legend entry generator\n params.size = sizeExpression(spec, scope, children[0].marks);\n }\n\n // generate legend marks\n children = [guideGroup({\n role: LegendEntryRole,\n from: dataRef,\n encode: entryEncode,\n marks: children,\n layout: entryLayout,\n interactive\n })];\n\n // include legend title if defined\n if (datum.title) {\n children.push(legendTitle(spec, config, encode.title, dataRef));\n }\n\n // parse legend specification\n return parseMark(guideGroup({\n role: LegendRole,\n from: dataRef,\n encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip),\n marks: children,\n aria: _('aria'),\n description: _('description'),\n zindex: _('zindex'),\n name,\n interactive,\n style\n }), scope);\n}\nfunction legendType(spec, scaleType) {\n let type = spec.type || Symbols;\n if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) {\n type = isContinuous(scaleType) ? Gradient : isDiscretizing(scaleType) ? Discrete : Symbols;\n }\n return type !== Gradient ? type : isDiscretizing(scaleType) ? Discrete : Gradient;\n}\nfunction scaleCount(spec) {\n return LegendScales.reduce((count, type) => count + (spec[type] ? 1 : 0), 0);\n}\nfunction buildLegendEncode(_, spec, config) {\n const encode = {\n enter: {},\n update: {}\n };\n addEncoders(encode, {\n orient: _('orient'),\n offset: _('offset'),\n padding: _('padding'),\n titlePadding: _('titlePadding'),\n cornerRadius: _('cornerRadius'),\n fill: _('fillColor'),\n stroke: _('strokeColor'),\n strokeWidth: config.strokeWidth,\n strokeDash: config.strokeDash,\n x: _('legendX'),\n y: _('legendY'),\n // accessibility support\n format: spec.format,\n formatType: spec.formatType\n });\n return encode;\n}\nfunction sizeExpression(spec, scope, marks) {\n const size = deref(getChannel('size', spec, marks)),\n strokeWidth = deref(getChannel('strokeWidth', spec, marks)),\n fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle));\n return parseExpression(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, scope);\n}\nfunction getChannel(name, spec, marks) {\n return spec[name] ? `scale(\"${spec[name]}\",datum)` : getEncoding(name, marks[0].encode);\n}\nfunction getFontSize(encode, scope, style) {\n return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style);\n}\n\nconst angleExpr = `item.orient===\"${Left}\"?-90:item.orient===\"${Right}\"?90:0`;\nfunction parseTitle (spec, scope) {\n spec = isString(spec) ? {\n text: spec\n } : spec;\n const _ = lookup(spec, scope.config.title),\n encode = spec.encode || {},\n userEncode = encode.group || {},\n name = userEncode.name || undefined,\n interactive = userEncode.interactive,\n style = userEncode.style,\n children = [];\n\n // single-element data source for group title\n const datum = {},\n dataRef = ref(scope.add(Collect(null, [datum])));\n\n // include title text\n children.push(buildTitle(spec, _, titleEncode(spec), dataRef));\n\n // include subtitle text\n if (spec.subtitle) {\n children.push(buildSubTitle(spec, _, encode.subtitle, dataRef));\n }\n\n // parse title specification\n return parseMark(guideGroup({\n role: TitleRole,\n from: dataRef,\n encode: groupEncode(_, userEncode),\n marks: children,\n aria: _('aria'),\n description: _('description'),\n zindex: _('zindex'),\n name,\n interactive,\n style\n }), scope);\n}\n\n// provide backwards-compatibility for title custom encode;\n// the top-level encode block has been *deprecated*.\nfunction titleEncode(spec) {\n const encode = spec.encode;\n return encode && encode.title || extend({\n name: spec.name,\n interactive: spec.interactive,\n style: spec.style\n }, encode);\n}\nfunction groupEncode(_, userEncode) {\n const encode = {\n enter: {},\n update: {}\n };\n addEncoders(encode, {\n orient: _('orient'),\n anchor: _('anchor'),\n align: {\n signal: alignExpr$1\n },\n angle: {\n signal: angleExpr\n },\n limit: _('limit'),\n frame: _('frame'),\n offset: _('offset') || 0,\n padding: _('subtitlePadding')\n });\n return extendEncode(encode, userEncode, Skip);\n}\nfunction buildTitle(spec, _, userEncode, dataRef) {\n const zero = {\n value: 0\n },\n text = spec.text,\n encode = {\n enter: {\n opacity: zero\n },\n update: {\n opacity: {\n value: 1\n }\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n text: text,\n align: {\n signal: 'item.mark.group.align'\n },\n angle: {\n signal: 'item.mark.group.angle'\n },\n limit: {\n signal: 'item.mark.group.limit'\n },\n baseline: 'top',\n dx: _('dx'),\n dy: _('dy'),\n fill: _('color'),\n font: _('font'),\n fontSize: _('fontSize'),\n fontStyle: _('fontStyle'),\n fontWeight: _('fontWeight'),\n lineHeight: _('lineHeight')\n }, {\n // update\n align: _('align'),\n angle: _('angle'),\n baseline: _('baseline')\n });\n return guideMark({\n type: TextMark,\n role: TitleTextRole,\n style: GroupTitleStyle,\n from: dataRef,\n encode\n }, userEncode);\n}\nfunction buildSubTitle(spec, _, userEncode, dataRef) {\n const zero = {\n value: 0\n },\n text = spec.subtitle,\n encode = {\n enter: {\n opacity: zero\n },\n update: {\n opacity: {\n value: 1\n }\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n text: text,\n align: {\n signal: 'item.mark.group.align'\n },\n angle: {\n signal: 'item.mark.group.angle'\n },\n limit: {\n signal: 'item.mark.group.limit'\n },\n baseline: 'top',\n dx: _('dx'),\n dy: _('dy'),\n fill: _('subtitleColor'),\n font: _('subtitleFont'),\n fontSize: _('subtitleFontSize'),\n fontStyle: _('subtitleFontStyle'),\n fontWeight: _('subtitleFontWeight'),\n lineHeight: _('subtitleLineHeight')\n }, {\n // update\n align: _('align'),\n angle: _('angle'),\n baseline: _('baseline')\n });\n return guideMark({\n type: TextMark,\n role: TitleSubtitleRole,\n style: GroupSubtitleStyle,\n from: dataRef,\n encode\n }, userEncode);\n}\n\nfunction parseData(data, scope) {\n const transforms = [];\n if (data.transform) {\n data.transform.forEach(tx => {\n transforms.push(parseTransform(tx, scope));\n });\n }\n if (data.on) {\n data.on.forEach(on => {\n parseTrigger(on, scope, data.name);\n });\n }\n scope.addDataPipeline(data.name, analyze(data, scope, transforms));\n}\n\n/**\n * Analyze a data pipeline, add needed operators.\n */\nfunction analyze(data, scope, ops) {\n const output = [];\n let source = null,\n modify = false,\n generate = false,\n upstream,\n i,\n n,\n t,\n m;\n if (data.values) {\n // hard-wired input data set\n if (isSignal(data.values) || hasSignal(data.format)) {\n // if either values is signal or format has signal, use dynamic loader\n output.push(load(scope, data));\n output.push(source = collect());\n } else {\n // otherwise, ingest upon dataflow init\n output.push(source = collect({\n $ingest: data.values,\n $format: data.format\n }));\n }\n } else if (data.url) {\n // load data from external source\n if (hasSignal(data.url) || hasSignal(data.format)) {\n // if either url or format has signal, use dynamic loader\n output.push(load(scope, data));\n output.push(source = collect());\n } else {\n // otherwise, request load upon dataflow init\n output.push(source = collect({\n $request: data.url,\n $format: data.format\n }));\n }\n } else if (data.source) {\n // derives from one or more other data sets\n source = upstream = array(data.source).map(d => ref(scope.getData(d).output));\n output.push(null); // populate later\n }\n\n // scan data transforms, add collectors as needed\n for (i = 0, n = ops.length; i < n; ++i) {\n t = ops[i];\n m = t.metadata;\n if (!source && !m.source) {\n output.push(source = collect());\n }\n output.push(t);\n if (m.generates) generate = true;\n if (m.modifies && !generate) modify = true;\n if (m.source) source = t;else if (m.changes) source = null;\n }\n if (upstream) {\n n = upstream.length - 1;\n output[0] = Relay({\n derive: modify,\n pulse: n ? upstream : upstream[0]\n });\n if (modify || n) {\n // collect derived and multi-pulse tuples\n output.splice(1, 0, collect());\n }\n }\n if (!source) output.push(collect());\n output.push(Sieve({}));\n return output;\n}\nfunction collect(values) {\n const s = Collect({}, values);\n s.metadata = {\n source: true\n };\n return s;\n}\nfunction load(scope, data) {\n return Load({\n url: data.url ? scope.property(data.url) : undefined,\n async: data.async ? scope.property(data.async) : undefined,\n values: data.values ? scope.property(data.values) : undefined,\n format: scope.objectProperty(data.format)\n });\n}\n\nconst isX = orient => orient === Bottom || orient === Top;\n\n// get sign coefficient based on axis orient\nconst getSign = (orient, a, b) => isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left || orient === Top ? a : b;\n\n// condition on axis x-direction\nconst ifX = (orient, a, b) => isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b;\n\n// condition on axis y-direction\nconst ifY = (orient, a, b) => isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a;\nconst ifTop = (orient, a, b) => isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top ? {\n value: a\n} : {\n value: b\n};\nconst ifRight = (orient, a, b) => isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right ? {\n value: a\n} : {\n value: b\n};\nconst ifXEnc = ($orient, a, b) => ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a, b);\nconst ifYEnc = ($orient, a, b) => ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a, b);\nconst ifLeftTopExpr = ($orient, a, b) => ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a, b);\nconst ifTopExpr = ($orient, a, b) => ifExpr(`${$orient} === '${Top}'`, a, b);\nconst ifRightExpr = ($orient, a, b) => ifExpr(`${$orient} === '${Right}'`, a, b);\nconst ifEnc = (test, a, b) => {\n // ensure inputs are encoder objects (or null)\n a = a != null ? encoder(a) : a;\n b = b != null ? encoder(b) : b;\n if (isSimple(a) && isSimple(b)) {\n // if possible generate simple signal expression\n a = a ? a.signal || stringValue(a.value) : null;\n b = b ? b.signal || stringValue(b.value) : null;\n return {\n signal: `${test} ? (${a}) : (${b})`\n };\n } else {\n // otherwise generate rule set\n return [extend({\n test\n }, a)].concat(b || []);\n }\n};\nconst isSimple = enc => enc == null || Object.keys(enc).length === 1;\nconst ifExpr = (test, a, b) => ({\n signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})`\n});\nconst ifOrient = ($orient, t, b, l, r) => ({\n signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : '') + (b != null ? `${$orient} === '${Bottom}' ? (${toExpr(b)}) : ` : '') + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : '') + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : '') + '(null)'\n});\nconst toExpr = v => isSignal(v) ? v.signal : v == null ? null : stringValue(v);\nconst mult = (sign, value) => value === 0 ? 0 : isSignal(sign) ? {\n signal: `(${sign.signal}) * ${value}`\n} : {\n value: sign * value\n};\nconst patch = (value, base) => {\n const s = value.signal;\n return s && s.endsWith('(null)') ? {\n signal: s.slice(0, -6) + base.signal\n } : value;\n};\n\nfunction fallback(prop, config, axisConfig, style) {\n let styleProp;\n if (config && hasOwnProperty(config, prop)) {\n return config[prop];\n } else if (hasOwnProperty(axisConfig, prop)) {\n return axisConfig[prop];\n } else if (prop.startsWith('title')) {\n switch (prop) {\n case 'titleColor':\n styleProp = 'fill';\n break;\n case 'titleFont':\n case 'titleFontSize':\n case 'titleFontWeight':\n styleProp = prop[5].toLowerCase() + prop.slice(6);\n }\n return style[GuideTitleStyle][styleProp];\n } else if (prop.startsWith('label')) {\n switch (prop) {\n case 'labelColor':\n styleProp = 'fill';\n break;\n case 'labelFont':\n case 'labelFontSize':\n styleProp = prop[5].toLowerCase() + prop.slice(6);\n }\n return style[GuideLabelStyle][styleProp];\n }\n return null;\n}\nfunction keys(objects) {\n const map = {};\n for (const obj of objects) {\n if (!obj) continue;\n for (const key in obj) map[key] = 1;\n }\n return Object.keys(map);\n}\nfunction axisConfig (spec, scope) {\n var config = scope.config,\n style = config.style,\n axis = config.axis,\n band = scope.scaleType(spec.scale) === 'band' && config.axisBand,\n orient = spec.orient,\n xy,\n or,\n key;\n if (isSignal(orient)) {\n const xyKeys = keys([config.axisX, config.axisY]),\n orientKeys = keys([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]);\n xy = {};\n for (key of xyKeys) {\n xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style));\n }\n or = {};\n for (key of orientKeys) {\n or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style));\n }\n } else {\n xy = orient === Top || orient === Bottom ? config.axisX : config.axisY;\n or = config['axis' + orient[0].toUpperCase() + orient.slice(1)];\n }\n const result = xy || or || band ? extend({}, axis, xy, or, band) : axis;\n return result;\n}\n\nfunction axisDomain (spec, config, userEncode, dataRef) {\n const _ = lookup(spec, config),\n orient = spec.orient;\n let enter, update;\n const encode = {\n enter: enter = {\n opacity: zero\n },\n update: update = {\n opacity: one\n },\n exit: {\n opacity: zero\n }\n };\n addEncoders(encode, {\n stroke: _('domainColor'),\n strokeCap: _('domainCap'),\n strokeDash: _('domainDash'),\n strokeDashOffset: _('domainDashOffset'),\n strokeWidth: _('domainWidth'),\n strokeOpacity: _('domainOpacity')\n });\n const pos0 = position(spec, 0);\n const pos1 = position(spec, 1);\n enter.x = update.x = ifX(orient, pos0, zero);\n enter.x2 = update.x2 = ifX(orient, pos1);\n enter.y = update.y = ifY(orient, pos0, zero);\n enter.y2 = update.y2 = ifY(orient, pos1);\n return guideMark({\n type: RuleMark,\n role: AxisDomainRole,\n from: dataRef,\n encode\n }, userEncode);\n}\nfunction position(spec, pos) {\n return {\n scale: spec.scale,\n range: pos\n };\n}\n\nfunction axisGrid (spec, config, userEncode, dataRef, band) {\n const _ = lookup(spec, config),\n orient = spec.orient,\n vscale = spec.gridScale,\n sign = getSign(orient, 1, -1),\n offset = offsetValue(spec.offset, sign);\n let enter, exit, update;\n const encode = {\n enter: enter = {\n opacity: zero\n },\n update: update = {\n opacity: one\n },\n exit: exit = {\n opacity: zero\n }\n };\n addEncoders(encode, {\n stroke: _('gridColor'),\n strokeCap: _('gridCap'),\n strokeDash: _('gridDash'),\n strokeDashOffset: _('gridDashOffset'),\n strokeOpacity: _('gridOpacity'),\n strokeWidth: _('gridWidth')\n });\n const tickPos = {\n scale: spec.scale,\n field: Value,\n band: band.band,\n extra: band.extra,\n offset: band.offset,\n round: _('tickRound')\n };\n const sz = ifX(orient, {\n signal: 'height'\n }, {\n signal: 'width'\n });\n const gridStart = vscale ? {\n scale: vscale,\n range: 0,\n mult: sign,\n offset: offset\n } : {\n value: 0,\n offset: offset\n };\n const gridEnd = vscale ? {\n scale: vscale,\n range: 1,\n mult: sign,\n offset: offset\n } : extend(sz, {\n mult: sign,\n offset: offset\n });\n enter.x = update.x = ifX(orient, tickPos, gridStart);\n enter.y = update.y = ifY(orient, tickPos, gridStart);\n enter.x2 = update.x2 = ifY(orient, gridEnd);\n enter.y2 = update.y2 = ifX(orient, gridEnd);\n exit.x = ifX(orient, tickPos);\n exit.y = ifY(orient, tickPos);\n return guideMark({\n type: RuleMark,\n role: AxisGridRole,\n key: Value,\n from: dataRef,\n encode\n }, userEncode);\n}\nfunction offsetValue(offset, sign) {\n if (sign === 1) ; else if (!isObject(offset)) {\n offset = isSignal(sign) ? {\n signal: `(${sign.signal}) * (${offset || 0})`\n } : sign * (offset || 0);\n } else {\n let entry = offset = extend({}, offset);\n while (entry.mult != null) {\n if (!isObject(entry.mult)) {\n entry.mult = isSignal(sign) // no offset if sign === 1\n ? {\n signal: `(${entry.mult}) * (${sign.signal})`\n } : entry.mult * sign;\n return offset;\n } else {\n entry = entry.mult = extend({}, entry.mult);\n }\n }\n entry.mult = sign;\n }\n return offset;\n}\n\nfunction axisTicks (spec, config, userEncode, dataRef, size, band) {\n const _ = lookup(spec, config),\n orient = spec.orient,\n sign = getSign(orient, -1, 1);\n let enter, exit, update;\n const encode = {\n enter: enter = {\n opacity: zero\n },\n update: update = {\n opacity: one\n },\n exit: exit = {\n opacity: zero\n }\n };\n addEncoders(encode, {\n stroke: _('tickColor'),\n strokeCap: _('tickCap'),\n strokeDash: _('tickDash'),\n strokeDashOffset: _('tickDashOffset'),\n strokeOpacity: _('tickOpacity'),\n strokeWidth: _('tickWidth')\n });\n const tickSize = encoder(size);\n tickSize.mult = sign;\n const tickPos = {\n scale: spec.scale,\n field: Value,\n band: band.band,\n extra: band.extra,\n offset: band.offset,\n round: _('tickRound')\n };\n update.y = enter.y = ifX(orient, zero, tickPos);\n update.y2 = enter.y2 = ifX(orient, tickSize);\n exit.x = ifX(orient, tickPos);\n update.x = enter.x = ifY(orient, zero, tickPos);\n update.x2 = enter.x2 = ifY(orient, tickSize);\n exit.y = ifY(orient, tickPos);\n return guideMark({\n type: RuleMark,\n role: AxisTickRole,\n key: Value,\n from: dataRef,\n encode\n }, userEncode);\n}\n\nfunction flushExpr(scale, threshold, a, b, c) {\n return {\n signal: 'flush(range(\"' + scale + '\"), ' + 'scale(\"' + scale + '\", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')'\n };\n}\nfunction axisLabels (spec, config, userEncode, dataRef, size, band) {\n const _ = lookup(spec, config),\n orient = spec.orient,\n scale = spec.scale,\n sign = getSign(orient, -1, 1),\n flush = deref(_('labelFlush')),\n flushOffset = deref(_('labelFlushOffset')),\n labelAlign = _('labelAlign'),\n labelBaseline = _('labelBaseline');\n let flushOn = flush === 0 || !!flush,\n update;\n const tickSize = encoder(size);\n tickSize.mult = sign;\n tickSize.offset = encoder(_('labelPadding') || 0);\n tickSize.offset.mult = sign;\n const tickPos = {\n scale: scale,\n field: Value,\n band: 0.5,\n offset: extendOffset(band.offset, _('labelOffset'))\n };\n const align = ifX(orient, flushOn ? flushExpr(scale, flush, '\"left\"', '\"right\"', '\"center\"') : {\n value: 'center'\n }, ifRight(orient, 'left', 'right'));\n const baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '\"top\"', '\"bottom\"', '\"middle\"') : {\n value: 'middle'\n });\n const offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0);\n flushOn = flushOn && flushOffset;\n const enter = {\n opacity: zero,\n x: ifX(orient, tickPos, tickSize),\n y: ifY(orient, tickPos, tickSize)\n };\n const encode = {\n enter: enter,\n update: update = {\n opacity: one,\n text: {\n field: Label\n },\n x: enter.x,\n y: enter.y,\n align,\n baseline\n },\n exit: {\n opacity: zero,\n x: enter.x,\n y: enter.y\n }\n };\n addEncoders(encode, {\n dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null,\n dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null\n });\n addEncoders(encode, {\n angle: _('labelAngle'),\n fill: _('labelColor'),\n fillOpacity: _('labelOpacity'),\n font: _('labelFont'),\n fontSize: _('labelFontSize'),\n fontWeight: _('labelFontWeight'),\n fontStyle: _('labelFontStyle'),\n limit: _('labelLimit'),\n lineHeight: _('labelLineHeight')\n }, {\n align: labelAlign,\n baseline: labelBaseline\n });\n const bound = _('labelBound');\n let overlap = _('labelOverlap');\n\n // if overlap method or bound defined, request label overlap removal\n overlap = overlap || bound ? {\n separation: _('labelSeparation'),\n method: overlap,\n order: 'datum.index',\n bound: bound ? {\n scale,\n orient,\n tolerance: bound\n } : null\n } : undefined;\n if (update.align !== align) {\n update.align = patch(update.align, align);\n }\n if (update.baseline !== baseline) {\n update.baseline = patch(update.baseline, baseline);\n }\n return guideMark({\n type: TextMark,\n role: AxisLabelRole,\n style: GuideLabelStyle,\n key: Value,\n from: dataRef,\n encode,\n overlap\n }, userEncode);\n}\n\nfunction axisTitle (spec, config, userEncode, dataRef) {\n const _ = lookup(spec, config),\n orient = spec.orient,\n sign = getSign(orient, -1, 1);\n let enter, update;\n const encode = {\n enter: enter = {\n opacity: zero,\n anchor: encoder(_('titleAnchor', null)),\n align: {\n signal: alignExpr$1\n }\n },\n update: update = extend({}, enter, {\n opacity: one,\n text: encoder(spec.title)\n }),\n exit: {\n opacity: zero\n }\n };\n const titlePos = {\n signal: `lerp(range(\"${spec.scale}\"), ${anchorExpr(0, 1, 0.5)})`\n };\n update.x = ifX(orient, titlePos);\n update.y = ifY(orient, titlePos);\n enter.angle = ifX(orient, zero, mult(sign, 90));\n enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), {\n value: Bottom\n });\n update.angle = enter.angle;\n update.baseline = enter.baseline;\n addEncoders(encode, {\n fill: _('titleColor'),\n fillOpacity: _('titleOpacity'),\n font: _('titleFont'),\n fontSize: _('titleFontSize'),\n fontStyle: _('titleFontStyle'),\n fontWeight: _('titleFontWeight'),\n limit: _('titleLimit'),\n lineHeight: _('titleLineHeight')\n }, {\n // require update\n align: _('titleAlign'),\n angle: _('titleAngle'),\n baseline: _('titleBaseline')\n });\n autoLayout(_, orient, encode, userEncode);\n encode.update.align = patch(encode.update.align, enter.align);\n encode.update.angle = patch(encode.update.angle, enter.angle);\n encode.update.baseline = patch(encode.update.baseline, enter.baseline);\n return guideMark({\n type: TextMark,\n role: AxisTitleRole,\n style: GuideTitleStyle,\n from: dataRef,\n encode\n }, userEncode);\n}\nfunction autoLayout(_, orient, encode, userEncode) {\n const auto = (value, dim) => value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has(dim, userEncode) ? true : false;\n const autoY = auto(_('titleX'), 'x'),\n autoX = auto(_('titleY'), 'y');\n encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY));\n}\n\nfunction parseAxis (spec, scope) {\n const config = axisConfig(spec, scope),\n encode = spec.encode || {},\n axisEncode = encode.axis || {},\n name = axisEncode.name || undefined,\n interactive = axisEncode.interactive,\n style = axisEncode.style,\n _ = lookup(spec, config),\n band = tickBand(_);\n\n // single-element data source for axis group\n const datum = {\n scale: spec.scale,\n ticks: !!_('ticks'),\n labels: !!_('labels'),\n grid: !!_('grid'),\n domain: !!_('domain'),\n title: spec.title != null\n };\n const dataRef = ref(scope.add(Collect({}, [datum])));\n\n // data source for axis ticks\n const ticksRef = ref(scope.add(AxisTicks({\n scale: scope.scaleRef(spec.scale),\n extra: scope.property(band.extra),\n count: scope.objectProperty(spec.tickCount),\n values: scope.objectProperty(spec.values),\n minstep: scope.property(spec.tickMinStep),\n formatType: scope.property(spec.formatType),\n formatSpecifier: scope.property(spec.format)\n })));\n\n // generate axis marks\n const children = [];\n let size;\n\n // include axis gridlines if requested\n if (datum.grid) {\n children.push(axisGrid(spec, config, encode.grid, ticksRef, band));\n }\n\n // include axis ticks if requested\n if (datum.ticks) {\n size = _('tickSize');\n children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band));\n }\n\n // include axis labels if requested\n if (datum.labels) {\n size = datum.ticks ? size : 0;\n children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band));\n }\n\n // include axis domain path if requested\n if (datum.domain) {\n children.push(axisDomain(spec, config, encode.domain, dataRef));\n }\n\n // include axis title if defined\n if (datum.title) {\n children.push(axisTitle(spec, config, encode.title, dataRef));\n }\n\n // parse axis specification\n return parseMark(guideGroup({\n role: AxisRole,\n from: dataRef,\n encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip),\n marks: children,\n aria: _('aria'),\n description: _('description'),\n zindex: _('zindex'),\n name,\n interactive,\n style\n }), scope);\n}\nfunction buildAxisEncode(_, spec) {\n const encode = {\n enter: {},\n update: {}\n };\n addEncoders(encode, {\n orient: _('orient'),\n offset: _('offset') || 0,\n position: value(spec.position, 0),\n titlePadding: _('titlePadding'),\n minExtent: _('minExtent'),\n maxExtent: _('maxExtent'),\n range: {\n signal: `abs(span(range(\"${spec.scale}\")))`\n },\n translate: _('translate'),\n // accessibility support\n format: spec.format,\n formatType: spec.formatType\n });\n return encode;\n}\n\nfunction parseScope (spec, scope, preprocessed) {\n const signals = array(spec.signals),\n scales = array(spec.scales);\n\n // parse signal definitions, if not already preprocessed\n if (!preprocessed) signals.forEach(_ => parseSignal(_, scope));\n\n // parse cartographic projection definitions\n array(spec.projections).forEach(_ => parseProjection(_, scope));\n\n // initialize scale references\n scales.forEach(_ => initScale(_, scope));\n\n // parse data sources\n array(spec.data).forEach(_ => parseData(_, scope));\n\n // parse scale definitions\n scales.forEach(_ => parseScale(_, scope));\n\n // parse signal updates\n (preprocessed || signals).forEach(_ => parseSignalUpdates(_, scope));\n\n // parse axis definitions\n array(spec.axes).forEach(_ => parseAxis(_, scope));\n\n // parse mark definitions\n array(spec.marks).forEach(_ => parseMark(_, scope));\n\n // parse legend definitions\n array(spec.legends).forEach(_ => parseLegend(_, scope));\n\n // parse title, if defined\n if (spec.title) parseTitle(spec.title, scope);\n\n // parse collected lambda (anonymous) expressions\n scope.parseLambdas();\n return scope;\n}\n\nconst rootEncode = spec => extendEncode({\n enter: {\n x: {\n value: 0\n },\n y: {\n value: 0\n }\n },\n update: {\n width: {\n signal: 'width'\n },\n height: {\n signal: 'height'\n }\n }\n}, spec);\nfunction parseView(spec, scope) {\n const config = scope.config;\n\n // add scenegraph root\n const root = ref(scope.root = scope.add(operator()));\n\n // parse top-level signal definitions\n const signals = collectSignals(spec, config);\n signals.forEach(_ => parseSignal(_, scope));\n\n // assign description, event, legend, and locale configuration\n scope.description = spec.description || config.description;\n scope.eventConfig = config.events;\n scope.legends = scope.objectProperty(config.legend && config.legend.layout);\n scope.locale = config.locale;\n\n // store root group item\n const input = scope.add(Collect());\n\n // encode root group item\n const encode = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, {\n pulse: ref(input)\n })));\n\n // perform view layout\n const parent = scope.add(ViewLayout({\n layout: scope.objectProperty(spec.layout),\n legends: scope.legends,\n autosize: scope.signalRef('autosize'),\n mark: root,\n pulse: ref(encode)\n }));\n scope.operators.pop();\n\n // parse remainder of specification\n scope.pushState(ref(encode), ref(parent), null);\n parseScope(spec, scope, signals);\n scope.operators.push(parent);\n\n // bound / render / sieve root item\n let op = scope.add(Bound({\n mark: root,\n pulse: ref(parent)\n }));\n op = scope.add(Render({\n pulse: ref(op)\n }));\n op = scope.add(Sieve({\n pulse: ref(op)\n }));\n\n // track metadata for root item\n scope.addData('root', new DataScope(scope, input, input, op));\n return scope;\n}\nfunction signalObject(name, value) {\n return value && value.signal ? {\n name,\n update: value.signal\n } : {\n name,\n value\n };\n}\n\n/**\n * Collect top-level signals, merging values as needed. Signals\n * defined in the config signals arrays are added only if that\n * signal is not explicitly defined in the specification.\n * Built-in signals (autosize, background, padding, width, height)\n * receive special treatment. They are initialized using the\n * top-level spec property, or, if undefined in the spec, using\n * the corresponding top-level config property. If this property\n * is a signal reference object, the signal expression maps to the\n * signal 'update' property. If the spec's top-level signal array\n * contains an entry that matches a built-in signal, that entry\n * will be merged with the built-in specification, potentially\n * overwriting existing 'value' or 'update' properties.\n */\nfunction collectSignals(spec, config) {\n const _ = name => value(spec[name], config[name]),\n signals = [signalObject('background', _('background')), signalObject('autosize', parseAutosize(_('autosize'))), signalObject('padding', parsePadding(_('padding'))), signalObject('width', _('width') || 0), signalObject('height', _('height') || 0)],\n pre = signals.reduce((p, s) => (p[s.name] = s, p), {}),\n map = {};\n\n // add spec signal array\n array(spec.signals).forEach(s => {\n if (hasOwnProperty(pre, s.name)) {\n // merge if built-in signal\n s = extend(pre[s.name], s);\n } else {\n // otherwise add to signal list\n signals.push(s);\n }\n map[s.name] = s;\n });\n\n // add config signal array\n array(config.signals).forEach(s => {\n if (!hasOwnProperty(map, s.name) && !hasOwnProperty(pre, s.name)) {\n // add to signal list if not already defined\n signals.push(s);\n }\n });\n return signals;\n}\n\nfunction Scope(config, options) {\n this.config = config || {};\n this.options = options || {};\n this.bindings = [];\n this.field = {};\n this.signals = {};\n this.lambdas = {};\n this.scales = {};\n this.events = {};\n this.data = {};\n this.streams = [];\n this.updates = [];\n this.operators = [];\n this.eventConfig = null;\n this.locale = null;\n this._id = 0;\n this._subid = 0;\n this._nextsub = [0];\n this._parent = [];\n this._encode = [];\n this._lookup = [];\n this._markpath = [];\n}\nfunction Subscope(scope) {\n this.config = scope.config;\n this.options = scope.options;\n this.legends = scope.legends;\n this.field = Object.create(scope.field);\n this.signals = Object.create(scope.signals);\n this.lambdas = Object.create(scope.lambdas);\n this.scales = Object.create(scope.scales);\n this.events = Object.create(scope.events);\n this.data = Object.create(scope.data);\n this.streams = [];\n this.updates = [];\n this.operators = [];\n this._id = 0;\n this._subid = ++scope._nextsub[0];\n this._nextsub = scope._nextsub;\n this._parent = scope._parent.slice();\n this._encode = scope._encode.slice();\n this._lookup = scope._lookup.slice();\n this._markpath = scope._markpath;\n}\nScope.prototype = Subscope.prototype = {\n parse(spec) {\n return parseScope(spec, this);\n },\n fork() {\n return new Subscope(this);\n },\n isSubscope() {\n return this._subid > 0;\n },\n toRuntime() {\n this.finish();\n return {\n description: this.description,\n operators: this.operators,\n streams: this.streams,\n updates: this.updates,\n bindings: this.bindings,\n eventConfig: this.eventConfig,\n locale: this.locale\n };\n },\n id() {\n return (this._subid ? this._subid + ':' : 0) + this._id++;\n },\n add(op) {\n this.operators.push(op);\n op.id = this.id();\n // if pre-registration references exist, resolve them now\n if (op.refs) {\n op.refs.forEach(ref => {\n ref.$ref = op.id;\n });\n op.refs = null;\n }\n return op;\n },\n proxy(op) {\n const vref = op instanceof Entry ? ref(op) : op;\n return this.add(Proxy({\n value: vref\n }));\n },\n addStream(stream) {\n this.streams.push(stream);\n stream.id = this.id();\n return stream;\n },\n addUpdate(update) {\n this.updates.push(update);\n return update;\n },\n // Apply metadata\n finish() {\n let name, ds;\n\n // annotate root\n if (this.root) this.root.root = true;\n\n // annotate signals\n for (name in this.signals) {\n this.signals[name].signal = name;\n }\n\n // annotate scales\n for (name in this.scales) {\n this.scales[name].scale = name;\n }\n\n // annotate data sets\n function annotate(op, name, type) {\n let data, list;\n if (op) {\n data = op.data || (op.data = {});\n list = data[name] || (data[name] = []);\n list.push(type);\n }\n }\n for (name in this.data) {\n ds = this.data[name];\n annotate(ds.input, name, 'input');\n annotate(ds.output, name, 'output');\n annotate(ds.values, name, 'values');\n for (const field in ds.index) {\n annotate(ds.index[field], name, 'index:' + field);\n }\n }\n return this;\n },\n // ----\n\n pushState(encode, parent, lookup) {\n this._encode.push(ref(this.add(Sieve({\n pulse: encode\n }))));\n this._parent.push(parent);\n this._lookup.push(lookup ? ref(this.proxy(lookup)) : null);\n this._markpath.push(-1);\n },\n popState() {\n this._encode.pop();\n this._parent.pop();\n this._lookup.pop();\n this._markpath.pop();\n },\n parent() {\n return peek(this._parent);\n },\n encode() {\n return peek(this._encode);\n },\n lookup() {\n return peek(this._lookup);\n },\n markpath() {\n const p = this._markpath;\n return ++p[p.length - 1];\n },\n // ----\n\n fieldRef(field, name) {\n if (isString(field)) return fieldRef$1(field, name);\n if (!field.signal) {\n error('Unsupported field reference: ' + stringValue(field));\n }\n const s = field.signal;\n let f = this.field[s];\n if (!f) {\n const params = {\n name: this.signalRef(s)\n };\n if (name) params.as = name;\n this.field[s] = f = ref(this.add(Field(params)));\n }\n return f;\n },\n compareRef(cmp) {\n let signal = false;\n const check = _ => isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _;\n const fields = array(cmp.field).map(check),\n orders = array(cmp.order).map(check);\n return signal ? ref(this.add(Compare({\n fields: fields,\n orders: orders\n }))) : compareRef(fields, orders);\n },\n keyRef(fields, flat) {\n let signal = false;\n const check = _ => isSignal(_) ? (signal = true, ref(sig[_.signal])) : _;\n const sig = this.signals;\n fields = array(fields).map(check);\n return signal ? ref(this.add(Key({\n fields: fields,\n flat: flat\n }))) : keyRef(fields, flat);\n },\n sortRef(sort) {\n if (!sort) return sort;\n\n // including id ensures stable sorting\n const a = aggrField(sort.op, sort.field),\n o = sort.order || Ascending;\n return o.signal ? ref(this.add(Compare({\n fields: a,\n orders: this.signalRef(o.signal)\n }))) : compareRef(a, o);\n },\n // ----\n\n event(source, type) {\n const key = source + ':' + type;\n if (!this.events[key]) {\n const id = this.id();\n this.streams.push({\n id: id,\n source: source,\n type: type\n });\n this.events[key] = id;\n }\n return this.events[key];\n },\n // ----\n\n hasOwnSignal(name) {\n return hasOwnProperty(this.signals, name);\n },\n addSignal(name, value) {\n if (this.hasOwnSignal(name)) {\n error('Duplicate signal name: ' + stringValue(name));\n }\n const op = value instanceof Entry ? value : this.add(operator(value));\n return this.signals[name] = op;\n },\n getSignal(name) {\n if (!this.signals[name]) {\n error('Unrecognized signal name: ' + stringValue(name));\n }\n return this.signals[name];\n },\n signalRef(s) {\n if (this.signals[s]) {\n return ref(this.signals[s]);\n } else if (!hasOwnProperty(this.lambdas, s)) {\n this.lambdas[s] = this.add(operator(null));\n }\n return ref(this.lambdas[s]);\n },\n parseLambdas() {\n const code = Object.keys(this.lambdas);\n for (let i = 0, n = code.length; i < n; ++i) {\n const s = code[i],\n e = parseExpression(s, this),\n op = this.lambdas[s];\n op.params = e.$params;\n op.update = e.$expr;\n }\n },\n property(spec) {\n return spec && spec.signal ? this.signalRef(spec.signal) : spec;\n },\n objectProperty(spec) {\n return !spec || !isObject(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec));\n },\n exprRef(code, name) {\n const params = {\n expr: parseExpression(code, this)\n };\n if (name) params.expr.$name = name;\n return ref(this.add(Expression(params)));\n },\n addBinding(name, bind) {\n if (!this.bindings) {\n error('Nested signals do not support binding: ' + stringValue(name));\n }\n this.bindings.push(extend({\n signal: name\n }, bind));\n },\n // ----\n\n addScaleProj(name, transform) {\n if (hasOwnProperty(this.scales, name)) {\n error('Duplicate scale or projection name: ' + stringValue(name));\n }\n this.scales[name] = this.add(transform);\n },\n addScale(name, params) {\n this.addScaleProj(name, Scale(params));\n },\n addProjection(name, params) {\n this.addScaleProj(name, Projection(params));\n },\n getScale(name) {\n if (!this.scales[name]) {\n error('Unrecognized scale name: ' + stringValue(name));\n }\n return this.scales[name];\n },\n scaleRef(name) {\n return ref(this.getScale(name));\n },\n scaleType(name) {\n return this.getScale(name).params.type;\n },\n projectionRef(name) {\n return this.scaleRef(name);\n },\n projectionType(name) {\n return this.scaleType(name);\n },\n // ----\n\n addData(name, dataScope) {\n if (hasOwnProperty(this.data, name)) {\n error('Duplicate data set name: ' + stringValue(name));\n }\n return this.data[name] = dataScope;\n },\n getData(name) {\n if (!this.data[name]) {\n error('Undefined data set name: ' + stringValue(name));\n }\n return this.data[name];\n },\n addDataPipeline(name, entries) {\n if (hasOwnProperty(this.data, name)) {\n error('Duplicate data set name: ' + stringValue(name));\n }\n return this.addData(name, DataScope.fromEntries(this, entries));\n }\n};\nfunction propertyLambda(spec) {\n return (isArray(spec) ? arrayLambda : objectLambda)(spec);\n}\nfunction arrayLambda(array) {\n const n = array.length;\n let code = '[';\n for (let i = 0; i < n; ++i) {\n const value = array[i];\n code += (i > 0 ? ',' : '') + (isObject(value) ? value.signal || propertyLambda(value) : stringValue(value));\n }\n return code + ']';\n}\nfunction objectLambda(obj) {\n let code = '{',\n i = 0,\n key,\n value;\n for (key in obj) {\n value = obj[key];\n code += (++i > 1 ? ',' : '') + stringValue(key) + ':' + (isObject(value) ? value.signal || propertyLambda(value) : stringValue(value));\n }\n return code + '}';\n}\n\n/**\n * Standard configuration defaults for Vega specification parsing.\n * Users can provide their own (sub-)set of these default values\n * by passing in a config object to the top-level parse method.\n */\nfunction defaults () {\n const defaultFont = 'sans-serif',\n defaultSymbolSize = 30,\n defaultStrokeWidth = 2,\n defaultColor = '#4c78a8',\n black = '#000',\n gray = '#888',\n lightGray = '#ddd';\n return {\n // default visualization description\n description: 'Vega visualization',\n // default padding around visualization\n padding: 0,\n // default for automatic sizing; options: 'none', 'pad', 'fit'\n // or provide an object (e.g., {'type': 'pad', 'resize': true})\n autosize: 'pad',\n // default view background color\n // covers the entire view component\n background: null,\n // default event handling configuration\n // preventDefault for view-sourced event types except 'wheel'\n events: {\n defaults: {\n allow: ['wheel']\n }\n },\n // defaults for top-level group marks\n // accepts mark properties (fill, stroke, etc)\n // covers the data rectangle within group width/height\n group: null,\n // defaults for basic mark types\n // each subset accepts mark properties (fill, stroke, etc)\n mark: null,\n arc: {\n fill: defaultColor\n },\n area: {\n fill: defaultColor\n },\n image: null,\n line: {\n stroke: defaultColor,\n strokeWidth: defaultStrokeWidth\n },\n path: {\n stroke: defaultColor\n },\n rect: {\n fill: defaultColor\n },\n rule: {\n stroke: black\n },\n shape: {\n stroke: defaultColor\n },\n symbol: {\n fill: defaultColor,\n size: 64\n },\n text: {\n fill: black,\n font: defaultFont,\n fontSize: 11\n },\n trail: {\n fill: defaultColor,\n size: defaultStrokeWidth\n },\n // style definitions\n style: {\n // axis & legend labels\n 'guide-label': {\n fill: black,\n font: defaultFont,\n fontSize: 10\n },\n // axis & legend titles\n 'guide-title': {\n fill: black,\n font: defaultFont,\n fontSize: 11,\n fontWeight: 'bold'\n },\n // headers, including chart title\n 'group-title': {\n fill: black,\n font: defaultFont,\n fontSize: 13,\n fontWeight: 'bold'\n },\n // chart subtitle\n 'group-subtitle': {\n fill: black,\n font: defaultFont,\n fontSize: 12\n },\n // defaults for styled point marks in Vega-Lite\n point: {\n size: defaultSymbolSize,\n strokeWidth: defaultStrokeWidth,\n shape: 'circle'\n },\n circle: {\n size: defaultSymbolSize,\n strokeWidth: defaultStrokeWidth\n },\n square: {\n size: defaultSymbolSize,\n strokeWidth: defaultStrokeWidth,\n shape: 'square'\n },\n // defaults for styled group marks in Vega-Lite\n cell: {\n fill: 'transparent',\n stroke: lightGray\n },\n view: {\n fill: 'transparent'\n }\n },\n // defaults for title\n title: {\n orient: 'top',\n anchor: 'middle',\n offset: 4,\n subtitlePadding: 3\n },\n // defaults for axes\n axis: {\n minExtent: 0,\n maxExtent: 200,\n bandPosition: 0.5,\n domain: true,\n domainWidth: 1,\n domainColor: gray,\n grid: false,\n gridWidth: 1,\n gridColor: lightGray,\n labels: true,\n labelAngle: 0,\n labelLimit: 180,\n labelOffset: 0,\n labelPadding: 2,\n ticks: true,\n tickColor: gray,\n tickOffset: 0,\n tickRound: true,\n tickSize: 5,\n tickWidth: 1,\n titlePadding: 4\n },\n // correction for centering bias\n axisBand: {\n tickOffset: -0.5\n },\n // defaults for cartographic projection\n projection: {\n type: 'mercator'\n },\n // defaults for legends\n legend: {\n orient: 'right',\n padding: 0,\n gridAlign: 'each',\n columnPadding: 10,\n rowPadding: 2,\n symbolDirection: 'vertical',\n gradientDirection: 'vertical',\n gradientLength: 200,\n gradientThickness: 16,\n gradientStrokeColor: lightGray,\n gradientStrokeWidth: 0,\n gradientLabelOffset: 2,\n labelAlign: 'left',\n labelBaseline: 'middle',\n labelLimit: 160,\n labelOffset: 4,\n labelOverlap: true,\n symbolLimit: 30,\n symbolType: 'circle',\n symbolSize: 100,\n symbolOffset: 0,\n symbolStrokeWidth: 1.5,\n symbolBaseFillColor: 'transparent',\n symbolBaseStrokeColor: gray,\n titleLimit: 180,\n titleOrient: 'top',\n titlePadding: 5,\n layout: {\n offset: 18,\n direction: 'horizontal',\n left: {\n direction: 'vertical'\n },\n right: {\n direction: 'vertical'\n }\n }\n },\n // defaults for scale ranges\n range: {\n category: {\n scheme: 'tableau10'\n },\n ordinal: {\n scheme: 'blues'\n },\n heatmap: {\n scheme: 'yellowgreenblue'\n },\n ramp: {\n scheme: 'blues'\n },\n diverging: {\n scheme: 'blueorange',\n extent: [1, 0]\n },\n symbol: ['circle', 'square', 'triangle-up', 'cross', 'diamond', 'triangle-right', 'triangle-down', 'triangle-left']\n }\n };\n}\n\nfunction parse (spec, config, options) {\n if (!isObject(spec)) {\n error('Input Vega specification must be an object.');\n }\n config = mergeConfig(defaults(), config, spec.config);\n return parseView(spec, new Scope(config, options)).toRuntime();\n}\n\nexport { AxisDomainRole, AxisGridRole, AxisLabelRole, AxisRole, AxisTickRole, AxisTitleRole, DataScope, FrameRole, LegendEntryRole, LegendLabelRole, LegendRole, LegendSymbolRole, LegendTitleRole, MarkRole, Scope, ScopeRole, defaults as config, parse, parseSignal as signal, parseSignalUpdates as signalUpdates, parseStream as stream };\n","import { extend } from 'vega-util';\nexport * from 'vega-util';\nimport { transforms } from 'vega-dataflow';\nexport { Dataflow, EventStream, MultiPulse, Operator, Parameters, Pulse, Transform, changeset, definition, ingest, isTuple, transform, transforms, tupleid } from 'vega-dataflow';\nimport * as tx from 'vega-transforms';\nimport * as vtx from 'vega-view-transforms';\nimport * as encode from 'vega-encode';\nimport * as geo from 'vega-geo';\nimport * as force from 'vega-force';\nimport * as tree from 'vega-hierarchy';\nimport * as label from 'vega-label';\nimport * as reg from 'vega-regression';\nimport * as voronoi from 'vega-voronoi';\nimport * as wordcloud from 'vega-wordcloud';\nimport * as xf from 'vega-crossfilter';\nexport * from 'vega-statistics';\nexport * from 'vega-time';\nexport * from 'vega-loader';\nexport * from 'vega-scenegraph';\nexport { interpolate, interpolateColors, interpolateRange, quantizeInterpolator, scale, scheme } from 'vega-scale';\nexport { projection } from 'vega-projection';\nexport { View } from 'vega-view';\nexport { defaultLocale, numberFormatDefaultLocale as formatLocale, locale, resetDefaultLocale, timeFormatDefaultLocale as timeFormatLocale } from 'vega-format';\nexport { expressionFunction } from 'vega-functions';\nexport { parse } from 'vega-parser';\nexport { context as runtimeContext } from 'vega-runtime';\nexport { codegenExpression, parseExpression } from 'vega-expression';\nexport { parseSelector } from 'vega-event-selector';\n\nvar version = \"5.26.1\";\n\n// -- Transforms -----\n\nextend(transforms, tx, vtx, encode, geo, force, label, tree, reg, voronoi, wordcloud, xf);\n\nexport { version };\n","function adjustSpatial (item, encode, swap) {\n let t;\n if (encode.x2) {\n if (encode.x) {\n if (swap && item.x > item.x2) {\n t = item.x;\n item.x = item.x2;\n item.x2 = t;\n }\n item.width = item.x2 - item.x;\n } else {\n item.x = item.x2 - (item.width || 0);\n }\n }\n if (encode.xc) {\n item.x = item.xc - (item.width || 0) / 2;\n }\n if (encode.y2) {\n if (encode.y) {\n if (swap && item.y > item.y2) {\n t = item.y;\n item.y = item.y2;\n item.y2 = t;\n }\n item.height = item.y2 - item.y;\n } else {\n item.y = item.y2 - (item.height || 0);\n }\n }\n if (encode.yc) {\n item.y = item.yc - (item.height || 0) / 2;\n }\n}\n\nvar Constants = {\n NaN: NaN,\n E: Math.E,\n LN2: Math.LN2,\n LN10: Math.LN10,\n LOG2E: Math.LOG2E,\n LOG10E: Math.LOG10E,\n PI: Math.PI,\n SQRT1_2: Math.SQRT1_2,\n SQRT2: Math.SQRT2,\n MIN_VALUE: Number.MIN_VALUE,\n MAX_VALUE: Number.MAX_VALUE\n};\n\nvar Ops = {\n '*': (a, b) => a * b,\n '+': (a, b) => a + b,\n '-': (a, b) => a - b,\n '/': (a, b) => a / b,\n '%': (a, b) => a % b,\n '>': (a, b) => a > b,\n '<': (a, b) => a < b,\n '<=': (a, b) => a <= b,\n '>=': (a, b) => a >= b,\n '==': (a, b) => a == b,\n '!=': (a, b) => a != b,\n '===': (a, b) => a === b,\n '!==': (a, b) => a !== b,\n '&': (a, b) => a & b,\n '|': (a, b) => a | b,\n '^': (a, b) => a ^ b,\n '<<': (a, b) => a << b,\n '>>': (a, b) => a >> b,\n '>>>': (a, b) => a >>> b\n};\n\nvar Unary = {\n '+': a => +a,\n '-': a => -a,\n '~': a => ~a,\n '!': a => !a\n};\n\nconst slice = Array.prototype.slice;\nconst apply = (m, args, cast) => {\n const obj = cast ? cast(args[0]) : args[0];\n return obj[m].apply(obj, slice.call(args, 1));\n};\nconst datetime = (y, m, d, H, M, S, ms) => new Date(y, m || 0, d != null ? d : 1, H || 0, M || 0, S || 0, ms || 0);\nvar Functions = {\n // math functions\n isNaN: Number.isNaN,\n isFinite: Number.isFinite,\n abs: Math.abs,\n acos: Math.acos,\n asin: Math.asin,\n atan: Math.atan,\n atan2: Math.atan2,\n ceil: Math.ceil,\n cos: Math.cos,\n exp: Math.exp,\n floor: Math.floor,\n log: Math.log,\n max: Math.max,\n min: Math.min,\n pow: Math.pow,\n random: Math.random,\n round: Math.round,\n sin: Math.sin,\n sqrt: Math.sqrt,\n tan: Math.tan,\n clamp: (a, b, c) => Math.max(b, Math.min(c, a)),\n // date functions\n now: Date.now,\n utc: Date.UTC,\n datetime: datetime,\n date: d => new Date(d).getDate(),\n day: d => new Date(d).getDay(),\n year: d => new Date(d).getFullYear(),\n month: d => new Date(d).getMonth(),\n hours: d => new Date(d).getHours(),\n minutes: d => new Date(d).getMinutes(),\n seconds: d => new Date(d).getSeconds(),\n milliseconds: d => new Date(d).getMilliseconds(),\n time: d => new Date(d).getTime(),\n timezoneoffset: d => new Date(d).getTimezoneOffset(),\n utcdate: d => new Date(d).getUTCDate(),\n utcday: d => new Date(d).getUTCDay(),\n utcyear: d => new Date(d).getUTCFullYear(),\n utcmonth: d => new Date(d).getUTCMonth(),\n utchours: d => new Date(d).getUTCHours(),\n utcminutes: d => new Date(d).getUTCMinutes(),\n utcseconds: d => new Date(d).getUTCSeconds(),\n utcmilliseconds: d => new Date(d).getUTCMilliseconds(),\n // sequence functions\n length: x => x.length,\n join: function () {\n return apply('join', arguments);\n },\n indexof: function () {\n return apply('indexOf', arguments);\n },\n lastindexof: function () {\n return apply('lastIndexOf', arguments);\n },\n slice: function () {\n return apply('slice', arguments);\n },\n reverse: x => x.slice().reverse(),\n // string functions\n parseFloat: parseFloat,\n parseInt: parseInt,\n upper: x => String(x).toUpperCase(),\n lower: x => String(x).toLowerCase(),\n substring: function () {\n return apply('substring', arguments, String);\n },\n split: function () {\n return apply('split', arguments, String);\n },\n replace: function () {\n return apply('replace', arguments, String);\n },\n trim: x => String(x).trim(),\n // regexp functions\n regexp: RegExp,\n test: (r, t) => RegExp(r).test(t)\n};\n\nconst EventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'];\nconst DisallowedMethods = new Set([Function, eval, setTimeout, setInterval]);\nif (typeof setImmediate === 'function') DisallowedMethods.add(setImmediate);\nconst Visitors = {\n Literal: ($, n) => n.value,\n Identifier: ($, n) => {\n const id = n.name;\n return $.memberDepth > 0 ? id : id === 'datum' ? $.datum : id === 'event' ? $.event : id === 'item' ? $.item : Constants[id] || $.params['$' + id];\n },\n MemberExpression: ($, n) => {\n const d = !n.computed,\n o = $(n.object);\n if (d) $.memberDepth += 1;\n const p = $(n.property);\n if (d) $.memberDepth -= 1;\n if (DisallowedMethods.has(o[p])) {\n // eslint-disable-next-line no-console\n console.error(`Prevented interpretation of member \"${p}\" which could lead to insecure code execution`);\n return;\n }\n return o[p];\n },\n CallExpression: ($, n) => {\n const args = n.arguments;\n let name = n.callee.name;\n\n // handle special internal functions used by encoders\n // re-route to corresponding standard function\n if (name.startsWith('_')) {\n name = name.slice(1);\n }\n\n // special case \"if\" due to conditional evaluation of branches\n return name === 'if' ? $(args[0]) ? $(args[1]) : $(args[2]) : ($.fn[name] || Functions[name]).apply($.fn, args.map($));\n },\n ArrayExpression: ($, n) => n.elements.map($),\n BinaryExpression: ($, n) => Ops[n.operator]($(n.left), $(n.right)),\n UnaryExpression: ($, n) => Unary[n.operator]($(n.argument)),\n ConditionalExpression: ($, n) => $(n.test) ? $(n.consequent) : $(n.alternate),\n LogicalExpression: ($, n) => n.operator === '&&' ? $(n.left) && $(n.right) : $(n.left) || $(n.right),\n ObjectExpression: ($, n) => n.properties.reduce((o, p) => {\n $.memberDepth += 1;\n const k = $(p.key);\n $.memberDepth -= 1;\n if (DisallowedMethods.has($(p.value))) {\n // eslint-disable-next-line no-console\n console.error(`Prevented interpretation of property \"${k}\" which could lead to insecure code execution`);\n } else {\n o[k] = $(p.value);\n }\n return o;\n }, {})\n};\nfunction interpret (ast, fn, params, datum, event, item) {\n const $ = n => Visitors[n.type]($, n);\n $.memberDepth = 0;\n $.fn = Object.create(fn);\n $.params = params;\n $.datum = datum;\n $.event = event;\n $.item = item;\n\n // route event functions to annotated vega event context\n EventFunctions.forEach(f => $.fn[f] = function () {\n return event.vega[f](...arguments);\n });\n return $(ast);\n}\n\nvar expression = {\n /**\n * Parse an expression used to update an operator value.\n */\n operator(ctx, expr) {\n const ast = expr.ast,\n fn = ctx.functions;\n return _ => interpret(ast, fn, _);\n },\n /**\n * Parse an expression provided as an operator parameter value.\n */\n parameter(ctx, expr) {\n const ast = expr.ast,\n fn = ctx.functions;\n return (datum, _) => interpret(ast, fn, _, datum);\n },\n /**\n * Parse an expression applied to an event stream.\n */\n event(ctx, expr) {\n const ast = expr.ast,\n fn = ctx.functions;\n return event => interpret(ast, fn, undefined, undefined, event);\n },\n /**\n * Parse an expression used to handle an event-driven operator update.\n */\n handler(ctx, expr) {\n const ast = expr.ast,\n fn = ctx.functions;\n return (_, event) => {\n const datum = event.item && event.item.datum;\n return interpret(ast, fn, _, datum, event);\n };\n },\n /**\n * Parse an expression that performs visual encoding.\n */\n encode(ctx, encode) {\n const {\n marktype,\n channels\n } = encode,\n fn = ctx.functions,\n swap = marktype === 'group' || marktype === 'image' || marktype === 'rect';\n return (item, _) => {\n const datum = item.datum;\n let m = 0,\n v;\n for (const name in channels) {\n v = interpret(channels[name].ast, fn, _, datum, undefined, item);\n if (item[name] !== v) {\n item[name] = v;\n m = 1;\n }\n }\n if (marktype !== 'rule') {\n adjustSpatial(item, channels, swap);\n }\n return m;\n };\n }\n};\n\nexport { expression as expressionInterpreter };\n","export function isLogicalOr(op) {\n return !!op.or;\n}\nexport function isLogicalAnd(op) {\n return !!op.and;\n}\nexport function isLogicalNot(op) {\n return !!op.not;\n}\nexport function forEachLeaf(op, fn) {\n if (isLogicalNot(op)) {\n forEachLeaf(op.not, fn);\n }\n else if (isLogicalAnd(op)) {\n for (const subop of op.and) {\n forEachLeaf(subop, fn);\n }\n }\n else if (isLogicalOr(op)) {\n for (const subop of op.or) {\n forEachLeaf(subop, fn);\n }\n }\n else {\n fn(op);\n }\n}\nexport function normalizeLogicalComposition(op, normalizer) {\n if (isLogicalNot(op)) {\n return { not: normalizeLogicalComposition(op.not, normalizer) };\n }\n else if (isLogicalAnd(op)) {\n return { and: op.and.map(o => normalizeLogicalComposition(o, normalizer)) };\n }\n else if (isLogicalOr(op)) {\n return { or: op.or.map(o => normalizeLogicalComposition(o, normalizer)) };\n }\n else {\n return normalizer(op);\n }\n}\n//# sourceMappingURL=logical.js.map","import { hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig } from 'vega-util';\nimport { isLogicalAnd, isLogicalNot, isLogicalOr } from './logical';\nexport const duplicate = structuredClone;\nexport function never(message) {\n throw new Error(message);\n}\n/**\n * Creates an object composed of the picked object properties.\n *\n * var object = {'a': 1, 'b': '2', 'c': 3};\n * pick(object, ['a', 'c']);\n * // → {'a': 1, 'c': 3}\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function pick(obj, props) {\n const copy = {};\n for (const prop of props) {\n if (hasOwnProperty(obj, prop)) {\n copy[prop] = obj[prop];\n }\n }\n return copy;\n}\n/**\n * The opposite of _.pick; this method creates an object composed of the own\n * and inherited enumerable string keyed properties of object that are not omitted.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function omit(obj, props) {\n const copy = { ...obj };\n for (const prop of props) {\n delete copy[prop];\n }\n return copy;\n}\n/**\n * Monkey patch Set so that `stringify` produces a string representation of sets.\n */\nSet.prototype['toJSON'] = function () {\n return `Set(${[...this].map(x => stringify(x)).join(',')})`;\n};\n/**\n * Converts any object to a string of limited size, or a number.\n */\nexport function hash(a) {\n if (isNumber(a)) {\n return a;\n }\n const str = isString(a) ? a : stringify(a);\n // short strings can be used as hash directly, longer strings are hashed to reduce memory usage\n if (str.length < 250) {\n return str;\n }\n // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\n let h = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n h = (h << 5) - h + char;\n h = h & h; // Convert to 32bit integer\n }\n return h;\n}\nexport function isNullOrFalse(x) {\n return x === false || x === null;\n}\nexport function contains(array, item) {\n return array.includes(item);\n}\n/**\n * Returns true if any item returns true.\n */\nexport function some(arr, f) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (f(a, k, i++)) {\n return true;\n }\n }\n return false;\n}\n/**\n * Returns true if all items return true.\n */\nexport function every(arr, f) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (!f(a, k, i++)) {\n return false;\n }\n }\n return true;\n}\n/**\n * recursively merges src into dest\n */\nexport function mergeDeep(dest, ...src) {\n for (const s of src) {\n deepMerge_(dest, s ?? {});\n }\n return dest;\n}\nfunction deepMerge_(dest, src) {\n for (const property of keys(src)) {\n writeConfig(dest, property, src[property], true);\n }\n}\nexport function unique(values, f) {\n const results = [];\n const u = {};\n let v;\n for (const val of values) {\n v = f(val);\n if (v in u) {\n continue;\n }\n u[v] = 1;\n results.push(val);\n }\n return results;\n}\n/**\n * Returns true if the two dictionaries agree. Applies only to defined values.\n */\nexport function isEqual(dict, other) {\n const dictKeys = keys(dict);\n const otherKeys = keys(other);\n if (dictKeys.length !== otherKeys.length) {\n return false;\n }\n for (const key of dictKeys) {\n if (dict[key] !== other[key]) {\n return false;\n }\n }\n return true;\n}\nexport function setEqual(a, b) {\n if (a.size !== b.size) {\n return false;\n }\n for (const e of a) {\n if (!b.has(e)) {\n return false;\n }\n }\n return true;\n}\nexport function hasIntersection(a, b) {\n for (const key of a) {\n if (b.has(key)) {\n return true;\n }\n }\n return false;\n}\nexport function prefixGenerator(a) {\n const prefixes = new Set();\n for (const x of a) {\n const splitField = splitAccessPath(x);\n // Wrap every element other than the first in `[]`\n const wrappedWithAccessors = splitField.map((y, i) => (i === 0 ? y : `[${y}]`));\n const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join(''));\n for (const y of computedPrefixes) {\n prefixes.add(y);\n }\n }\n return prefixes;\n}\n/**\n * Returns true if a and b have an intersection. Also return true if a or b are undefined\n * since this means we don't know what fields a node produces or depends on.\n */\nexport function fieldIntersection(a, b) {\n if (a === undefined || b === undefined) {\n return true;\n }\n return hasIntersection(prefixGenerator(a), prefixGenerator(b));\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isEmpty(obj) {\n return keys(obj).length === 0;\n}\n// This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208\nexport const keys = Object.keys;\nexport const vals = Object.values;\nexport const entries = Object.entries;\nexport function isBoolean(b) {\n return b === true || b === false;\n}\n/**\n * Convert a string into a valid variable name\n */\nexport function varName(s) {\n // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _\n const alphanumericS = s.replace(/\\W/g, '_');\n // Add _ if the string has leading numbers.\n return (s.match(/^\\d+/) ? '_' : '') + alphanumericS;\n}\nexport function logicalExpr(op, cb) {\n if (isLogicalNot(op)) {\n return `!(${logicalExpr(op.not, cb)})`;\n }\n else if (isLogicalAnd(op)) {\n return `(${op.and.map((and) => logicalExpr(and, cb)).join(') && (')})`;\n }\n else if (isLogicalOr(op)) {\n return `(${op.or.map((or) => logicalExpr(or, cb)).join(') || (')})`;\n }\n else {\n return cb(op);\n }\n}\n/**\n * Delete nested property of an object, and delete the ancestors of the property if they become empty.\n */\nexport function deleteNestedProperty(obj, orderedProps) {\n if (orderedProps.length === 0) {\n return true;\n }\n const prop = orderedProps.shift(); // eslint-disable-line @typescript-eslint/no-non-null-assertion\n if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) {\n delete obj[prop];\n }\n return isEmpty(obj);\n}\nexport function titleCase(s) {\n return s.charAt(0).toUpperCase() + s.substr(1);\n}\n/**\n * Converts a path to an access path with datum.\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function accessPathWithDatum(path, datum = 'datum') {\n const pieces = splitAccessPath(path);\n const prefixes = [];\n for (let i = 1; i <= pieces.length; i++) {\n const prefix = `[${pieces.slice(0, i).map(stringValue).join('][')}]`;\n prefixes.push(`${datum}${prefix}`);\n }\n return prefixes.join(' && ');\n}\n/**\n * Return access with datum to the flattened field.\n *\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function flatAccessWithDatum(path, datum = 'datum') {\n return `${datum}[${stringValue(splitAccessPath(path).join('.'))}]`;\n}\nfunction escapePathAccess(string) {\n return string.replace(/(\\[|\\]|\\.|'|\")/g, '\\\\$1');\n}\n/**\n * Replaces path accesses with access to non-nested field.\n * For example, `foo[\"bar\"].baz` becomes `foo\\\\.bar\\\\.baz`.\n */\nexport function replacePathInField(path) {\n return `${splitAccessPath(path).map(escapePathAccess).join('\\\\.')}`;\n}\n/**\n * Replace all occurrences of a string with another string.\n *\n * @param string the string to replace in\n * @param find the string to replace\n * @param replacement the replacement\n */\nexport function replaceAll(string, find, replacement) {\n return string.replace(new RegExp(find.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'g'), replacement);\n}\n/**\n * Remove path accesses with access from field.\n * For example, `foo[\"bar\"].baz` becomes `foo.bar.baz`.\n */\nexport function removePathFromField(path) {\n return `${splitAccessPath(path).join('.')}`;\n}\n/**\n * Count the depth of the path. Returns 1 for fields that are not nested.\n */\nexport function accessPathDepth(path) {\n if (!path) {\n return 0;\n }\n return splitAccessPath(path).length;\n}\n/**\n * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included.\n */\nexport function getFirstDefined(...args) {\n for (const arg of args) {\n if (arg !== undefined) {\n return arg;\n }\n }\n return undefined;\n}\n// variable used to generate id\nlet idCounter = 42;\n/**\n * Returns a new random id every time it gets called.\n *\n * Has side effect!\n */\nexport function uniqueId(prefix) {\n const id = ++idCounter;\n return prefix ? String(prefix) + id : id;\n}\n/**\n * Resets the id counter used in uniqueId. This can be useful for testing.\n */\nexport function resetIdCounter() {\n idCounter = 42;\n}\nexport function internalField(name) {\n return isInternalField(name) ? name : `__${name}`;\n}\nexport function isInternalField(name) {\n return name.startsWith('__');\n}\n/**\n * Normalize angle to be within [0,360).\n */\nexport function normalizeAngle(angle) {\n if (angle === undefined) {\n return undefined;\n }\n return ((angle % 360) + 360) % 360;\n}\n/**\n * Returns whether the passed in value is a valid number.\n */\nexport function isNumeric(value) {\n if (isNumber(value)) {\n return true;\n }\n return !isNaN(value) && !isNaN(parseFloat(value));\n}\nconst clonedProto = Object.getPrototypeOf(structuredClone({}));\n/**\n * Compares two values for equality, including arrays and objects.\n *\n * Adapted from https://github.com/epoberezkin/fast-deep-equal.\n */\nexport function deepEqual(a, b) {\n if (a === b)\n return true;\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n // compare names to avoid issues with structured clone\n if (a.constructor.name !== b.constructor.name)\n return false;\n let length;\n let i;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (!deepEqual(a[i], b[i]))\n return false;\n return true;\n }\n if (a instanceof Map && b instanceof Map) {\n if (a.size !== b.size)\n return false;\n for (i of a.entries())\n if (!b.has(i[0]))\n return false;\n for (i of a.entries())\n if (!deepEqual(i[1], b.get(i[0])))\n return false;\n return true;\n }\n if (a instanceof Set && b instanceof Set) {\n if (a.size !== b.size)\n return false;\n for (i of a.entries())\n if (!b.has(i[0]))\n return false;\n return true;\n }\n if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i])\n return false;\n return true;\n }\n if (a.constructor === RegExp)\n return a.source === b.source && a.flags === b.flags;\n // also compare to structured clone prototype\n if (a.valueOf !== Object.prototype.valueOf && a.valueOf !== clonedProto.valueOf)\n return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString && a.toString !== clonedProto.toString)\n return a.toString() === b.toString();\n const ks = Object.keys(a);\n length = ks.length;\n if (length !== Object.keys(b).length)\n return false;\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, ks[i]))\n return false;\n for (i = length; i-- !== 0;) {\n const key = ks[i];\n if (!deepEqual(a[key], b[key]))\n return false;\n }\n return true;\n }\n // true if both NaN, false otherwise\n return a !== a && b !== b;\n}\n/**\n * Converts any object to a string representation that can be consumed by humans.\n *\n * Adapted from https://github.com/epoberezkin/fast-json-stable-stringify\n */\nexport function stringify(data) {\n const seen = [];\n return (function _stringify(node) {\n if (node && node.toJSON && typeof node.toJSON === 'function') {\n node = node.toJSON();\n }\n if (node === undefined)\n return undefined;\n if (typeof node == 'number')\n return isFinite(node) ? '' + node : 'null';\n if (typeof node !== 'object')\n return JSON.stringify(node);\n let i, out;\n if (Array.isArray(node)) {\n out = '[';\n for (i = 0; i < node.length; i++) {\n if (i)\n out += ',';\n out += _stringify(node[i]) || 'null';\n }\n return out + ']';\n }\n if (node === null)\n return 'null';\n if (seen.includes(node)) {\n throw new TypeError('Converting circular structure to JSON');\n }\n const seenIndex = seen.push(node) - 1;\n const ks = Object.keys(node).sort();\n out = '';\n for (i = 0; i < ks.length; i++) {\n const key = ks[i];\n const value = _stringify(node[key]);\n if (!value)\n continue;\n if (out)\n out += ',';\n out += JSON.stringify(key) + ':' + value;\n }\n seen.splice(seenIndex, 1);\n return `{${out}}`;\n })(data);\n}\n//# sourceMappingURL=util.js.map","/*\n * Constants and utilities for encoding channels (Visual variables)\n * such as 'x', 'y', 'color'.\n */\nimport { keys } from './util';\n// Facet\nexport const ROW = 'row';\nexport const COLUMN = 'column';\nexport const FACET = 'facet';\n// Position\nexport const X = 'x';\nexport const Y = 'y';\nexport const X2 = 'x2';\nexport const Y2 = 'y2';\n// Position Offset\nexport const XOFFSET = 'xOffset';\nexport const YOFFSET = 'yOffset';\n// Arc-Position\nexport const RADIUS = 'radius';\nexport const RADIUS2 = 'radius2';\nexport const THETA = 'theta';\nexport const THETA2 = 'theta2';\n// Geo Position\nexport const LATITUDE = 'latitude';\nexport const LONGITUDE = 'longitude';\nexport const LATITUDE2 = 'latitude2';\nexport const LONGITUDE2 = 'longitude2';\n// Mark property with scale\nexport const COLOR = 'color';\nexport const FILL = 'fill';\nexport const STROKE = 'stroke';\nexport const SHAPE = 'shape';\nexport const SIZE = 'size';\nexport const ANGLE = 'angle';\nexport const OPACITY = 'opacity';\nexport const FILLOPACITY = 'fillOpacity';\nexport const STROKEOPACITY = 'strokeOpacity';\nexport const STROKEWIDTH = 'strokeWidth';\nexport const STROKEDASH = 'strokeDash';\n// Non-scale channel\nexport const TEXT = 'text';\nexport const ORDER = 'order';\nexport const DETAIL = 'detail';\nexport const KEY = 'key';\nexport const TOOLTIP = 'tooltip';\nexport const HREF = 'href';\nexport const URL = 'url';\nexport const DESCRIPTION = 'description';\nconst POSITION_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n x2: 1,\n y2: 1\n};\nconst POLAR_POSITION_CHANNEL_INDEX = {\n theta: 1,\n theta2: 1,\n radius: 1,\n radius2: 1\n};\nexport function isPolarPositionChannel(c) {\n return c in POLAR_POSITION_CHANNEL_INDEX;\n}\nconst GEO_POSIITON_CHANNEL_INDEX = {\n longitude: 1,\n longitude2: 1,\n latitude: 1,\n latitude2: 1\n};\nexport function getPositionChannelFromLatLong(channel) {\n switch (channel) {\n case LATITUDE:\n return 'y';\n case LATITUDE2:\n return 'y2';\n case LONGITUDE:\n return 'x';\n case LONGITUDE2:\n return 'x2';\n }\n}\nexport function isGeoPositionChannel(c) {\n return c in GEO_POSIITON_CHANNEL_INDEX;\n}\nexport const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX);\nconst UNIT_CHANNEL_INDEX = {\n ...POSITION_CHANNEL_INDEX,\n ...POLAR_POSITION_CHANNEL_INDEX,\n ...GEO_POSIITON_CHANNEL_INDEX,\n xOffset: 1,\n yOffset: 1,\n // color\n color: 1,\n fill: 1,\n stroke: 1,\n // other non-position with scale\n opacity: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n strokeWidth: 1,\n strokeDash: 1,\n size: 1,\n angle: 1,\n shape: 1,\n // channels without scales\n order: 1,\n text: 1,\n detail: 1,\n key: 1,\n tooltip: 1,\n href: 1,\n url: 1,\n description: 1\n};\nexport function isColorChannel(channel) {\n return channel === COLOR || channel === FILL || channel === STROKE;\n}\nconst FACET_CHANNEL_INDEX = {\n row: 1,\n column: 1,\n facet: 1\n};\nexport const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX);\nconst CHANNEL_INDEX = {\n ...UNIT_CHANNEL_INDEX,\n ...FACET_CHANNEL_INDEX\n};\nexport const CHANNELS = keys(CHANNEL_INDEX);\nconst { order: _o, detail: _d, tooltip: _tt1, ...SINGLE_DEF_CHANNEL_INDEX } = CHANNEL_INDEX;\nconst { row: _r, column: _c, facet: _f, ...SINGLE_DEF_UNIT_CHANNEL_INDEX } = SINGLE_DEF_CHANNEL_INDEX;\n/**\n * Channels that cannot have an array of channelDef.\n * model.fieldDef, getFieldDef only work for these channels.\n *\n * (The only two channels that can have an array of channelDefs are \"detail\" and \"order\".\n * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef\n * are not applicable for them. Similarly, selection projection won't work with \"detail\" and \"order\".)\n */\nexport const SINGLE_DEF_CHANNELS = keys(SINGLE_DEF_CHANNEL_INDEX);\nexport const SINGLE_DEF_UNIT_CHANNELS = keys(SINGLE_DEF_UNIT_CHANNEL_INDEX);\nexport function isSingleDefUnitChannel(str) {\n return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str];\n}\nexport function isChannel(str) {\n return !!CHANNEL_INDEX[str];\n}\nexport const SECONDARY_RANGE_CHANNEL = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2];\nexport function isSecondaryRangeChannel(c) {\n const main = getMainRangeChannel(c);\n return main !== c;\n}\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getMainRangeChannel(channel) {\n switch (channel) {\n case X2:\n return X;\n case Y2:\n return Y;\n case LATITUDE2:\n return LATITUDE;\n case LONGITUDE2:\n return LONGITUDE;\n case THETA2:\n return THETA;\n case RADIUS2:\n return RADIUS;\n }\n return channel;\n}\nexport function getVgPositionChannel(channel) {\n if (isPolarPositionChannel(channel)) {\n switch (channel) {\n case THETA:\n return 'startAngle';\n case THETA2:\n return 'endAngle';\n case RADIUS:\n return 'outerRadius';\n case RADIUS2:\n return 'innerRadius';\n }\n }\n return channel;\n}\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getSecondaryRangeChannel(channel) {\n switch (channel) {\n case X:\n return X2;\n case Y:\n return Y2;\n case LATITUDE:\n return LATITUDE2;\n case LONGITUDE:\n return LONGITUDE2;\n case THETA:\n return THETA2;\n case RADIUS:\n return RADIUS2;\n }\n return undefined;\n}\nexport function getSizeChannel(channel) {\n switch (channel) {\n case X:\n case X2:\n return 'width';\n case Y:\n case Y2:\n return 'height';\n }\n return undefined;\n}\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getOffsetChannel(channel) {\n switch (channel) {\n case X:\n return 'xOffset';\n case Y:\n return 'yOffset';\n case X2:\n return 'x2Offset';\n case Y2:\n return 'y2Offset';\n case THETA:\n return 'thetaOffset';\n case RADIUS:\n return 'radiusOffset';\n case THETA2:\n return 'theta2Offset';\n case RADIUS2:\n return 'radius2Offset';\n }\n return undefined;\n}\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getOffsetScaleChannel(channel) {\n switch (channel) {\n case X:\n return 'xOffset';\n case Y:\n return 'yOffset';\n }\n return undefined;\n}\nexport function getMainChannelFromOffsetChannel(channel) {\n switch (channel) {\n case 'xOffset':\n return 'x';\n case 'yOffset':\n return 'y';\n }\n}\n// CHANNELS without COLUMN, ROW\nexport const UNIT_CHANNELS = keys(UNIT_CHANNEL_INDEX);\n// NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2;\nconst { x: _x, y: _y, \n// x2 and y2 share the same scale as x and y\nx2: _x2, y2: _y2, \n//\nxOffset: _xo, yOffset: _yo, latitude: _latitude, longitude: _longitude, latitude2: _latitude2, longitude2: _longitude2, theta: _theta, theta2: _theta2, radius: _radius, radius2: _radius2, \n// The rest of unit channels then have scale\n...NONPOSITION_CHANNEL_INDEX } = UNIT_CHANNEL_INDEX;\nexport const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX);\nconst POSITION_SCALE_CHANNEL_INDEX = {\n x: 1,\n y: 1\n};\nexport const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX);\nexport function isXorY(channel) {\n return channel in POSITION_SCALE_CHANNEL_INDEX;\n}\nexport const POLAR_POSITION_SCALE_CHANNEL_INDEX = {\n theta: 1,\n radius: 1\n};\nexport const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX);\nexport function getPositionScaleChannel(sizeType) {\n return sizeType === 'width' ? X : Y;\n}\nconst OFFSET_SCALE_CHANNEL_INDEX = { xOffset: 1, yOffset: 1 };\nexport const OFFSET_SCALE_CHANNELS = keys(OFFSET_SCALE_CHANNEL_INDEX);\nexport function isXorYOffset(channel) {\n return channel in OFFSET_SCALE_CHANNEL_INDEX;\n}\n// NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without position / offset\nconst { \n// x2 and y2 share the same scale as x and y\n// text and tooltip have format instead of scale,\n// href has neither format, nor scale\ntext: _t, tooltip: _tt, href: _hr, url: _u, description: _al, \n// detail and order have no scale\ndetail: _dd, key: _k, order: _oo, ...NONPOSITION_SCALE_CHANNEL_INDEX } = NONPOSITION_CHANNEL_INDEX;\nexport const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX);\nexport function isNonPositionScaleChannel(channel) {\n return !!NONPOSITION_CHANNEL_INDEX[channel];\n}\n/**\n * @returns whether Vega supports legends for a particular channel\n */\nexport function supportLegend(channel) {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n case SIZE:\n case SHAPE:\n case OPACITY:\n case STROKEWIDTH:\n case STROKEDASH:\n return true;\n case FILLOPACITY:\n case STROKEOPACITY:\n case ANGLE:\n return false;\n }\n}\n// Declare SCALE_CHANNEL_INDEX\nconst SCALE_CHANNEL_INDEX = {\n ...POSITION_SCALE_CHANNEL_INDEX,\n ...POLAR_POSITION_SCALE_CHANNEL_INDEX,\n ...OFFSET_SCALE_CHANNEL_INDEX,\n ...NONPOSITION_SCALE_CHANNEL_INDEX\n};\n/** List of channels with scales */\nexport const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX);\nexport function isScaleChannel(channel) {\n return !!SCALE_CHANNEL_INDEX[channel];\n}\n/**\n * Return whether a channel supports a particular mark type.\n * @param channel channel name\n * @param mark the mark type\n * @return whether the mark supports the channel\n */\nexport function supportMark(channel, mark) {\n return getSupportedMark(channel)[mark];\n}\nconst ALL_MARKS = {\n // all marks\n arc: 'always',\n area: 'always',\n bar: 'always',\n circle: 'always',\n geoshape: 'always',\n image: 'always',\n line: 'always',\n rule: 'always',\n point: 'always',\n rect: 'always',\n square: 'always',\n trail: 'always',\n text: 'always',\n tick: 'always'\n};\nconst { geoshape: _g, ...ALL_MARKS_EXCEPT_GEOSHAPE } = ALL_MARKS;\n/**\n * Return a dictionary showing whether a channel supports mark type.\n * @param channel\n * @return A dictionary mapping mark types to 'always', 'binned', or undefined\n */\nfunction getSupportedMark(channel) {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n // falls through\n case DESCRIPTION:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case ORDER: // TODO: revise (order might not support rect, which is not stackable?)\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n // falls through\n case FACET:\n case ROW: // falls through\n case COLUMN:\n return ALL_MARKS;\n case X:\n case Y:\n case XOFFSET:\n case YOFFSET:\n case LATITUDE:\n case LONGITUDE:\n // all marks except geoshape. geoshape does not use X, Y -- it uses a projection\n return ALL_MARKS_EXCEPT_GEOSHAPE;\n case X2:\n case Y2:\n case LATITUDE2:\n case LONGITUDE2:\n return {\n area: 'always',\n bar: 'always',\n image: 'always',\n rect: 'always',\n rule: 'always',\n circle: 'binned',\n point: 'binned',\n square: 'binned',\n tick: 'binned',\n line: 'binned',\n trail: 'binned'\n };\n case SIZE:\n return {\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n text: 'always',\n line: 'always',\n trail: 'always'\n };\n case STROKEDASH:\n return {\n line: 'always',\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n geoshape: 'always'\n };\n case SHAPE:\n return { point: 'always', geoshape: 'always' };\n case TEXT:\n return { text: 'always' };\n case ANGLE:\n return { point: 'always', square: 'always', text: 'always' };\n case URL:\n return { image: 'always' };\n case THETA:\n return { text: 'always', arc: 'always' };\n case RADIUS:\n return { text: 'always', arc: 'always' };\n case THETA2:\n case RADIUS2:\n return { arc: 'always' };\n }\n}\nexport function rangeType(channel) {\n switch (channel) {\n case X:\n case Y:\n case THETA:\n case RADIUS:\n case XOFFSET:\n case YOFFSET:\n case SIZE:\n case ANGLE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through]\n case X2:\n case Y2:\n case THETA2:\n case RADIUS2:\n return undefined;\n case FACET:\n case ROW:\n case COLUMN:\n case SHAPE:\n case STROKEDASH:\n // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through]\n case TEXT:\n case TOOLTIP:\n case HREF:\n case URL:\n case DESCRIPTION:\n return 'discrete';\n // Color can be either continuous or discrete, depending on scale type.\n case COLOR:\n case FILL:\n case STROKE:\n return 'flexible';\n // No scale, no range type.\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n case DETAIL:\n case KEY:\n case ORDER:\n return undefined;\n }\n}\n//# sourceMappingURL=channel.js.map","import { isString } from 'vega-util';\nimport { contains } from './util';\nconst AGGREGATE_OP_INDEX = {\n argmax: 1,\n argmin: 1,\n average: 1,\n count: 1,\n distinct: 1,\n product: 1,\n max: 1,\n mean: 1,\n median: 1,\n min: 1,\n missing: 1,\n q1: 1,\n q3: 1,\n ci0: 1,\n ci1: 1,\n stderr: 1,\n stdev: 1,\n stdevp: 1,\n sum: 1,\n valid: 1,\n values: 1,\n variance: 1,\n variancep: 1\n};\nexport const MULTIDOMAIN_SORT_OP_INDEX = {\n count: 1,\n min: 1,\n max: 1\n};\nexport function isArgminDef(a) {\n return !!a && !!a['argmin'];\n}\nexport function isArgmaxDef(a) {\n return !!a && !!a['argmax'];\n}\nexport function isAggregateOp(a) {\n return isString(a) && !!AGGREGATE_OP_INDEX[a];\n}\nexport const COUNTING_OPS = new Set([\n 'count',\n 'valid',\n 'missing',\n 'distinct'\n]);\nexport function isCountingAggregateOp(aggregate) {\n return isString(aggregate) && COUNTING_OPS.has(aggregate);\n}\nexport function isMinMaxOp(aggregate) {\n return isString(aggregate) && contains(['min', 'max'], aggregate);\n}\n/** Additive-based aggregation operations. These can be applied to stack. */\nexport const SUM_OPS = new Set([\n 'count',\n 'sum',\n 'distinct',\n 'valid',\n 'missing'\n]);\n/**\n * Aggregation operators that always produce values within the range [domainMin, domainMax].\n */\nexport const SHARED_DOMAIN_OPS = new Set([\n 'mean',\n 'average',\n 'median',\n 'q1',\n 'q3',\n 'min',\n 'max'\n]);\n//# sourceMappingURL=aggregate.js.map","import { isBoolean, isObject } from 'vega-util';\nimport { COLOR, COLUMN, FILL, FILLOPACITY, OPACITY, ROW, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH } from './channel';\nimport { normalizeBin } from './channeldef';\nimport { entries, keys, varName } from './util';\n/**\n * Create a key for the bin configuration. Not for prebinned bin.\n */\nexport function binToString(bin) {\n if (isBoolean(bin)) {\n bin = normalizeBin(bin, undefined);\n }\n return ('bin' +\n keys(bin)\n .map(p => (isParameterExtent(bin[p]) ? varName(`_${p}_${entries(bin[p])}`) : varName(`_${p}_${bin[p]}`)))\n .join(''));\n}\n/**\n * Vega-Lite should bin the data.\n */\nexport function isBinning(bin) {\n return bin === true || (isBinParams(bin) && !bin.binned);\n}\n/**\n * The data is already binned and so Vega-Lite should not bin it again.\n */\nexport function isBinned(bin) {\n return bin === 'binned' || (isBinParams(bin) && bin.binned === true);\n}\nexport function isBinParams(bin) {\n return isObject(bin);\n}\nexport function isParameterExtent(extent) {\n return extent?.['param'];\n}\nexport function autoMaxBins(channel) {\n switch (channel) {\n case ROW:\n case COLUMN:\n case SIZE:\n case COLOR:\n case FILL:\n case STROKE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // Facets and Size shouldn't have too many bins\n // We choose 6 like shape to simplify the rule [falls through]\n case SHAPE:\n return 6; // Vega's \"shape\" has 6 distinct values\n case STROKEDASH:\n return 4; // We only provide 5 different stroke dash values (but 4 is more effective)\n default:\n return 10;\n }\n}\n//# sourceMappingURL=bin.js.map","import { signalRefOrValue } from './compile/common';\nimport { keys } from './util';\nexport function isExprRef(o) {\n return !!o?.expr;\n}\nexport function replaceExprRef(index) {\n const props = keys(index || {});\n const newIndex = {};\n for (const prop of props) {\n newIndex[prop] = signalRefOrValue(index[prop]);\n }\n return newIndex;\n}\n//# sourceMappingURL=expr.js.map","import { isArray, isString } from 'vega-util';\nimport { pick } from './util';\nexport function extractTitleConfig(titleConfig) {\n const { \n // These are non-mark title config that need to be hardcoded\n anchor, frame, offset, orient, angle, limit, \n // color needs to be redirect to fill\n color, \n // subtitle properties\n subtitleColor, subtitleFont, subtitleFontSize, subtitleFontStyle, subtitleFontWeight, subtitleLineHeight, subtitlePadding, \n // The rest are mark config.\n ...rest } = titleConfig;\n const titleMarkConfig = {\n ...rest,\n ...(color ? { fill: color } : {})\n };\n // These are non-mark title config that need to be hardcoded\n const nonMarkTitleProperties = {\n ...(anchor ? { anchor } : {}),\n ...(frame ? { frame } : {}),\n ...(offset ? { offset } : {}),\n ...(orient ? { orient } : {}),\n ...(angle !== undefined ? { angle } : {}),\n ...(limit !== undefined ? { limit } : {})\n };\n // subtitle part can stay in config.title since header titles do not use subtitle\n const subtitle = {\n ...(subtitleColor ? { subtitleColor } : {}),\n ...(subtitleFont ? { subtitleFont } : {}),\n ...(subtitleFontSize ? { subtitleFontSize } : {}),\n ...(subtitleFontStyle ? { subtitleFontStyle } : {}),\n ...(subtitleFontWeight ? { subtitleFontWeight } : {}),\n ...(subtitleLineHeight ? { subtitleLineHeight } : {}),\n ...(subtitlePadding ? { subtitlePadding } : {})\n };\n const subtitleMarkConfig = pick(titleConfig, ['align', 'baseline', 'dx', 'dy', 'limit']);\n return { titleMarkConfig, subtitleMarkConfig, nonMarkTitleProperties, subtitle };\n}\nexport function isText(v) {\n return isString(v) || (isArray(v) && isString(v[0]));\n}\n//# sourceMappingURL=title.js.map","import { isArray } from 'vega-util';\nimport { keys } from './util';\nexport function isSignalRef(o) {\n return !!o?.signal;\n}\nexport function isVgRangeStep(range) {\n return !!range['step'];\n}\nexport function isDataRefUnionedDomain(domain) {\n if (!isArray(domain)) {\n return 'fields' in domain && !('data' in domain);\n }\n return false;\n}\nexport function isFieldRefUnionDomain(domain) {\n if (!isArray(domain)) {\n return 'fields' in domain && 'data' in domain;\n }\n return false;\n}\nexport function isDataRefDomain(domain) {\n if (!isArray(domain)) {\n return 'field' in domain && 'data' in domain;\n }\n return false;\n}\nconst VG_MARK_CONFIG_INDEX = {\n aria: 1,\n description: 1,\n ariaRole: 1,\n ariaRoleDescription: 1,\n blend: 1,\n opacity: 1,\n fill: 1,\n fillOpacity: 1,\n stroke: 1,\n strokeCap: 1,\n strokeWidth: 1,\n strokeOpacity: 1,\n strokeDash: 1,\n strokeDashOffset: 1,\n strokeJoin: 1,\n strokeOffset: 1,\n strokeMiterLimit: 1,\n startAngle: 1,\n endAngle: 1,\n padAngle: 1,\n innerRadius: 1,\n outerRadius: 1,\n size: 1,\n shape: 1,\n interpolate: 1,\n tension: 1,\n orient: 1,\n align: 1,\n baseline: 1,\n text: 1,\n dir: 1,\n dx: 1,\n dy: 1,\n ellipsis: 1,\n limit: 1,\n radius: 1,\n theta: 1,\n angle: 1,\n font: 1,\n fontSize: 1,\n fontWeight: 1,\n fontStyle: 1,\n lineBreak: 1,\n lineHeight: 1,\n cursor: 1,\n href: 1,\n tooltip: 1,\n cornerRadius: 1,\n cornerRadiusTopLeft: 1,\n cornerRadiusTopRight: 1,\n cornerRadiusBottomLeft: 1,\n cornerRadiusBottomRight: 1,\n aspect: 1,\n width: 1,\n height: 1,\n url: 1,\n smooth: 1\n // commented below are vg channel that do not have mark config.\n // x: 1,\n // y: 1,\n // x2: 1,\n // y2: 1,\n // xc'|'yc'\n // clip: 1,\n // path: 1,\n // url: 1,\n};\nexport const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX);\nexport const VG_MARK_INDEX = {\n arc: 1,\n area: 1,\n group: 1,\n image: 1,\n line: 1,\n path: 1,\n rect: 1,\n rule: 1,\n shape: 1,\n symbol: 1,\n text: 1,\n trail: 1\n};\n// Vega's cornerRadius channels.\nexport const VG_CORNERRADIUS_CHANNELS = [\n 'cornerRadius',\n 'cornerRadiusTopLeft',\n 'cornerRadiusTopRight',\n 'cornerRadiusBottomLeft',\n 'cornerRadiusBottomRight'\n];\n//# sourceMappingURL=vega.schema.js.map","import { array, isArray, stringValue } from 'vega-util';\nimport { vgField } from '../channeldef';\nimport { isExprRef } from '../expr';\nimport { isText } from '../title';\nimport { deepEqual, getFirstDefined } from '../util';\nimport { isSignalRef } from '../vega.schema';\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\nexport function signalOrValueRefWithCondition(val) {\n const condition = isArray(val.condition)\n ? val.condition.map(conditionalSignalRefOrValue)\n : conditionalSignalRefOrValue(val.condition);\n return {\n ...signalRefOrValue(val),\n condition\n };\n}\nexport function signalRefOrValue(value) {\n if (isExprRef(value)) {\n const { expr, ...rest } = value;\n return { signal: expr, ...rest };\n }\n return value;\n}\nexport function conditionalSignalRefOrValue(value) {\n if (isExprRef(value)) {\n const { expr, ...rest } = value;\n return { signal: expr, ...rest };\n }\n return value;\n}\nexport function signalOrValueRef(value) {\n if (isExprRef(value)) {\n const { expr, ...rest } = value;\n return { signal: expr, ...rest };\n }\n if (isSignalRef(value)) {\n return value;\n }\n return value !== undefined ? { value } : undefined;\n}\nexport function exprFromSignalRefOrValue(ref) {\n if (isSignalRef(ref)) {\n return ref.signal;\n }\n return stringValue(ref);\n}\nexport function exprFromValueRefOrSignalRef(ref) {\n if (isSignalRef(ref)) {\n return ref.signal;\n }\n return stringValue(ref.value);\n}\nexport function signalOrStringValue(v) {\n if (isSignalRef(v)) {\n return v.signal;\n }\n return v == null ? null : stringValue(v);\n}\nexport function applyMarkConfig(e, model, propsList) {\n for (const property of propsList) {\n const value = getMarkConfig(property, model.markDef, model.config);\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n return e;\n}\nexport function getStyles(mark) {\n return [].concat(mark.type, mark.style ?? []);\n}\nexport function getMarkPropOrConfig(channel, mark, config, opt = {}) {\n const { vgChannel, ignoreVgConfig } = opt;\n if (vgChannel && mark[vgChannel] !== undefined) {\n return mark[vgChannel];\n }\n else if (mark[channel] !== undefined) {\n return mark[channel];\n }\n else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) {\n return undefined;\n }\n return getMarkConfig(channel, mark, config, opt);\n}\n/**\n * Return property value from style or mark specific config property if exists.\n * Otherwise, return general mark specific config.\n */\nexport function getMarkConfig(channel, mark, config, { vgChannel } = {}) {\n return getFirstDefined(\n // style config has highest precedence\n vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined, getMarkStyleConfig(channel, mark, config.style), \n // then mark-specific config\n vgChannel ? config[mark.type][vgChannel] : undefined, config[mark.type][channel], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine\n // If there is vgChannel, skip vl channel.\n // For example, vl size for text is vg fontSize, but config.mark.size is only for point size.\n vgChannel ? config.mark[vgChannel] : config.mark[channel] // Need to cast for the same reason as above\n );\n}\nexport function getMarkStyleConfig(prop, mark, styleConfigIndex) {\n return getStyleConfig(prop, getStyles(mark), styleConfigIndex);\n}\nexport function getStyleConfig(p, styles, styleConfigIndex) {\n styles = array(styles);\n let value;\n for (const style of styles) {\n const styleConfig = styleConfigIndex[style];\n if (styleConfig && styleConfig[p] !== undefined) {\n value = styleConfig[p];\n }\n }\n return value;\n}\n/**\n * Return Vega sort parameters (tuple of field and order).\n */\nexport function sortParams(orderDef, fieldRefOption) {\n return array(orderDef).reduce((s, orderChannelDef) => {\n s.field.push(vgField(orderChannelDef, fieldRefOption));\n s.order.push(orderChannelDef.sort ?? 'ascending');\n return s;\n }, { field: [], order: [] });\n}\nexport function mergeTitleFieldDefs(f1, f2) {\n const merged = [...f1];\n f2.forEach(fdToMerge => {\n for (const fieldDef1 of merged) {\n // If already exists, no need to append to merged array\n if (deepEqual(fieldDef1, fdToMerge)) {\n return;\n }\n }\n merged.push(fdToMerge);\n });\n return merged;\n}\nexport function mergeTitle(title1, title2) {\n if (deepEqual(title1, title2) || !title2) {\n // if titles are the same or title2 is falsy\n return title1;\n }\n else if (!title1) {\n // if title1 is falsy\n return title2;\n }\n else {\n return [...array(title1), ...array(title2)].join(', ');\n }\n}\nexport function mergeTitleComponent(v1, v2) {\n const v1Val = v1.value;\n const v2Val = v2.value;\n if (v1Val == null || v2Val === null) {\n return {\n explicit: v1.explicit,\n value: null\n };\n }\n else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) {\n return {\n explicit: v1.explicit,\n value: mergeTitle(v1Val, v2Val)\n };\n }\n else if (isText(v1Val) || isSignalRef(v1Val)) {\n return {\n explicit: v1.explicit,\n value: v1Val\n };\n }\n else if (isText(v2Val) || isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: v2Val\n };\n }\n else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: mergeTitleFieldDefs(v1Val, v2Val)\n };\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('It should never reach here');\n}\n//# sourceMappingURL=common.js.map","import { getSizeChannel } from '../channel';\nimport { stringify } from '../util';\nexport function invalidSpec(spec) {\n return `Invalid specification ${stringify(spec)}. Make sure the specification includes at least one of the following properties: \"mark\", \"layer\", \"facet\", \"hconcat\", \"vconcat\", \"concat\", or \"repeat\".`;\n}\n// FIT\nexport const FIT_NON_SINGLE = 'Autosize \"fit\" only works for single views and layered views.';\nexport function containerSizeNonSingle(name) {\n const uName = name == 'width' ? 'Width' : 'Height';\n return `${uName} \"container\" only works for single views and layered views.`;\n}\nexport function containerSizeNotCompatibleWithAutosize(name) {\n const uName = name == 'width' ? 'Width' : 'Height';\n const fitDirection = name == 'width' ? 'x' : 'y';\n return `${uName} \"container\" only works well with autosize \"fit\" or \"fit-${fitDirection}\".`;\n}\nexport function droppingFit(channel) {\n return channel\n ? `Dropping \"fit-${channel}\" because spec has discrete ${getSizeChannel(channel)}.`\n : `Dropping \"fit\" because spec has discrete size.`;\n}\n// VIEW SIZE\nexport function unknownField(channel) {\n return `Unknown field for ${channel}. Cannot calculate view size.`;\n}\n// SELECTION\nexport function cannotProjectOnChannelWithoutField(channel) {\n return `Cannot project a selection on encoding channel \"${channel}\", which has no field.`;\n}\nexport function cannotProjectAggregate(channel, aggregate) {\n return `Cannot project a selection on encoding channel \"${channel}\" as it uses an aggregate function (\"${aggregate}\").`;\n}\nexport function nearestNotSupportForContinuous(mark) {\n return `The \"nearest\" transform is not supported for ${mark} marks.`;\n}\nexport function selectionNotSupported(mark) {\n return `Selection not supported for ${mark} yet.`;\n}\nexport function selectionNotFound(name) {\n return `Cannot find a selection named \"${name}\".`;\n}\nexport const SCALE_BINDINGS_CONTINUOUS = 'Scale bindings are currently only supported for scales with unbinned, continuous domains.';\nexport const LEGEND_BINDINGS_MUST_HAVE_PROJECTION = 'Legend bindings are only supported for selections over an individual field or encoding channel.';\nexport function cannotLookupVariableParameter(name) {\n return `Lookups can only be performed on selection parameters. \"${name}\" is a variable parameter.`;\n}\nexport function noSameUnitLookup(name) {\n return (`Cannot define and lookup the \"${name}\" selection in the same view. ` +\n `Try moving the lookup into a second, layered view?`);\n}\nexport const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.';\nexport const INTERVAL_INITIALIZED_WITH_POS = 'Interval selections should be initialized using \"x\", \"y\", \"longitude\", or \"latitude\" keys.';\n// REPEAT\nexport function noSuchRepeatedValue(field) {\n return `Unknown repeated value \"${field}\".`;\n}\nexport function columnsNotSupportByRowCol(type) {\n return `The \"columns\" property cannot be used when \"${type}\" has nested row/column.`;\n}\n// CONCAT / REPEAT\nexport const CONCAT_CANNOT_SHARE_AXIS = 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).';\n// DATA\nexport function unrecognizedParse(p) {\n return `Unrecognized parse \"${p}\".`;\n}\nexport function differentParse(field, local, ancestor) {\n return `An ancestor parsed field \"${field}\" as ${ancestor} but a child wants to parse the field as ${local}.`;\n}\nexport const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.';\n// TRANSFORMS\nexport function invalidTransformIgnored(transform) {\n return `Ignoring an invalid transform: ${stringify(transform)}.`;\n}\nexport const NO_FIELDS_NEEDS_AS = 'If \"from.fields\" is not specified, \"as\" has to be a string that specifies the key to be used for the data from the secondary source.';\n// ENCODING & FACET\nexport function customFormatTypeNotAllowed(channel) {\n return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`;\n}\nexport function projectionOverridden(opt) {\n const { parentProjection, projection } = opt;\n return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify(projection)}.`;\n}\nexport const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.';\nexport function offsetNestedInsideContinuousPositionScaleDropped(mainChannel) {\n return `${mainChannel}Offset dropped because ${mainChannel} is continuous`;\n}\nexport function primitiveChannelDef(channel, type, value) {\n return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`;\n}\nexport function invalidFieldType(type) {\n return `Invalid field type \"${type}\".`;\n}\nexport function invalidFieldTypeForCountAggregate(type, aggregate) {\n return `Invalid field type \"${type}\" for aggregate: \"${aggregate}\", using \"quantitative\" instead.`;\n}\nexport function invalidAggregate(aggregate) {\n return `Invalid aggregation operator \"${aggregate}\".`;\n}\nexport function missingFieldType(channel, newType) {\n return `Missing type for channel \"${channel}\", using \"${newType}\" instead.`;\n}\nexport function droppingColor(type, opt) {\n const { fill, stroke } = opt;\n return `Dropping color ${type} as the plot also has ${fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke'}.`;\n}\nexport function relativeBandSizeNotSupported(sizeChannel) {\n return `Position range does not support relative band size for ${sizeChannel}.`;\n}\nexport function emptyFieldDef(fieldDef, channel) {\n return `Dropping ${stringify(fieldDef)} from channel \"${channel}\" since it does not contain any data field, datum, value, or signal.`;\n}\nexport const LINE_WITH_VARYING_SIZE = 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.';\nexport function incompatibleChannel(channel, markOrFacet, when) {\n return `${channel} dropped as it is incompatible with \"${markOrFacet}\"${when ? ` when ${when}` : ''}.`;\n}\nexport function offsetEncodingScaleIgnored(channel) {\n return `${channel} encoding has no scale, so specified scale is ignored.`;\n}\nexport function invalidEncodingChannel(channel) {\n return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`;\n}\nexport function channelShouldBeDiscrete(channel) {\n return `${channel} encoding should be discrete (ordinal / nominal / binned).`;\n}\nexport function channelShouldBeDiscreteOrDiscretizing(channel) {\n return `${channel} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`;\n}\nexport function facetChannelDropped(channels) {\n return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`;\n}\nexport function discreteChannelCannotEncode(channel, type) {\n return `Using discrete channel \"${channel}\" to encode \"${type}\" field can be misleading as it does not encode ${type === 'ordinal' ? 'order' : 'magnitude'}.`;\n}\n// MARK\nexport function rangeMarkAlignmentCannotBeExpression(align) {\n return `The ${align} for range marks cannot be an expression`;\n}\nexport function lineWithRange(hasX2, hasY2) {\n const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2';\n return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`;\n}\nexport function orientOverridden(original, actual) {\n return `Specified orient \"${original}\" overridden with \"${actual}\".`;\n}\n// SCALE\nexport const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN = 'Custom domain scale cannot be unioned with default field-based domain.';\nexport function cannotUseScalePropertyWithNonColor(prop) {\n return `Cannot use the scale property \"${prop}\" with non-color channel.`;\n}\nexport function cannotUseRelativeBandSizeWithNonBandScale(scaleType) {\n return `Cannot use the relative band size with ${scaleType} scale.`;\n}\nexport function unaggregateDomainHasNoEffectForRawField(fieldDef) {\n return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`;\n}\nexport function unaggregateDomainWithNonSharedDomainOp(aggregate) {\n return `Unaggregated domain not applicable for \"${aggregate}\" since it produces values outside the origin domain of the source data.`;\n}\nexport function unaggregatedDomainWithLogScale(fieldDef) {\n return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`;\n}\nexport function cannotApplySizeToNonOrientedMark(mark) {\n return `Cannot apply size to non-oriented mark \"${mark}\".`;\n}\nexport function scaleTypeNotWorkWithChannel(channel, scaleType, defaultScaleType) {\n return `Channel \"${channel}\" does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\nexport function scaleTypeNotWorkWithFieldDef(scaleType, defaultScaleType) {\n return `FieldDef does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\nexport function scalePropertyNotWorkWithScaleType(scaleType, propName, channel) {\n return `${channel}-scale's \"${propName}\" is dropped as it does not work with ${scaleType} scale.`;\n}\nexport function scaleTypeNotWorkWithMark(mark, scaleType) {\n return `Scale type \"${scaleType}\" does not work with mark \"${mark}\".`;\n}\nexport function stepDropped(channel) {\n return `The step for \"${channel}\" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`;\n}\nexport function mergeConflictingProperty(property, propertyOf, v1, v2) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(v2)}). Using ${stringify(v1)}.`;\n}\nexport function mergeConflictingDomainProperty(property, propertyOf, v1, v2) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(v2)}). Using the union of the two domains.`;\n}\nexport function independentScaleMeansIndependentGuide(channel) {\n return `Setting the scale to be independent for \"${channel}\" means we also have to set the guide (axis or legend) to be independent.`;\n}\nexport function domainSortDropped(sort) {\n return `Dropping sort property ${stringify(sort)} as unioned domains only support boolean or op \"count\", \"min\", and \"max\".`;\n}\nexport const MORE_THAN_ONE_SORT = 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.';\nexport const FACETED_INDEPENDENT_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.';\nexport const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.';\nexport const FACETED_INDEPENDENT_SAME_SOURCE = 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.';\n// AXIS\nexport const INVALID_CHANNEL_FOR_AXIS = 'Invalid channel for axis.';\n// STACK\nexport function cannotStackRangedMark(channel) {\n return `Cannot stack \"${channel}\" if there is already \"${channel}2\".`;\n}\nexport function cannotStackNonLinearScale(scaleType) {\n return `Cannot stack non-linear scale (${scaleType}).`;\n}\nexport function stackNonSummativeAggregate(aggregate) {\n return `Stacking is applied even though the aggregate function is non-summative (\"${aggregate}\").`;\n}\n// TIMEUNIT\nexport function invalidTimeUnit(unitName, value) {\n return `Invalid ${unitName}: ${stringify(value)}.`;\n}\nexport function droppedDay(d) {\n return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`;\n}\nexport function errorBarCenterAndExtentAreNotNeeded(center, extent) {\n return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${extent && center ? 'are ' : 'is '}not needed when data are aggregated.`;\n}\nexport function errorBarCenterIsUsedWithWrongExtent(center, extent, mark) {\n return `${center} is not usually used with ${extent} for ${mark}.`;\n}\nexport function errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark) {\n return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`;\n}\nexport function errorBand1DNotSupport(property) {\n return `1D error band does not support ${property}.`;\n}\n// CHANNEL\nexport function channelRequiredForBinned(channel) {\n return `Channel ${channel} is required for \"binned\" bin.`;\n}\nexport function channelShouldNotBeUsedForBinned(channel) {\n return `Channel ${channel} should not be used with \"binned\" bin.`;\n}\nexport function domainRequiredForThresholdScale(channel) {\n return `Domain for ${channel} is required for threshold scale.`;\n}\n//# sourceMappingURL=message.js.map","/**\n * Vega-Lite's singleton logger utility.\n */\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _LocalLogger_level;\nimport { Debug, Error as ErrorLevel, Info, logger, Warn } from 'vega-util';\nexport * as message from './message';\n/**\n * Main (default) Vega Logger instance for Vega-Lite.\n */\nconst main = logger(Warn);\nlet current = main;\n/**\n * Logger tool for checking if the code throws correct warning.\n */\nexport class LocalLogger {\n constructor() {\n this.warns = [];\n this.infos = [];\n this.debugs = [];\n _LocalLogger_level.set(this, Warn);\n }\n level(_) {\n if (_) {\n __classPrivateFieldSet(this, _LocalLogger_level, _, \"f\");\n return this;\n }\n return __classPrivateFieldGet(this, _LocalLogger_level, \"f\");\n }\n warn(...args) {\n if (__classPrivateFieldGet(this, _LocalLogger_level, \"f\") >= Warn)\n this.warns.push(...args);\n return this;\n }\n info(...args) {\n if (__classPrivateFieldGet(this, _LocalLogger_level, \"f\") >= Info)\n this.infos.push(...args);\n return this;\n }\n debug(...args) {\n if (__classPrivateFieldGet(this, _LocalLogger_level, \"f\") >= Debug)\n this.debugs.push(...args);\n return this;\n }\n error(...args) {\n if (__classPrivateFieldGet(this, _LocalLogger_level, \"f\") >= ErrorLevel)\n throw Error(...args);\n return this;\n }\n}\n_LocalLogger_level = new WeakMap();\nexport function wrap(f) {\n return () => {\n current = new LocalLogger();\n f(current);\n reset();\n };\n}\n/**\n * Set the singleton logger to be a custom logger.\n */\nexport function set(newLogger) {\n current = newLogger;\n return current;\n}\n/**\n * Reset the main logger to use the default Vega Logger.\n */\nexport function reset() {\n current = main;\n return current;\n}\nexport function error(...args) {\n current.error(...args);\n}\nexport function warn(...args) {\n current.warn(...args);\n}\nexport function info(...args) {\n current.info(...args);\n}\nexport function debug(...args) {\n current.debug(...args);\n}\n//# sourceMappingURL=index.js.map","// DateTime definition object\nimport { isNumber, isObject } from 'vega-util';\nimport * as log from './log';\nimport { TIMEUNIT_PARTS } from './timeunit';\nimport { duplicate, isNumeric, keys } from './util';\nexport function isDateTime(o) {\n if (o && isObject(o)) {\n for (const part of TIMEUNIT_PARTS) {\n if (part in o) {\n return true;\n }\n }\n }\n return false;\n}\nexport const MONTHS = [\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december'\n];\nexport const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3));\nexport const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];\nexport const SHORT_DAYS = DAYS.map(d => d.substr(0, 3));\nfunction normalizeQuarter(q) {\n if (isNumeric(q)) {\n q = +q;\n }\n if (isNumber(q)) {\n if (q > 4) {\n log.warn(log.message.invalidTimeUnit('quarter', q));\n }\n // We accept 1-based quarter, so need to readjust to 0-based quarter\n return q - 1;\n }\n else {\n // Invalid quarter\n throw new Error(log.message.invalidTimeUnit('quarter', q));\n }\n}\nfunction normalizeMonth(m) {\n if (isNumeric(m)) {\n m = +m;\n }\n if (isNumber(m)) {\n // We accept 1-based month, so need to readjust to 0-based month\n return m - 1;\n }\n else {\n const lowerM = m.toLowerCase();\n const monthIndex = MONTHS.indexOf(lowerM);\n if (monthIndex !== -1) {\n return monthIndex; // 0 for january, ...\n }\n const shortM = lowerM.substr(0, 3);\n const shortMonthIndex = SHORT_MONTHS.indexOf(shortM);\n if (shortMonthIndex !== -1) {\n return shortMonthIndex;\n }\n // Invalid month\n throw new Error(log.message.invalidTimeUnit('month', m));\n }\n}\nfunction normalizeDay(d) {\n if (isNumeric(d)) {\n d = +d;\n }\n if (isNumber(d)) {\n // mod so that this can be both 0-based where 0 = sunday\n // and 1-based where 7=sunday\n return d % 7;\n }\n else {\n const lowerD = d.toLowerCase();\n const dayIndex = DAYS.indexOf(lowerD);\n if (dayIndex !== -1) {\n return dayIndex; // 0 for january, ...\n }\n const shortD = lowerD.substr(0, 3);\n const shortDayIndex = SHORT_DAYS.indexOf(shortD);\n if (shortDayIndex !== -1) {\n return shortDayIndex;\n }\n // Invalid day\n throw new Error(log.message.invalidTimeUnit('day', d));\n }\n}\n/**\n * @param d the date.\n * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime.\n * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds]\n */\nfunction dateTimeParts(d, normalize) {\n const parts = [];\n if (normalize && d.day !== undefined) {\n if (keys(d).length > 1) {\n log.warn(log.message.droppedDay(d));\n d = duplicate(d);\n delete d.day;\n }\n }\n if (d.year !== undefined) {\n parts.push(d.year);\n }\n else {\n // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega\n // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year).\n parts.push(2012);\n }\n if (d.month !== undefined) {\n const month = normalize ? normalizeMonth(d.month) : d.month;\n parts.push(month);\n }\n else if (d.quarter !== undefined) {\n const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter;\n parts.push(isNumber(quarter) ? quarter * 3 : `${quarter}*3`);\n }\n else {\n parts.push(0); // months start at zero in JS\n }\n if (d.date !== undefined) {\n parts.push(d.date);\n }\n else if (d.day !== undefined) {\n // HACK: Day only works as a standalone unit\n // This is only correct because we always set year to 2006 for day\n const day = normalize ? normalizeDay(d.day) : d.day;\n parts.push(isNumber(day) ? day + 1 : `${day}+1`);\n }\n else {\n parts.push(1); // Date starts at 1 in JS\n }\n // Note: can't use TimeUnit enum here as importing it will create\n // circular dependency problem!\n for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds']) {\n const unit = d[timeUnit];\n parts.push(typeof unit === 'undefined' ? 0 : unit);\n }\n return parts;\n}\n/**\n * Return Vega expression for a date time.\n *\n * @param d the date time.\n * @returns the Vega expression.\n */\nexport function dateTimeToExpr(d) {\n const parts = dateTimeParts(d, true);\n const string = parts.join(', ');\n if (d.utc) {\n return `utc(${string})`;\n }\n else {\n return `datetime(${string})`;\n }\n}\n/**\n * Return Vega expression for a date time expression.\n *\n * @param d the internal date time object with expression.\n * @returns the Vega expression.\n */\nexport function dateTimeExprToExpr(d) {\n const parts = dateTimeParts(d, false);\n const string = parts.join(', ');\n if (d.utc) {\n return `utc(${string})`;\n }\n else {\n return `datetime(${string})`;\n }\n}\n/**\n * @param d the date time.\n * @returns the timestamp.\n */\nexport function dateTimeToTimestamp(d) {\n const parts = dateTimeParts(d, true);\n if (d.utc) {\n return +new Date(Date.UTC(...parts));\n }\n else {\n return +new Date(...parts);\n }\n}\n//# sourceMappingURL=datetime.js.map","import { isObject, isString } from 'vega-util';\nimport { dateTimeExprToExpr, dateTimeToExpr } from './datetime';\nimport { accessPathWithDatum, keys, stringify, varName } from './util';\n/** Time Unit that only corresponds to only one part of Date objects. */\nexport const LOCAL_SINGLE_TIMEUNIT_INDEX = {\n year: 1,\n quarter: 1,\n month: 1,\n week: 1,\n day: 1,\n dayofyear: 1,\n date: 1,\n hours: 1,\n minutes: 1,\n seconds: 1,\n milliseconds: 1\n};\nexport const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX);\nexport function isLocalSingleTimeUnit(timeUnit) {\n return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit];\n}\nexport const UTC_SINGLE_TIMEUNIT_INDEX = {\n utcyear: 1,\n utcquarter: 1,\n utcmonth: 1,\n utcweek: 1,\n utcday: 1,\n utcdayofyear: 1,\n utcdate: 1,\n utchours: 1,\n utcminutes: 1,\n utcseconds: 1,\n utcmilliseconds: 1\n};\nexport const LOCAL_MULTI_TIMEUNIT_INDEX = {\n yearquarter: 1,\n yearquartermonth: 1,\n yearmonth: 1,\n yearmonthdate: 1,\n yearmonthdatehours: 1,\n yearmonthdatehoursminutes: 1,\n yearmonthdatehoursminutesseconds: 1,\n yearweek: 1,\n yearweekday: 1,\n yearweekdayhours: 1,\n yearweekdayhoursminutes: 1,\n yearweekdayhoursminutesseconds: 1,\n yeardayofyear: 1,\n quartermonth: 1,\n monthdate: 1,\n monthdatehours: 1,\n monthdatehoursminutes: 1,\n monthdatehoursminutesseconds: 1,\n weekday: 1,\n weeksdayhours: 1,\n weekdayhoursminutes: 1,\n weekdayhoursminutesseconds: 1,\n dayhours: 1,\n dayhoursminutes: 1,\n dayhoursminutesseconds: 1,\n hoursminutes: 1,\n hoursminutesseconds: 1,\n minutesseconds: 1,\n secondsmilliseconds: 1\n};\nconst BINNED_LOCAL_TIMEUNIT_INDEX = {\n binnedyear: 1,\n binnedyearquarter: 1,\n binnedyearquartermonth: 1,\n binnedyearmonth: 1,\n binnedyearmonthdate: 1,\n binnedyearmonthdatehours: 1,\n binnedyearmonthdatehoursminutes: 1,\n binnedyearmonthdatehoursminutesseconds: 1,\n binnedyearweek: 1,\n binnedyearweekday: 1,\n binnedyearweekdayhours: 1,\n binnedyearweekdayhoursminutes: 1,\n binnedyearweekdayhoursminutesseconds: 1,\n binnedyeardayofyear: 1\n};\nconst BINNED_UTC_TIMEUNIT_INDEX = {\n binnedutcyear: 1,\n binnedutcyearquarter: 1,\n binnedutcyearquartermonth: 1,\n binnedutcyearmonth: 1,\n binnedutcyearmonthdate: 1,\n binnedutcyearmonthdatehours: 1,\n binnedutcyearmonthdatehoursminutes: 1,\n binnedutcyearmonthdatehoursminutesseconds: 1,\n binnedutcyearweek: 1,\n binnedutcyearweekday: 1,\n binnedutcyearweekdayhours: 1,\n binnedutcyearweekdayhoursminutes: 1,\n binnedutcyearweekdayhoursminutesseconds: 1,\n binnedutcyeardayofyear: 1\n};\nexport const BINNED_TIMEUNIT_INDEX = {\n ...BINNED_LOCAL_TIMEUNIT_INDEX,\n ...BINNED_UTC_TIMEUNIT_INDEX\n};\nexport function isBinnedTimeUnit(timeUnit) {\n if (isObject(timeUnit)) {\n return timeUnit.binned;\n }\n return isBinnedTimeUnitString(timeUnit);\n}\nexport function isBinnedTimeUnitString(timeUnit) {\n return timeUnit && timeUnit.startsWith('binned');\n}\nexport const UTC_MULTI_TIMEUNIT_INDEX = {\n utcyearquarter: 1,\n utcyearquartermonth: 1,\n utcyearmonth: 1,\n utcyearmonthdate: 1,\n utcyearmonthdatehours: 1,\n utcyearmonthdatehoursminutes: 1,\n utcyearmonthdatehoursminutesseconds: 1,\n utcyearweek: 1,\n utcyearweekday: 1,\n utcyearweekdayhours: 1,\n utcyearweekdayhoursminutes: 1,\n utcyearweekdayhoursminutesseconds: 1,\n utcyeardayofyear: 1,\n utcquartermonth: 1,\n utcmonthdate: 1,\n utcmonthdatehours: 1,\n utcmonthdatehoursminutes: 1,\n utcmonthdatehoursminutesseconds: 1,\n utcweekday: 1,\n utcweeksdayhours: 1,\n utcweekdayhoursminutes: 1,\n utcweekdayhoursminutesseconds: 1,\n utcdayhours: 1,\n utcdayhoursminutes: 1,\n utcdayhoursminutesseconds: 1,\n utchoursminutes: 1,\n utchoursminutesseconds: 1,\n utcminutesseconds: 1,\n utcsecondsmilliseconds: 1\n};\nexport function isUTCTimeUnit(t) {\n return t.startsWith('utc');\n}\nexport function getLocalTimeUnitFromUTCTimeUnit(t) {\n return t.substring(3);\n}\n// In order of increasing specificity\nexport const VEGALITE_TIMEFORMAT = {\n 'year-month': '%b %Y ',\n 'year-month-date': '%b %d, %Y '\n};\nexport function getTimeUnitParts(timeUnit) {\n return TIMEUNIT_PARTS.filter(part => containsTimeUnit(timeUnit, part));\n}\nexport function getSmallestTimeUnitPart(timeUnit) {\n const parts = getTimeUnitParts(timeUnit);\n return parts[parts.length - 1];\n}\n/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */\nexport function containsTimeUnit(fullTimeUnit, timeUnit) {\n const index = fullTimeUnit.indexOf(timeUnit);\n if (index < 0) {\n return false;\n }\n // exclude milliseconds\n if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') {\n return false;\n }\n // exclude dayofyear\n if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') {\n return false;\n }\n if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') {\n return false;\n }\n return true;\n}\n/**\n * Returns Vega expression for a given timeUnit and fieldRef\n */\nexport function fieldExpr(fullTimeUnit, field, { end } = { end: false }) {\n const fieldRef = accessPathWithDatum(field);\n const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : '';\n function func(timeUnit) {\n if (timeUnit === 'quarter') {\n // quarter starting at 0 (0,3,6,9).\n return `(${utc}quarter(${fieldRef})-1)`;\n }\n else {\n return `${utc}${timeUnit}(${fieldRef})`;\n }\n }\n let lastTimeUnit;\n const dateExpr = {};\n for (const part of TIMEUNIT_PARTS) {\n if (containsTimeUnit(fullTimeUnit, part)) {\n dateExpr[part] = func(part);\n lastTimeUnit = part;\n }\n }\n if (end) {\n dateExpr[lastTimeUnit] += '+1';\n }\n return dateTimeExprToExpr(dateExpr);\n}\nexport function timeUnitSpecifierExpression(timeUnit) {\n if (!timeUnit) {\n return undefined;\n }\n const timeUnitParts = getTimeUnitParts(timeUnit);\n return `timeUnitSpecifier(${stringify(timeUnitParts)}, ${stringify(VEGALITE_TIMEFORMAT)})`;\n}\n/**\n * Returns the signal expression used for axis labels for a time unit.\n */\nexport function formatExpression(timeUnit, field, isUTCScale) {\n if (!timeUnit) {\n return undefined;\n }\n const expr = timeUnitSpecifierExpression(timeUnit);\n // We only use utcFormat for utc scale\n // For utc time units, the data is already converted as a part of timeUnit transform.\n // Thus, utc time units should use timeFormat to avoid shifting the time twice.\n const utc = isUTCScale || isUTCTimeUnit(timeUnit);\n return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`;\n}\nexport function normalizeTimeUnit(timeUnit) {\n if (!timeUnit) {\n return undefined;\n }\n let params;\n if (isString(timeUnit)) {\n if (isBinnedTimeUnitString(timeUnit)) {\n params = {\n unit: timeUnit.substring(6),\n binned: true\n };\n }\n else {\n params = {\n unit: timeUnit\n };\n }\n }\n else if (isObject(timeUnit)) {\n params = {\n ...timeUnit,\n ...(timeUnit.unit ? { unit: timeUnit.unit } : {})\n };\n }\n if (isUTCTimeUnit(params.unit)) {\n params.utc = true;\n params.unit = getLocalTimeUnitFromUTCTimeUnit(params.unit);\n }\n return params;\n}\nexport function timeUnitToString(tu) {\n const { utc, ...rest } = normalizeTimeUnit(tu);\n if (rest.unit) {\n return ((utc ? 'utc' : '') +\n keys(rest)\n .map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`))\n .join(''));\n }\n else {\n // when maxbins is specified instead of units\n return ((utc ? 'utc' : '') +\n 'timeunit' +\n keys(rest)\n .map(p => varName(`_${p}_${rest[p]}`))\n .join(''));\n }\n}\nexport function durationExpr(timeUnit, wrap = x => x) {\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit);\n const smallestUnitPart = getSmallestTimeUnitPart(normalizedTimeUnit.unit);\n if (smallestUnitPart && smallestUnitPart !== 'day') {\n const startDate = {\n year: 2001,\n month: 1,\n date: 1,\n hours: 0,\n minutes: 0,\n seconds: 0,\n milliseconds: 0\n };\n const { step, part } = getDateTimePartAndStep(smallestUnitPart, normalizedTimeUnit.step);\n const endDate = {\n ...startDate,\n [part]: +startDate[part] + step\n };\n // Calculate timestamp duration for the smallest unit listed\n return `${wrap(dateTimeToExpr(endDate))} - ${wrap(dateTimeToExpr(startDate))}`;\n }\n return undefined;\n}\nconst DATE_PARTS = {\n year: 1,\n month: 1,\n date: 1,\n hours: 1,\n minutes: 1,\n seconds: 1,\n milliseconds: 1\n};\nexport function isDatePart(timeUnit) {\n return !!DATE_PARTS[timeUnit];\n}\nexport function getDateTimePartAndStep(timeUnit, step = 1) {\n if (isDatePart(timeUnit)) {\n return { part: timeUnit, step };\n }\n switch (timeUnit) {\n case 'day':\n case 'dayofyear':\n return { part: 'date', step };\n case 'quarter':\n return { part: 'month', step: step * 3 };\n case 'week':\n return { part: 'date', step: step * 7 };\n }\n}\n//# sourceMappingURL=timeunit.js.map","import { isArray } from 'vega-util';\nimport { valueExpr, vgField } from './channeldef';\nimport { fieldExpr as timeUnitFieldExpr, normalizeTimeUnit } from './timeunit';\nimport { stringify } from './util';\nimport { isSignalRef } from './vega.schema';\nexport function isSelectionPredicate(predicate) {\n return predicate?.['param'];\n}\nexport function isFieldEqualPredicate(predicate) {\n return !!predicate?.field && predicate.equal !== undefined;\n}\nexport function isFieldLTPredicate(predicate) {\n return !!predicate?.field && predicate.lt !== undefined;\n}\nexport function isFieldLTEPredicate(predicate) {\n return !!predicate?.field && predicate.lte !== undefined;\n}\nexport function isFieldGTPredicate(predicate) {\n return !!predicate?.field && predicate.gt !== undefined;\n}\nexport function isFieldGTEPredicate(predicate) {\n return !!predicate?.field && predicate.gte !== undefined;\n}\nexport function isFieldRangePredicate(predicate) {\n if (predicate?.field) {\n if (isArray(predicate.range) && predicate.range.length === 2) {\n return true;\n }\n else if (isSignalRef(predicate.range)) {\n return true;\n }\n }\n return false;\n}\nexport function isFieldOneOfPredicate(predicate) {\n return (!!predicate?.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility\n );\n}\nexport function isFieldValidPredicate(predicate) {\n return !!predicate?.field && predicate.valid !== undefined;\n}\nexport function isFieldPredicate(predicate) {\n return (isFieldOneOfPredicate(predicate) ||\n isFieldEqualPredicate(predicate) ||\n isFieldRangePredicate(predicate) ||\n isFieldLTPredicate(predicate) ||\n isFieldGTPredicate(predicate) ||\n isFieldLTEPredicate(predicate) ||\n isFieldGTEPredicate(predicate));\n}\nfunction predicateValueExpr(v, timeUnit) {\n return valueExpr(v, { timeUnit, wrapTime: true });\n}\nfunction predicateValuesExpr(vals, timeUnit) {\n return vals.map(v => predicateValueExpr(v, timeUnit));\n}\n// This method is used by Voyager. Do not change its behavior without changing Voyager.\nexport function fieldFilterExpression(predicate, useInRange = true) {\n const { field } = predicate;\n const normalizedTimeUnit = normalizeTimeUnit(predicate.timeUnit);\n const { unit, binned } = normalizedTimeUnit || {};\n const rawFieldExpr = vgField(predicate, { expr: 'datum' });\n const fieldExpr = unit\n ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly.\n // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline\n // TODO: support utc\n `time(${!binned ? timeUnitFieldExpr(unit, field) : rawFieldExpr})`\n : rawFieldExpr;\n if (isFieldEqualPredicate(predicate)) {\n return `${fieldExpr}===${predicateValueExpr(predicate.equal, unit)}`;\n }\n else if (isFieldLTPredicate(predicate)) {\n const upper = predicate.lt;\n return `${fieldExpr}<${predicateValueExpr(upper, unit)}`;\n }\n else if (isFieldGTPredicate(predicate)) {\n const lower = predicate.gt;\n return `${fieldExpr}>${predicateValueExpr(lower, unit)}`;\n }\n else if (isFieldLTEPredicate(predicate)) {\n const upper = predicate.lte;\n return `${fieldExpr}<=${predicateValueExpr(upper, unit)}`;\n }\n else if (isFieldGTEPredicate(predicate)) {\n const lower = predicate.gte;\n return `${fieldExpr}>=${predicateValueExpr(lower, unit)}`;\n }\n else if (isFieldOneOfPredicate(predicate)) {\n return `indexof([${predicateValuesExpr(predicate.oneOf, unit).join(',')}], ${fieldExpr}) !== -1`;\n }\n else if (isFieldValidPredicate(predicate)) {\n return fieldValidPredicate(fieldExpr, predicate.valid);\n }\n else if (isFieldRangePredicate(predicate)) {\n const { range } = predicate;\n const lower = isSignalRef(range) ? { signal: `${range.signal}[0]` } : range[0];\n const upper = isSignalRef(range) ? { signal: `${range.signal}[1]` } : range[1];\n if (lower !== null && upper !== null && useInRange) {\n return ('inrange(' + fieldExpr + ', [' + predicateValueExpr(lower, unit) + ', ' + predicateValueExpr(upper, unit) + '])');\n }\n const exprs = [];\n if (lower !== null) {\n exprs.push(`${fieldExpr} >= ${predicateValueExpr(lower, unit)}`);\n }\n if (upper !== null) {\n exprs.push(`${fieldExpr} <= ${predicateValueExpr(upper, unit)}`);\n }\n return exprs.length > 0 ? exprs.join(' && ') : 'true';\n }\n /* istanbul ignore next: it should never reach here */\n throw new Error(`Invalid field predicate: ${stringify(predicate)}`);\n}\nexport function fieldValidPredicate(fieldExpr, valid = true) {\n if (valid) {\n return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`;\n }\n else {\n return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`;\n }\n}\nexport function normalizePredicate(f) {\n if (isFieldPredicate(f) && f.timeUnit) {\n return {\n ...f,\n timeUnit: normalizeTimeUnit(f.timeUnit)\n };\n }\n return f;\n}\n//# sourceMappingURL=predicate.js.map","import { keys } from './util';\n/**\n * Data type based on level of measurement\n */\nexport const Type = {\n quantitative: 'quantitative',\n ordinal: 'ordinal',\n temporal: 'temporal',\n nominal: 'nominal',\n geojson: 'geojson'\n};\nexport function isType(t) {\n return t in Type;\n}\nexport function isContinuous(type) {\n return type === 'quantitative' || type === 'temporal';\n}\nexport function isDiscrete(type) {\n return type === 'ordinal' || type === 'nominal';\n}\nexport const QUANTITATIVE = Type.quantitative;\nexport const ORDINAL = Type.ordinal;\nexport const TEMPORAL = Type.temporal;\nexport const NOMINAL = Type.nominal;\nexport const GEOJSON = Type.geojson;\nexport const TYPES = keys(Type);\n/**\n * Get full, lowercase type name for a given type.\n * @param type\n * @return Full type name.\n */\nexport function getFullName(type) {\n if (type) {\n type = type.toLowerCase();\n switch (type) {\n case 'q':\n case QUANTITATIVE:\n return 'quantitative';\n case 't':\n case TEMPORAL:\n return 'temporal';\n case 'o':\n case ORDINAL:\n return 'ordinal';\n case 'n':\n case NOMINAL:\n return 'nominal';\n case GEOJSON:\n return 'geojson';\n }\n }\n // If we get invalid input, return undefined type.\n return undefined;\n}\n//# sourceMappingURL=type.js.map","import { isObject } from 'vega';\nimport { isString } from 'vega-util';\nimport * as CHANNEL from './channel';\nimport { isColorChannel } from './channel';\nimport * as log from './log';\nimport { NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL } from './type';\nimport { contains, keys } from './util';\nexport const ScaleType = {\n // Continuous - Quantitative\n LINEAR: 'linear',\n LOG: 'log',\n POW: 'pow',\n SQRT: 'sqrt',\n SYMLOG: 'symlog',\n IDENTITY: 'identity',\n SEQUENTIAL: 'sequential',\n // Continuous - Time\n TIME: 'time',\n UTC: 'utc',\n // Discretizing scales\n QUANTILE: 'quantile',\n QUANTIZE: 'quantize',\n THRESHOLD: 'threshold',\n BIN_ORDINAL: 'bin-ordinal',\n // Discrete scales\n ORDINAL: 'ordinal',\n POINT: 'point',\n BAND: 'band'\n};\n/**\n * Index for scale categories -- only scale of the same categories can be merged together.\n * Current implementation is trying to be conservative and avoid merging scale type that might not work together\n */\nexport const SCALE_CATEGORY_INDEX = {\n linear: 'numeric',\n log: 'numeric',\n pow: 'numeric',\n sqrt: 'numeric',\n symlog: 'numeric',\n identity: 'numeric',\n sequential: 'numeric',\n time: 'time',\n utc: 'time',\n ordinal: 'ordinal',\n 'bin-ordinal': 'bin-ordinal',\n point: 'ordinal-position',\n band: 'ordinal-position',\n quantile: 'discretizing',\n quantize: 'discretizing',\n threshold: 'discretizing'\n};\nexport const SCALE_TYPES = keys(SCALE_CATEGORY_INDEX);\n/**\n * Whether the two given scale types can be merged together.\n */\nexport function scaleCompatible(scaleType1, scaleType2) {\n const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1];\n const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2];\n return (scaleCategory1 === scaleCategory2 ||\n (scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time') ||\n (scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time'));\n}\n/**\n * Index for scale precedence -- high score = higher priority for merging.\n */\nconst SCALE_PRECEDENCE_INDEX = {\n // numeric\n linear: 0,\n log: 1,\n pow: 1,\n sqrt: 1,\n symlog: 1,\n identity: 1,\n sequential: 1,\n // time\n time: 0,\n utc: 0,\n // ordinal-position -- these have higher precedence than continuous scales as they support more types of data\n point: 10,\n band: 11,\n // non grouped types\n ordinal: 0,\n 'bin-ordinal': 0,\n quantile: 0,\n quantize: 0,\n threshold: 0\n};\n/**\n * Return scale categories -- only scale of the same categories can be merged together.\n */\nexport function scaleTypePrecedence(scaleType) {\n return SCALE_PRECEDENCE_INDEX[scaleType];\n}\nexport const QUANTITATIVE_SCALES = new Set([\n 'linear',\n 'log',\n 'pow',\n 'sqrt',\n 'symlog'\n]);\nexport const CONTINUOUS_TO_CONTINUOUS_SCALES = new Set([\n ...QUANTITATIVE_SCALES,\n 'time',\n 'utc'\n]);\nexport function isQuantitative(type) {\n return QUANTITATIVE_SCALES.has(type);\n}\nexport const CONTINUOUS_TO_DISCRETE_SCALES = new Set([\n 'quantile',\n 'quantize',\n 'threshold'\n]);\nexport const CONTINUOUS_DOMAIN_SCALES = new Set([\n ...CONTINUOUS_TO_CONTINUOUS_SCALES,\n ...CONTINUOUS_TO_DISCRETE_SCALES,\n 'sequential',\n 'identity'\n]);\nexport const DISCRETE_DOMAIN_SCALES = new Set([\n 'ordinal',\n 'bin-ordinal',\n 'point',\n 'band'\n]);\nexport const TIME_SCALE_TYPES = new Set(['time', 'utc']);\nexport function hasDiscreteDomain(type) {\n return DISCRETE_DOMAIN_SCALES.has(type);\n}\nexport function hasContinuousDomain(type) {\n return CONTINUOUS_DOMAIN_SCALES.has(type);\n}\nexport function isContinuousToContinuous(type) {\n return CONTINUOUS_TO_CONTINUOUS_SCALES.has(type);\n}\nexport function isContinuousToDiscrete(type) {\n return CONTINUOUS_TO_DISCRETE_SCALES.has(type);\n}\nexport const defaultScaleConfig = {\n pointPadding: 0.5,\n barBandPaddingInner: 0.1,\n rectBandPaddingInner: 0,\n bandWithNestedOffsetPaddingInner: 0.2,\n bandWithNestedOffsetPaddingOuter: 0.2,\n minBandSize: 2,\n minFontSize: 8,\n maxFontSize: 40,\n minOpacity: 0.3,\n maxOpacity: 0.8,\n // FIXME: revise if these *can* become ratios of width/height step\n minSize: 9,\n minStrokeWidth: 1,\n maxStrokeWidth: 4,\n quantileCount: 4,\n quantizeCount: 4,\n zero: true\n};\nexport function isExtendedScheme(scheme) {\n return !isString(scheme) && !!scheme['name'];\n}\nexport function isParameterDomain(domain) {\n return domain?.['param'];\n}\nexport function isDomainUnionWith(domain) {\n return domain?.['unionWith'];\n}\nexport function isFieldRange(range) {\n return isObject(range) && 'field' in range;\n}\nconst SCALE_PROPERTY_INDEX = {\n type: 1,\n domain: 1,\n domainMax: 1,\n domainMin: 1,\n domainMid: 1,\n domainRaw: 1,\n align: 1,\n range: 1,\n rangeMax: 1,\n rangeMin: 1,\n scheme: 1,\n bins: 1,\n // Other properties\n reverse: 1,\n round: 1,\n // quantitative / time\n clamp: 1,\n nice: 1,\n // quantitative\n base: 1,\n exponent: 1,\n constant: 1,\n interpolate: 1,\n zero: 1,\n // band/point\n padding: 1,\n paddingInner: 1,\n paddingOuter: 1\n};\nexport const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX);\nconst { type, domain, range, rangeMax, rangeMin, scheme, ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX } = SCALE_PROPERTY_INDEX;\nexport const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX);\nexport function scaleTypeSupportProperty(scaleType, propName) {\n switch (propName) {\n case 'type':\n case 'domain':\n case 'reverse':\n case 'range':\n return true;\n case 'scheme':\n case 'interpolate':\n return !['point', 'band', 'identity'].includes(scaleType);\n case 'bins':\n return !['point', 'band', 'identity', 'ordinal'].includes(scaleType);\n case 'round':\n return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point';\n case 'padding':\n case 'rangeMin':\n case 'rangeMax':\n return isContinuousToContinuous(scaleType) || ['point', 'band'].includes(scaleType);\n case 'paddingOuter':\n case 'align':\n return ['point', 'band'].includes(scaleType);\n case 'paddingInner':\n return scaleType === 'band';\n case 'domainMax':\n case 'domainMid':\n case 'domainMin':\n case 'domainRaw':\n case 'clamp':\n return isContinuousToContinuous(scaleType);\n case 'nice':\n return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold';\n case 'exponent':\n return scaleType === 'pow';\n case 'base':\n return scaleType === 'log';\n case 'constant':\n return scaleType === 'symlog';\n case 'zero':\n return (hasContinuousDomain(scaleType) &&\n !contains([\n 'log',\n 'time',\n 'utc',\n 'threshold',\n 'quantile' // quantile depends on distribution so zero does not matter\n ], scaleType));\n }\n}\n/**\n * Returns undefined if the input channel supports the input scale property name\n */\nexport function channelScalePropertyIncompatability(channel, propName) {\n switch (propName) {\n case 'interpolate':\n case 'scheme':\n case 'domainMid':\n if (!isColorChannel(channel)) {\n return log.message.cannotUseScalePropertyWithNonColor(propName);\n }\n return undefined;\n case 'align':\n case 'type':\n case 'bins':\n case 'domain':\n case 'domainMax':\n case 'domainMin':\n case 'domainRaw':\n case 'range':\n case 'base':\n case 'exponent':\n case 'constant':\n case 'nice':\n case 'padding':\n case 'paddingInner':\n case 'paddingOuter':\n case 'rangeMax':\n case 'rangeMin':\n case 'reverse':\n case 'round':\n case 'clamp':\n case 'zero':\n return undefined; // GOOD!\n }\n}\nexport function scaleTypeSupportDataType(specifiedType, fieldDefType) {\n if (contains([ORDINAL, NOMINAL], fieldDefType)) {\n return specifiedType === undefined || hasDiscreteDomain(specifiedType);\n }\n else if (fieldDefType === TEMPORAL) {\n return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType);\n }\n else if (fieldDefType === QUANTITATIVE) {\n return isQuantitative(specifiedType) || isContinuousToDiscrete(specifiedType) || specifiedType === undefined;\n }\n return true;\n}\nexport function channelSupportScaleType(channel, scaleType, hasNestedOffsetScale = false) {\n if (!CHANNEL.isScaleChannel(channel)) {\n return false;\n }\n switch (channel) {\n case CHANNEL.X:\n case CHANNEL.Y:\n case CHANNEL.XOFFSET:\n case CHANNEL.YOFFSET:\n case CHANNEL.THETA:\n case CHANNEL.RADIUS:\n if (isContinuousToContinuous(scaleType)) {\n return true;\n }\n else if (scaleType === 'band') {\n return true;\n }\n else if (scaleType === 'point') {\n /*\n Point scale can't be use if the position has a nested offset scale\n because if there is a nested scale, then it's band.\n */\n return !hasNestedOffsetScale;\n }\n return false;\n case CHANNEL.SIZE: // TODO: size and opacity can support ordinal with more modification\n case CHANNEL.STROKEWIDTH:\n case CHANNEL.OPACITY:\n case CHANNEL.FILLOPACITY:\n case CHANNEL.STROKEOPACITY:\n case CHANNEL.ANGLE:\n // Although it generally doesn't make sense to use band with size and opacity,\n // it can also work since we use band: 0.5 to get midpoint.\n return (isContinuousToContinuous(scaleType) ||\n isContinuousToDiscrete(scaleType) ||\n contains(['band', 'point', 'ordinal'], scaleType));\n case CHANNEL.COLOR:\n case CHANNEL.FILL:\n case CHANNEL.STROKE:\n return scaleType !== 'band'; // band does not make sense with color\n case CHANNEL.STROKEDASH:\n case CHANNEL.SHAPE:\n return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType);\n }\n}\n//# sourceMappingURL=scale.js.map","import { keys } from './util';\n/**\n * All types of primitive marks.\n */\nexport const Mark = {\n arc: 'arc',\n area: 'area',\n bar: 'bar',\n image: 'image',\n line: 'line',\n point: 'point',\n rect: 'rect',\n rule: 'rule',\n text: 'text',\n tick: 'tick',\n trail: 'trail',\n circle: 'circle',\n square: 'square',\n geoshape: 'geoshape'\n};\nexport const ARC = Mark.arc;\nexport const AREA = Mark.area;\nexport const BAR = Mark.bar;\nexport const IMAGE = Mark.image;\nexport const LINE = Mark.line;\nexport const POINT = Mark.point;\nexport const RECT = Mark.rect;\nexport const RULE = Mark.rule;\nexport const TEXT = Mark.text;\nexport const TICK = Mark.tick;\nexport const TRAIL = Mark.trail;\nexport const CIRCLE = Mark.circle;\nexport const SQUARE = Mark.square;\nexport const GEOSHAPE = Mark.geoshape;\nexport function isMark(m) {\n return m in Mark;\n}\nexport function isPathMark(m) {\n return ['line', 'area', 'trail'].includes(m);\n}\nexport function isRectBasedMark(m) {\n return ['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */].includes(m);\n}\nexport const PRIMITIVE_MARKS = new Set(keys(Mark));\nexport function isMarkDef(mark) {\n return mark['type'];\n}\nexport function isPrimitiveMark(mark) {\n const markType = isMarkDef(mark) ? mark.type : mark;\n return PRIMITIVE_MARKS.has(markType);\n}\nexport const STROKE_CONFIG = [\n 'stroke',\n 'strokeWidth',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeOpacity',\n 'strokeJoin',\n 'strokeMiterLimit'\n];\nexport const FILL_CONFIG = ['fill', 'fillOpacity'];\nexport const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG];\nconst VL_ONLY_MARK_CONFIG_INDEX = {\n color: 1,\n filled: 1,\n invalid: 1,\n order: 1,\n radius2: 1,\n theta2: 1,\n timeUnitBandSize: 1,\n timeUnitBandPosition: 1\n};\nexport const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX);\nexport const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {\n area: ['line', 'point'],\n bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'],\n rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'],\n line: ['point'],\n tick: ['bandSize', 'thickness']\n};\nexport const defaultMarkConfig = {\n color: '#4c78a8',\n invalid: 'filter',\n timeUnitBandSize: 1\n};\nconst MARK_CONFIG_INDEX = {\n mark: 1,\n arc: 1,\n area: 1,\n bar: 1,\n circle: 1,\n image: 1,\n line: 1,\n point: 1,\n rect: 1,\n rule: 1,\n square: 1,\n text: 1,\n tick: 1,\n trail: 1,\n geoshape: 1\n};\nexport const MARK_CONFIGS = keys(MARK_CONFIG_INDEX);\nexport function isRelativeBandSize(o) {\n return o && o['band'] != undefined;\n}\nexport const BAR_CORNER_RADIUS_INDEX = {\n horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'],\n vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight']\n};\nconst DEFAULT_RECT_BAND_SIZE = 5;\nexport const defaultBarConfig = {\n binSpacing: 1,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n minBandSize: 0.25,\n timeUnitBandPosition: 0.5\n};\nexport const defaultRectConfig = {\n binSpacing: 0,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n minBandSize: 0.25,\n timeUnitBandPosition: 0.5\n};\nexport const defaultTickConfig = {\n thickness: 1\n};\nexport function getMarkType(m) {\n return isMarkDef(m) ? m.type : m;\n}\n//# sourceMappingURL=mark.js.map","import { isFunction, isString } from 'vega-util';\nimport { isCountingAggregateOp } from '../../../aggregate';\nimport { isBinned, isBinning } from '../../../bin';\nimport { getMainRangeChannel, X, X2, Y2 } from '../../../channel';\nimport { binRequiresRange, getBandPosition, isDatumDef, isFieldDef, isFieldOrDatumDef, isTypedFieldDef, isValueDef, vgField } from '../../../channeldef';\nimport { dateTimeToExpr, isDateTime } from '../../../datetime';\nimport { isExprRef } from '../../../expr';\nimport * as log from '../../../log';\nimport { isPathMark } from '../../../mark';\nimport { fieldValidPredicate } from '../../../predicate';\nimport { hasDiscreteDomain, isContinuousToContinuous } from '../../../scale';\nimport { TEMPORAL } from '../../../type';\nimport { contains, stringify } from '../../../util';\nimport { isSignalRef } from '../../../vega.schema';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nexport function midPointRefWithPositionInvalidTest(params) {\n const { channel, channelDef, markDef, scale, config } = params;\n const ref = midPoint(params);\n // Wrap to check if the positional value is invalid, if so, plot the point on the min value\n if (\n // Only this for field def without counting aggregate (as count wouldn't be null)\n isFieldDef(channelDef) &&\n !isCountingAggregateOp(channelDef.aggregate) &&\n // and only for continuous scale\n scale &&\n isContinuousToContinuous(scale.get('type'))) {\n return wrapPositionInvalidTest({\n fieldDef: channelDef,\n channel,\n markDef,\n ref,\n config\n });\n }\n return ref;\n}\nexport function wrapPositionInvalidTest({ fieldDef, channel, markDef, ref, config }) {\n if (isPathMark(markDef.type)) {\n // path mark already use defined to skip points, no need to do it here.\n return ref;\n }\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid === null) {\n // if there is no invalid filter, don't do the invalid test\n return [fieldInvalidTestValueRef(fieldDef, channel), ref];\n }\n return ref;\n}\nexport function fieldInvalidTestValueRef(fieldDef, channel) {\n const test = fieldInvalidPredicate(fieldDef, true);\n const mainChannel = getMainRangeChannel(channel); // we can cast here as the output can't be other things.\n const zeroValueRef = mainChannel === 'y'\n ? { field: { group: 'height' } }\n : // x / angle / radius can all use 0\n { value: 0 };\n return { test, ...zeroValueRef };\n}\nexport function fieldInvalidPredicate(field, invalid = true) {\n return fieldValidPredicate(isString(field) ? field : vgField(field, { expr: 'datum' }), !invalid);\n}\nexport function datumDefToExpr(datumDef) {\n const { datum } = datumDef;\n if (isDateTime(datum)) {\n return dateTimeToExpr(datum);\n }\n return `${stringify(datum)}`;\n}\nexport function valueRefForFieldOrDatumDef(fieldDef, scaleName, opt, encode) {\n const ref = {};\n if (scaleName) {\n ref.scale = scaleName;\n }\n if (isDatumDef(fieldDef)) {\n const { datum } = fieldDef;\n if (isDateTime(datum)) {\n ref.signal = dateTimeToExpr(datum);\n }\n else if (isSignalRef(datum)) {\n ref.signal = datum.signal;\n }\n else if (isExprRef(datum)) {\n ref.signal = datum.expr;\n }\n else {\n ref.value = datum;\n }\n }\n else {\n ref.field = vgField(fieldDef, opt);\n }\n if (encode) {\n const { offset, band } = encode;\n if (offset) {\n ref.offset = offset;\n }\n if (band) {\n ref.band = band;\n }\n }\n return ref;\n}\n/**\n * Signal that returns the middle of a bin from start and end field. Should only be used with x and y.\n */\nexport function interpolatedSignalRef({ scaleName, fieldOrDatumDef, fieldOrDatumDef2, offset, startSuffix, endSuffix = 'end', bandPosition = 0.5 }) {\n const expr = !isSignalRef(bandPosition) && 0 < bandPosition && bandPosition < 1 ? 'datum' : undefined;\n const start = vgField(fieldOrDatumDef, { expr, suffix: startSuffix });\n const end = fieldOrDatumDef2 !== undefined\n ? vgField(fieldOrDatumDef2, { expr })\n : vgField(fieldOrDatumDef, { suffix: endSuffix, expr });\n const ref = {};\n if (bandPosition === 0 || bandPosition === 1) {\n ref.scale = scaleName;\n const field = bandPosition === 0 ? start : end;\n ref.field = field;\n }\n else {\n const datum = isSignalRef(bandPosition)\n ? `(1-${bandPosition.signal}) * ${start} + ${bandPosition.signal} * ${end}`\n : `${1 - bandPosition} * ${start} + ${bandPosition} * ${end}`;\n ref.signal = `scale(\"${scaleName}\", ${datum})`;\n }\n if (offset) {\n ref.offset = offset;\n }\n return ref;\n}\nexport function binSizeExpr({ scaleName, fieldDef }) {\n const start = vgField(fieldDef, { expr: 'datum' });\n const end = vgField(fieldDef, { expr: 'datum', suffix: 'end' });\n return `abs(scale(\"${scaleName}\", ${end}) - scale(\"${scaleName}\", ${start}))`;\n}\n/**\n * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels.\n */\nexport function midPoint({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef, bandPosition }) {\n // TODO: datum support\n if (channelDef) {\n /* istanbul ignore else */\n if (isFieldOrDatumDef(channelDef)) {\n const scaleType = scale?.get('type');\n if (isTypedFieldDef(channelDef)) {\n bandPosition ?? (bandPosition = getBandPosition({\n fieldDef: channelDef,\n fieldDef2: channel2Def,\n markDef,\n config\n }));\n const { bin, timeUnit, type } = channelDef;\n if (isBinning(bin) || (bandPosition && timeUnit && type === TEMPORAL)) {\n // Use middle only for x an y to place marks in the center between start and end of the bin range.\n // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match.\n if (stack?.impute) {\n // For stack, we computed bin_mid so we can impute.\n return valueRefForFieldOrDatumDef(channelDef, scaleName, { binSuffix: 'mid' }, { offset });\n }\n if (bandPosition && !hasDiscreteDomain(scaleType)) {\n // if band = 0, no need to call interpolation\n // For non-stack, we can just calculate bin mid on the fly using signal.\n return interpolatedSignalRef({ scaleName, fieldOrDatumDef: channelDef, bandPosition, offset });\n }\n return valueRefForFieldOrDatumDef(channelDef, scaleName, binRequiresRange(channelDef, channel) ? { binSuffix: 'range' } : {}, {\n offset\n });\n }\n else if (isBinned(bin)) {\n if (isFieldDef(channel2Def)) {\n return interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef,\n fieldOrDatumDef2: channel2Def,\n bandPosition,\n offset\n });\n }\n else {\n const channel2 = channel === X ? X2 : Y2;\n log.warn(log.message.channelRequiredForBinned(channel2));\n }\n }\n }\n return valueRefForFieldOrDatumDef(channelDef, scaleName, hasDiscreteDomain(scaleType) ? { binSuffix: 'range' } : {}, // no need for bin suffix if there is no scale\n {\n offset,\n // For band, to get mid point, need to offset by half of the band\n band: scaleType === 'band' ? bandPosition ?? channelDef.bandPosition ?? 0.5 : undefined\n });\n }\n else if (isValueDef(channelDef)) {\n const value = channelDef.value;\n const offsetMixins = offset ? { offset } : {};\n return { ...widthHeightValueOrSignalRef(channel, value), ...offsetMixins };\n }\n // If channelDef is neither field def or value def, it's a condition-only def.\n // In such case, we will use default ref.\n }\n if (isFunction(defaultRef)) {\n defaultRef = defaultRef();\n }\n if (defaultRef) {\n // for non-position, ref could be undefined.\n return {\n ...defaultRef,\n // only include offset when it is non-zero (zero = no offset)\n ...(offset ? { offset } : {})\n };\n }\n return defaultRef;\n}\n/**\n * Convert special \"width\" and \"height\" values in Vega-Lite into Vega value ref.\n */\nexport function widthHeightValueOrSignalRef(channel, value) {\n if (contains(['x', 'x2'], channel) && value === 'width') {\n return { field: { group: 'width' } };\n }\n else if (contains(['y', 'y2'], channel) && value === 'height') {\n return { field: { group: 'height' } };\n }\n return signalOrValueRef(value);\n}\n//# sourceMappingURL=valueref.js.map","import { isString } from 'vega-util';\nimport { isBinning } from '../bin';\nimport { channelDefType, isFieldDef, isFieldOrDatumDefForTimeFormat, isPositionFieldOrDatumDef, isScaleFieldDef, vgField } from '../channeldef';\nimport { fieldValidPredicate } from '../predicate';\nimport { ScaleType } from '../scale';\nimport { formatExpression, normalizeTimeUnit, timeUnitSpecifierExpression } from '../timeunit';\nimport { QUANTITATIVE } from '../type';\nimport { stringify } from '../util';\nimport { isSignalRef } from '../vega.schema';\nimport { datumDefToExpr } from './mark/encode/valueref';\nexport function isCustomFormatType(formatType) {\n return formatType && formatType !== 'number' && formatType !== 'time';\n}\nfunction customFormatExpr(formatType, field, format) {\n return `${formatType}(${field}${format ? `, ${stringify(format)}` : ''})`;\n}\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\nexport function formatSignalRef({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config }) {\n if (isCustomFormatType(formatType)) {\n return formatCustomType({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n config\n });\n }\n const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack);\n const type = channelDefType(fieldOrDatumDef);\n if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (type === 'quantitative') {\n if (normalizeStack && config.normalizedNumberFormatType)\n return formatCustomType({\n fieldOrDatumDef,\n format: config.normalizedNumberFormat,\n formatType: config.normalizedNumberFormatType,\n expr,\n config\n });\n if (config.numberFormatType) {\n return formatCustomType({\n fieldOrDatumDef,\n format: config.numberFormat,\n formatType: config.numberFormatType,\n expr,\n config\n });\n }\n }\n if (type === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n fieldOrDatumDef.timeUnit === undefined) {\n return formatCustomType({\n fieldOrDatumDef,\n format: config.timeFormat,\n formatType: config.timeFormatType,\n expr,\n config\n });\n }\n }\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const signal = timeFormatExpression({\n field,\n timeUnit: isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined,\n format,\n formatType: config.timeFormatType,\n rawTimeFormat: config.timeFormat,\n isUTCScale: isScaleFieldDef(fieldOrDatumDef) && fieldOrDatumDef.scale?.type === ScaleType.UTC\n });\n return signal ? { signal } : undefined;\n }\n format = numberFormat({ type, specifiedFormat: format, config, normalizeStack });\n if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) {\n const endField = vgField(fieldOrDatumDef, { expr, binSuffix: 'end' });\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n }\n else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') {\n return {\n signal: `${formatExpr(field, format)}`\n };\n }\n else {\n return { signal: `isValid(${field}) ? ${field} : \"\"+${field}` };\n }\n}\nfunction fieldToFormat(fieldOrDatumDef, expr, normalizeStack) {\n if (isFieldDef(fieldOrDatumDef)) {\n if (normalizeStack) {\n return `${vgField(fieldOrDatumDef, { expr, suffix: 'end' })}-${vgField(fieldOrDatumDef, {\n expr,\n suffix: 'start'\n })}`;\n }\n else {\n return vgField(fieldOrDatumDef, { expr });\n }\n }\n else {\n return datumDefToExpr(fieldOrDatumDef);\n }\n}\nexport function formatCustomType({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config, field }) {\n field ?? (field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack));\n if (field !== 'datum.value' && // For axis/legend, we can't correctly know the end of the bin from `datum`\n isFieldDef(fieldOrDatumDef) &&\n isBinning(fieldOrDatumDef.bin)) {\n const endField = vgField(fieldOrDatumDef, { expr, binSuffix: 'end' });\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n }\n return { signal: customFormatExpr(formatType, field, format) };\n}\nexport function guideFormat(fieldOrDatumDef, type, format, formatType, config, omitTimeFormatConfig // axis doesn't use config.timeFormat\n) {\n if (isString(formatType) && isCustomFormatType(formatType)) {\n return undefined; // handled in encode block\n }\n else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (channelDefType(fieldOrDatumDef) === 'quantitative') {\n if (config.normalizedNumberFormatType &&\n isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize') {\n return undefined; // handled in encode block\n }\n if (config.numberFormatType) {\n return undefined; // handled in encode block\n }\n }\n }\n if (isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize' &&\n config.normalizedNumberFormat) {\n return numberFormat({\n type: 'quantitative',\n config,\n normalizeStack: true\n });\n }\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n if (timeUnit === undefined && config.customFormatTypes && config.timeFormatType) {\n return undefined; // hanlded in encode block\n }\n return timeFormat({ specifiedFormat: format, timeUnit, config, omitTimeFormatConfig });\n }\n return numberFormat({ type, specifiedFormat: format, config });\n}\nexport function guideFormatType(formatType, fieldOrDatumDef, scaleType) {\n if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) {\n return formatType;\n }\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') {\n return isFieldDef(fieldOrDatumDef) && normalizeTimeUnit(fieldOrDatumDef?.timeUnit)?.utc ? 'utc' : 'time';\n }\n return undefined;\n}\n/**\n * Returns number format for a fieldDef.\n */\nexport function numberFormat({ type, specifiedFormat, config, normalizeStack }) {\n // Specified format in axis/legend has higher precedence than fieldDef.format\n if (isString(specifiedFormat)) {\n return specifiedFormat;\n }\n if (type === QUANTITATIVE) {\n // we only apply the default if the field is quantitative\n return normalizeStack ? config.normalizedNumberFormat : config.numberFormat;\n }\n return undefined;\n}\n/**\n * Returns time format for a fieldDef for use in guides.\n */\nexport function timeFormat({ specifiedFormat, timeUnit, config, omitTimeFormatConfig }) {\n if (specifiedFormat) {\n return specifiedFormat;\n }\n if (timeUnit) {\n return {\n signal: timeUnitSpecifierExpression(timeUnit)\n };\n }\n return omitTimeFormatConfig ? undefined : config.timeFormat;\n}\nfunction formatExpr(field, format) {\n return `format(${field}, \"${format || ''}\")`;\n}\nfunction binNumberFormatExpr(field, format, formatType, config) {\n if (isCustomFormatType(formatType)) {\n return customFormatExpr(formatType, field, format);\n }\n return formatExpr(field, (isString(format) ? format : undefined) ?? config.numberFormat);\n}\nexport function binFormatExpression(startField, endField, format, formatType, config) {\n if (format === undefined && formatType === undefined && config.customFormatTypes && config.numberFormatType) {\n return binFormatExpression(startField, endField, config.numberFormat, config.numberFormatType, config);\n }\n const start = binNumberFormatExpr(startField, format, formatType, config);\n const end = binNumberFormatExpr(endField, format, formatType, config);\n return `${fieldValidPredicate(startField, false)} ? \"null\" : ${start} + \"${BIN_RANGE_DELIMITER}\" + ${end}`;\n}\n/**\n * Returns the time expression used for axis/legend labels or text mark for a temporal field\n */\nexport function timeFormatExpression({ field, timeUnit, format, formatType, rawTimeFormat, isUTCScale }) {\n if (!timeUnit || format) {\n // If there is no time unit, or if user explicitly specifies format for axis/legend/text.\n if (!timeUnit && formatType) {\n return `${formatType}(${field}, '${format}')`;\n }\n format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit.\n return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`;\n }\n else {\n return formatExpression(timeUnit, field, isUTCScale);\n }\n}\n//# sourceMappingURL=format.js.map","import { isArray } from 'vega-util';\nexport const DEFAULT_SORT_OP = 'min';\nconst SORT_BY_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n color: 1,\n fill: 1,\n stroke: 1,\n strokeWidth: 1,\n size: 1,\n shape: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n opacity: 1,\n text: 1\n};\nexport function isSortByChannel(c) {\n return c in SORT_BY_CHANNEL_INDEX;\n}\nexport function isSortByEncoding(sort) {\n return !!sort?.['encoding'];\n}\nexport function isSortField(sort) {\n return sort && (sort['op'] === 'count' || !!sort['field']);\n}\nexport function isSortArray(sort) {\n return sort && isArray(sort);\n}\n//# sourceMappingURL=sort.js.map","export function isFacetMapping(f) {\n return 'row' in f || 'column' in f;\n}\nexport function isFacetFieldDef(channelDef) {\n return !!channelDef && 'header' in channelDef;\n}\nexport function isFacetSpec(spec) {\n return 'facet' in spec;\n}\n//# sourceMappingURL=facet.js.map","import { isArray, isBoolean, isNumber, isString } from 'vega-util';\nimport { isAggregateOp, isArgmaxDef, isArgminDef, isCountingAggregateOp } from './aggregate';\nimport { autoMaxBins, binToString, isBinned, isBinning } from './bin';\nimport { ANGLE, COLOR, COLUMN, DESCRIPTION, DETAIL, FACET, FILL, FILLOPACITY, getSizeChannel, HREF, isScaleChannel, isSecondaryRangeChannel, isXorY, KEY, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, OPACITY, ORDER, RADIUS, RADIUS2, ROW, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, TEXT, THETA, THETA2, TOOLTIP, URL, X, X2, XOFFSET, Y, Y2, YOFFSET } from './channel';\nimport { getMarkConfig, getMarkPropOrConfig } from './compile/common';\nimport { isCustomFormatType } from './compile/format';\nimport { dateTimeToExpr, isDateTime } from './datetime';\nimport { isExprRef } from './expr';\nimport * as log from './log';\nimport { isRectBasedMark } from './mark';\nimport { hasDiscreteDomain, isContinuousToDiscrete, SCALE_CATEGORY_INDEX } from './scale';\nimport { isSortByChannel } from './sort';\nimport { isFacetFieldDef } from './spec/facet';\nimport { getTimeUnitParts, isBinnedTimeUnit, isLocalSingleTimeUnit, normalizeTimeUnit, timeUnitToString } from './timeunit';\nimport { getFullName, QUANTITATIVE } from './type';\nimport { flatAccessWithDatum, getFirstDefined, internalField, omit, removePathFromField, replacePathInField, stringify, titleCase } from './util';\nimport { isSignalRef } from './vega.schema';\nexport function isConditionalParameter(c) {\n return c['param'];\n}\nexport function isRepeatRef(field) {\n return field && !isString(field) && 'repeat' in field;\n}\nexport function toFieldDefBase(fieldDef) {\n const { field, timeUnit, bin, aggregate } = fieldDef;\n return {\n ...(timeUnit ? { timeUnit } : {}),\n ...(bin ? { bin } : {}),\n ...(aggregate ? { aggregate } : {}),\n field\n };\n}\nexport function isSortableFieldDef(fieldDef) {\n return 'sort' in fieldDef;\n}\nexport function getBandPosition({ fieldDef, fieldDef2, markDef: mark, config }) {\n if (isFieldOrDatumDef(fieldDef) && fieldDef.bandPosition !== undefined) {\n return fieldDef.bandPosition;\n }\n if (isFieldDef(fieldDef)) {\n const { timeUnit, bin } = fieldDef;\n if (timeUnit && !fieldDef2) {\n return getMarkConfig('timeUnitBandPosition', mark, config);\n }\n else if (isBinning(bin)) {\n return 0.5;\n }\n }\n return undefined;\n}\nexport function getBandSize({ channel, fieldDef, fieldDef2, markDef: mark, config, scaleType, useVlSizeChannel }) {\n const sizeChannel = getSizeChannel(channel);\n const size = getMarkPropOrConfig(useVlSizeChannel ? 'size' : sizeChannel, mark, config, {\n vgChannel: sizeChannel\n });\n if (size !== undefined) {\n return size;\n }\n if (isFieldDef(fieldDef)) {\n const { timeUnit, bin } = fieldDef;\n if (timeUnit && !fieldDef2) {\n return { band: getMarkConfig('timeUnitBandSize', mark, config) };\n }\n else if (isBinning(bin) && !hasDiscreteDomain(scaleType)) {\n return { band: 1 };\n }\n }\n if (isRectBasedMark(mark.type)) {\n if (scaleType) {\n if (hasDiscreteDomain(scaleType)) {\n return config[mark.type]?.discreteBandSize || { band: 1 };\n }\n else {\n return config[mark.type]?.continuousBandSize;\n }\n }\n return config[mark.type]?.discreteBandSize;\n }\n return undefined;\n}\nexport function hasBandEnd(fieldDef, fieldDef2, markDef, config) {\n if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) {\n // Need to check bandPosition because non-rect marks (e.g., point) with timeUnit\n // doesn't have to use bandEnd if there is no bandPosition.\n return getBandPosition({ fieldDef, fieldDef2, markDef, config }) !== undefined;\n }\n return false;\n}\nexport function isOrderOnlyDef(orderDef) {\n return orderDef && !!orderDef.sort && !orderDef['field'];\n}\nexport function isConditionalDef(channelDef) {\n return channelDef && 'condition' in channelDef;\n}\n/**\n * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef\n */\nexport function hasConditionalFieldDef(channelDef) {\n const condition = channelDef?.['condition'];\n return !!condition && !isArray(condition) && isFieldDef(condition);\n}\nexport function hasConditionalFieldOrDatumDef(channelDef) {\n const condition = channelDef?.['condition'];\n return !!condition && !isArray(condition) && isFieldOrDatumDef(condition);\n}\nexport function hasConditionalValueDef(channelDef) {\n const condition = channelDef?.['condition'];\n return !!condition && (isArray(condition) || isValueDef(condition));\n}\nexport function isFieldDef(channelDef) {\n // TODO: we can't use field in channelDef here as it's somehow failing runtime test\n return channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count');\n}\nexport function channelDefType(channelDef) {\n return channelDef?.['type'];\n}\nexport function isDatumDef(channelDef) {\n return channelDef && 'datum' in channelDef;\n}\nexport function isContinuousFieldOrDatumDef(cd) {\n // TODO: make datum support DateTime object\n return (isTypedFieldDef(cd) && !isDiscrete(cd)) || isNumericDataDef(cd);\n}\nexport function isUnbinnedQuantitativeFieldOrDatumDef(cd) {\n // TODO: make datum support DateTime object\n return (isTypedFieldDef(cd) && cd.type === 'quantitative' && !cd.bin) || isNumericDataDef(cd);\n}\nexport function isNumericDataDef(cd) {\n return isDatumDef(cd) && isNumber(cd.datum);\n}\nexport function isFieldOrDatumDef(channelDef) {\n return isFieldDef(channelDef) || isDatumDef(channelDef);\n}\nexport function isTypedFieldDef(channelDef) {\n return channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef;\n}\nexport function isValueDef(channelDef) {\n return channelDef && 'value' in channelDef && 'value' in channelDef;\n}\nexport function isScaleFieldDef(channelDef) {\n return channelDef && ('scale' in channelDef || 'sort' in channelDef);\n}\nexport function isPositionFieldOrDatumDef(channelDef) {\n return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef);\n}\nexport function isMarkPropFieldOrDatumDef(channelDef) {\n return channelDef && 'legend' in channelDef;\n}\nexport function isStringFieldOrDatumDef(channelDef) {\n return channelDef && ('format' in channelDef || 'formatType' in channelDef);\n}\nexport function toStringFieldDef(fieldDef) {\n // omit properties that don't exist in string field defs\n return omit(fieldDef, ['legend', 'axis', 'header', 'scale']);\n}\nfunction isOpFieldDef(fieldDef) {\n return 'op' in fieldDef;\n}\n/**\n * Get a Vega field reference from a Vega-Lite field def.\n */\nexport function vgField(fieldDef, opt = {}) {\n let field = fieldDef.field;\n const prefix = opt.prefix;\n let suffix = opt.suffix;\n let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped\n if (isCount(fieldDef)) {\n field = internalField('count');\n }\n else {\n let fn;\n if (!opt.nofn) {\n if (isOpFieldDef(fieldDef)) {\n fn = fieldDef.op;\n }\n else {\n const { bin, aggregate, timeUnit } = fieldDef;\n if (isBinning(bin)) {\n fn = binToString(bin);\n suffix = (opt.binSuffix ?? '') + (opt.suffix ?? '');\n }\n else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmax_${aggregate.argmax}`;\n }\n else if (isArgminDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmin_${aggregate.argmin}`;\n }\n else {\n fn = String(aggregate);\n }\n }\n else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n fn = timeUnitToString(timeUnit);\n suffix = ((!['range', 'mid'].includes(opt.binSuffix) && opt.binSuffix) || '') + (opt.suffix ?? '');\n }\n }\n }\n if (fn) {\n field = field ? `${fn}_${field}` : fn;\n }\n }\n if (suffix) {\n field = `${field}_${suffix}`;\n }\n if (prefix) {\n field = `${prefix}_${field}`;\n }\n if (opt.forAs) {\n return removePathFromField(field);\n }\n else if (opt.expr) {\n // Expression to access flattened field. No need to escape dots.\n return flatAccessWithDatum(field, opt.expr) + argAccessor;\n }\n else {\n // We flattened all fields so paths should have become dot.\n return replacePathInField(field) + argAccessor;\n }\n}\nexport function isDiscrete(def) {\n switch (def.type) {\n case 'nominal':\n case 'ordinal':\n case 'geojson':\n return true;\n case 'quantitative':\n return isFieldDef(def) && !!def.bin;\n case 'temporal':\n return false;\n }\n throw new Error(log.message.invalidFieldType(def.type));\n}\nexport function isDiscretizing(def) {\n return isScaleFieldDef(def) && isContinuousToDiscrete(def.scale?.type);\n}\nexport function isCount(fieldDef) {\n return fieldDef.aggregate === 'count';\n}\nexport function verbalTitleFormatter(fieldDef, config) {\n const { field, bin, timeUnit, aggregate } = fieldDef;\n if (aggregate === 'count') {\n return config.countTitle;\n }\n else if (isBinning(bin)) {\n return `${field} (binned)`;\n }\n else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n const unit = normalizeTimeUnit(timeUnit)?.unit;\n if (unit) {\n return `${field} (${getTimeUnitParts(unit).join('-')})`;\n }\n }\n else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n return `${field} for max ${aggregate.argmax}`;\n }\n else if (isArgminDef(aggregate)) {\n return `${field} for min ${aggregate.argmin}`;\n }\n else {\n return `${titleCase(aggregate)} of ${field}`;\n }\n }\n return field;\n}\nexport function functionalTitleFormatter(fieldDef) {\n const { aggregate, bin, timeUnit, field } = fieldDef;\n if (isArgmaxDef(aggregate)) {\n return `${field} for argmax(${aggregate.argmax})`;\n }\n else if (isArgminDef(aggregate)) {\n return `${field} for argmin(${aggregate.argmin})`;\n }\n const timeUnitParams = timeUnit && !isBinnedTimeUnit(timeUnit) ? normalizeTimeUnit(timeUnit) : undefined;\n const fn = aggregate || timeUnitParams?.unit || (timeUnitParams?.maxbins && 'timeunit') || (isBinning(bin) && 'bin');\n if (fn) {\n return `${fn.toUpperCase()}(${field})`;\n }\n else {\n return field;\n }\n}\nexport const defaultTitleFormatter = (fieldDef, config) => {\n switch (config.fieldTitle) {\n case 'plain':\n return fieldDef.field;\n case 'functional':\n return functionalTitleFormatter(fieldDef);\n default:\n return verbalTitleFormatter(fieldDef, config);\n }\n};\nlet titleFormatter = defaultTitleFormatter;\nexport function setTitleFormatter(formatter) {\n titleFormatter = formatter;\n}\nexport function resetTitleFormatter() {\n setTitleFormatter(defaultTitleFormatter);\n}\nexport function title(fieldOrDatumDef, config, { allowDisabling, includeDefault = true }) {\n const guideTitle = getGuide(fieldOrDatumDef)?.title;\n if (!isFieldDef(fieldOrDatumDef)) {\n return guideTitle ?? fieldOrDatumDef.title;\n }\n const fieldDef = fieldOrDatumDef;\n const def = includeDefault ? defaultTitle(fieldDef, config) : undefined;\n if (allowDisabling) {\n return getFirstDefined(guideTitle, fieldDef.title, def);\n }\n else {\n return guideTitle ?? fieldDef.title ?? def;\n }\n}\nexport function getGuide(fieldDef) {\n if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) {\n return fieldDef.axis;\n }\n else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) {\n return fieldDef.legend;\n }\n else if (isFacetFieldDef(fieldDef) && fieldDef.header) {\n return fieldDef.header;\n }\n return undefined;\n}\nexport function defaultTitle(fieldDef, config) {\n return titleFormatter(fieldDef, config);\n}\nexport function getFormatMixins(fieldDef) {\n if (isStringFieldOrDatumDef(fieldDef)) {\n const { format, formatType } = fieldDef;\n return { format, formatType };\n }\n else {\n const guide = getGuide(fieldDef) ?? {};\n const { format, formatType } = guide;\n return { format, formatType };\n }\n}\nexport function defaultType(fieldDef, channel) {\n switch (channel) {\n case 'latitude':\n case 'longitude':\n return 'quantitative';\n case 'row':\n case 'column':\n case 'facet':\n case 'shape':\n case 'strokeDash':\n return 'nominal';\n case 'order':\n return 'ordinal';\n }\n if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) {\n return 'ordinal';\n }\n const { aggregate, bin, timeUnit } = fieldDef;\n if (timeUnit) {\n return 'temporal';\n }\n if (bin || (aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate))) {\n return 'quantitative';\n }\n if (isScaleFieldDef(fieldDef) && fieldDef.scale?.type) {\n switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) {\n case 'numeric':\n case 'discretizing':\n return 'quantitative';\n case 'time':\n return 'temporal';\n }\n }\n return 'nominal';\n}\n/**\n * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef.\n * @param channelDef\n */\nexport function getFieldDef(channelDef) {\n if (isFieldDef(channelDef)) {\n return channelDef;\n }\n else if (hasConditionalFieldDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\nexport function getFieldOrDatumDef(channelDef) {\n if (isFieldOrDatumDef(channelDef)) {\n return channelDef;\n }\n else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\n/**\n * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing.\n */\nexport function initChannelDef(channelDef, channel, config, opt = {}) {\n if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) {\n const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean';\n log.warn(log.message.primitiveChannelDef(channel, primitiveType, channelDef));\n return { value: channelDef };\n }\n // If a fieldDef contains a field, we need type.\n if (isFieldOrDatumDef(channelDef)) {\n return initFieldOrDatumDef(channelDef, channel, config, opt);\n }\n else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return {\n ...channelDef,\n // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition\n condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt)\n };\n }\n return channelDef;\n}\nexport function initFieldOrDatumDef(fd, channel, config, opt) {\n if (isStringFieldOrDatumDef(fd)) {\n const { format, formatType, ...rest } = fd;\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef(rest, channel, config, opt);\n }\n }\n else {\n const guideType = isPositionFieldOrDatumDef(fd)\n ? 'axis'\n : isMarkPropFieldOrDatumDef(fd)\n ? 'legend'\n : isFacetFieldDef(fd)\n ? 'header'\n : null;\n if (guideType && fd[guideType]) {\n const { format, formatType, ...newGuide } = fd[guideType];\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef({ ...fd, [guideType]: newGuide }, channel, config, opt);\n }\n }\n }\n if (isFieldDef(fd)) {\n return initFieldDef(fd, channel, opt);\n }\n return initDatumDef(fd);\n}\nfunction initDatumDef(datumDef) {\n let type = datumDef['type'];\n if (type) {\n return datumDef;\n }\n const { datum } = datumDef;\n type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined;\n return { ...datumDef, type };\n}\nexport function initFieldDef(fd, channel, { compositeMark = false } = {}) {\n const { aggregate, timeUnit, bin, field } = fd;\n const fieldDef = { ...fd };\n // Drop invalid aggregate\n if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) {\n log.warn(log.message.invalidAggregate(aggregate));\n delete fieldDef.aggregate;\n }\n // Normalize Time Unit\n if (timeUnit) {\n fieldDef.timeUnit = normalizeTimeUnit(timeUnit);\n }\n if (field) {\n fieldDef.field = `${field}`;\n }\n // Normalize bin\n if (isBinning(bin)) {\n fieldDef.bin = normalizeBin(bin, channel);\n }\n if (isBinned(bin) && !isXorY(channel)) {\n log.warn(log.message.channelShouldNotBeUsedForBinned(channel));\n }\n // Normalize Type\n if (isTypedFieldDef(fieldDef)) {\n const { type } = fieldDef;\n const fullType = getFullName(type);\n if (type !== fullType) {\n // convert short type to full type\n fieldDef.type = fullType;\n }\n if (type !== 'quantitative') {\n if (isCountingAggregateOp(aggregate)) {\n log.warn(log.message.invalidFieldTypeForCountAggregate(type, aggregate));\n fieldDef.type = 'quantitative';\n }\n }\n }\n else if (!isSecondaryRangeChannel(channel)) {\n // If type is empty / invalid, then augment with default type\n const newType = defaultType(fieldDef, channel);\n fieldDef['type'] = newType;\n }\n if (isTypedFieldDef(fieldDef)) {\n const { compatible, warning } = channelCompatibility(fieldDef, channel) || {};\n if (compatible === false) {\n log.warn(warning);\n }\n }\n if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) {\n const { sort } = fieldDef;\n if (isSortByChannel(sort)) {\n return {\n ...fieldDef,\n sort: { encoding: sort }\n };\n }\n const sub = sort.substr(1);\n if (sort.charAt(0) === '-' && isSortByChannel(sub)) {\n return {\n ...fieldDef,\n sort: { encoding: sub, order: 'descending' }\n };\n }\n }\n if (isFacetFieldDef(fieldDef)) {\n const { header } = fieldDef;\n if (header) {\n const { orient, ...rest } = header;\n if (orient) {\n return {\n ...fieldDef,\n header: {\n ...rest,\n labelOrient: header.labelOrient || orient,\n titleOrient: header.titleOrient || orient\n }\n };\n }\n }\n }\n return fieldDef;\n}\nexport function normalizeBin(bin, channel) {\n if (isBoolean(bin)) {\n return { maxbins: autoMaxBins(channel) };\n }\n else if (bin === 'binned') {\n return {\n binned: true\n };\n }\n else if (!bin.maxbins && !bin.step) {\n return { ...bin, maxbins: autoMaxBins(channel) };\n }\n else {\n return bin;\n }\n}\nconst COMPATIBLE = { compatible: true };\nexport function channelCompatibility(fieldDef, channel) {\n const type = fieldDef.type;\n if (type === 'geojson' && channel !== 'shape') {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with a geojson data.`\n };\n }\n switch (channel) {\n case ROW:\n case COLUMN:\n case FACET:\n if (!isDiscrete(fieldDef)) {\n return {\n compatible: false,\n warning: log.message.channelShouldBeDiscrete(channel)\n };\n }\n return COMPATIBLE;\n case X:\n case Y:\n case XOFFSET:\n case YOFFSET:\n case COLOR:\n case FILL:\n case STROKE:\n case TEXT:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case URL:\n case ANGLE:\n case THETA:\n case RADIUS:\n case DESCRIPTION:\n return COMPATIBLE;\n case LONGITUDE:\n case LONGITUDE2:\n case LATITUDE:\n case LATITUDE2:\n if (type !== QUANTITATIVE) {\n return {\n compatible: false,\n warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.`\n };\n }\n return COMPATIBLE;\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n case SIZE:\n case THETA2:\n case RADIUS2:\n case X2:\n case Y2:\n if (type === 'nominal' && !fieldDef['sort']) {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with an unsorted discrete field.`\n };\n }\n return COMPATIBLE;\n case SHAPE:\n case STROKEDASH:\n if (!isDiscrete(fieldDef) && !isDiscretizing(fieldDef)) {\n return {\n compatible: false,\n warning: log.message.channelShouldBeDiscreteOrDiscretizing(channel)\n };\n }\n return COMPATIBLE;\n case ORDER:\n if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) {\n return {\n compatible: false,\n warning: `Channel order is inappropriate for nominal field, which has no inherent order.`\n };\n }\n return COMPATIBLE;\n }\n}\n/**\n * Check if the field def uses a time format or does not use any format but is temporal\n * (this does not cover field defs that are temporal but use a number format).\n */\nexport function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) {\n const { formatType } = getFormatMixins(fieldOrDatumDef);\n return formatType === 'time' || (!formatType && isTimeFieldDef(fieldOrDatumDef));\n}\n/**\n * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`.\n */\nexport function isTimeFieldDef(def) {\n return def && (def['type'] === 'temporal' || (isFieldDef(def) && !!def.timeUnit));\n}\n/**\n * Getting a value associated with a fielddef.\n * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit)\n */\nexport function valueExpr(v, { timeUnit, type, wrapTime, undefinedIfExprNotRequired }) {\n const unit = timeUnit && normalizeTimeUnit(timeUnit)?.unit;\n let isTime = unit || type === 'temporal';\n let expr;\n if (isExprRef(v)) {\n expr = v.expr;\n }\n else if (isSignalRef(v)) {\n expr = v.signal;\n }\n else if (isDateTime(v)) {\n isTime = true;\n expr = dateTimeToExpr(v);\n }\n else if (isString(v) || isNumber(v)) {\n if (isTime) {\n expr = `datetime(${stringify(v)})`;\n if (isLocalSingleTimeUnit(unit)) {\n // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit\n if ((isNumber(v) && v < 10000) || (isString(v) && isNaN(Date.parse(v)))) {\n expr = dateTimeToExpr({ [unit]: v });\n }\n }\n }\n }\n if (expr) {\n return wrapTime && isTime ? `time(${expr})` : expr;\n }\n // number or boolean or normal string\n return undefinedIfExprNotRequired ? undefined : stringify(v);\n}\n/**\n * Standardize value array -- convert each value to Vega expression if applicable\n */\nexport function valueArray(fieldOrDatumDef, values) {\n const { type } = fieldOrDatumDef;\n return values.map(v => {\n const timeUnit = isFieldDef(fieldOrDatumDef) && !isBinnedTimeUnit(fieldOrDatumDef.timeUnit) ? fieldOrDatumDef.timeUnit : undefined;\n const expr = valueExpr(v, {\n timeUnit,\n type,\n undefinedIfExprNotRequired: true\n });\n // return signal for the expression if we need an expression\n if (expr !== undefined) {\n return { signal: expr };\n }\n // otherwise just return the original value\n return v;\n });\n}\n/**\n * Checks whether a fieldDef for a particular channel requires a computed bin range.\n */\nexport function binRequiresRange(fieldDef, channel) {\n if (!isBinning(fieldDef.bin)) {\n console.warn('Only call this method for binned field defs.');\n return false;\n }\n // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels.\n // We could check whether the axis or legend exists (not disabled) but that seems overkill.\n return isScaleChannel(channel) && ['ordinal', 'nominal'].includes(fieldDef.type);\n}\n//# sourceMappingURL=channeldef.js.map","import { keys } from './util';\nexport const CONDITIONAL_AXIS_PROP_INDEX = {\n labelAlign: {\n part: 'labels',\n vgProp: 'align'\n },\n labelBaseline: {\n part: 'labels',\n vgProp: 'baseline'\n },\n labelColor: {\n part: 'labels',\n vgProp: 'fill'\n },\n labelFont: {\n part: 'labels',\n vgProp: 'font'\n },\n labelFontSize: {\n part: 'labels',\n vgProp: 'fontSize'\n },\n labelFontStyle: {\n part: 'labels',\n vgProp: 'fontStyle'\n },\n labelFontWeight: {\n part: 'labels',\n vgProp: 'fontWeight'\n },\n labelOpacity: {\n part: 'labels',\n vgProp: 'opacity'\n },\n labelOffset: null,\n labelPadding: null,\n gridColor: {\n part: 'grid',\n vgProp: 'stroke'\n },\n gridDash: {\n part: 'grid',\n vgProp: 'strokeDash'\n },\n gridDashOffset: {\n part: 'grid',\n vgProp: 'strokeDashOffset'\n },\n gridOpacity: {\n part: 'grid',\n vgProp: 'opacity'\n },\n gridWidth: {\n part: 'grid',\n vgProp: 'strokeWidth'\n },\n tickColor: {\n part: 'ticks',\n vgProp: 'stroke'\n },\n tickDash: {\n part: 'ticks',\n vgProp: 'strokeDash'\n },\n tickDashOffset: {\n part: 'ticks',\n vgProp: 'strokeDashOffset'\n },\n tickOpacity: {\n part: 'ticks',\n vgProp: 'opacity'\n },\n tickSize: null,\n tickWidth: {\n part: 'ticks',\n vgProp: 'strokeWidth'\n }\n};\nexport function isConditionalAxisValue(v) {\n return v?.condition;\n}\nexport const AXIS_PARTS = ['domain', 'grid', 'labels', 'ticks', 'title'];\n/**\n * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes.\n */\nexport const AXIS_PROPERTY_TYPE = {\n grid: 'grid',\n gridCap: 'grid',\n gridColor: 'grid',\n gridDash: 'grid',\n gridDashOffset: 'grid',\n gridOpacity: 'grid',\n gridScale: 'grid',\n gridWidth: 'grid',\n orient: 'main',\n bandPosition: 'both',\n aria: 'main',\n description: 'main',\n domain: 'main',\n domainCap: 'main',\n domainColor: 'main',\n domainDash: 'main',\n domainDashOffset: 'main',\n domainOpacity: 'main',\n domainWidth: 'main',\n format: 'main',\n formatType: 'main',\n labelAlign: 'main',\n labelAngle: 'main',\n labelBaseline: 'main',\n labelBound: 'main',\n labelColor: 'main',\n labelFlush: 'main',\n labelFlushOffset: 'main',\n labelFont: 'main',\n labelFontSize: 'main',\n labelFontStyle: 'main',\n labelFontWeight: 'main',\n labelLimit: 'main',\n labelLineHeight: 'main',\n labelOffset: 'main',\n labelOpacity: 'main',\n labelOverlap: 'main',\n labelPadding: 'main',\n labels: 'main',\n labelSeparation: 'main',\n maxExtent: 'main',\n minExtent: 'main',\n offset: 'both',\n position: 'main',\n tickCap: 'main',\n tickColor: 'main',\n tickDash: 'main',\n tickDashOffset: 'main',\n tickMinStep: 'both',\n tickOffset: 'both',\n tickOpacity: 'main',\n tickRound: 'both',\n ticks: 'main',\n tickSize: 'main',\n tickWidth: 'both',\n title: 'main',\n titleAlign: 'main',\n titleAnchor: 'main',\n titleAngle: 'main',\n titleBaseline: 'main',\n titleColor: 'main',\n titleFont: 'main',\n titleFontSize: 'main',\n titleFontStyle: 'main',\n titleFontWeight: 'main',\n titleLimit: 'main',\n titleLineHeight: 'main',\n titleOpacity: 'main',\n titlePadding: 'main',\n titleX: 'main',\n titleY: 'main',\n encode: 'both',\n scale: 'both',\n tickBand: 'both',\n tickCount: 'both',\n tickExtra: 'both',\n translate: 'both',\n values: 'both',\n zindex: 'both' // this is actually set afterward, so it doesn't matter\n};\nexport const COMMON_AXIS_PROPERTIES_INDEX = {\n orient: 1,\n aria: 1,\n bandPosition: 1,\n description: 1,\n domain: 1,\n domainCap: 1,\n domainColor: 1,\n domainDash: 1,\n domainDashOffset: 1,\n domainOpacity: 1,\n domainWidth: 1,\n format: 1,\n formatType: 1,\n grid: 1,\n gridCap: 1,\n gridColor: 1,\n gridDash: 1,\n gridDashOffset: 1,\n gridOpacity: 1,\n gridWidth: 1,\n labelAlign: 1,\n labelAngle: 1,\n labelBaseline: 1,\n labelBound: 1,\n labelColor: 1,\n labelFlush: 1,\n labelFlushOffset: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelLineHeight: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labels: 1,\n labelSeparation: 1,\n maxExtent: 1,\n minExtent: 1,\n offset: 1,\n position: 1,\n tickBand: 1,\n tickCap: 1,\n tickColor: 1,\n tickCount: 1,\n tickDash: 1,\n tickDashOffset: 1,\n tickExtra: 1,\n tickMinStep: 1,\n tickOffset: 1,\n tickOpacity: 1,\n tickRound: 1,\n ticks: 1,\n tickSize: 1,\n tickWidth: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleAngle: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titlePadding: 1,\n titleX: 1,\n titleY: 1,\n translate: 1,\n values: 1,\n zindex: 1\n};\nconst AXIS_PROPERTIES_INDEX = {\n ...COMMON_AXIS_PROPERTIES_INDEX,\n style: 1,\n labelExpr: 1,\n encoding: 1\n};\nexport function isAxisProperty(prop) {\n return !!AXIS_PROPERTIES_INDEX[prop];\n}\n// Export for dependent projects\nexport const AXIS_PROPERTIES = keys(AXIS_PROPERTIES_INDEX);\nconst AXIS_CONFIGS_INDEX = {\n axis: 1,\n axisBand: 1,\n axisBottom: 1,\n axisDiscrete: 1,\n axisLeft: 1,\n axisPoint: 1,\n axisQuantitative: 1,\n axisRight: 1,\n axisTemporal: 1,\n axisTop: 1,\n axisX: 1,\n axisXBand: 1,\n axisXDiscrete: 1,\n axisXPoint: 1,\n axisXQuantitative: 1,\n axisXTemporal: 1,\n axisY: 1,\n axisYBand: 1,\n axisYDiscrete: 1,\n axisYPoint: 1,\n axisYQuantitative: 1,\n axisYTemporal: 1\n};\nexport const AXIS_CONFIGS = keys(AXIS_CONFIGS_INDEX);\n//# sourceMappingURL=axis.js.map","export function isUnitSpec(spec) {\n return 'mark' in spec;\n}\n//# sourceMappingURL=unit.js.map","import { getMarkType } from '../mark';\nimport { isUnitSpec } from '../spec/unit';\nexport class CompositeMarkNormalizer {\n constructor(name, run) {\n this.name = name;\n this.run = run;\n }\n hasMatchingType(spec) {\n if (isUnitSpec(spec)) {\n return getMarkType(spec.mark) === this.name;\n }\n return false;\n }\n}\n//# sourceMappingURL=base.js.map","import { array, isArray } from 'vega-util';\nimport { isArgmaxDef, isArgminDef } from './aggregate';\nimport { isBinned, isBinning } from './bin';\nimport { ANGLE, CHANNELS, COLOR, DESCRIPTION, DETAIL, FILL, FILLOPACITY, getMainChannelFromOffsetChannel, getOffsetScaleChannel, HREF, isChannel, isNonPositionScaleChannel, isSecondaryRangeChannel, isXorY, isXorYOffset, KEY, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, OPACITY, ORDER, RADIUS, RADIUS2, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, supportMark, TEXT, THETA, THETA2, TOOLTIP, UNIT_CHANNELS, URL, X, X2, XOFFSET, Y, Y2, YOFFSET } from './channel';\nimport { binRequiresRange, getFieldDef, getGuide, hasConditionalFieldDef, hasConditionalFieldOrDatumDef, initChannelDef, initFieldDef, isConditionalDef, isDatumDef, isFieldDef, isOrderOnlyDef, isTypedFieldDef, isValueDef, title, vgField } from './channeldef';\nimport * as log from './log';\nimport { isContinuous, isDiscrete, QUANTITATIVE, TEMPORAL } from './type';\nimport { keys, some } from './util';\nimport { isSignalRef } from './vega.schema';\nimport { isBinnedTimeUnit } from './timeunit';\nexport function channelHasField(encoding, channel) {\n const channelDef = encoding && encoding[channel];\n if (channelDef) {\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.field);\n }\n else {\n return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef);\n }\n }\n return false;\n}\nexport function channelHasFieldOrDatum(encoding, channel) {\n const channelDef = encoding && encoding[channel];\n if (channelDef) {\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.field);\n }\n else {\n return isFieldDef(channelDef) || isDatumDef(channelDef) || hasConditionalFieldOrDatumDef(channelDef);\n }\n }\n return false;\n}\nexport function channelHasNestedOffsetScale(encoding, channel) {\n if (isXorY(channel)) {\n const fieldDef = encoding[channel];\n if ((isFieldDef(fieldDef) || isDatumDef(fieldDef)) &&\n (isDiscrete(fieldDef.type) || (isFieldDef(fieldDef) && fieldDef.timeUnit))) {\n const offsetChannel = getOffsetScaleChannel(channel);\n return channelHasFieldOrDatum(encoding, offsetChannel);\n }\n }\n return false;\n}\nexport function isAggregate(encoding) {\n return some(CHANNELS, channel => {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.aggregate);\n }\n else {\n const fieldDef = getFieldDef(channelDef);\n return fieldDef && !!fieldDef.aggregate;\n }\n }\n return false;\n });\n}\nexport function extractTransformsFromEncoding(oldEncoding, config) {\n const groupby = [];\n const bins = [];\n const timeUnits = [];\n const aggregate = [];\n const encoding = {};\n forEach(oldEncoding, (channelDef, channel) => {\n // Extract potential embedded transformations along with remaining properties\n if (isFieldDef(channelDef)) {\n const { field, aggregate: aggOp, bin, timeUnit, ...remaining } = channelDef;\n if (aggOp || timeUnit || bin) {\n const guide = getGuide(channelDef);\n const isTitleDefined = guide?.title;\n let newField = vgField(channelDef, { forAs: true });\n const newFieldDef = {\n // Only add title if it doesn't exist\n ...(isTitleDefined ? [] : { title: title(channelDef, config, { allowDisabling: true }) }),\n ...remaining,\n // Always overwrite field\n field: newField\n };\n if (aggOp) {\n let op;\n if (isArgmaxDef(aggOp)) {\n op = 'argmax';\n newField = vgField({ op: 'argmax', field: aggOp.argmax }, { forAs: true });\n newFieldDef.field = `${newField}.${field}`;\n }\n else if (isArgminDef(aggOp)) {\n op = 'argmin';\n newField = vgField({ op: 'argmin', field: aggOp.argmin }, { forAs: true });\n newFieldDef.field = `${newField}.${field}`;\n }\n else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') {\n op = aggOp;\n }\n if (op) {\n const aggregateEntry = {\n op,\n as: newField\n };\n if (field) {\n aggregateEntry.field = field;\n }\n aggregate.push(aggregateEntry);\n }\n }\n else {\n groupby.push(newField);\n if (isTypedFieldDef(channelDef) && isBinning(bin)) {\n bins.push({ bin, field, as: newField });\n // Add additional groupbys for range and end of bins\n groupby.push(vgField(channelDef, { binSuffix: 'end' }));\n if (binRequiresRange(channelDef, channel)) {\n groupby.push(vgField(channelDef, { binSuffix: 'range' }));\n }\n // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively\n if (isXorY(channel)) {\n const secondaryChannel = {\n field: `${newField}_end`\n };\n encoding[`${channel}2`] = secondaryChannel;\n }\n newFieldDef.bin = 'binned';\n if (!isSecondaryRangeChannel(channel)) {\n newFieldDef['type'] = QUANTITATIVE;\n }\n }\n else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n timeUnits.push({\n timeUnit,\n field,\n as: newField\n });\n // define the format type for later compilation\n const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time';\n if (formatType) {\n if (channel === TEXT || channel === TOOLTIP) {\n newFieldDef['formatType'] = formatType;\n }\n else if (isNonPositionScaleChannel(channel)) {\n newFieldDef['legend'] = {\n formatType,\n ...newFieldDef['legend']\n };\n }\n else if (isXorY(channel)) {\n newFieldDef['axis'] = {\n formatType,\n ...newFieldDef['axis']\n };\n }\n }\n }\n }\n // now the field should refer to post-transformed field instead\n encoding[channel] = newFieldDef;\n }\n else {\n groupby.push(field);\n encoding[channel] = oldEncoding[channel];\n }\n }\n else {\n // For value def / signal ref / datum def, just copy\n encoding[channel] = oldEncoding[channel];\n }\n });\n return {\n bins,\n timeUnits,\n aggregate,\n groupby,\n encoding\n };\n}\nexport function markChannelCompatible(encoding, channel, mark) {\n const markSupported = supportMark(channel, mark);\n if (!markSupported) {\n return false;\n }\n else if (markSupported === 'binned') {\n const primaryFieldDef = encoding[channel === X2 ? X : Y];\n // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef\n // has \"binned\" data and thus need x2/y2 to specify the bin-end field.\n if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) {\n return true;\n }\n else {\n return false;\n }\n }\n return true;\n}\nexport function initEncoding(encoding, mark, filled, config) {\n const normalizedEncoding = {};\n for (const key of keys(encoding)) {\n if (!isChannel(key)) {\n // Drop invalid channel\n log.warn(log.message.invalidEncodingChannel(key));\n }\n }\n for (let channel of UNIT_CHANNELS) {\n if (!encoding[channel]) {\n continue;\n }\n const channelDef = encoding[channel];\n if (isXorYOffset(channel)) {\n const mainChannel = getMainChannelFromOffsetChannel(channel);\n const positionDef = normalizedEncoding[mainChannel];\n if (isFieldDef(positionDef)) {\n if (isContinuous(positionDef.type)) {\n if (isFieldDef(channelDef) && !positionDef.timeUnit) {\n // TODO: nesting continuous field instead continuous field should\n // behave like offsetting the data in data domain\n log.warn(log.message.offsetNestedInsideContinuousPositionScaleDropped(mainChannel));\n continue;\n }\n }\n }\n }\n if (channel === 'angle' && mark === 'arc' && !encoding.theta) {\n log.warn(log.message.REPLACE_ANGLE_WITH_THETA);\n channel = THETA;\n }\n if (!markChannelCompatible(encoding, channel, mark)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, mark));\n continue;\n }\n // Drop line's size if the field is aggregated.\n if (channel === SIZE && mark === 'line') {\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef?.aggregate) {\n log.warn(log.message.LINE_WITH_VARYING_SIZE);\n continue;\n }\n }\n // Drop color if either fill or stroke is specified\n if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) {\n log.warn(log.message.droppingColor('encoding', { fill: 'fill' in encoding, stroke: 'stroke' in encoding }));\n continue;\n }\n if (channel === DETAIL ||\n (channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef)) ||\n (channel === TOOLTIP && isArray(channelDef))) {\n if (channelDef) {\n if (channel === ORDER) {\n const def = encoding[channel];\n if (isOrderOnlyDef(def)) {\n normalizedEncoding[channel] = def;\n continue;\n }\n }\n // Array of fieldDefs for detail channel (or production rule)\n normalizedEncoding[channel] = array(channelDef).reduce((defs, fieldDef) => {\n if (!isFieldDef(fieldDef)) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n }\n else {\n defs.push(initFieldDef(fieldDef, channel));\n }\n return defs;\n }, []);\n }\n }\n else {\n if (channel === TOOLTIP && channelDef === null) {\n // Preserve null so we can use it to disable tooltip\n normalizedEncoding[channel] = null;\n }\n else if (!isFieldDef(channelDef) &&\n !isDatumDef(channelDef) &&\n !isValueDef(channelDef) &&\n !isConditionalDef(channelDef) &&\n !isSignalRef(channelDef)) {\n log.warn(log.message.emptyFieldDef(channelDef, channel));\n continue;\n }\n normalizedEncoding[channel] = initChannelDef(channelDef, channel, config);\n }\n }\n return normalizedEncoding;\n}\n/**\n * For composite marks, we have to call initChannelDef during init so we can infer types earlier.\n */\nexport function normalizeEncoding(encoding, config) {\n const normalizedEncoding = {};\n for (const channel of keys(encoding)) {\n const newChannelDef = initChannelDef(encoding[channel], channel, config, { compositeMark: true });\n normalizedEncoding[channel] = newChannelDef;\n }\n return normalizedEncoding;\n}\nexport function fieldDefs(encoding) {\n const arr = [];\n for (const channel of keys(encoding)) {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n const channelDefArray = array(channelDef);\n for (const def of channelDefArray) {\n if (isFieldDef(def)) {\n arr.push(def);\n }\n else if (hasConditionalFieldDef(def)) {\n arr.push(def.condition);\n }\n }\n }\n }\n return arr;\n}\nexport function forEach(mapping, f, thisArg) {\n if (!mapping) {\n return;\n }\n for (const channel of keys(mapping)) {\n const el = mapping[channel];\n if (isArray(el)) {\n for (const channelDef of el) {\n f.call(thisArg, channelDef, channel);\n }\n }\n else {\n f.call(thisArg, el, channel);\n }\n }\n}\nexport function reduce(mapping, f, init, thisArg) {\n if (!mapping) {\n return init;\n }\n return keys(mapping).reduce((r, channel) => {\n const map = mapping[channel];\n if (isArray(map)) {\n return map.reduce((r1, channelDef) => {\n return f.call(thisArg, r1, channelDef, channel);\n }, r);\n }\n else {\n return f.call(thisArg, r, map, channel);\n }\n }, init);\n}\n/**\n * Returns list of path grouping fields for the given encoding\n */\nexport function pathGroupingFields(mark, encoding) {\n return keys(encoding).reduce((details, channel) => {\n switch (channel) {\n // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group\n case X:\n case Y:\n case HREF:\n case DESCRIPTION:\n case URL:\n case X2:\n case Y2:\n case XOFFSET:\n case YOFFSET:\n case THETA:\n case THETA2:\n case RADIUS:\n case RADIUS2:\n // falls through\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n // TODO: case 'cursor':\n // text, shape, shouldn't be a part of line/trail/area [falls through]\n case TEXT:\n case SHAPE:\n case ANGLE:\n // falls through\n // tooltip fields should not be added to group by [falls through]\n case TOOLTIP:\n return details;\n case ORDER:\n // order should not group line / trail\n if (mark === 'line' || mark === 'trail') {\n return details;\n }\n // but order should group area for stacking (falls through)\n case DETAIL:\n case KEY: {\n const channelDef = encoding[channel];\n if (isArray(channelDef) || isFieldDef(channelDef)) {\n for (const fieldDef of array(channelDef)) {\n if (!fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n }\n }\n return details;\n }\n case SIZE:\n if (mark === 'trail') {\n // For trail, size should not group trail lines.\n return details;\n }\n // For line, size should group lines.\n // falls through\n case COLOR:\n case FILL:\n case STROKE:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEDASH:\n case STROKEWIDTH: {\n // TODO strokeDashOffset:\n // falls through\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef && !fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n return details;\n }\n }\n }, []);\n}\n//# sourceMappingURL=encoding.js.map","import { isArray, isBoolean, isString } from 'vega-util';\nimport { isContinuousFieldOrDatumDef, isFieldDef, isFieldOrDatumDefForTimeFormat } from '../channeldef';\nimport { fieldDefs } from '../encoding';\nimport * as log from '../log';\nimport { isMarkDef } from '../mark';\nimport { getFirstDefined, hash, unique } from '../util';\nimport { isSignalRef } from '../vega.schema';\nimport { toStringFieldDef } from './../channeldef';\nexport function filterTooltipWithAggregatedField(oldEncoding) {\n const { tooltip, ...filteredEncoding } = oldEncoding;\n if (!tooltip) {\n return { filteredEncoding };\n }\n let customTooltipWithAggregatedField;\n let customTooltipWithoutAggregatedField;\n if (isArray(tooltip)) {\n for (const t of tooltip) {\n if (t.aggregate) {\n if (!customTooltipWithAggregatedField) {\n customTooltipWithAggregatedField = [];\n }\n customTooltipWithAggregatedField.push(t);\n }\n else {\n if (!customTooltipWithoutAggregatedField) {\n customTooltipWithoutAggregatedField = [];\n }\n customTooltipWithoutAggregatedField.push(t);\n }\n }\n if (customTooltipWithAggregatedField) {\n filteredEncoding.tooltip = customTooltipWithAggregatedField;\n }\n }\n else {\n if (tooltip['aggregate']) {\n filteredEncoding.tooltip = tooltip;\n }\n else {\n customTooltipWithoutAggregatedField = tooltip;\n }\n }\n if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) {\n customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0];\n }\n return { customTooltipWithoutAggregatedField, filteredEncoding };\n}\nexport function getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, withFieldName = true) {\n if ('tooltip' in encodingWithoutContinuousAxis) {\n return { tooltip: encodingWithoutContinuousAxis.tooltip };\n }\n const fiveSummaryTooltip = tooltipSummary.map(({ fieldPrefix, titlePrefix }) => {\n const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : '';\n return {\n field: fieldPrefix + continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n title: isSignalRef(titlePrefix) ? { signal: `${titlePrefix}\"${escape(mainTitle)}\"` } : titlePrefix + mainTitle\n };\n });\n const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef);\n return {\n tooltip: [\n ...fiveSummaryTooltip,\n // need to cast because TextFieldDef supports fewer types of bin\n ...unique(tooltipFieldDefs, hash)\n ]\n };\n}\nexport function getTitle(continuousAxisChannelDef) {\n const { title, field } = continuousAxisChannelDef;\n return getFirstDefined(title, field);\n}\nexport function makeCompositeAggregatePartFactory(compositeMarkDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, compositeMarkConfig) {\n const { scale, axis } = continuousAxisChannelDef;\n return ({ partName, mark, positionPrefix, endPositionPrefix = undefined, extraEncoding = {} }) => {\n const title = getTitle(continuousAxisChannelDef);\n return partLayerMixins(compositeMarkDef, partName, compositeMarkConfig, {\n mark,\n encoding: {\n [continuousAxis]: {\n field: `${positionPrefix}_${continuousAxisChannelDef.field}`,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? { title } : {}),\n ...(scale !== undefined ? { scale } : {}),\n ...(axis !== undefined ? { axis } : {})\n },\n ...(isString(endPositionPrefix)\n ? {\n [`${continuousAxis}2`]: {\n field: `${endPositionPrefix}_${continuousAxisChannelDef.field}`\n }\n }\n : {}),\n ...sharedEncoding,\n ...extraEncoding\n }\n });\n };\n}\nexport function partLayerMixins(markDef, part, compositeMarkConfig, partBaseSpec) {\n const { clip, color, opacity } = markDef;\n const mark = markDef.type;\n if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) {\n return [\n {\n ...partBaseSpec,\n mark: {\n ...compositeMarkConfig[part],\n ...(clip ? { clip } : {}),\n ...(color ? { color } : {}),\n ...(opacity ? { opacity } : {}),\n ...(isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : { type: partBaseSpec.mark }),\n style: `${mark}-${String(part)}`,\n ...(isBoolean(markDef[part]) ? {} : markDef[part])\n }\n }\n ];\n }\n return [];\n}\nexport function compositeMarkContinuousAxis(spec, orient, compositeMark) {\n const { encoding } = spec;\n const continuousAxis = orient === 'vertical' ? 'y' : 'x';\n const continuousAxisChannelDef = encoding[continuousAxis]; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal.\n const continuousAxisChannelDef2 = encoding[`${continuousAxis}2`];\n const continuousAxisChannelDefError = encoding[`${continuousAxis}Error`];\n const continuousAxisChannelDefError2 = encoding[`${continuousAxis}Error2`];\n return {\n continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark),\n continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark),\n continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark),\n continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark),\n continuousAxis\n };\n}\nfunction filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark) {\n if (continuousAxisChannelDef?.aggregate) {\n const { aggregate, ...continuousAxisWithoutAggregate } = continuousAxisChannelDef;\n if (aggregate !== compositeMark) {\n log.warn(log.message.errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark));\n }\n return continuousAxisWithoutAggregate;\n }\n else {\n return continuousAxisChannelDef;\n }\n}\nexport function compositeMarkOrient(spec, compositeMark) {\n const { mark, encoding } = spec;\n const { x, y } = encoding;\n if (isMarkDef(mark) && mark.orient) {\n return mark.orient;\n }\n if (isContinuousFieldOrDatumDef(x)) {\n // x is continuous\n if (isContinuousFieldOrDatumDef(y)) {\n // both x and y are continuous\n const xAggregate = isFieldDef(x) && x.aggregate;\n const yAggregate = isFieldDef(y) && y.aggregate;\n if (!xAggregate && yAggregate === compositeMark) {\n return 'vertical';\n }\n else if (!yAggregate && xAggregate === compositeMark) {\n return 'horizontal';\n }\n else if (xAggregate === compositeMark && yAggregate === compositeMark) {\n throw new Error('Both x and y cannot have aggregate');\n }\n else {\n if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) {\n // y is temporal but x is not\n return 'horizontal';\n }\n // default orientation for two continuous\n return 'vertical';\n }\n }\n return 'horizontal';\n }\n else if (isContinuousFieldOrDatumDef(y)) {\n // y is continuous but x is not\n return 'vertical';\n }\n else {\n // Neither x nor y is continuous.\n throw new Error(`Need a valid continuous axis for ${compositeMark}s`);\n }\n}\n//# sourceMappingURL=common.js.map","import { isNumber, isObject } from 'vega-util';\nimport { getMarkPropOrConfig } from '../compile/common';\nimport { extractTransformsFromEncoding, normalizeEncoding } from '../encoding';\nimport * as log from '../log';\nimport { isMarkDef } from '../mark';\nimport { isEmpty, omit } from '../util';\nimport { CompositeMarkNormalizer } from './base';\nimport { compositeMarkContinuousAxis, compositeMarkOrient, filterTooltipWithAggregatedField, getCompositeMarkTooltip, getTitle, makeCompositeAggregatePartFactory, partLayerMixins } from './common';\nexport const BOXPLOT = 'boxplot';\nexport const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks'];\nexport const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot);\nexport function getBoxPlotType(extent) {\n if (isNumber(extent)) {\n return 'tukey';\n }\n // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now.\n return extent;\n}\nexport function normalizeBoxPlot(spec, { config }) {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n const { mark, encoding: _encoding, params, projection: _p, ...outerSpec } = spec;\n const markDef = isMarkDef(mark) ? mark : { type: mark };\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (params) {\n log.warn(log.message.selectionNotSupported('boxplot'));\n }\n const extent = markDef.extent ?? config.boxplot.extent;\n const sizeValue = getMarkPropOrConfig('size', markDef, // TODO: https://github.com/vega/vega-lite/issues/6245\n config);\n const invalid = markDef.invalid;\n const boxPlotType = getBoxPlotType(extent);\n const { bins, timeUnits, transform, continuousAxisChannelDef, continuousAxis, groupby, aggregate, encodingWithoutContinuousAxis, ticksOrient, boxOrient, customTooltipWithoutAggregatedField } = boxParams(spec, extent, config);\n const { color, size, ...encodingWithoutSizeColorAndContinuousAxis } = encodingWithoutContinuousAxis;\n const makeBoxPlotPart = (sharedEncoding) => {\n return makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, config.boxplot);\n };\n const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis);\n const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis);\n const makeBoxPlotMidTick = makeBoxPlotPart({ ...encodingWithoutSizeColorAndContinuousAxis, ...(size ? { size } : {}) });\n const fiveSummaryTooltipEncoding = getCompositeMarkTooltip([\n { fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', titlePrefix: 'Max' },\n { fieldPrefix: 'upper_box_', titlePrefix: 'Q3' },\n { fieldPrefix: 'mid_box_', titlePrefix: 'Median' },\n { fieldPrefix: 'lower_box_', titlePrefix: 'Q1' },\n { fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', titlePrefix: 'Min' }\n ], continuousAxisChannelDef, encodingWithoutContinuousAxis);\n // ## Whisker Layers\n const endTick = { type: 'tick', color: 'black', opacity: 1, orient: ticksOrient, invalid, aria: false };\n const whiskerTooltipEncoding = boxPlotType === 'min-max'\n ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker\n : // for tukey / k-IQR, just show upper/lower-whisker\n getCompositeMarkTooltip([\n { fieldPrefix: 'upper_whisker_', titlePrefix: 'Upper Whisker' },\n { fieldPrefix: 'lower_whisker_', titlePrefix: 'Lower Whisker' }\n ], continuousAxisChannelDef, encodingWithoutContinuousAxis);\n const whiskerLayers = [\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: { type: 'rule', invalid, aria: false },\n positionPrefix: 'lower_whisker',\n endPositionPrefix: 'lower_box',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: { type: 'rule', invalid, aria: false },\n positionPrefix: 'upper_box',\n endPositionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'lower_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n })\n ];\n // ## Box Layers\n // TODO: support hiding certain mark parts\n const boxLayers = [\n ...(boxPlotType !== 'tukey' ? whiskerLayers : []),\n ...makeBoxPlotBox({\n partName: 'box',\n mark: {\n type: 'bar',\n ...(sizeValue ? { size: sizeValue } : {}),\n orient: boxOrient,\n invalid,\n ariaRoleDescription: 'box'\n },\n positionPrefix: 'lower_box',\n endPositionPrefix: 'upper_box',\n extraEncoding: fiveSummaryTooltipEncoding\n }),\n ...makeBoxPlotMidTick({\n partName: 'median',\n mark: {\n type: 'tick',\n invalid,\n ...(isObject(config.boxplot.median) && config.boxplot.median.color ? { color: config.boxplot.median.color } : {}),\n ...(sizeValue ? { size: sizeValue } : {}),\n orient: ticksOrient,\n aria: false\n },\n positionPrefix: 'mid_box',\n extraEncoding: fiveSummaryTooltipEncoding\n })\n ];\n if (boxPlotType === 'min-max') {\n return {\n ...outerSpec,\n transform: (outerSpec.transform ?? []).concat(transform),\n layer: boxLayers\n };\n }\n // Tukey Box Plot\n const lowerBoxExpr = `datum[\"lower_box_${continuousAxisChannelDef.field}\"]`;\n const upperBoxExpr = `datum[\"upper_box_${continuousAxisChannelDef.field}\"]`;\n const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`;\n const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`;\n const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`;\n const fieldExpr = `datum[\"${continuousAxisChannelDef.field}\"]`;\n const joinaggregateTransform = {\n joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field),\n groupby\n };\n const filteredWhiskerSpec = {\n transform: [\n {\n filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})`\n },\n {\n aggregate: [\n {\n op: 'min',\n field: continuousAxisChannelDef.field,\n as: `lower_whisker_${continuousAxisChannelDef.field}`\n },\n {\n op: 'max',\n field: continuousAxisChannelDef.field,\n as: `upper_whisker_${continuousAxisChannelDef.field}`\n },\n // preserve lower_box / upper_box\n {\n op: 'min',\n field: `lower_box_${continuousAxisChannelDef.field}`,\n as: `lower_box_${continuousAxisChannelDef.field}`\n },\n {\n op: 'max',\n field: `upper_box_${continuousAxisChannelDef.field}`,\n as: `upper_box_${continuousAxisChannelDef.field}`\n },\n ...aggregate\n ],\n groupby\n }\n ],\n layer: whiskerLayers\n };\n const { tooltip, ...encodingWithoutSizeColorContinuousAxisAndTooltip } = encodingWithoutSizeColorAndContinuousAxis;\n const { scale, axis } = continuousAxisChannelDef;\n const title = getTitle(continuousAxisChannelDef);\n const axisWithoutTitle = omit(axis, ['title']);\n const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, {\n transform: [{ filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})` }],\n mark: 'point',\n encoding: {\n [continuousAxis]: {\n field: continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? { title } : {}),\n ...(scale !== undefined ? { scale } : {}),\n // add axis without title since we already added the title above\n ...(isEmpty(axisWithoutTitle) ? {} : { axis: axisWithoutTitle })\n },\n ...encodingWithoutSizeColorContinuousAxisAndTooltip,\n ...(color ? { color } : {}),\n ...(customTooltipWithoutAggregatedField ? { tooltip: customTooltipWithoutAggregatedField } : {})\n }\n })[0];\n let filteredLayersMixins;\n const filteredLayersMixinsTransforms = [...bins, ...timeUnits, joinaggregateTransform];\n if (outlierLayersMixins) {\n filteredLayersMixins = {\n transform: filteredLayersMixinsTransforms,\n layer: [outlierLayersMixins, filteredWhiskerSpec]\n };\n }\n else {\n filteredLayersMixins = filteredWhiskerSpec;\n filteredLayersMixins.transform.unshift(...filteredLayersMixinsTransforms);\n }\n return {\n ...outerSpec,\n layer: [\n filteredLayersMixins,\n {\n // boxplot\n transform,\n layer: boxLayers\n }\n ]\n };\n}\nfunction boxParamsQuartiles(continousAxisField) {\n return [\n {\n op: 'q1',\n field: continousAxisField,\n as: `lower_box_${continousAxisField}`\n },\n {\n op: 'q3',\n field: continousAxisField,\n as: `upper_box_${continousAxisField}`\n }\n ];\n}\nfunction boxParams(spec, extent, config) {\n const orient = compositeMarkOrient(spec, BOXPLOT);\n const { continuousAxisChannelDef, continuousAxis } = compositeMarkContinuousAxis(spec, orient, BOXPLOT);\n const continuousFieldName = continuousAxisChannelDef.field;\n const boxPlotType = getBoxPlotType(extent);\n const boxplotSpecificAggregate = [\n ...boxParamsQuartiles(continuousFieldName),\n {\n op: 'median',\n field: continuousFieldName,\n as: `mid_box_${continuousFieldName}`\n },\n {\n op: 'min',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName\n },\n {\n op: 'max',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName\n }\n ];\n const postAggregateCalculates = boxPlotType === 'min-max' || boxPlotType === 'tukey'\n ? []\n : [\n // This is for the original k-IQR, which we do not expose\n {\n calculate: `datum[\"upper_box_${continuousFieldName}\"] - datum[\"lower_box_${continuousFieldName}\"]`,\n as: `iqr_${continuousFieldName}`\n },\n {\n calculate: `min(datum[\"upper_box_${continuousFieldName}\"] + datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"max_${continuousFieldName}\"])`,\n as: `upper_whisker_${continuousFieldName}`\n },\n {\n calculate: `max(datum[\"lower_box_${continuousFieldName}\"] - datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"min_${continuousFieldName}\"])`,\n as: `lower_whisker_${continuousFieldName}`\n }\n ];\n const { [continuousAxis]: oldContinuousAxisChannelDef, ...oldEncodingWithoutContinuousAxis } = spec.encoding;\n const { customTooltipWithoutAggregatedField, filteredEncoding } = filterTooltipWithAggregatedField(oldEncodingWithoutContinuousAxis);\n const { bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(filteredEncoding, config);\n const ticksOrient = orient === 'vertical' ? 'horizontal' : 'vertical';\n const boxOrient = orient;\n const transform = [\n ...bins,\n ...timeUnits,\n {\n aggregate: [...aggregate, ...boxplotSpecificAggregate],\n groupby\n },\n ...postAggregateCalculates\n ];\n return {\n bins,\n timeUnits,\n transform,\n groupby,\n aggregate,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient,\n boxOrient,\n customTooltipWithoutAggregatedField\n };\n}\n//# sourceMappingURL=boxplot.js.map","import { isContinuousFieldOrDatumDef, isFieldOrDatumDef, title } from '../channeldef';\nimport { extractTransformsFromEncoding, normalizeEncoding } from '../encoding';\nimport * as log from '../log';\nimport { isMarkDef } from '../mark';\nimport { replaceAll, titleCase } from '../util';\nimport { CompositeMarkNormalizer } from './base';\nimport { compositeMarkContinuousAxis, compositeMarkOrient, getCompositeMarkTooltip, makeCompositeAggregatePartFactory } from './common';\nexport const ERRORBAR = 'errorbar';\nexport const ERRORBAR_PARTS = ['ticks', 'rule'];\nexport const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar);\nexport function normalizeErrorBar(spec, { config }) {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n const { transform, continuousAxisChannelDef, continuousAxis, encodingWithoutContinuousAxis, ticksOrient, markDef, outerSpec, tooltipEncoding } = errorBarParams(spec, ERRORBAR, config);\n delete encodingWithoutContinuousAxis['size'];\n const makeErrorBarPart = makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorbar);\n const thickness = markDef.thickness;\n const size = markDef.size;\n const tick = {\n type: 'tick',\n orient: ticksOrient,\n aria: false,\n ...(thickness !== undefined ? { thickness } : {}),\n ...(size !== undefined ? { size } : {})\n };\n const layer = [\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'lower',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'rule',\n mark: {\n type: 'rule',\n ariaRoleDescription: 'errorbar',\n ...(thickness !== undefined ? { size: thickness } : {})\n },\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ];\n return {\n ...outerSpec,\n transform,\n ...(layer.length > 1 ? { layer } : { ...layer[0] })\n };\n}\nfunction errorBarOrientAndInputType(spec, compositeMark) {\n const { encoding } = spec;\n if (errorBarIsInputTypeRaw(encoding)) {\n return {\n orient: compositeMarkOrient(spec, compositeMark),\n inputType: 'raw'\n };\n }\n const isTypeAggregatedUpperLower = errorBarIsInputTypeAggregatedUpperLower(encoding);\n const isTypeAggregatedError = errorBarIsInputTypeAggregatedError(encoding);\n const x = encoding.x;\n const y = encoding.y;\n if (isTypeAggregatedUpperLower) {\n // type is aggregated-upper-lower\n if (isTypeAggregatedError) {\n throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`);\n }\n const x2 = encoding.x2;\n const y2 = encoding.y2;\n if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) {\n // having both x, x2 and y, y2\n throw new Error(`${compositeMark} cannot have both x2 and y2`);\n }\n else if (isFieldOrDatumDef(x2)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x, x2 quantitative and field y, y2 are not specified\n return { orient: 'horizontal', inputType: 'aggregated-upper-lower' };\n }\n else {\n // having x, x2 that are not both quantitative\n throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`);\n }\n }\n else if (isFieldOrDatumDef(y2)) {\n // y2 is a FieldDef\n if (isContinuousFieldOrDatumDef(y)) {\n // having y, y2 quantitative and field x, x2 are not specified\n return { orient: 'vertical', inputType: 'aggregated-upper-lower' };\n }\n else {\n // having y, y2 that are not both quantitative\n throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`);\n }\n }\n throw new Error('No ranged axis');\n }\n else {\n // type is aggregated-error\n const xError = encoding.xError;\n const xError2 = encoding.xError2;\n const yError = encoding.yError;\n const yError2 = encoding.yError2;\n if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) {\n // having xError2 without xError\n throw new Error(`${compositeMark} cannot have xError2 without xError`);\n }\n if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) {\n // having yError2 without yError\n throw new Error(`${compositeMark} cannot have yError2 without yError`);\n }\n if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) {\n // having both xError and yError\n throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`);\n }\n else if (isFieldOrDatumDef(xError)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x and xError that are all quantitative\n return { orient: 'horizontal', inputType: 'aggregated-error' };\n }\n else {\n // having x, xError, and xError2 that are not all quantitative\n throw new Error('All x, xError, and xError2 (if exist) have to be quantitative');\n }\n }\n else if (isFieldOrDatumDef(yError)) {\n if (isContinuousFieldOrDatumDef(y)) {\n // having y and yError that are all quantitative\n return { orient: 'vertical', inputType: 'aggregated-error' };\n }\n else {\n // having y, yError, and yError2 that are not all quantitative\n throw new Error('All y, yError, and yError2 (if exist) have to be quantitative');\n }\n }\n throw new Error('No ranged axis');\n }\n}\nfunction errorBarIsInputTypeRaw(encoding) {\n return ((isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) &&\n !isFieldOrDatumDef(encoding.x2) &&\n !isFieldOrDatumDef(encoding.y2) &&\n !isFieldOrDatumDef(encoding.xError) &&\n !isFieldOrDatumDef(encoding.xError2) &&\n !isFieldOrDatumDef(encoding.yError) &&\n !isFieldOrDatumDef(encoding.yError2));\n}\nfunction errorBarIsInputTypeAggregatedUpperLower(encoding) {\n return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2);\n}\nfunction errorBarIsInputTypeAggregatedError(encoding) {\n return (isFieldOrDatumDef(encoding.xError) ||\n isFieldOrDatumDef(encoding.xError2) ||\n isFieldOrDatumDef(encoding.yError) ||\n isFieldOrDatumDef(encoding.yError2));\n}\nexport function errorBarParams(spec, compositeMark, config) {\n // TODO: use selection\n const { mark, encoding, params, projection: _p, ...outerSpec } = spec;\n const markDef = isMarkDef(mark) ? mark : { type: mark };\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (params) {\n log.warn(log.message.selectionNotSupported(compositeMark));\n }\n const { orient, inputType } = errorBarOrientAndInputType(spec, compositeMark);\n const { continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, continuousAxis } = compositeMarkContinuousAxis(spec, orient, compositeMark);\n const { errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName } = errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config);\n const { [continuousAxis]: oldContinuousAxisChannelDef, [continuousAxis === 'x' ? 'x2' : 'y2']: oldContinuousAxisChannelDef2, [continuousAxis === 'x' ? 'xError' : 'yError']: oldContinuousAxisChannelDefError, [continuousAxis === 'x' ? 'xError2' : 'yError2']: oldContinuousAxisChannelDefError2, ...oldEncodingWithoutContinuousAxis } = encoding;\n const { bins, timeUnits, aggregate: oldAggregate, groupby: oldGroupBy, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config);\n const aggregate = [...oldAggregate, ...errorBarSpecificAggregate];\n const groupby = inputType !== 'raw' ? [] : oldGroupBy;\n const tooltipEncoding = getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, tooltipTitleWithFieldName);\n return {\n transform: [\n ...(outerSpec.transform ?? []),\n ...bins,\n ...timeUnits,\n ...(aggregate.length === 0 ? [] : [{ aggregate, groupby }]),\n ...postAggregateCalculates\n ],\n groupby,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical',\n markDef,\n outerSpec,\n tooltipEncoding\n };\n}\nfunction errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config) {\n let errorBarSpecificAggregate = [];\n let postAggregateCalculates = [];\n const continuousFieldName = continuousAxisChannelDef.field;\n let tooltipSummary;\n let tooltipTitleWithFieldName = false;\n if (inputType === 'raw') {\n const center = markDef.center\n ? markDef.center\n : markDef.extent\n ? markDef.extent === 'iqr'\n ? 'median'\n : 'mean'\n : config.errorbar.center;\n const extent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr';\n if ((center === 'median') !== (extent === 'iqr')) {\n log.warn(log.message.errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark));\n }\n if (extent === 'stderr' || extent === 'stdev') {\n errorBarSpecificAggregate = [\n { op: extent, field: continuousFieldName, as: `extent_${continuousFieldName}` },\n { op: center, field: continuousFieldName, as: `center_${continuousFieldName}` }\n ];\n postAggregateCalculates = [\n {\n calculate: `datum[\"center_${continuousFieldName}\"] + datum[\"extent_${continuousFieldName}\"]`,\n as: `upper_${continuousFieldName}`\n },\n {\n calculate: `datum[\"center_${continuousFieldName}\"] - datum[\"extent_${continuousFieldName}\"]`,\n as: `lower_${continuousFieldName}`\n }\n ];\n tooltipSummary = [\n { fieldPrefix: 'center_', titlePrefix: titleCase(center) },\n { fieldPrefix: 'upper_', titlePrefix: getTitlePrefix(center, extent, '+') },\n { fieldPrefix: 'lower_', titlePrefix: getTitlePrefix(center, extent, '-') }\n ];\n tooltipTitleWithFieldName = true;\n }\n else {\n let centerOp;\n let lowerExtentOp;\n let upperExtentOp;\n if (extent === 'ci') {\n centerOp = 'mean';\n lowerExtentOp = 'ci0';\n upperExtentOp = 'ci1';\n }\n else {\n centerOp = 'median';\n lowerExtentOp = 'q1';\n upperExtentOp = 'q3';\n }\n errorBarSpecificAggregate = [\n { op: lowerExtentOp, field: continuousFieldName, as: `lower_${continuousFieldName}` },\n { op: upperExtentOp, field: continuousFieldName, as: `upper_${continuousFieldName}` },\n { op: centerOp, field: continuousFieldName, as: `center_${continuousFieldName}` }\n ];\n tooltipSummary = [\n {\n fieldPrefix: 'upper_',\n titlePrefix: title({ field: continuousFieldName, aggregate: upperExtentOp, type: 'quantitative' }, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'lower_',\n titlePrefix: title({ field: continuousFieldName, aggregate: lowerExtentOp, type: 'quantitative' }, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'center_',\n titlePrefix: title({ field: continuousFieldName, aggregate: centerOp, type: 'quantitative' }, config, {\n allowDisabling: false\n })\n }\n ];\n }\n }\n else {\n if (markDef.center || markDef.extent) {\n log.warn(log.message.errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent));\n }\n if (inputType === 'aggregated-upper-lower') {\n tooltipSummary = [];\n postAggregateCalculates = [\n { calculate: `datum[\"${continuousAxisChannelDef2.field}\"]`, as: `upper_${continuousFieldName}` },\n { calculate: `datum[\"${continuousFieldName}\"]`, as: `lower_${continuousFieldName}` }\n ];\n }\n else if (inputType === 'aggregated-error') {\n tooltipSummary = [{ fieldPrefix: '', titlePrefix: continuousFieldName }];\n postAggregateCalculates = [\n {\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: `upper_${continuousFieldName}`\n }\n ];\n if (continuousAxisChannelDefError2) {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError2.field}\"]`,\n as: `lower_${continuousFieldName}`\n });\n }\n else {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] - datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: `lower_${continuousFieldName}`\n });\n }\n }\n for (const postAggregateCalculate of postAggregateCalculates) {\n tooltipSummary.push({\n fieldPrefix: postAggregateCalculate.as.substring(0, 6),\n titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum[\"', ''), '\"]', '')\n });\n }\n }\n return { postAggregateCalculates, errorBarSpecificAggregate, tooltipSummary, tooltipTitleWithFieldName };\n}\nfunction getTitlePrefix(center, extent, operation) {\n return `${titleCase(center)} ${operation} ${extent}`;\n}\n//# sourceMappingURL=errorbar.js.map","import { normalizeEncoding } from '../encoding';\nimport * as log from '../log';\nimport { CompositeMarkNormalizer } from './base';\nimport { makeCompositeAggregatePartFactory } from './common';\nimport { errorBarParams } from './errorbar';\nexport const ERRORBAND = 'errorband';\nexport const ERRORBAND_PARTS = ['band', 'borders'];\nexport const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand);\nexport function normalizeErrorBand(spec, { config }) {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n const { transform, continuousAxisChannelDef, continuousAxis, encodingWithoutContinuousAxis, markDef, outerSpec, tooltipEncoding } = errorBarParams(spec, ERRORBAND, config);\n const errorBandDef = markDef;\n const makeErrorBandPart = makeCompositeAggregatePartFactory(errorBandDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorband);\n const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined;\n let bandMark = { type: is2D ? 'area' : 'rect' };\n let bordersMark = { type: is2D ? 'line' : 'rule' };\n const interpolate = {\n ...(errorBandDef.interpolate ? { interpolate: errorBandDef.interpolate } : {}),\n ...(errorBandDef.tension && errorBandDef.interpolate ? { tension: errorBandDef.tension } : {})\n };\n if (is2D) {\n bandMark = {\n ...bandMark,\n ...interpolate,\n ariaRoleDescription: 'errorband'\n };\n bordersMark = {\n ...bordersMark,\n ...interpolate,\n aria: false\n };\n }\n else if (errorBandDef.interpolate) {\n log.warn(log.message.errorBand1DNotSupport('interpolate'));\n }\n else if (errorBandDef.tension) {\n log.warn(log.message.errorBand1DNotSupport('tension'));\n }\n return {\n ...outerSpec,\n transform,\n layer: [\n ...makeErrorBandPart({\n partName: 'band',\n mark: bandMark,\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'lower',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ]\n };\n}\n//# sourceMappingURL=errorband.js.map","import { keys } from '../util';\nimport { CompositeMarkNormalizer } from './base';\nimport { BOXPLOT, BOXPLOT_PARTS, normalizeBoxPlot } from './boxplot';\nimport { ERRORBAND, ERRORBAND_PARTS, normalizeErrorBand } from './errorband';\nimport { ERRORBAR, ERRORBAR_PARTS, normalizeErrorBar } from './errorbar';\n/**\n * Registry index for all composite mark's normalizer\n */\nconst compositeMarkRegistry = {};\nexport function add(mark, run, parts) {\n const normalizer = new CompositeMarkNormalizer(mark, run);\n compositeMarkRegistry[mark] = { normalizer, parts };\n}\nexport function remove(mark) {\n delete compositeMarkRegistry[mark];\n}\nexport function getAllCompositeMarks() {\n return keys(compositeMarkRegistry);\n}\nadd(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS);\nadd(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS);\nadd(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS);\n//# sourceMappingURL=index.js.map","export const VL_ONLY_LEGEND_CONFIG = [\n 'gradientHorizontalMaxLength',\n 'gradientHorizontalMinLength',\n 'gradientVerticalMaxLength',\n 'gradientVerticalMinLength',\n 'unselectedOpacity'\n];\n//# sourceMappingURL=guide.js.map","import { keys } from './util';\nexport const HEADER_TITLE_PROPERTIES_MAP = {\n titleAlign: 'align',\n titleAnchor: 'anchor',\n titleAngle: 'angle',\n titleBaseline: 'baseline',\n titleColor: 'color',\n titleFont: 'font',\n titleFontSize: 'fontSize',\n titleFontStyle: 'fontStyle',\n titleFontWeight: 'fontWeight',\n titleLimit: 'limit',\n titleLineHeight: 'lineHeight',\n titleOrient: 'orient',\n titlePadding: 'offset'\n};\nexport const HEADER_LABEL_PROPERTIES_MAP = {\n labelAlign: 'align',\n labelAnchor: 'anchor',\n labelAngle: 'angle',\n labelBaseline: 'baseline',\n labelColor: 'color',\n labelFont: 'font',\n labelFontSize: 'fontSize',\n labelFontStyle: 'fontStyle',\n labelFontWeight: 'fontWeight',\n labelLimit: 'limit',\n labelLineHeight: 'lineHeight',\n labelOrient: 'orient',\n labelPadding: 'offset'\n};\nexport const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP);\nexport const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP);\nconst HEADER_CONFIGS_INDEX = {\n header: 1,\n headerRow: 1,\n headerColumn: 1,\n headerFacet: 1\n};\nexport const HEADER_CONFIGS = keys(HEADER_CONFIGS_INDEX);\n//# sourceMappingURL=header.js.map","import { keys } from './util';\nexport const LEGEND_SCALE_CHANNELS = [\n 'size',\n 'shape',\n 'fill',\n 'stroke',\n 'strokeDash',\n 'strokeWidth',\n 'opacity'\n];\nexport const defaultLegendConfig = {\n gradientHorizontalMaxLength: 200,\n gradientHorizontalMinLength: 100,\n gradientVerticalMaxLength: 200,\n gradientVerticalMinLength: 64,\n unselectedOpacity: 0.35\n};\nexport const COMMON_LEGEND_PROPERTY_INDEX = {\n aria: 1,\n clipHeight: 1,\n columnPadding: 1,\n columns: 1,\n cornerRadius: 1,\n description: 1,\n direction: 1,\n fillColor: 1,\n format: 1,\n formatType: 1,\n gradientLength: 1,\n gradientOpacity: 1,\n gradientStrokeColor: 1,\n gradientStrokeWidth: 1,\n gradientThickness: 1,\n gridAlign: 1,\n labelAlign: 1,\n labelBaseline: 1,\n labelColor: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labelSeparation: 1,\n legendX: 1,\n legendY: 1,\n offset: 1,\n orient: 1,\n padding: 1,\n rowPadding: 1,\n strokeColor: 1,\n symbolDash: 1,\n symbolDashOffset: 1,\n symbolFillColor: 1,\n symbolLimit: 1,\n symbolOffset: 1,\n symbolOpacity: 1,\n symbolSize: 1,\n symbolStrokeColor: 1,\n symbolStrokeWidth: 1,\n symbolType: 1,\n tickCount: 1,\n tickMinStep: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titleOrient: 1,\n titlePadding: 1,\n type: 1,\n values: 1,\n zindex: 1\n};\nexport const LEGEND_PROPERTIES = keys(COMMON_LEGEND_PROPERTY_INDEX);\n//# sourceMappingURL=legend.js.map","import { isObject } from 'vega-util';\nexport const SELECTION_ID = '_vgsid_';\nexport const defaultConfig = {\n point: {\n on: 'click',\n fields: [SELECTION_ID],\n toggle: 'event.shiftKey',\n resolve: 'global',\n clear: 'dblclick'\n },\n interval: {\n on: '[pointerdown, window:pointerup] > window:pointermove!',\n encodings: ['x', 'y'],\n translate: '[pointerdown, window:pointerup] > window:pointermove!',\n zoom: 'wheel!',\n mark: { fill: '#333', fillOpacity: 0.125, stroke: 'white' },\n resolve: 'global',\n clear: 'dblclick'\n }\n};\nexport function isLegendBinding(bind) {\n return bind === 'legend' || !!bind?.legend;\n}\nexport function isLegendStreamBinding(bind) {\n return isLegendBinding(bind) && isObject(bind);\n}\nexport function isSelectionParameter(param) {\n return !!param?.['select'];\n}\n//# sourceMappingURL=selection.js.map","import { isSelectionParameter } from './selection';\nexport function assembleParameterSignals(params) {\n const signals = [];\n for (const param of params || []) {\n // Selection parameters are handled separately via assembleSelectionTopLevelSignals\n // and assembleSignals methods registered on the Model.\n if (isSelectionParameter(param))\n continue;\n const { expr, bind, ...rest } = param;\n if (bind && expr) {\n // Vega's InitSignal -- apply expr to \"init\"\n const signal = {\n ...rest,\n bind,\n init: expr\n };\n signals.push(signal);\n }\n else {\n const signal = {\n ...rest,\n ...(expr ? { update: expr } : {}),\n ...(bind ? { bind } : {})\n };\n signals.push(signal);\n }\n }\n return signals;\n}\n//# sourceMappingURL=parameter.js.map","export function isAnyConcatSpec(spec) {\n return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec);\n}\nexport function isConcatSpec(spec) {\n return 'concat' in spec;\n}\nexport function isVConcatSpec(spec) {\n return 'vconcat' in spec;\n}\nexport function isHConcatSpec(spec) {\n return 'hconcat' in spec;\n}\n//# sourceMappingURL=concat.js.map","import { isNumber, isObject } from 'vega-util';\nimport { keys } from '../util';\nimport { isConcatSpec, isVConcatSpec } from './concat';\nimport { isFacetMapping, isFacetSpec } from './facet';\nexport function getStepFor({ step, offsetIsDiscrete }) {\n if (offsetIsDiscrete) {\n return step.for ?? 'offset';\n }\n else {\n return 'position';\n }\n}\nexport function isStep(size) {\n return isObject(size) && size['step'] !== undefined;\n}\nexport function isFrameMixins(o) {\n return o['view'] || o['width'] || o['height'];\n}\nexport const DEFAULT_SPACING = 20;\nconst COMPOSITION_LAYOUT_INDEX = {\n align: 1,\n bounds: 1,\n center: 1,\n columns: 1,\n spacing: 1\n};\nconst COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX);\nexport function extractCompositionLayout(spec, specType, config) {\n const compositionConfig = config[specType];\n const layout = {};\n // Apply config first\n const { spacing: spacingConfig, columns } = compositionConfig;\n if (spacingConfig !== undefined) {\n layout.spacing = spacingConfig;\n }\n if (columns !== undefined) {\n if ((isFacetSpec(spec) && !isFacetMapping(spec.facet)) || isConcatSpec(spec)) {\n layout.columns = columns;\n }\n }\n if (isVConcatSpec(spec)) {\n layout.columns = 1;\n }\n // Then copy properties from the spec\n for (const prop of COMPOSITION_LAYOUT_PROPERTIES) {\n if (spec[prop] !== undefined) {\n if (prop === 'spacing') {\n const spacing = spec[prop];\n layout[prop] = isNumber(spacing)\n ? spacing\n : {\n row: spacing.row ?? spacingConfig,\n column: spacing.column ?? spacingConfig\n };\n }\n else {\n layout[prop] = spec[prop];\n }\n }\n }\n return layout;\n}\n//# sourceMappingURL=base.js.map","import { writeConfig } from 'vega';\nimport { isObject, mergeConfig } from 'vega-util';\nimport { AXIS_CONFIGS, isConditionalAxisValue } from './axis';\nimport { signalOrValueRefWithCondition, signalRefOrValue } from './compile/common';\nimport { getAllCompositeMarks } from './compositemark';\nimport { replaceExprRef } from './expr';\nimport { VL_ONLY_LEGEND_CONFIG } from './guide';\nimport { HEADER_CONFIGS } from './header';\nimport { defaultLegendConfig } from './legend';\nimport * as mark from './mark';\nimport { MARK_CONFIGS, PRIMITIVE_MARKS, VL_ONLY_MARK_CONFIG_PROPERTIES, VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX } from './mark';\nimport { assembleParameterSignals } from './parameter';\nimport { defaultScaleConfig } from './scale';\nimport { defaultConfig as defaultSelectionConfig } from './selection';\nimport { DEFAULT_SPACING, isStep } from './spec/base';\nimport { extractTitleConfig } from './title';\nimport { duplicate, getFirstDefined, isEmpty, keys, omit } from './util';\nexport function getViewConfigContinuousSize(viewConfig, channel) {\n return viewConfig[channel] ?? viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility\n}\nexport function getViewConfigDiscreteStep(viewConfig, channel) {\n const size = getViewConfigDiscreteSize(viewConfig, channel);\n return isStep(size) ? size.step : DEFAULT_STEP;\n}\nexport function getViewConfigDiscreteSize(viewConfig, channel) {\n const size = viewConfig[channel] ?? viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility\n return getFirstDefined(size, { step: viewConfig.step });\n}\nexport const DEFAULT_STEP = 20;\nexport const defaultViewConfig = {\n continuousWidth: 200,\n continuousHeight: 200,\n step: DEFAULT_STEP\n};\nexport function isVgScheme(rangeScheme) {\n return rangeScheme && !!rangeScheme['scheme'];\n}\nexport const defaultConfig = {\n background: 'white',\n padding: 5,\n timeFormat: '%b %d, %Y',\n countTitle: 'Count of Records',\n view: defaultViewConfig,\n mark: mark.defaultMarkConfig,\n arc: {},\n area: {},\n bar: mark.defaultBarConfig,\n circle: {},\n geoshape: {},\n image: {},\n line: {},\n point: {},\n rect: mark.defaultRectConfig,\n rule: { color: 'black' },\n square: {},\n text: { color: 'black' },\n tick: mark.defaultTickConfig,\n trail: {},\n boxplot: {\n size: 14,\n extent: 1.5,\n box: {},\n median: { color: 'white' },\n outliers: {},\n rule: {},\n ticks: null\n },\n errorbar: {\n center: 'mean',\n rule: true,\n ticks: false\n },\n errorband: {\n band: {\n opacity: 0.3\n },\n borders: false\n },\n scale: defaultScaleConfig,\n projection: {},\n legend: defaultLegendConfig,\n header: { titlePadding: 10, labelPadding: 10 },\n headerColumn: {},\n headerRow: {},\n headerFacet: {},\n selection: defaultSelectionConfig,\n style: {},\n title: {},\n facet: { spacing: DEFAULT_SPACING },\n concat: { spacing: DEFAULT_SPACING },\n normalizedNumberFormat: '.0%'\n};\n// Tableau10 color palette, copied from `vegaScale.scheme('tableau10')`\nconst tab10 = [\n '#4c78a8',\n '#f58518',\n '#e45756',\n '#72b7b2',\n '#54a24b',\n '#eeca3b',\n '#b279a2',\n '#ff9da6',\n '#9d755d',\n '#bab0ac'\n];\nexport const DEFAULT_FONT_SIZE = {\n text: 11,\n guideLabel: 10,\n guideTitle: 11,\n groupTitle: 13,\n groupSubtitle: 12\n};\nexport const DEFAULT_COLOR = {\n blue: tab10[0],\n orange: tab10[1],\n red: tab10[2],\n teal: tab10[3],\n green: tab10[4],\n yellow: tab10[5],\n purple: tab10[6],\n pink: tab10[7],\n brown: tab10[8],\n gray0: '#000',\n gray1: '#111',\n gray2: '#222',\n gray3: '#333',\n gray4: '#444',\n gray5: '#555',\n gray6: '#666',\n gray7: '#777',\n gray8: '#888',\n gray9: '#999',\n gray10: '#aaa',\n gray11: '#bbb',\n gray12: '#ccc',\n gray13: '#ddd',\n gray14: '#eee',\n gray15: '#fff'\n};\nexport function colorSignalConfig(color = {}) {\n return {\n signals: [\n {\n name: 'color',\n value: isObject(color) ? { ...DEFAULT_COLOR, ...color } : DEFAULT_COLOR\n }\n ],\n mark: { color: { signal: 'color.blue' } },\n rule: { color: { signal: 'color.gray0' } },\n text: {\n color: { signal: 'color.gray0' }\n },\n style: {\n 'guide-label': {\n fill: { signal: 'color.gray0' }\n },\n 'guide-title': {\n fill: { signal: 'color.gray0' }\n },\n 'group-title': {\n fill: { signal: 'color.gray0' }\n },\n 'group-subtitle': {\n fill: { signal: 'color.gray0' }\n },\n cell: {\n stroke: { signal: 'color.gray8' }\n }\n },\n axis: {\n domainColor: { signal: 'color.gray13' },\n gridColor: { signal: 'color.gray8' },\n tickColor: { signal: 'color.gray13' }\n },\n range: {\n category: [\n { signal: 'color.blue' },\n { signal: 'color.orange' },\n { signal: 'color.red' },\n { signal: 'color.teal' },\n { signal: 'color.green' },\n { signal: 'color.yellow' },\n { signal: 'color.purple' },\n { signal: 'color.pink' },\n { signal: 'color.brown' },\n { signal: 'color.grey8' }\n ]\n }\n };\n}\nexport function fontSizeSignalConfig(fontSize) {\n return {\n signals: [\n {\n name: 'fontSize',\n value: isObject(fontSize) ? { ...DEFAULT_FONT_SIZE, ...fontSize } : DEFAULT_FONT_SIZE\n }\n ],\n text: {\n fontSize: { signal: 'fontSize.text' }\n },\n style: {\n 'guide-label': {\n fontSize: { signal: 'fontSize.guideLabel' }\n },\n 'guide-title': {\n fontSize: { signal: 'fontSize.guideTitle' }\n },\n 'group-title': {\n fontSize: { signal: 'fontSize.groupTitle' }\n },\n 'group-subtitle': {\n fontSize: { signal: 'fontSize.groupSubtitle' }\n }\n }\n };\n}\nexport function fontConfig(font) {\n return {\n text: { font },\n style: {\n 'guide-label': { font },\n 'guide-title': { font },\n 'group-title': { font },\n 'group-subtitle': { font }\n }\n };\n}\nfunction getAxisConfigInternal(axisConfig) {\n const props = keys(axisConfig || {});\n const axisConfigInternal = {};\n for (const prop of props) {\n const val = axisConfig[prop];\n axisConfigInternal[prop] = isConditionalAxisValue(val)\n ? signalOrValueRefWithCondition(val)\n : signalRefOrValue(val);\n }\n return axisConfigInternal;\n}\nfunction getStyleConfigInternal(styleConfig) {\n const props = keys(styleConfig);\n const styleConfigInternal = {};\n for (const prop of props) {\n // We need to cast to cheat a bit here since styleConfig can be either mark config or axis config\n styleConfigInternal[prop] = getAxisConfigInternal(styleConfig[prop]);\n }\n return styleConfigInternal;\n}\nconst configPropsWithExpr = [\n ...MARK_CONFIGS,\n ...AXIS_CONFIGS,\n ...HEADER_CONFIGS,\n 'background',\n 'padding',\n 'legend',\n 'lineBreak',\n 'scale',\n 'style',\n 'title',\n 'view'\n];\n/**\n * Merge specified config with default config and config for the `color` flag,\n * then replace all expressions with signals\n */\nexport function initConfig(specifiedConfig = {}) {\n const { color, font, fontSize, selection, ...restConfig } = specifiedConfig;\n const mergedConfig = mergeConfig({}, duplicate(defaultConfig), font ? fontConfig(font) : {}, color ? colorSignalConfig(color) : {}, fontSize ? fontSizeSignalConfig(fontSize) : {}, restConfig || {});\n // mergeConfig doesn't recurse and overrides object values.\n if (selection) {\n writeConfig(mergedConfig, 'selection', selection, true);\n }\n const outputConfig = omit(mergedConfig, configPropsWithExpr);\n for (const prop of ['background', 'lineBreak', 'padding']) {\n if (mergedConfig[prop]) {\n outputConfig[prop] = signalRefOrValue(mergedConfig[prop]);\n }\n }\n for (const markConfigType of mark.MARK_CONFIGS) {\n if (mergedConfig[markConfigType]) {\n // FIXME: outputConfig[markConfigType] expects that types are replaced recursively but replaceExprRef only replaces one level deep\n outputConfig[markConfigType] = replaceExprRef(mergedConfig[markConfigType]);\n }\n }\n for (const axisConfigType of AXIS_CONFIGS) {\n if (mergedConfig[axisConfigType]) {\n outputConfig[axisConfigType] = getAxisConfigInternal(mergedConfig[axisConfigType]);\n }\n }\n for (const headerConfigType of HEADER_CONFIGS) {\n if (mergedConfig[headerConfigType]) {\n outputConfig[headerConfigType] = replaceExprRef(mergedConfig[headerConfigType]);\n }\n }\n if (mergedConfig.legend) {\n outputConfig.legend = replaceExprRef(mergedConfig.legend);\n }\n if (mergedConfig.scale) {\n outputConfig.scale = replaceExprRef(mergedConfig.scale);\n }\n if (mergedConfig.style) {\n outputConfig.style = getStyleConfigInternal(mergedConfig.style);\n }\n if (mergedConfig.title) {\n outputConfig.title = replaceExprRef(mergedConfig.title);\n }\n if (mergedConfig.view) {\n outputConfig.view = replaceExprRef(mergedConfig.view);\n }\n return outputConfig;\n}\nconst MARK_STYLES = new Set(['view', ...PRIMITIVE_MARKS]);\nconst VL_ONLY_CONFIG_PROPERTIES = [\n 'color',\n 'fontSize',\n 'background',\n 'padding',\n 'facet',\n 'concat',\n 'numberFormat',\n 'numberFormatType',\n 'normalizedNumberFormat',\n 'normalizedNumberFormatType',\n 'timeFormat',\n 'countTitle',\n 'header',\n 'axisQuantitative',\n 'axisTemporal',\n 'axisDiscrete',\n 'axisPoint',\n 'axisXBand',\n 'axisXPoint',\n 'axisXDiscrete',\n 'axisXQuantitative',\n 'axisXTemporal',\n 'axisYBand',\n 'axisYPoint',\n 'axisYDiscrete',\n 'axisYQuantitative',\n 'axisYTemporal',\n 'scale',\n 'selection',\n 'overlay' // FIXME: Redesign and unhide this\n];\nconst VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {\n view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'],\n ...VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX\n};\nexport function stripAndRedirectConfig(config) {\n config = duplicate(config);\n for (const prop of VL_ONLY_CONFIG_PROPERTIES) {\n delete config[prop];\n }\n if (config.axis) {\n // delete condition axis config\n for (const prop in config.axis) {\n if (isConditionalAxisValue(config.axis[prop])) {\n delete config.axis[prop];\n }\n }\n }\n if (config.legend) {\n for (const prop of VL_ONLY_LEGEND_CONFIG) {\n delete config.legend[prop];\n }\n }\n // Remove Vega-Lite only generic mark config\n if (config.mark) {\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config.mark[prop];\n }\n if (config.mark.tooltip && isObject(config.mark.tooltip)) {\n delete config.mark.tooltip;\n }\n }\n if (config.params) {\n config.signals = (config.signals || []).concat(assembleParameterSignals(config.params));\n delete config.params;\n }\n for (const markType of MARK_STYLES) {\n // Remove Vega-Lite-only mark config\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config[markType][prop];\n }\n // Remove Vega-Lite only mark-specific config\n const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType];\n if (vlOnlyMarkSpecificConfigs) {\n for (const prop of vlOnlyMarkSpecificConfigs) {\n delete config[markType][prop];\n }\n }\n // Redirect mark config to config.style so that mark config only affect its own mark type\n // without affecting other marks that share the same underlying Vega marks.\n // For example, config.rect should not affect bar marks.\n redirectConfigToStyleConfig(config, markType);\n }\n for (const m of getAllCompositeMarks()) {\n // Clean up the composite mark config as we don't need them in the output specs anymore\n delete config[m];\n }\n redirectTitleConfig(config);\n // Remove empty config objects.\n for (const prop in config) {\n if (isObject(config[prop]) && isEmpty(config[prop])) {\n delete config[prop];\n }\n }\n return isEmpty(config) ? undefined : config;\n}\n/**\n *\n * Redirect config.title -- so that title config do not affect header labels,\n * which also uses `title` directive to implement.\n *\n * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles.\n */\nfunction redirectTitleConfig(config) {\n const { titleMarkConfig, subtitleMarkConfig, subtitle } = extractTitleConfig(config.title);\n // set config.style if title/subtitleMarkConfig is not an empty object\n if (!isEmpty(titleMarkConfig)) {\n config.style['group-title'] = {\n ...config.style['group-title'],\n ...titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega\n };\n }\n if (!isEmpty(subtitleMarkConfig)) {\n config.style['group-subtitle'] = {\n ...config.style['group-subtitle'],\n ...subtitleMarkConfig\n };\n }\n // subtitle part can stay in config.title since header titles do not use subtitle\n if (!isEmpty(subtitle)) {\n config.title = subtitle;\n }\n else {\n delete config.title;\n }\n}\nfunction redirectConfigToStyleConfig(config, prop, // string = composite mark\ntoProp, compositeMarkPart) {\n const propConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop];\n if (prop === 'view') {\n toProp = 'cell'; // View's default style is \"cell\"\n }\n const style = {\n ...propConfig,\n ...config.style[toProp ?? prop]\n };\n // set config.style if it is not an empty object\n if (!isEmpty(style)) {\n config.style[toProp ?? prop] = style;\n }\n if (!compositeMarkPart) {\n // For composite mark, so don't delete the whole config yet as we have to do multiple redirections.\n delete config[prop];\n }\n}\n//# sourceMappingURL=config.js.map","export function isLayerSpec(spec) {\n return 'layer' in spec;\n}\n//# sourceMappingURL=layer.js.map","import * as log from '../log';\nimport { isConcatSpec, isHConcatSpec, isVConcatSpec } from './concat';\nimport { isFacetSpec } from './facet';\nimport { isLayerSpec } from './layer';\nimport { isRepeatSpec } from './repeat';\nimport { isUnitSpec } from './unit';\nexport class SpecMapper {\n map(spec, params) {\n if (isFacetSpec(spec)) {\n return this.mapFacet(spec, params);\n }\n else if (isRepeatSpec(spec)) {\n return this.mapRepeat(spec, params);\n }\n else if (isHConcatSpec(spec)) {\n return this.mapHConcat(spec, params);\n }\n else if (isVConcatSpec(spec)) {\n return this.mapVConcat(spec, params);\n }\n else if (isConcatSpec(spec)) {\n return this.mapConcat(spec, params);\n }\n else {\n return this.mapLayerOrUnit(spec, params);\n }\n }\n mapLayerOrUnit(spec, params) {\n if (isLayerSpec(spec)) {\n return this.mapLayer(spec, params);\n }\n else if (isUnitSpec(spec)) {\n return this.mapUnit(spec, params);\n }\n throw new Error(log.message.invalidSpec(spec));\n }\n mapLayer(spec, params) {\n return {\n ...spec,\n layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params))\n };\n }\n mapHConcat(spec, params) {\n return {\n ...spec,\n hconcat: spec.hconcat.map(subspec => this.map(subspec, params))\n };\n }\n mapVConcat(spec, params) {\n return {\n ...spec,\n vconcat: spec.vconcat.map(subspec => this.map(subspec, params))\n };\n }\n mapConcat(spec, params) {\n const { concat, ...rest } = spec;\n return {\n ...rest,\n concat: concat.map(subspec => this.map(subspec, params))\n };\n }\n mapFacet(spec, params) {\n return {\n // as any is required here since TS cannot infer that FO may only be FieldName or Field, but not RepeatRef\n ...spec,\n // TODO: remove \"any\" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760\n spec: this.map(spec.spec, params)\n };\n }\n mapRepeat(spec, params) {\n return {\n ...spec,\n // as any is required here since TS cannot infer that the output type satisfies the input type\n spec: this.map(spec.spec, params)\n };\n }\n}\n//# sourceMappingURL=map.js.map","import { isArray } from 'vega-util';\nexport function isRepeatSpec(spec) {\n return 'repeat' in spec;\n}\nexport function isLayerRepeatSpec(spec) {\n return !isArray(spec.repeat) && spec.repeat['layer'];\n}\n//# sourceMappingURL=repeat.js.map","import { array, isBoolean } from 'vega-util';\nimport { SUM_OPS } from './aggregate';\nimport { getSecondaryRangeChannel, NONPOSITION_CHANNELS } from './channel';\nimport { channelDefType, getFieldDef, isFieldDef, isFieldOrDatumDef, vgField } from './channeldef';\nimport { channelHasField, isAggregate } from './encoding';\nimport * as log from './log';\nimport { ARC, AREA, BAR, CIRCLE, isMarkDef, isPathMark, LINE, POINT, RULE, SQUARE, TEXT, TICK } from './mark';\nimport { ScaleType } from './scale';\nconst STACK_OFFSET_INDEX = {\n zero: 1,\n center: 1,\n normalize: 1\n};\nexport function isStackOffset(s) {\n return s in STACK_OFFSET_INDEX;\n}\nexport const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]);\nexport const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]);\nfunction isUnbinnedQuantitative(channelDef) {\n return isFieldDef(channelDef) && channelDefType(channelDef) === 'quantitative' && !channelDef.bin;\n}\nfunction potentialStackedChannel(encoding, x, { orient, type: mark }) {\n const y = x === 'x' ? 'y' : 'radius';\n const isCartesianBarOrArea = x === 'x' && ['bar', 'area'].includes(mark);\n const xDef = encoding[x];\n const yDef = encoding[y];\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n if (isUnbinnedQuantitative(xDef) && isUnbinnedQuantitative(yDef)) {\n if (xDef.stack) {\n return x;\n }\n else if (yDef.stack) {\n return y;\n }\n const xAggregate = isFieldDef(xDef) && !!xDef.aggregate;\n const yAggregate = isFieldDef(yDef) && !!yDef.aggregate;\n // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y\n if (xAggregate !== yAggregate) {\n return xAggregate ? x : y;\n }\n if (isCartesianBarOrArea) {\n if (orient === 'vertical') {\n return y;\n }\n else if (orient === 'horizontal') {\n return x;\n }\n }\n }\n else if (isUnbinnedQuantitative(xDef)) {\n return x;\n }\n else if (isUnbinnedQuantitative(yDef)) {\n return y;\n }\n }\n else if (isUnbinnedQuantitative(xDef)) {\n if (isCartesianBarOrArea && orient === 'vertical') {\n return undefined;\n }\n return x;\n }\n else if (isUnbinnedQuantitative(yDef)) {\n if (isCartesianBarOrArea && orient === 'horizontal') {\n return undefined;\n }\n return y;\n }\n return undefined;\n}\nfunction getDimensionChannel(channel) {\n switch (channel) {\n case 'x':\n return 'y';\n case 'y':\n return 'x';\n case 'theta':\n return 'radius';\n case 'radius':\n return 'theta';\n }\n}\nexport function stack(m, encoding) {\n const markDef = isMarkDef(m) ? m : { type: m };\n const mark = markDef.type;\n // Should have stackable mark\n if (!STACKABLE_MARKS.has(mark)) {\n return null;\n }\n // Run potential stacked twice, one for Cartesian and another for Polar,\n // so text marks can be stacked in any of the coordinates.\n // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking.\n // However, since we probably never want to do that, let's just note the limitation here.\n const fieldChannel = potentialStackedChannel(encoding, 'x', markDef) || potentialStackedChannel(encoding, 'theta', markDef);\n if (!fieldChannel) {\n return null;\n }\n const stackedFieldDef = encoding[fieldChannel];\n const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined;\n const dimensionChannel = getDimensionChannel(fieldChannel);\n const groupbyChannels = [];\n const groupbyFields = new Set();\n if (encoding[dimensionChannel]) {\n const dimensionDef = encoding[dimensionChannel];\n const dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined;\n if (dimensionField && dimensionField !== stackedField) {\n // avoid grouping by the stacked field\n groupbyChannels.push(dimensionChannel);\n groupbyFields.add(dimensionField);\n }\n }\n const dimensionOffsetChannel = dimensionChannel === 'x' ? 'xOffset' : 'yOffset';\n const dimensionOffsetDef = encoding[dimensionOffsetChannel];\n const dimensionOffsetField = isFieldDef(dimensionOffsetDef) ? vgField(dimensionOffsetDef, {}) : undefined;\n if (dimensionOffsetField && dimensionOffsetField !== stackedField) {\n // avoid grouping by the stacked field\n groupbyChannels.push(dimensionOffsetChannel);\n groupbyFields.add(dimensionOffsetField);\n }\n // If the dimension has offset, don't stack anymore\n // Should have grouping level of detail that is different from the dimension field\n const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => {\n // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001)\n if (channel !== 'tooltip' && channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n for (const cDef of array(channelDef)) {\n const fieldDef = getFieldDef(cDef);\n if (fieldDef.aggregate) {\n continue;\n }\n // Check whether the channel's field is identical to x/y's field or if the channel is a repeat\n const f = vgField(fieldDef, {});\n if (\n // if fielddef is a repeat, just include it in the stack by\n !f ||\n // otherwise, the field must be different from the groupBy fields.\n !groupbyFields.has(f)) {\n sc.push({ channel, fieldDef });\n }\n }\n }\n return sc;\n }, []);\n // Automatically determine offset\n let offset;\n if (stackedFieldDef.stack !== undefined) {\n if (isBoolean(stackedFieldDef.stack)) {\n offset = stackedFieldDef.stack ? 'zero' : null;\n }\n else {\n offset = stackedFieldDef.stack;\n }\n }\n else if (STACK_BY_DEFAULT_MARKS.has(mark)) {\n offset = 'zero';\n }\n if (!offset || !isStackOffset(offset)) {\n return null;\n }\n if (isAggregate(encoding) && stackBy.length === 0) {\n return null;\n }\n // warn when stacking non-linear\n if (stackedFieldDef?.scale?.type && stackedFieldDef?.scale?.type !== ScaleType.LINEAR) {\n if (stackedFieldDef?.stack) {\n log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type));\n }\n return null;\n }\n // Check if it is a ranged mark\n if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) {\n if (stackedFieldDef.stack !== undefined) {\n log.warn(log.message.cannotStackRangedMark(fieldChannel));\n }\n return null;\n }\n // Warn if stacking non-summative aggregate\n if (isFieldDef(stackedFieldDef) &&\n stackedFieldDef.aggregate &&\n !SUM_OPS.has(stackedFieldDef.aggregate)) {\n log.warn(log.message.stackNonSummativeAggregate(stackedFieldDef.aggregate));\n }\n return {\n groupbyChannels,\n groupbyFields,\n fieldChannel,\n impute: stackedFieldDef.impute === null ? false : isPathMark(mark),\n stackBy,\n offset\n };\n}\n//# sourceMappingURL=stack.js.map","import { isBinned, isBinning } from '../../bin';\nimport { isFieldDef, isNumericDataDef, isUnbinnedQuantitativeFieldOrDatumDef, isTypedFieldDef } from '../../channeldef';\nimport { isAggregate } from '../../encoding';\nimport { replaceExprRef } from '../../expr';\nimport * as log from '../../log';\nimport { AREA, BAR, BAR_CORNER_RADIUS_INDEX as BAR_CORNER_RADIUS_END_INDEX, CIRCLE, IMAGE, LINE, POINT, RECT, RULE, SQUARE, TEXT, TICK } from '../../mark';\nimport { QUANTITATIVE, TEMPORAL } from '../../type';\nimport { contains, getFirstDefined } from '../../util';\nimport { getMarkConfig, getMarkPropOrConfig } from '../common';\nexport function initMarkdef(originalMarkDef, encoding, config) {\n // FIXME: markDef expects that exprRefs are replaced recursively but replaceExprRef only replaces the top level\n const markDef = replaceExprRef(originalMarkDef);\n // set orient, which can be overridden by rules as sometimes the specified orient is invalid.\n const specifiedOrient = getMarkPropOrConfig('orient', markDef, config);\n markDef.orient = orient(markDef.type, encoding, specifiedOrient);\n if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) {\n log.warn(log.message.orientOverridden(markDef.orient, specifiedOrient));\n }\n if (markDef.type === 'bar' && markDef.orient) {\n const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config);\n if (cornerRadiusEnd !== undefined) {\n const newProps = (markDef.orient === 'horizontal' && encoding.x2) || (markDef.orient === 'vertical' && encoding.y2)\n ? ['cornerRadius']\n : BAR_CORNER_RADIUS_END_INDEX[markDef.orient];\n for (const newProp of newProps) {\n markDef[newProp] = cornerRadiusEnd;\n }\n if (markDef.cornerRadiusEnd !== undefined) {\n delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius\n }\n }\n }\n // set opacity and filled if not specified in mark config\n const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config);\n if (specifiedOpacity === undefined) {\n markDef.opacity = opacity(markDef.type, encoding);\n }\n // set cursor, which should be pointer if href channel is present unless otherwise specified\n const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config);\n if (specifiedCursor === undefined) {\n markDef.cursor = cursor(markDef, encoding, config);\n }\n return markDef;\n}\nfunction cursor(markDef, encoding, config) {\n if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) {\n return 'pointer';\n }\n return markDef.cursor;\n}\nfunction opacity(mark, encoding) {\n if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) {\n // point-based marks\n if (!isAggregate(encoding)) {\n return 0.7;\n }\n }\n return undefined;\n}\nexport function defaultFilled(markDef, config, { graticule }) {\n if (graticule) {\n return false;\n }\n const filledConfig = getMarkConfig('filled', markDef, config);\n const mark = markDef.type;\n return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE);\n}\nfunction orient(mark, encoding, specifiedOrient) {\n switch (mark) {\n case POINT:\n case CIRCLE:\n case SQUARE:\n case TEXT:\n case RECT:\n case IMAGE:\n // orient is meaningless for these marks.\n return undefined;\n }\n const { x, y, x2, y2 } = encoding;\n switch (mark) {\n case BAR:\n if (isFieldDef(x) && (isBinned(x.bin) || (isFieldDef(y) && y.aggregate && !x.aggregate))) {\n return 'vertical';\n }\n if (isFieldDef(y) && (isBinned(y.bin) || (isFieldDef(x) && x.aggregate && !y.aggregate))) {\n return 'horizontal';\n }\n if (y2 || x2) {\n // Ranged bar does not always have clear orientation, so we allow overriding\n if (specifiedOrient) {\n return specifiedOrient;\n }\n // If y is range and x is non-range, non-bin Q\n if (!x2) {\n if ((isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) || isNumericDataDef(x)) {\n if (isFieldDef(y) && isBinned(y.bin)) {\n return 'horizontal';\n }\n }\n return 'vertical';\n }\n // If x is range and y is non-range, non-bin Q\n if (!y2) {\n if ((isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) || isNumericDataDef(y)) {\n if (isFieldDef(x) && isBinned(x.bin)) {\n return 'vertical';\n }\n }\n return 'horizontal';\n }\n }\n // falls through\n case RULE:\n // return undefined for line segment rule and bar with both axis ranged\n // we have to ignore the case that the data are already binned\n if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) {\n return undefined;\n }\n // falls through\n case AREA:\n // If there are range for both x and y, y (vertical) has higher precedence.\n if (y2) {\n if (isFieldDef(y) && isBinned(y.bin)) {\n return 'horizontal';\n }\n else {\n return 'vertical';\n }\n }\n else if (x2) {\n if (isFieldDef(x) && isBinned(x.bin)) {\n return 'vertical';\n }\n else {\n return 'horizontal';\n }\n }\n else if (mark === RULE) {\n if (x && !y) {\n return 'vertical';\n }\n else if (y && !x) {\n return 'horizontal';\n }\n }\n // falls through\n case LINE:\n case TICK: {\n const xIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(x);\n const yIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(y);\n if (specifiedOrient) {\n return specifiedOrient;\n }\n else if (xIsMeasure && !yIsMeasure) {\n // Tick is opposite to bar, line, area\n return mark !== 'tick' ? 'horizontal' : 'vertical';\n }\n else if (!xIsMeasure && yIsMeasure) {\n // Tick is opposite to bar, line, area\n return mark !== 'tick' ? 'vertical' : 'horizontal';\n }\n else if (xIsMeasure && yIsMeasure) {\n return 'vertical';\n }\n else {\n const xIsTemporal = isTypedFieldDef(x) && x.type === TEMPORAL;\n const yIsTemporal = isTypedFieldDef(y) && y.type === TEMPORAL;\n // x: T, y: N --> vertical tick\n if (xIsTemporal && !yIsTemporal) {\n return 'vertical';\n }\n else if (!xIsTemporal && yIsTemporal) {\n return 'horizontal';\n }\n }\n return undefined;\n }\n }\n return 'vertical';\n}\n//# sourceMappingURL=init.js.map","import { isObject } from 'vega-util';\nimport { normalizeEncoding } from '../encoding';\nimport { isMarkDef } from '../mark';\nimport { isUnitSpec } from '../spec/unit';\nimport { stack } from '../stack';\nimport { keys, omit, pick } from '../util';\nimport { initMarkdef } from '../compile/mark/init';\nfunction dropLineAndPoint(markDef) {\n const { point: _point, line: _line, ...mark } = markDef;\n return keys(mark).length > 1 ? mark : mark.type;\n}\nfunction dropLineAndPointFromConfig(config) {\n for (const mark of ['line', 'area', 'rule', 'trail']) {\n if (config[mark]) {\n config = {\n ...config,\n // TODO: remove as any\n [mark]: omit(config[mark], ['point', 'line'])\n };\n }\n }\n return config;\n}\nfunction getPointOverlay(markDef, markConfig = {}, encoding) {\n if (markDef.point === 'transparent') {\n return { opacity: 0 };\n }\n else if (markDef.point) {\n // truthy : true or object\n return isObject(markDef.point) ? markDef.point : {};\n }\n else if (markDef.point !== undefined) {\n // false or null\n return null;\n }\n else {\n // undefined (not disabled)\n if (markConfig.point || encoding.shape) {\n // enable point overlay if config[mark].point is truthy or if encoding.shape is provided\n return isObject(markConfig.point) ? markConfig.point : {};\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\nfunction getLineOverlay(markDef, markConfig = {}) {\n if (markDef.line) {\n // true or object\n return markDef.line === true ? {} : markDef.line;\n }\n else if (markDef.line !== undefined) {\n // false or null\n return null;\n }\n else {\n // undefined (not disabled)\n if (markConfig.line) {\n // enable line overlay if config[mark].line is truthy\n return markConfig.line === true ? {} : markConfig.line;\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\nexport class PathOverlayNormalizer {\n constructor() {\n this.name = 'path-overlay';\n }\n hasMatchingType(spec, config) {\n if (isUnitSpec(spec)) {\n const { mark, encoding } = spec;\n const markDef = isMarkDef(mark) ? mark : { type: mark };\n switch (markDef.type) {\n case 'line':\n case 'rule':\n case 'trail':\n return !!getPointOverlay(markDef, config[markDef.type], encoding);\n case 'area':\n return (\n // false / null are also included as we want to remove the properties\n !!getPointOverlay(markDef, config[markDef.type], encoding) ||\n !!getLineOverlay(markDef, config[markDef.type]));\n }\n }\n return false;\n }\n run(spec, normParams, normalize) {\n const { config } = normParams;\n const { params, projection, mark, name, encoding: e, ...outerSpec } = spec;\n // Need to call normalizeEncoding because we need the inferred types to correctly determine stack\n const encoding = normalizeEncoding(e, config);\n const markDef = isMarkDef(mark) ? mark : { type: mark };\n const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding);\n const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]);\n const layer = [\n {\n name,\n ...(params ? { params } : {}),\n mark: dropLineAndPoint({\n // TODO: extract this 0.7 to be shared with default opacity for point/tick/...\n ...(markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined\n ? { opacity: 0.7 }\n : {}),\n ...markDef\n }),\n // drop shape from encoding as this might be used to trigger point overlay\n encoding: omit(encoding, ['shape'])\n }\n ];\n // FIXME: determine rules for applying selections.\n // Need to copy stack config to overlayed layer\n // FIXME: normalizer shouldn't call `initMarkdef`, a method from an init phase.\n const stackProps = stack(initMarkdef(markDef, encoding, config), encoding);\n let overlayEncoding = encoding;\n if (stackProps) {\n const { fieldChannel: stackFieldChannel, offset } = stackProps;\n overlayEncoding = {\n ...encoding,\n [stackFieldChannel]: {\n ...encoding[stackFieldChannel],\n ...(offset ? { stack: offset } : {})\n }\n };\n }\n // overlay line layer should be on the edge of area but passing y2/x2 makes\n // it as \"rule\" mark so that it draws unwanted vertical/horizontal lines.\n // point overlay also should not have y2/x2 as it does not support.\n overlayEncoding = omit(overlayEncoding, ['y2', 'x2']);\n if (lineOverlay) {\n layer.push({\n ...(projection ? { projection } : {}),\n mark: {\n type: 'line',\n ...pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip']),\n ...lineOverlay\n },\n encoding: overlayEncoding\n });\n }\n if (pointOverlay) {\n layer.push({\n ...(projection ? { projection } : {}),\n mark: {\n type: 'point',\n opacity: 1,\n filled: true,\n ...pick(markDef, ['clip', 'tooltip']),\n ...pointOverlay\n },\n encoding: overlayEncoding\n });\n }\n return normalize({\n ...outerSpec,\n layer\n }, {\n ...normParams,\n config: dropLineAndPointFromConfig(config)\n });\n }\n}\n//# sourceMappingURL=pathoverlay.js.map","import { hasOwnProperty, isArray } from 'vega-util';\nimport { hasConditionalFieldOrDatumDef, isConditionalDef, isFieldDef, isFieldOrDatumDef, isRepeatRef, isSortableFieldDef } from '../channeldef';\nimport * as log from '../log';\nimport { isSortField } from '../sort';\nimport { isFacetMapping } from '../spec/facet';\nexport function replaceRepeaterInFacet(facet, repeater) {\n if (!repeater) {\n return facet;\n }\n if (isFacetMapping(facet)) {\n return replaceRepeaterInMapping(facet, repeater);\n }\n return replaceRepeaterInFieldDef(facet, repeater);\n}\nexport function replaceRepeaterInEncoding(encoding, repeater) {\n if (!repeater) {\n return encoding;\n }\n return replaceRepeaterInMapping(encoding, repeater);\n}\n/**\n * Replaces repeated value and returns if the repeated value is valid.\n */\nfunction replaceRepeatInProp(prop, o, repeater) {\n const val = o[prop];\n if (isRepeatRef(val)) {\n if (val.repeat in repeater) {\n return { ...o, [prop]: repeater[val.repeat] };\n }\n else {\n log.warn(log.message.noSuchRepeatedValue(val.repeat));\n return undefined;\n }\n }\n return o;\n}\n/**\n * Replace repeater values in a field def with the concrete field name.\n */\nfunction replaceRepeaterInFieldDef(fieldDef, repeater) {\n fieldDef = replaceRepeatInProp('field', fieldDef, repeater);\n if (fieldDef === undefined) {\n // the field def should be ignored\n return undefined;\n }\n else if (fieldDef === null) {\n return null;\n }\n if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) {\n const sort = replaceRepeatInProp('field', fieldDef.sort, repeater);\n fieldDef = {\n ...fieldDef,\n ...(sort ? { sort } : {})\n };\n }\n return fieldDef;\n}\nfunction replaceRepeaterInFieldOrDatumDef(def, repeater) {\n if (isFieldDef(def)) {\n return replaceRepeaterInFieldDef(def, repeater);\n }\n else {\n const datumDef = replaceRepeatInProp('datum', def, repeater);\n if (datumDef !== def && !datumDef.type) {\n datumDef.type = 'nominal';\n }\n return datumDef;\n }\n}\nfunction replaceRepeaterInChannelDef(channelDef, repeater) {\n if (isFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater);\n if (fd) {\n return fd;\n }\n else if (isConditionalDef(channelDef)) {\n return { condition: channelDef.condition };\n }\n }\n else {\n if (hasConditionalFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater);\n if (fd) {\n return {\n ...channelDef,\n condition: fd\n };\n }\n else {\n const { condition, ...channelDefWithoutCondition } = channelDef;\n return channelDefWithoutCondition;\n }\n }\n return channelDef;\n }\n return undefined;\n}\nfunction replaceRepeaterInMapping(mapping, repeater) {\n const out = {};\n for (const channel in mapping) {\n if (hasOwnProperty(mapping, channel)) {\n const channelDef = mapping[channel];\n if (isArray(channelDef)) {\n // array cannot have condition\n out[channel] = channelDef // somehow we need to cast it here\n .map(cd => replaceRepeaterInChannelDef(cd, repeater))\n .filter(cd => cd);\n }\n else {\n const cd = replaceRepeaterInChannelDef(channelDef, repeater);\n if (cd !== undefined) {\n out[channel] = cd;\n }\n }\n }\n }\n return out;\n}\n//# sourceMappingURL=repeater.js.map","import { isObject } from 'vega-util';\nimport { isBinned } from '../bin';\nimport { getMainRangeChannel, SECONDARY_RANGE_CHANNEL } from '../channel';\nimport { isDatumDef, isFieldDef } from '../channeldef';\nimport * as log from '../log';\nimport { isMarkDef } from '../mark';\nimport { isUnitSpec } from '../spec/unit';\nexport class RuleForRangedLineNormalizer {\n constructor() {\n this.name = 'RuleForRangedLine';\n }\n hasMatchingType(spec) {\n if (isUnitSpec(spec)) {\n const { encoding, mark } = spec;\n if (mark === 'line' || (isMarkDef(mark) && mark.type === 'line')) {\n for (const channel of SECONDARY_RANGE_CHANNEL) {\n const mainChannel = getMainRangeChannel(channel);\n const mainChannelDef = encoding[mainChannel];\n if (encoding[channel]) {\n if ((isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) || isDatumDef(mainChannelDef)) {\n return true;\n }\n }\n }\n }\n }\n return false;\n }\n run(spec, params, normalize) {\n const { encoding, mark } = spec;\n log.warn(log.message.lineWithRange(!!encoding.x2, !!encoding.y2));\n return normalize({\n ...spec,\n mark: isObject(mark) ? { ...mark, type: 'rule' } : 'rule'\n }, params);\n }\n}\n//# sourceMappingURL=ruleforrangedline.js.map","import { isArray } from 'vega-util';\nimport { COLUMN, FACET, ROW } from '../channel';\nimport { hasConditionalFieldOrDatumDef, isFieldOrDatumDef, isValueDef } from '../channeldef';\nimport { boxPlotNormalizer } from '../compositemark/boxplot';\nimport { errorBandNormalizer } from '../compositemark/errorband';\nimport { errorBarNormalizer } from '../compositemark/errorbar';\nimport { channelHasField } from '../encoding';\nimport * as log from '../log';\nimport { isFacetMapping } from '../spec/facet';\nimport { SpecMapper } from '../spec/map';\nimport { isLayerRepeatSpec } from '../spec/repeat';\nimport { isUnitSpec } from '../spec/unit';\nimport { isEmpty, keys, omit, varName } from '../util';\nimport { isSignalRef } from '../vega.schema';\nimport { PathOverlayNormalizer } from './pathoverlay';\nimport { replaceRepeaterInEncoding, replaceRepeaterInFacet } from './repeater';\nimport { RuleForRangedLineNormalizer } from './ruleforrangedline';\nexport class CoreNormalizer extends SpecMapper {\n constructor() {\n super(...arguments);\n this.nonFacetUnitNormalizers = [\n boxPlotNormalizer,\n errorBarNormalizer,\n errorBandNormalizer,\n new PathOverlayNormalizer(),\n new RuleForRangedLineNormalizer()\n ];\n }\n map(spec, params) {\n // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec.\n if (isUnitSpec(spec)) {\n const hasRow = channelHasField(spec.encoding, ROW);\n const hasColumn = channelHasField(spec.encoding, COLUMN);\n const hasFacet = channelHasField(spec.encoding, FACET);\n if (hasRow || hasColumn || hasFacet) {\n return this.mapFacetedUnit(spec, params);\n }\n }\n return super.map(spec, params);\n }\n // This is for normalizing non-facet unit\n mapUnit(spec, params) {\n const { parentEncoding, parentProjection } = params;\n const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater);\n const specWithReplacedEncoding = {\n ...spec,\n ...(spec.name ? { name: [params.repeaterPrefix, spec.name].filter(n => n).join('_') } : {}),\n ...(encoding ? { encoding } : {})\n };\n if (parentEncoding || parentProjection) {\n return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params);\n }\n const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this);\n for (const unitNormalizer of this.nonFacetUnitNormalizers) {\n if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) {\n return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit);\n }\n }\n return specWithReplacedEncoding;\n }\n mapRepeat(spec, params) {\n if (isLayerRepeatSpec(spec)) {\n return this.mapLayerRepeat(spec, params);\n }\n else {\n return this.mapNonLayerRepeat(spec, params);\n }\n }\n mapLayerRepeat(spec, params) {\n const { repeat, spec: childSpec, ...rest } = spec;\n const { row, column, layer } = repeat;\n const { repeater = {}, repeaterPrefix = '' } = params;\n if (row || column) {\n return this.mapRepeat({\n ...spec,\n repeat: {\n ...(row ? { row } : {}),\n ...(column ? { column } : {})\n },\n spec: {\n repeat: { layer },\n spec: childSpec\n }\n }, params);\n }\n else {\n return {\n ...rest,\n layer: layer.map(layerValue => {\n const childRepeater = {\n ...repeater,\n layer: layerValue\n };\n const childName = `${(childSpec.name ? `${childSpec.name}_` : '') + repeaterPrefix}child__layer_${varName(layerValue)}`;\n const child = this.mapLayerOrUnit(childSpec, { ...params, repeater: childRepeater, repeaterPrefix: childName });\n child.name = childName;\n return child;\n })\n };\n }\n }\n mapNonLayerRepeat(spec, params) {\n const { repeat, spec: childSpec, data, ...remainingProperties } = spec;\n if (!isArray(repeat) && spec.columns) {\n // is repeat with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('repeat'));\n }\n const concat = [];\n const { repeater = {}, repeaterPrefix = '' } = params;\n const row = (!isArray(repeat) && repeat.row) || [repeater ? repeater.row : null];\n const column = (!isArray(repeat) && repeat.column) || [repeater ? repeater.column : null];\n const repeatValues = (isArray(repeat) && repeat) || [repeater ? repeater.repeat : null];\n // cross product\n for (const repeatValue of repeatValues) {\n for (const rowValue of row) {\n for (const columnValue of column) {\n const childRepeater = {\n repeat: repeatValue,\n row: rowValue,\n column: columnValue,\n layer: repeater.layer\n };\n const childName = (childSpec.name ? `${childSpec.name}_` : '') +\n repeaterPrefix +\n 'child__' +\n (isArray(repeat)\n ? `${varName(repeatValue)}`\n : (repeat.row ? `row_${varName(rowValue)}` : '') +\n (repeat.column ? `column_${varName(columnValue)}` : ''));\n const child = this.map(childSpec, { ...params, repeater: childRepeater, repeaterPrefix: childName });\n child.name = childName;\n // we move data up\n concat.push(omit(child, ['data']));\n }\n }\n }\n const columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1;\n return {\n data: childSpec.data ?? data,\n align: 'all',\n ...remainingProperties,\n columns,\n concat\n };\n }\n mapFacet(spec, params) {\n const { facet } = spec;\n if (isFacetMapping(facet) && spec.columns) {\n // is facet with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('facet'));\n }\n return super.mapFacet(spec, params);\n }\n mapUnitWithParentEncodingOrProjection(spec, params) {\n const { encoding, projection } = spec;\n const { parentEncoding, parentProjection, config } = params;\n const mergedProjection = mergeProjection({ parentProjection, projection });\n const mergedEncoding = mergeEncoding({\n parentEncoding,\n encoding: replaceRepeaterInEncoding(encoding, params.repeater)\n });\n return this.mapUnit({\n ...spec,\n ...(mergedProjection ? { projection: mergedProjection } : {}),\n ...(mergedEncoding ? { encoding: mergedEncoding } : {})\n }, { config });\n }\n mapFacetedUnit(spec, normParams) {\n // New encoding in the inside spec should not contain row / column\n // as row/column should be moved to facet\n const { row, column, facet, ...encoding } = spec.encoding;\n // Mark and encoding should be moved into the inner spec\n const { mark, width, projection, height, view, params, encoding: _, ...outerSpec } = spec;\n const { facetMapping, layout } = this.getFacetMappingAndLayout({ row, column, facet }, normParams);\n const newEncoding = replaceRepeaterInEncoding(encoding, normParams.repeater);\n return this.mapFacet({\n ...outerSpec,\n ...layout,\n // row / column has higher precedence than facet\n facet: facetMapping,\n spec: {\n ...(width ? { width } : {}),\n ...(height ? { height } : {}),\n ...(view ? { view } : {}),\n ...(projection ? { projection } : {}),\n mark,\n encoding: newEncoding,\n ...(params ? { params } : {})\n }\n }, normParams);\n }\n getFacetMappingAndLayout(facets, params) {\n const { row, column, facet } = facets;\n if (row || column) {\n if (facet) {\n log.warn(log.message.facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])]));\n }\n const facetMapping = {};\n const layout = {};\n for (const channel of [ROW, COLUMN]) {\n const def = facets[channel];\n if (def) {\n const { align, center, spacing, columns, ...defWithoutLayout } = def;\n facetMapping[channel] = defWithoutLayout;\n for (const prop of ['align', 'center', 'spacing']) {\n if (def[prop] !== undefined) {\n layout[prop] ?? (layout[prop] = {});\n layout[prop][channel] = def[prop];\n }\n }\n }\n }\n return { facetMapping, layout };\n }\n else {\n const { align, center, spacing, columns, ...facetMapping } = facet;\n return {\n facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater),\n layout: {\n ...(align ? { align } : {}),\n ...(center ? { center } : {}),\n ...(spacing ? { spacing } : {}),\n ...(columns ? { columns } : {})\n }\n };\n }\n }\n mapLayer(spec, { parentEncoding, parentProjection, ...otherParams }) {\n // Special handling for extended layer spec\n const { encoding, projection, ...rest } = spec;\n const params = {\n ...otherParams,\n parentEncoding: mergeEncoding({ parentEncoding, encoding, layer: true }),\n parentProjection: mergeProjection({ parentProjection, projection })\n };\n return super.mapLayer({\n ...rest,\n ...(spec.name ? { name: [params.repeaterPrefix, spec.name].filter(n => n).join('_') } : {})\n }, params);\n }\n}\nfunction mergeEncoding({ parentEncoding, encoding = {}, layer }) {\n let merged = {};\n if (parentEncoding) {\n const channels = new Set([...keys(parentEncoding), ...keys(encoding)]);\n for (const channel of channels) {\n const channelDef = encoding[channel];\n const parentChannelDef = parentEncoding[channel];\n if (isFieldOrDatumDef(channelDef)) {\n // Field/Datum Def can inherit properties from its parent\n // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one.\n const mergedChannelDef = {\n ...parentChannelDef,\n ...channelDef\n };\n merged[channel] = mergedChannelDef;\n }\n else if (hasConditionalFieldOrDatumDef(channelDef)) {\n merged[channel] = {\n ...channelDef,\n condition: {\n ...parentChannelDef,\n ...channelDef.condition\n }\n };\n }\n else if (channelDef || channelDef === null) {\n merged[channel] = channelDef;\n }\n else if (layer ||\n isValueDef(parentChannelDef) ||\n isSignalRef(parentChannelDef) ||\n isFieldOrDatumDef(parentChannelDef) ||\n isArray(parentChannelDef)) {\n merged[channel] = parentChannelDef;\n }\n }\n }\n else {\n merged = encoding;\n }\n return !merged || isEmpty(merged) ? undefined : merged;\n}\nfunction mergeProjection(opt) {\n const { parentProjection, projection } = opt;\n if (parentProjection && projection) {\n log.warn(log.message.projectionOverridden({ parentProjection, projection }));\n }\n return projection ?? parentProjection;\n}\n//# sourceMappingURL=core.js.map","import { normalizeLogicalComposition } from './logical';\nimport { normalizePredicate } from './predicate';\nexport function isFilter(t) {\n return 'filter' in t;\n}\nexport function isImputeSequence(t) {\n return t?.['stop'] !== undefined;\n}\nexport function isLookup(t) {\n return 'lookup' in t;\n}\nexport function isLookupData(from) {\n return 'data' in from;\n}\nexport function isLookupSelection(from) {\n return 'param' in from;\n}\nexport function isPivot(t) {\n return 'pivot' in t;\n}\nexport function isDensity(t) {\n return 'density' in t;\n}\nexport function isQuantile(t) {\n return 'quantile' in t;\n}\nexport function isRegression(t) {\n return 'regression' in t;\n}\nexport function isLoess(t) {\n return 'loess' in t;\n}\nexport function isSample(t) {\n return 'sample' in t;\n}\nexport function isWindow(t) {\n return 'window' in t;\n}\nexport function isJoinAggregate(t) {\n return 'joinaggregate' in t;\n}\nexport function isFlatten(t) {\n return 'flatten' in t;\n}\nexport function isCalculate(t) {\n return 'calculate' in t;\n}\nexport function isBin(t) {\n return 'bin' in t;\n}\nexport function isImpute(t) {\n return 'impute' in t;\n}\nexport function isTimeUnit(t) {\n return 'timeUnit' in t;\n}\nexport function isAggregate(t) {\n return 'aggregate' in t;\n}\nexport function isStack(t) {\n return 'stack' in t;\n}\nexport function isFold(t) {\n return 'fold' in t;\n}\nexport function isExtent(t) {\n return 'extent' in t && !('density' in t);\n}\nexport function normalizeTransform(transform) {\n return transform.map(t => {\n if (isFilter(t)) {\n return {\n filter: normalizeLogicalComposition(t.filter, normalizePredicate)\n };\n }\n return t;\n });\n}\n//# sourceMappingURL=transform.js.map","import { isArray } from 'vega';\nimport { isBinParams } from '../bin';\nimport { isConditionalDef, isFieldDef, isScaleFieldDef } from '../channeldef';\nimport { normalizeLogicalComposition } from '../logical';\nimport { SpecMapper } from '../spec/map';\nimport { isBin, isFilter, isLookup } from '../transform';\nimport { duplicate, entries, vals } from '../util';\nexport class SelectionCompatibilityNormalizer extends SpecMapper {\n map(spec, normParams) {\n normParams.emptySelections ?? (normParams.emptySelections = {});\n normParams.selectionPredicates ?? (normParams.selectionPredicates = {});\n spec = normalizeTransforms(spec, normParams);\n return super.map(spec, normParams);\n }\n mapLayerOrUnit(spec, normParams) {\n spec = normalizeTransforms(spec, normParams);\n if (spec.encoding) {\n const encoding = {};\n for (const [channel, enc] of entries(spec.encoding)) {\n encoding[channel] = normalizeChannelDef(enc, normParams);\n }\n spec = { ...spec, encoding };\n }\n return super.mapLayerOrUnit(spec, normParams);\n }\n mapUnit(spec, normParams) {\n const { selection, ...rest } = spec;\n if (selection) {\n return {\n ...rest,\n params: entries(selection).map(([name, selDef]) => {\n const { init: value, bind, empty, ...select } = selDef;\n if (select.type === 'single') {\n select.type = 'point';\n select.toggle = false;\n }\n else if (select.type === 'multi') {\n select.type = 'point';\n }\n // Propagate emptiness forwards and backwards\n normParams.emptySelections[name] = empty !== 'none';\n for (const pred of vals(normParams.selectionPredicates[name] ?? {})) {\n pred.empty = empty !== 'none';\n }\n return { name, value, select, bind };\n })\n };\n }\n return spec;\n }\n}\nfunction normalizeTransforms(spec, normParams) {\n const { transform: tx, ...rest } = spec;\n if (tx) {\n const transform = tx.map((t) => {\n if (isFilter(t)) {\n return { filter: normalizePredicate(t, normParams) };\n }\n else if (isBin(t) && isBinParams(t.bin)) {\n return {\n ...t,\n bin: normalizeBinExtent(t.bin)\n };\n }\n else if (isLookup(t)) {\n const { selection: param, ...from } = t.from;\n return param\n ? {\n ...t,\n from: { param, ...from }\n }\n : t;\n }\n return t;\n });\n return { ...rest, transform };\n }\n return spec;\n}\nfunction normalizeChannelDef(obj, normParams) {\n const enc = duplicate(obj);\n if (isFieldDef(enc) && isBinParams(enc.bin)) {\n enc.bin = normalizeBinExtent(enc.bin);\n }\n if (isScaleFieldDef(enc) && enc.scale?.domain?.selection) {\n const { selection: param, ...domain } = enc.scale.domain;\n enc.scale.domain = { ...domain, ...(param ? { param } : {}) };\n }\n if (isConditionalDef(enc)) {\n if (isArray(enc.condition)) {\n enc.condition = enc.condition.map((c) => {\n const { selection, param, test, ...cond } = c;\n return param ? c : { ...cond, test: normalizePredicate(c, normParams) };\n });\n }\n else {\n const { selection, param, test, ...cond } = normalizeChannelDef(enc.condition, normParams);\n enc.condition = param\n ? enc.condition\n : {\n ...cond,\n test: normalizePredicate(enc.condition, normParams)\n };\n }\n }\n return enc;\n}\nfunction normalizeBinExtent(bin) {\n const ext = bin.extent;\n if (ext?.selection) {\n const { selection: param, ...rest } = ext;\n return { ...bin, extent: { ...rest, param } };\n }\n return bin;\n}\nfunction normalizePredicate(op, normParams) {\n // Normalize old compositions of selection names (e.g., selection: {and: [\"one\", \"two\"]})\n const normalizeSelectionComposition = (o) => {\n return normalizeLogicalComposition(o, param => {\n var _a;\n const empty = normParams.emptySelections[param] ?? true;\n const pred = { param, empty };\n (_a = normParams.selectionPredicates)[param] ?? (_a[param] = []);\n normParams.selectionPredicates[param].push(pred);\n return pred;\n });\n };\n return op.selection\n ? normalizeSelectionComposition(op.selection)\n : normalizeLogicalComposition(op.test || op.filter, o => o.selection ? normalizeSelectionComposition(o.selection) : o);\n}\n//# sourceMappingURL=selectioncompat.js.map","import { isArray, isString } from 'vega';\nimport { isSelectionParameter } from '../selection';\nimport { isUnitSpec } from '../spec';\nimport { SpecMapper } from '../spec/map';\nexport class TopLevelSelectionsNormalizer extends SpecMapper {\n map(spec, normParams) {\n const selections = normParams.selections ?? [];\n if (spec.params && !isUnitSpec(spec)) {\n const params = [];\n for (const param of spec.params) {\n if (isSelectionParameter(param)) {\n selections.push(param);\n }\n else {\n params.push(param);\n }\n }\n spec.params = params;\n }\n normParams.selections = selections;\n return super.map(spec, normParams);\n }\n mapUnit(spec, normParams) {\n const selections = normParams.selections;\n if (!selections || !selections.length)\n return spec;\n const path = (normParams.path ?? []).concat(spec.name);\n const params = [];\n for (const selection of selections) {\n // By default, apply selections to all unit views.\n if (!selection.views || !selection.views.length) {\n params.push(selection);\n }\n else {\n for (const view of selection.views) {\n // view is either a specific unit name, or a partial path through the spec tree.\n if ((isString(view) && (view === spec.name || path.includes(view))) ||\n (isArray(view) &&\n // logic for backwards compatibility with view paths before we had unique names\n // @ts-ignore\n view.map(v => path.indexOf(v)).every((v, i, arr) => v !== -1 && (i === 0 || v > arr[i - 1])))) {\n params.push(selection);\n }\n }\n }\n }\n if (params.length)\n spec.params = params;\n return spec;\n }\n}\nfor (const method of ['mapFacet', 'mapRepeat', 'mapHConcat', 'mapVConcat', 'mapLayer']) {\n const proto = TopLevelSelectionsNormalizer.prototype[method];\n TopLevelSelectionsNormalizer.prototype[method] = function (spec, params) {\n return proto.call(this, spec, addSpecNameToParams(spec, params));\n };\n}\nfunction addSpecNameToParams(spec, params) {\n return spec.name\n ? {\n ...params,\n path: (params.path ?? []).concat(spec.name)\n }\n : params;\n}\n//# sourceMappingURL=toplevelselection.js.map","import { isString } from 'vega-util';\nimport { initConfig } from '../config';\nimport * as log from '../log';\nimport { isLayerSpec, isUnitSpec } from '../spec';\nimport { deepEqual } from '../util';\nimport { CoreNormalizer } from './core';\nimport { SelectionCompatibilityNormalizer } from './selectioncompat';\nimport { TopLevelSelectionsNormalizer } from './toplevelselection';\nexport function normalize(spec, config) {\n if (config === undefined) {\n config = initConfig(spec.config);\n }\n const normalizedSpec = normalizeGenericSpec(spec, config);\n const { width, height } = spec;\n const autosize = normalizeAutoSize(normalizedSpec, { width, height, autosize: spec.autosize }, config);\n return {\n ...normalizedSpec,\n ...(autosize ? { autosize } : {})\n };\n}\nconst coreNormalizer = new CoreNormalizer();\nconst selectionCompatNormalizer = new SelectionCompatibilityNormalizer();\nconst topLevelSelectionNormalizer = new TopLevelSelectionsNormalizer();\n/**\n * Decompose extended unit specs into composition of pure unit specs.\n * And push top-level selection definitions down to unit specs.\n */\nfunction normalizeGenericSpec(spec, config = {}) {\n const normParams = { config };\n return topLevelSelectionNormalizer.map(coreNormalizer.map(selectionCompatNormalizer.map(spec, normParams), normParams), normParams);\n}\nfunction _normalizeAutoSize(autosize) {\n return isString(autosize) ? { type: autosize } : autosize ?? {};\n}\n/**\n * Normalize autosize and deal with width or height == \"container\".\n */\nexport function normalizeAutoSize(spec, sizeInfo, config) {\n let { width, height } = sizeInfo;\n const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec);\n const autosizeDefault = {};\n if (!isFitCompatible) {\n // If spec is not compatible with autosize == \"fit\", discard width/height == container\n if (width == 'container') {\n log.warn(log.message.containerSizeNonSingle('width'));\n width = undefined;\n }\n if (height == 'container') {\n log.warn(log.message.containerSizeNonSingle('height'));\n height = undefined;\n }\n }\n else {\n // Default autosize parameters to fit when width/height is \"container\"\n if (width == 'container' && height == 'container') {\n autosizeDefault.type = 'fit';\n autosizeDefault.contains = 'padding';\n }\n else if (width == 'container') {\n autosizeDefault.type = 'fit-x';\n autosizeDefault.contains = 'padding';\n }\n else if (height == 'container') {\n autosizeDefault.type = 'fit-y';\n autosizeDefault.contains = 'padding';\n }\n }\n const autosize = {\n type: 'pad',\n ...autosizeDefault,\n ...(config ? _normalizeAutoSize(config.autosize) : {}),\n ..._normalizeAutoSize(spec.autosize)\n };\n if (autosize.type === 'fit' && !isFitCompatible) {\n log.warn(log.message.FIT_NON_SINGLE);\n autosize.type = 'pad';\n }\n if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('width'));\n }\n if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('height'));\n }\n // Delete autosize property if it's Vega's default\n if (deepEqual(autosize, { type: 'pad' })) {\n return undefined;\n }\n return autosize;\n}\n//# sourceMappingURL=index.js.map","import { getPositionScaleChannel } from '../channel';\nimport { signalRefOrValue } from '../compile/common';\nexport function isFitType(autoSizeType) {\n return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y';\n}\nexport function getFitType(sizeType) {\n return sizeType ? `fit-${getPositionScaleChannel(sizeType)}` : 'fit';\n}\nconst TOP_LEVEL_PROPERTIES = [\n 'background',\n 'padding'\n // We do not include \"autosize\" here as it is supported by only unit and layer specs and thus need to be normalized\n];\nexport function extractTopLevelProperties(t, includeParams) {\n const o = {};\n for (const p of TOP_LEVEL_PROPERTIES) {\n if (t && t[p] !== undefined) {\n o[p] = signalRefOrValue(t[p]);\n }\n }\n if (includeParams) {\n o.params = t.params;\n }\n return o;\n}\n//# sourceMappingURL=toplevel.js.map","import * as log from '../log';\nimport { deepEqual, duplicate, getFirstDefined, keys } from '../util';\n/**\n * Generic class for storing properties that are explicitly specified\n * and implicitly determined by the compiler.\n * This is important for scale/axis/legend merging as\n * we want to prioritize properties that users explicitly specified.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport class Split {\n constructor(explicit = {}, implicit = {}) {\n this.explicit = explicit;\n this.implicit = implicit;\n }\n clone() {\n return new Split(duplicate(this.explicit), duplicate(this.implicit));\n }\n combine() {\n return {\n ...this.explicit,\n ...this.implicit\n };\n }\n get(key) {\n // Explicit has higher precedence\n return getFirstDefined(this.explicit[key], this.implicit[key]);\n }\n getWithExplicit(key) {\n // Explicit has higher precedence\n if (this.explicit[key] !== undefined) {\n return { explicit: true, value: this.explicit[key] };\n }\n else if (this.implicit[key] !== undefined) {\n return { explicit: false, value: this.implicit[key] };\n }\n return { explicit: false, value: undefined };\n }\n setWithExplicit(key, { value, explicit }) {\n if (value !== undefined) {\n this.set(key, value, explicit);\n }\n }\n set(key, value, explicit) {\n delete this[explicit ? 'implicit' : 'explicit'][key];\n this[explicit ? 'explicit' : 'implicit'][key] = value;\n return this;\n }\n copyKeyFromSplit(key, { explicit, implicit }) {\n // Explicit has higher precedence\n if (explicit[key] !== undefined) {\n this.set(key, explicit[key], true);\n }\n else if (implicit[key] !== undefined) {\n this.set(key, implicit[key], false);\n }\n }\n copyKeyFromObject(key, s) {\n // Explicit has higher precedence\n if (s[key] !== undefined) {\n this.set(key, s[key], true);\n }\n }\n /**\n * Merge split object into this split object. Properties from the other split\n * overwrite properties from this split.\n */\n copyAll(other) {\n for (const key of keys(other.combine())) {\n const val = other.getWithExplicit(key);\n this.setWithExplicit(key, val);\n }\n }\n}\nexport function makeExplicit(value) {\n return {\n explicit: true,\n value\n };\n}\nexport function makeImplicit(value) {\n return {\n explicit: false,\n value\n };\n}\nexport function tieBreakByComparing(compare) {\n return (v1, v2, property, propertyOf) => {\n const diff = compare(v1.value, v2.value);\n if (diff > 0) {\n return v1;\n }\n else if (diff < 0) {\n return v2;\n }\n return defaultTieBreaker(v1, v2, property, propertyOf);\n };\n}\nexport function defaultTieBreaker(v1, v2, property, propertyOf) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, prefer v1.\n return v1;\n}\nexport function mergeValuesWithExplicit(v1, v2, property, propertyOf, tieBreaker = defaultTieBreaker) {\n if (v1 === undefined || v1.value === undefined) {\n // For first run\n return v2;\n }\n if (v1.explicit && !v2.explicit) {\n return v1;\n }\n else if (v2.explicit && !v1.explicit) {\n return v2;\n }\n else if (deepEqual(v1.value, v2.value)) {\n return v1;\n }\n else {\n return tieBreaker(v1, v2, property, propertyOf);\n }\n}\n//# sourceMappingURL=split.js.map","import { Split } from '../split';\n/**\n * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf)\n * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the\n * same field again (or differently).\n */\nexport class AncestorParse extends Split {\n constructor(explicit = {}, implicit = {}, parseNothing = false) {\n super(explicit, implicit);\n this.explicit = explicit;\n this.implicit = implicit;\n this.parseNothing = parseNothing;\n }\n clone() {\n const clone = super.clone();\n clone.parseNothing = this.parseNothing;\n return clone;\n }\n}\n//# sourceMappingURL=index.js.map","export function isUrlData(data) {\n return 'url' in data;\n}\nexport function isInlineData(data) {\n return 'values' in data;\n}\nexport function isNamedData(data) {\n return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data);\n}\nexport function isGenerator(data) {\n return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data));\n}\nexport function isSequenceGenerator(data) {\n return 'sequence' in data;\n}\nexport function isSphereGenerator(data) {\n return 'sphere' in data;\n}\nexport function isGraticuleGenerator(data) {\n return 'graticule' in data;\n}\nexport var DataSourceType;\n(function (DataSourceType) {\n DataSourceType[DataSourceType[\"Raw\"] = 0] = \"Raw\";\n DataSourceType[DataSourceType[\"Main\"] = 1] = \"Main\";\n DataSourceType[DataSourceType[\"Row\"] = 2] = \"Row\";\n DataSourceType[DataSourceType[\"Column\"] = 3] = \"Column\";\n DataSourceType[DataSourceType[\"Lookup\"] = 4] = \"Lookup\";\n})(DataSourceType || (DataSourceType = {}));\n//# sourceMappingURL=data.js.map","import { parseSelector } from 'vega-event-selector';\nimport { identity, isArray, stringValue } from 'vega-util';\nimport { MODIFY, STORE, unitName, VL_SELECTION_RESOLVE, TUPLE, selectionCompilers } from '.';\nimport { dateTimeToExpr, isDateTime, dateTimeToTimestamp } from '../../datetime';\nimport { hasContinuousDomain } from '../../scale';\nimport { SELECTION_ID } from '../../selection';\nimport { keys, replacePathInField, stringify, vals } from '../../util';\nimport { isUnitModel } from '../model';\nimport { parseSelectionExtent } from './parse';\nexport function assembleProjection(proj) {\n const { signals, hasLegend, index, ...rest } = proj;\n rest.field = replacePathInField(rest.field);\n return rest;\n}\nexport function assembleInit(init, isExpr = true, wrap = identity) {\n if (isArray(init)) {\n const assembled = init.map(v => assembleInit(v, isExpr, wrap));\n return isExpr ? `[${assembled.join(', ')}]` : assembled;\n }\n else if (isDateTime(init)) {\n if (isExpr) {\n return wrap(dateTimeToExpr(init));\n }\n else {\n return wrap(dateTimeToTimestamp(init));\n }\n }\n return isExpr ? wrap(stringify(init)) : init;\n}\nexport function assembleUnitSelectionSignals(model, signals) {\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const name = selCmpt.name;\n let modifyExpr = `${name}${TUPLE}, ${selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`}`;\n for (const c of selectionCompilers) {\n if (!c.defined(selCmpt))\n continue;\n if (c.signals)\n signals = c.signals(model, selCmpt, signals);\n if (c.modifyExpr)\n modifyExpr = c.modifyExpr(model, selCmpt, modifyExpr);\n }\n signals.push({\n name: name + MODIFY,\n on: [\n {\n events: { signal: selCmpt.name + TUPLE },\n update: `modify(${stringValue(selCmpt.name + STORE)}, ${modifyExpr})`\n }\n ]\n });\n }\n return cleanupEmptyOnArray(signals);\n}\nexport function assembleFacetSignals(model, signals) {\n if (model.component.selection && keys(model.component.selection).length) {\n const name = stringValue(model.getName('cell'));\n signals.unshift({\n name: 'facet',\n value: {},\n on: [\n {\n events: parseSelector('pointermove', 'scope'),\n update: `isTuple(facet) ? facet : group(${name}).datum`\n }\n ]\n });\n }\n return cleanupEmptyOnArray(signals);\n}\nexport function assembleTopLevelSignals(model, signals) {\n let hasSelections = false;\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const name = selCmpt.name;\n const store = stringValue(name + STORE);\n const hasSg = signals.filter(s => s.name === name);\n if (hasSg.length === 0) {\n const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve;\n const isPoint = selCmpt.type === 'point' ? ', true, true)' : ')';\n signals.push({\n name: selCmpt.name,\n update: `${VL_SELECTION_RESOLVE}(${store}, ${stringValue(resolve)}${isPoint}`\n });\n }\n hasSelections = true;\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.topLevelSignals) {\n signals = c.topLevelSignals(model, selCmpt, signals);\n }\n }\n }\n if (hasSelections) {\n const hasUnit = signals.filter(s => s.name === 'unit');\n if (hasUnit.length === 0) {\n signals.unshift({\n name: 'unit',\n value: {},\n on: [{ events: 'pointermove', update: 'isTuple(group()) ? group() : unit' }]\n });\n }\n }\n return cleanupEmptyOnArray(signals);\n}\nexport function assembleUnitSelectionData(model, data) {\n const dataCopy = [...data];\n const unit = unitName(model, { escape: false });\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const store = { name: selCmpt.name + STORE };\n if (selCmpt.project.hasSelectionId) {\n store.transform = [{ type: 'collect', sort: { field: SELECTION_ID } }];\n }\n if (selCmpt.init) {\n const fields = selCmpt.project.items.map(assembleProjection);\n store.values = selCmpt.project.hasSelectionId\n ? selCmpt.init.map(i => ({ unit, [SELECTION_ID]: assembleInit(i, false)[0] }))\n : selCmpt.init.map(i => ({ unit, fields, values: assembleInit(i, false) }));\n }\n const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE);\n if (!contains.length) {\n dataCopy.push(store);\n }\n }\n return dataCopy;\n}\nexport function assembleUnitSelectionMarks(model, marks) {\n for (const selCmpt of vals(model.component.selection ?? {})) {\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.marks) {\n marks = c.marks(model, selCmpt, marks);\n }\n }\n }\n return marks;\n}\nexport function assembleLayerSelectionMarks(model, marks) {\n for (const child of model.children) {\n if (isUnitModel(child)) {\n marks = assembleUnitSelectionMarks(child, marks);\n }\n }\n return marks;\n}\nexport function assembleSelectionScaleDomain(model, extent, scaleCmpt, domain) {\n const parsedExtent = parseSelectionExtent(model, extent.param, extent);\n return {\n signal: hasContinuousDomain(scaleCmpt.get('type')) && isArray(domain) && domain[0] > domain[1]\n ? `isValid(${parsedExtent}) && reverse(${parsedExtent})`\n : parsedExtent\n };\n}\nfunction cleanupEmptyOnArray(signals) {\n return signals.map(s => {\n if (s.on && !s.on.length)\n delete s.on;\n return s;\n });\n}\n//# sourceMappingURL=assemble.js.map","import * as log from '../../log';\nimport { uniqueId } from '../../util';\n/**\n * A node in the dataflow tree.\n */\nexport class DataFlowNode {\n constructor(parent, debugName) {\n this.debugName = debugName;\n this._children = [];\n this._parent = null;\n if (parent) {\n this.parent = parent;\n }\n }\n /**\n * Clone this node with a deep copy but don't clone links to children or parents.\n */\n clone() {\n throw new Error('Cannot clone node');\n }\n get parent() {\n return this._parent;\n }\n /**\n * Set the parent of the node and also add this node to the parent's children.\n */\n set parent(parent) {\n this._parent = parent;\n if (parent) {\n parent.addChild(this);\n }\n }\n get children() {\n return this._children;\n }\n numChildren() {\n return this._children.length;\n }\n addChild(child, loc) {\n // do not add the same child twice\n if (this._children.includes(child)) {\n log.warn(log.message.ADD_SAME_CHILD_TWICE);\n return;\n }\n if (loc !== undefined) {\n this._children.splice(loc, 0, child);\n }\n else {\n this._children.push(child);\n }\n }\n removeChild(oldChild) {\n const loc = this._children.indexOf(oldChild);\n this._children.splice(loc, 1);\n return loc;\n }\n /**\n * Remove node from the dataflow.\n */\n remove() {\n let loc = this._parent.removeChild(this);\n for (const child of this._children) {\n // do not use the set method because we want to insert at a particular location\n child._parent = this._parent;\n this._parent.addChild(child, loc++);\n }\n }\n /**\n * Insert another node as a parent of this node.\n */\n insertAsParentOf(other) {\n const parent = other.parent;\n parent.removeChild(this);\n this.parent = parent;\n other.parent = this;\n }\n swapWithParent() {\n const parent = this._parent;\n const newParent = parent.parent;\n // reconnect the children\n for (const child of this._children) {\n child.parent = parent;\n }\n // remove old links\n this._children = []; // equivalent to removing every child link one by one\n parent.removeChild(this);\n const loc = parent.parent.removeChild(parent);\n // swap two nodes but maintain order in children\n this._parent = newParent;\n newParent.addChild(this, loc);\n parent.parent = this;\n }\n}\nexport class OutputNode extends DataFlowNode {\n clone() {\n const cloneObj = new this.constructor();\n cloneObj.debugName = `clone_${this.debugName}`;\n cloneObj._source = this._source;\n cloneObj._name = `clone_${this._name}`;\n cloneObj.type = this.type;\n cloneObj.refCounts = this.refCounts;\n cloneObj.refCounts[cloneObj._name] = 0;\n return cloneObj;\n }\n /**\n * @param source The name of the source. Will change in assemble.\n * @param type The type of the output node.\n * @param refCounts A global ref counter map.\n */\n constructor(parent, source, type, refCounts) {\n super(parent, source);\n this.type = type;\n this.refCounts = refCounts;\n this._source = this._name = source;\n if (this.refCounts && !(this._name in this.refCounts)) {\n this.refCounts[this._name] = 0;\n }\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return new Set();\n }\n hash() {\n if (this._hash === undefined) {\n this._hash = `Output ${uniqueId()}`;\n }\n return this._hash;\n }\n /**\n * Request the datasource name and increase the ref counter.\n *\n * During the parsing phase, this will return the simple name such as 'main' or 'raw'.\n * It is crucial to request the name from an output node to mark it as a required node.\n * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase.\n *\n * In the assemble phase, this will return the correct name.\n */\n getSource() {\n this.refCounts[this._name]++;\n return this._source;\n }\n isRequired() {\n return !!this.refCounts[this._name];\n }\n setSource(source) {\n this._source = source;\n }\n}\n//# sourceMappingURL=dataflow.js.map","import { getBandPosition, vgField } from '../../channeldef';\nimport { getDateTimePartAndStep, getSmallestTimeUnitPart, getTimeUnitParts, isBinnedTimeUnit, normalizeTimeUnit } from '../../timeunit';\nimport { duplicate, entries, hash, isEmpty, replacePathInField, vals } from '../../util';\nimport { isUnitModel } from '../model';\nimport { DataFlowNode } from './dataflow';\nimport { isRectBasedMark } from '../../mark';\nimport { isXorY } from '../../channel';\nfunction isTimeUnitTransformComponent(timeUnitComponent) {\n return timeUnitComponent.as !== undefined;\n}\nfunction offsetAs(field) {\n return `${field}_end`;\n}\nexport class TimeUnitNode extends DataFlowNode {\n clone() {\n return new TimeUnitNode(null, duplicate(this.timeUnits));\n }\n constructor(parent, timeUnits) {\n super(parent);\n this.timeUnits = timeUnits;\n }\n static makeFromEncoding(parent, model) {\n const formula = model.reduceFieldDef((timeUnitComponent, fieldDef, channel) => {\n const { field, timeUnit } = fieldDef;\n if (timeUnit) {\n let component;\n if (isBinnedTimeUnit(timeUnit)) {\n // For binned time unit, only produce end if the mark is a rect-based mark (rect, bar, image, arc), which needs \"range\".\n if (isUnitModel(model)) {\n const { mark, markDef, config } = model;\n const bandPosition = getBandPosition({ fieldDef, markDef, config });\n if (isRectBasedMark(mark) || !!bandPosition) {\n component = {\n timeUnit: normalizeTimeUnit(timeUnit),\n field\n };\n }\n }\n }\n else {\n component = {\n as: vgField(fieldDef, { forAs: true }),\n field,\n timeUnit\n };\n }\n if (isUnitModel(model)) {\n const { mark, markDef, config } = model;\n const bandPosition = getBandPosition({ fieldDef, markDef, config });\n if (isRectBasedMark(mark) && isXorY(channel) && bandPosition !== 0.5) {\n component.rectBandPosition = bandPosition;\n }\n }\n if (component) {\n timeUnitComponent[hash(component)] = component;\n }\n }\n return timeUnitComponent;\n }, {});\n if (isEmpty(formula)) {\n return null;\n }\n return new TimeUnitNode(parent, formula);\n }\n static makeFromTransform(parent, t) {\n const { timeUnit, ...other } = { ...t };\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit);\n const component = {\n ...other,\n timeUnit: normalizedTimeUnit\n };\n return new TimeUnitNode(parent, {\n [hash(component)]: component\n });\n }\n /**\n * Merge together TimeUnitNodes assigning the children of `other` to `this`\n * and removing `other`.\n */\n merge(other) {\n this.timeUnits = { ...this.timeUnits };\n // if the same hash happen twice, merge\n for (const key in other.timeUnits) {\n if (!this.timeUnits[key]) {\n // copy if it's not a duplicate\n this.timeUnits[key] = other.timeUnits[key];\n }\n }\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n other.remove();\n }\n /**\n * Remove time units coming from the other node.\n */\n removeFormulas(fields) {\n const newFormula = {};\n for (const [key, timeUnitComponent] of entries(this.timeUnits)) {\n const fieldAs = isTimeUnitTransformComponent(timeUnitComponent)\n ? timeUnitComponent.as\n : `${timeUnitComponent.field}_end`;\n if (!fields.has(fieldAs)) {\n newFormula[key] = timeUnitComponent;\n }\n }\n this.timeUnits = newFormula;\n }\n producedFields() {\n return new Set(vals(this.timeUnits).map(f => {\n return isTimeUnitTransformComponent(f) ? f.as : offsetAs(f.field);\n }));\n }\n dependentFields() {\n return new Set(vals(this.timeUnits).map(f => f.field));\n }\n hash() {\n return `TimeUnit ${hash(this.timeUnits)}`;\n }\n assemble() {\n const transforms = [];\n for (const f of vals(this.timeUnits)) {\n const { rectBandPosition } = f;\n const normalizedTimeUnit = normalizeTimeUnit(f.timeUnit);\n if (isTimeUnitTransformComponent(f)) {\n const { field, as } = f;\n const { unit, utc, ...params } = normalizedTimeUnit;\n const startEnd = [as, `${as}_end`];\n transforms.push({\n field: replacePathInField(field),\n type: 'timeunit',\n ...(unit ? { units: getTimeUnitParts(unit) } : {}),\n ...(utc ? { timezone: 'utc' } : {}),\n ...params,\n as: startEnd\n });\n transforms.push(...offsetedRectFormulas(startEnd, rectBandPosition, normalizedTimeUnit));\n }\n else if (f) {\n const { field: escapedField } = f;\n // since this is a expression, we want the unescaped field name\n const field = escapedField.replaceAll('\\\\.', '.');\n const expr = offsetExpr({ timeUnit: normalizedTimeUnit, field });\n const endAs = offsetAs(field);\n transforms.push({\n type: 'formula',\n expr,\n as: endAs\n });\n transforms.push(...offsetedRectFormulas([field, endAs], rectBandPosition, normalizedTimeUnit));\n }\n }\n return transforms;\n }\n}\nexport const OFFSETTED_RECT_START_SUFFIX = 'offsetted_rect_start';\nexport const OFFSETTED_RECT_END_SUFFIX = 'offsetted_rect_end';\nfunction offsetExpr({ timeUnit, field, reverse }) {\n const { unit, utc } = timeUnit;\n const smallestUnit = getSmallestTimeUnitPart(unit);\n const { part, step } = getDateTimePartAndStep(smallestUnit, timeUnit.step);\n const offsetFn = utc ? 'utcOffset' : 'timeOffset';\n const expr = `${offsetFn}('${part}', datum['${field}'], ${reverse ? -step : step})`;\n return expr;\n}\nfunction offsetedRectFormulas([startField, endField], rectBandPosition, timeUnit) {\n if (rectBandPosition !== undefined && rectBandPosition !== 0.5) {\n const startExpr = `datum['${startField}']`;\n const endExpr = `datum['${endField}']`;\n return [\n {\n type: 'formula',\n expr: interpolateExpr([\n offsetExpr({\n timeUnit,\n field: startField,\n reverse: true\n }),\n startExpr\n ], rectBandPosition + 0.5),\n as: `${startField}_${OFFSETTED_RECT_START_SUFFIX}`\n },\n {\n type: 'formula',\n expr: interpolateExpr([startExpr, endExpr], rectBandPosition + 0.5),\n as: `${startField}_${OFFSETTED_RECT_END_SUFFIX}`\n }\n ];\n }\n return [];\n}\nfunction interpolateExpr([start, end], fraction) {\n return `${1 - fraction} * ${start} + ${fraction} * ${end}`;\n}\n//# sourceMappingURL=timeunit.js.map","import { array, isObject } from 'vega-util';\nimport { getPositionChannelFromLatLong, isGeoPositionChannel, isScaleChannel, isSingleDefUnitChannel } from '../../channel';\nimport * as log from '../../log';\nimport { hasContinuousDomain } from '../../scale';\nimport { SELECTION_ID } from '../../selection';\nimport { hash, keys, varName, isEmpty } from '../../util';\nimport { TimeUnitNode } from '../data/timeunit';\nimport { assembleProjection } from './assemble';\nimport { isBinnedTimeUnit } from '../../timeunit';\nexport const TUPLE_FIELDS = '_tuple_fields';\nexport class SelectionProjectionComponent {\n constructor(...items) {\n this.items = items;\n this.hasChannel = {};\n this.hasField = {};\n this.hasSelectionId = false;\n }\n}\nconst project = {\n defined: () => {\n return true; // This transform handles its own defaults, so always run parse.\n },\n parse: (model, selCmpt, selDef) => {\n const name = selCmpt.name;\n const proj = (selCmpt.project ?? (selCmpt.project = new SelectionProjectionComponent()));\n const parsed = {};\n const timeUnits = {};\n const signals = new Set();\n const signalName = (p, range) => {\n const suffix = range === 'visual' ? p.channel : p.field;\n let sg = varName(`${name}_${suffix}`);\n for (let counter = 1; signals.has(sg); counter++) {\n sg = varName(`${name}_${suffix}_${counter}`);\n }\n signals.add(sg);\n return { [range]: sg };\n };\n const type = selCmpt.type;\n const cfg = model.config.selection[type];\n const init = selDef.value !== undefined\n ? array(selDef.value)\n : null;\n // If no explicit projection (either fields or encodings) is specified, set some defaults.\n // If an initial value is set, try to infer projections.\n let { fields, encodings } = (isObject(selDef.select) ? selDef.select : {});\n if (!fields && !encodings && init) {\n for (const initVal of init) {\n // initVal may be a scalar value to smoothen varParam -> pointSelection gradient.\n if (!isObject(initVal)) {\n continue;\n }\n for (const key of keys(initVal)) {\n if (isSingleDefUnitChannel(key)) {\n (encodings || (encodings = [])).push(key);\n }\n else {\n if (type === 'interval') {\n log.warn(log.message.INTERVAL_INITIALIZED_WITH_POS);\n encodings = cfg.encodings;\n }\n else {\n (fields ?? (fields = [])).push(key);\n }\n }\n }\n }\n }\n // If no initial value is specified, use the default configuration.\n // We break this out as a separate if block (instead of an else condition)\n // to account for unprojected point selections that have scalar initial values\n if (!fields && !encodings) {\n encodings = cfg.encodings;\n if ('fields' in cfg) {\n fields = cfg.fields;\n }\n }\n for (const channel of encodings ?? []) {\n const fieldDef = model.fieldDef(channel);\n if (fieldDef) {\n let field = fieldDef.field;\n if (fieldDef.aggregate) {\n log.warn(log.message.cannotProjectAggregate(channel, fieldDef.aggregate));\n continue;\n }\n else if (!field) {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n continue;\n }\n if (fieldDef.timeUnit && !isBinnedTimeUnit(fieldDef.timeUnit)) {\n field = model.vgField(channel);\n // Construct TimeUnitComponents which will be combined into a\n // TimeUnitNode. This node may need to be inserted into the\n // dataflow if the selection is used across views that do not\n // have these time units defined.\n const component = {\n timeUnit: fieldDef.timeUnit,\n as: field,\n field: fieldDef.field\n };\n timeUnits[hash(component)] = component;\n }\n // Prevent duplicate projections on the same field.\n // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag).\n if (!parsed[field]) {\n // Determine whether the tuple will store enumerated or ranged values.\n // Interval selections store ranges for continuous scales, and enumerations otherwise.\n // Single/multi selections store ranges for binned fields, and enumerations otherwise.\n const tplType = type === 'interval' &&\n isScaleChannel(channel) &&\n hasContinuousDomain(model.getScaleComponent(channel).get('type'))\n ? 'R'\n : fieldDef.bin\n ? 'R-RE'\n : 'E';\n const p = { field, channel, type: tplType, index: proj.items.length };\n p.signals = { ...signalName(p, 'data'), ...signalName(p, 'visual') };\n proj.items.push((parsed[field] = p));\n proj.hasField[field] = parsed[field];\n proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID;\n if (isGeoPositionChannel(channel)) {\n p.geoChannel = channel;\n p.channel = getPositionChannelFromLatLong(channel);\n proj.hasChannel[p.channel] = parsed[field];\n }\n else {\n proj.hasChannel[channel] = parsed[field];\n }\n }\n }\n else {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n }\n }\n for (const field of fields ?? []) {\n if (proj.hasField[field])\n continue;\n const p = { type: 'E', field, index: proj.items.length };\n p.signals = { ...signalName(p, 'data') };\n proj.items.push(p);\n proj.hasField[field] = p;\n proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID;\n }\n if (init) {\n selCmpt.init = init.map((v) => {\n // Selections can be initialized either with a full object that maps projections to values\n // or scalar values to smoothen the abstraction gradient from variable params to point selections.\n return proj.items.map(p => isObject(v) ? (v[p.geoChannel || p.channel] !== undefined ? v[p.geoChannel || p.channel] : v[p.field]) : v);\n });\n }\n if (!isEmpty(timeUnits)) {\n proj.timeUnit = new TimeUnitNode(null, timeUnits);\n }\n },\n signals: (model, selCmpt, allSignals) => {\n const name = selCmpt.name + TUPLE_FIELDS;\n const hasSignal = allSignals.filter(s => s.name === name);\n return hasSignal.length > 0 || selCmpt.project.hasSelectionId\n ? allSignals\n : allSignals.concat({\n name,\n value: selCmpt.project.items.map(assembleProjection)\n });\n }\n};\nexport default project;\n//# sourceMappingURL=project.js.map","import { stringValue } from 'vega-util';\nimport { VL_SELECTION_RESOLVE } from '.';\nimport { isScaleChannel } from '../../channel';\nimport * as log from '../../log';\nimport { hasContinuousDomain } from '../../scale';\nimport { isLayerModel } from '../model';\nimport { replacePathInField } from '../../util';\nconst scaleBindings = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales';\n },\n parse: (model, selCmpt) => {\n const bound = (selCmpt.scales = []);\n for (const proj of selCmpt.project.items) {\n const channel = proj.channel;\n if (!isScaleChannel(channel)) {\n continue;\n }\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n if (!scale || !hasContinuousDomain(scaleType)) {\n log.warn(log.message.SCALE_BINDINGS_CONTINUOUS);\n continue;\n }\n scale.set('selectionExtent', { param: selCmpt.name, field: proj.field }, true);\n bound.push(proj);\n }\n },\n topLevelSignals: (model, selCmpt, signals) => {\n const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0);\n // Top-level signals are only needed for multiview displays and if this\n // view's top-level signals haven't already been generated.\n if (!model.parent || isTopLevelLayer(model) || bound.length === 0) {\n return signals;\n }\n // vlSelectionResolve does not account for the behavior of bound scales in\n // multiview displays. Each unit view adds a tuple to the store, but the\n // state of the selection is the unit selection most recently updated. This\n // state is captured by the top-level signals that we insert and \"push\n // outer\" to from within the units. We need to reassemble this state into\n // the top-level named signal, except no single selCmpt has a global view.\n const namedSg = signals.filter(s => s.name === selCmpt.name)[0];\n let update = namedSg.update;\n if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) {\n namedSg.update = `{${bound\n .map(proj => `${stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`)\n .join(', ')}}`;\n }\n else {\n for (const proj of bound) {\n const mapping = `${stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`;\n if (!update.includes(mapping)) {\n update = `${update.substring(0, update.length - 1)}, ${mapping}}`;\n }\n }\n namedSg.update = update;\n }\n return signals.concat(bound.map(proj => ({ name: proj.signals.data })));\n },\n signals: (model, selCmpt, signals) => {\n // Nested signals need only push to top-level signals with multiview displays.\n if (model.parent && !isTopLevelLayer(model)) {\n for (const proj of selCmpt.scales) {\n const signal = signals.filter(s => s.name === proj.signals.data)[0];\n signal.push = 'outer';\n delete signal.value;\n delete signal.update;\n }\n }\n return signals;\n }\n};\nexport default scaleBindings;\nexport function domain(model, channel) {\n const scale = stringValue(model.scaleName(channel));\n return `domain(${scale})`;\n}\nfunction isTopLevelLayer(model) {\n return model.parent && isLayerModel(model.parent) && (!model.parent.parent ?? isTopLevelLayer(model.parent.parent));\n}\n//# sourceMappingURL=scales.js.map","import { isObject } from 'vega';\nimport { array, stringValue } from 'vega-util';\nimport { STORE, TUPLE, unitName } from '.';\nimport { LATITUDE, LONGITUDE, X, Y } from '../../channel';\nimport { warn } from '../../log';\nimport { hasContinuousDomain } from '../../scale';\nimport { SELECTION_ID } from '../../selection';\nimport { keys, vals } from '../../util';\nimport { isUnitModel } from '../model';\nimport { assembleInit } from './assemble';\nimport { TUPLE_FIELDS } from './project';\nimport scales from './scales';\nexport const BRUSH = '_brush';\nexport const SCALE_TRIGGER = '_scale_trigger';\nexport const GEO_INIT_TICK = 'geo_interval_init_tick'; // Workaround for https://github.com/vega/vega/issues/3481\nconst INIT = '_init';\nconst CENTER = '_center';\nconst interval = {\n defined: selCmpt => selCmpt.type === 'interval',\n parse: (model, selCmpt, selDef) => {\n var _a;\n if (model.hasProjection) {\n const def = { ...(isObject(selDef.select) ? selDef.select : {}) };\n def.fields = [SELECTION_ID];\n if (!def.encodings) {\n // Remap default x/y projection\n def.encodings = selDef.value ? keys(selDef.value) : [LONGITUDE, LATITUDE];\n }\n selDef.select = { type: 'interval', ...def };\n }\n if (selCmpt.translate && !scales.defined(selCmpt)) {\n const filterExpr = `!event.item || event.item.mark.name !== ${stringValue(selCmpt.name + BRUSH)}`;\n for (const evt of selCmpt.events) {\n if (!evt.between) {\n warn(`${evt} is not an ordered event stream for interval selections.`);\n continue;\n }\n const filters = array(((_a = evt.between[0]).filter ?? (_a.filter = [])));\n if (filters.indexOf(filterExpr) < 0) {\n filters.push(filterExpr);\n }\n }\n }\n },\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const tupleSg = name + TUPLE;\n const channels = vals(selCmpt.project.hasChannel).filter(p => p.channel === X || p.channel === Y);\n const init = selCmpt.init ? selCmpt.init[0] : null;\n signals.push(...channels.reduce((arr, proj) => arr.concat(channelSignals(model, selCmpt, proj, init && init[proj.index])), []));\n if (!model.hasProjection) {\n // Proxy scale reactions to ensure that an infinite loop doesn't occur\n // when an interval selection filter touches the scale.\n if (!scales.defined(selCmpt)) {\n const triggerSg = name + SCALE_TRIGGER;\n const scaleTriggers = channels.map(proj => {\n const channel = proj.channel;\n const { data: dname, visual: vname } = proj.signals;\n const scaleName = stringValue(model.scaleName(channel));\n const scaleType = model.getScaleComponent(channel).get('type');\n const toNum = hasContinuousDomain(scaleType) ? '+' : '';\n return (`(!isArray(${dname}) || ` +\n `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` +\n `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))`);\n });\n if (scaleTriggers.length) {\n signals.push({\n name: triggerSg,\n value: {},\n on: [\n {\n events: channels.map(proj => ({ scale: model.scaleName(proj.channel) })),\n update: scaleTriggers.join(' && ') + ` ? ${triggerSg} : {}`\n }\n ]\n });\n }\n }\n // Only add an interval to the store if it has valid data extents. Data extents\n // are set to null if pixel extents are equal to account for intervals over\n // ordinal/nominal domains which, when inverted, will still produce a valid datum.\n const dataSignals = channels.map(proj => proj.signals.data);\n const update = `unit: ${unitName(model)}, fields: ${name + TUPLE_FIELDS}, values`;\n return signals.concat({\n name: tupleSg,\n ...(init ? { init: `{${update}: ${assembleInit(init)}}` } : {}),\n ...(dataSignals.length\n ? {\n on: [\n {\n events: [{ signal: dataSignals.join(' || ') }],\n update: `${dataSignals.join(' && ')} ? {${update}: [${dataSignals}]} : null`\n }\n ]\n }\n : {})\n });\n }\n else {\n const projection = stringValue(model.projectionName());\n const centerSg = model.projectionName() + CENTER;\n const { x, y } = selCmpt.project.hasChannel;\n const xvname = x && x.signals.visual;\n const yvname = y && y.signals.visual;\n const xinit = x ? init && init[x.index] : `${centerSg}[0]`;\n const yinit = y ? init && init[y.index] : `${centerSg}[1]`;\n const sizeSg = (layout) => model.getSizeSignalRef(layout).signal;\n const bbox = `[` +\n `[${xvname ? xvname + '[0]' : '0'}, ${yvname ? yvname + '[0]' : '0'}],` +\n `[${xvname ? xvname + '[1]' : sizeSg('width')}, ` +\n `${yvname ? yvname + '[1]' : sizeSg('height')}]` +\n `]`;\n if (init) {\n signals.unshift({\n name: name + INIT,\n init: `[scale(${projection}, [${x ? xinit[0] : xinit}, ${y ? yinit[0] : yinit}]), ` +\n `scale(${projection}, [${x ? xinit[1] : xinit}, ${y ? yinit[1] : yinit}])]`\n });\n if (!x || !y) {\n // If initializing a uni-dimensional brush, use the center of the view to determine the other coord\n const hasCenterSg = signals.find(s => s.name === centerSg);\n if (!hasCenterSg) {\n signals.unshift({\n name: centerSg,\n update: `invert(${projection}, [${sizeSg('width')}/2, ${sizeSg('height')}/2])`\n });\n }\n }\n }\n const intersect = `intersect(${bbox}, {markname: ${stringValue(model.getName('marks'))}}, unit.mark)`;\n const base = `{unit: ${unitName(model)}}`;\n const update = `vlSelectionTuples(${intersect}, ${base})`;\n const visualSignals = channels.map(proj => proj.signals.visual);\n return signals.concat({\n name: tupleSg,\n on: [\n {\n events: [\n ...(visualSignals.length ? [{ signal: visualSignals.join(' || ') }] : []),\n ...(init ? [{ signal: GEO_INIT_TICK }] : [])\n ],\n update\n }\n ]\n });\n }\n },\n topLevelSignals: (model, selCmpt, signals) => {\n if (isUnitModel(model) && model.hasProjection && selCmpt.init) {\n // Workaround for https://github.com/vega/vega/issues/3481\n // The scenegraph isn't populated on the first pulse. So we use a timer signal\n // to re-pulse the dataflow as soon as possible. We return an object to ensure\n // this only occurs once.\n const hasTick = signals.filter(s => s.name === GEO_INIT_TICK);\n if (!hasTick.length) {\n signals.unshift({\n name: GEO_INIT_TICK,\n value: null,\n on: [\n {\n events: 'timer{1}',\n update: `${GEO_INIT_TICK} === null ? {} : ${GEO_INIT_TICK}`\n }\n ]\n });\n }\n }\n return signals;\n },\n marks: (model, selCmpt, marks) => {\n const name = selCmpt.name;\n const { x, y } = selCmpt.project.hasChannel;\n const xvname = x?.signals.visual;\n const yvname = y?.signals.visual;\n const store = `data(${stringValue(selCmpt.name + STORE)})`;\n // Do not add a brush if we're binding to scales\n // or we don't have a valid interval projection\n if (scales.defined(selCmpt) || (!x && !y)) {\n return marks;\n }\n const update = {\n x: x !== undefined ? { signal: `${xvname}[0]` } : { value: 0 },\n y: y !== undefined ? { signal: `${yvname}[0]` } : { value: 0 },\n x2: x !== undefined ? { signal: `${xvname}[1]` } : { field: { group: 'width' } },\n y2: y !== undefined ? { signal: `${yvname}[1]` } : { field: { group: 'height' } }\n };\n // If the selection is resolved to global, only a single interval is in\n // the store. Wrap brush mark's encodings with a production rule to test\n // this based on the `unit` property. Hide the brush mark if it corresponds\n // to a unit different from the one in the store.\n if (selCmpt.resolve === 'global') {\n for (const key of keys(update)) {\n update[key] = [\n {\n test: `${store}.length && ${store}[0].unit === ${unitName(model)}`,\n ...update[key]\n },\n { value: 0 }\n ];\n }\n }\n // Two brush marks ensure that fill colors and other aesthetic choices do\n // not interefere with the core marks, but that the brushed region can still\n // be interacted with (e.g., dragging it around).\n const { fill, fillOpacity, cursor, ...stroke } = selCmpt.mark;\n const vgStroke = keys(stroke).reduce((def, k) => {\n def[k] = [\n {\n test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`]\n .filter(t => t)\n .join(' && '),\n value: stroke[k]\n },\n { value: null }\n ];\n return def;\n }, {});\n return [\n {\n name: `${name + BRUSH}_bg`,\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n fill: { value: fill },\n fillOpacity: { value: fillOpacity }\n },\n update\n }\n },\n ...marks,\n {\n name: name + BRUSH,\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n ...(cursor ? { cursor: { value: cursor } } : {}),\n fill: { value: 'transparent' }\n },\n update: { ...update, ...vgStroke }\n }\n }\n ];\n }\n};\nexport default interval;\n/**\n * Returns the visual and data signals for an interval selection.\n */\nfunction channelSignals(model, selCmpt, proj, init) {\n const scaledInterval = !model.hasProjection;\n const channel = proj.channel;\n const vname = proj.signals.visual;\n const scaleName = stringValue(scaledInterval ? model.scaleName(channel) : model.projectionName());\n const scaled = (str) => `scale(${scaleName}, ${str})`;\n const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal;\n const coord = `${channel}(unit)`;\n const von = selCmpt.events.reduce((def, evt) => {\n return [\n ...def,\n { events: evt.between[0], update: `[${coord}, ${coord}]` },\n { events: evt, update: `[${vname}[0], clamp(${coord}, 0, ${size})]` } // Brush End\n ];\n }, []);\n if (scaledInterval) {\n const dname = proj.signals.data;\n const hasScales = scales.defined(selCmpt);\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n const vinit = init ? { init: assembleInit(init, true, scaled) } : { value: [] };\n // React to pan/zooms of continuous scales. Non-continuous scales\n // (band, point) cannot be pan/zoomed and any other changes\n // to their domains (e.g., filtering) should clear the brushes.\n von.push({\n events: { signal: selCmpt.name + SCALE_TRIGGER },\n update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]`\n });\n return hasScales\n ? [{ name: dname, on: [] }]\n : [\n { name: vname, ...vinit, on: von },\n {\n name: dname,\n ...(init ? { init: assembleInit(init) } : {}),\n on: [\n {\n events: { signal: vname },\n update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})`\n }\n ]\n }\n ];\n }\n else {\n const initIdx = channel === X ? 0 : 1;\n const initSg = selCmpt.name + INIT;\n const vinit = init ? { init: `[${initSg}[0][${initIdx}], ${initSg}[1][${initIdx}]]` } : { value: [] };\n return [{ name: vname, ...vinit, on: von }];\n }\n}\n//# sourceMappingURL=interval.js.map","import { stringValue } from 'vega-util';\nimport { TUPLE, unitName } from '.';\nimport { SELECTION_ID } from '../../selection';\nimport { vals } from '../../util';\nimport { BRUSH } from './interval';\nimport { TUPLE_FIELDS } from './project';\nconst point = {\n defined: selCmpt => selCmpt.type === 'point',\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const fieldsSg = name + TUPLE_FIELDS;\n const project = selCmpt.project;\n const datum = '(item().isVoronoi ? datum.datum : datum)';\n // Only add a discrete selection to the store if a datum is present _and_\n // the interaction isn't occurring on a group mark. This guards against\n // polluting interactive state with invalid values in faceted displays\n // as the group marks are also data-driven. We force the update to account\n // for constant null states but varying toggles (e.g., shift-click in\n // whitespace followed by a click in whitespace; the store should only\n // be cleared on the second click).\n const brushes = vals(model.component.selection ?? {})\n .reduce((acc, cmpt) => {\n return cmpt.type === 'interval' ? acc.concat(cmpt.name + BRUSH) : acc;\n }, [])\n .map(b => `indexof(item().mark.name, '${b}') < 0`)\n .join(' && ');\n const test = `datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${brushes ? ` && ${brushes}` : ''}`;\n let update = `unit: ${unitName(model)}, `;\n if (selCmpt.project.hasSelectionId) {\n update += `${SELECTION_ID}: ${datum}[${stringValue(SELECTION_ID)}]`;\n }\n else {\n const values = project.items\n .map(p => {\n const fieldDef = model.fieldDef(p.channel);\n // Binned fields should capture extents, for a range test against the raw field.\n return fieldDef?.bin\n ? `[${datum}[${stringValue(model.vgField(p.channel, {}))}], ` +\n `${datum}[${stringValue(model.vgField(p.channel, { binSuffix: 'end' }))}]]`\n : `${datum}[${stringValue(p.field)}]`;\n })\n .join(', ');\n update += `fields: ${fieldsSg}, values: [${values}]`;\n }\n const events = selCmpt.events;\n return signals.concat([\n {\n name: name + TUPLE,\n on: events\n ? [\n {\n events,\n update: `${test} ? {${update}} : null`,\n force: true\n }\n ]\n : []\n }\n ]);\n }\n};\nexport default point;\n//# sourceMappingURL=point.js.map","import { array } from 'vega-util';\nimport { isConditionalDef, isConditionalParameter } from '../../../channeldef';\nimport { expression } from '../../predicate';\nimport { parseSelectionPredicate } from '../../selection/parse';\n/**\n * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition\n * or a simple mixin if channel def has no condition.\n */\nexport function wrapCondition(model, channelDef, vgChannel, refFn) {\n const condition = isConditionalDef(channelDef) && channelDef.condition;\n const valueRef = refFn(channelDef);\n if (condition) {\n const conditions = array(condition);\n const vgConditions = conditions.map(c => {\n const conditionValueRef = refFn(c);\n if (isConditionalParameter(c)) {\n const { param, empty } = c;\n const test = parseSelectionPredicate(model, { param, empty });\n return { test, ...conditionValueRef };\n }\n else {\n const test = expression(model, c.test); // FIXME: remove casting once TS is no longer dumb about it\n return { test, ...conditionValueRef };\n }\n });\n return {\n [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])]\n };\n }\n else {\n return valueRef !== undefined ? { [vgChannel]: valueRef } : {};\n }\n}\n//# sourceMappingURL=conditional.js.map","import { getFormatMixins, isFieldOrDatumDef, isValueDef } from '../../../channeldef';\nimport { signalOrValueRef } from '../../common';\nimport { formatSignalRef } from '../../format';\nimport { wrapCondition } from './conditional';\nexport function text(model, channel = 'text') {\n const channelDef = model.encoding[channel];\n return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config));\n}\nexport function textRef(channelDef, config, expr = 'datum') {\n // text\n if (channelDef) {\n if (isValueDef(channelDef)) {\n return signalOrValueRef(channelDef.value);\n }\n if (isFieldOrDatumDef(channelDef)) {\n const { format, formatType } = getFormatMixins(channelDef);\n return formatSignalRef({ fieldOrDatumDef: channelDef, format, formatType, expr, config });\n }\n }\n return undefined;\n}\n//# sourceMappingURL=text.js.map","import { array, isArray, isObject, isString } from 'vega-util';\nimport { isBinned } from '../../../bin';\nimport { getMainRangeChannel, isXorY, THETA, RADIUS } from '../../../channel';\nimport { defaultTitle, getFieldDef, getFormatMixins, hasConditionalFieldDef, isFieldDef, isTypedFieldDef, vgField } from '../../../channeldef';\nimport { forEach } from '../../../encoding';\nimport { entries } from '../../../util';\nimport { isSignalRef } from '../../../vega.schema';\nimport { getMarkPropOrConfig } from '../../common';\nimport { binFormatExpression, formatSignalRef } from '../../format';\nimport { wrapCondition } from './conditional';\nimport { textRef } from './text';\nexport function tooltip(model, opt = {}) {\n const { encoding, markDef, config, stack } = model;\n const channelDef = encoding.tooltip;\n if (isArray(channelDef)) {\n return { tooltip: tooltipRefForEncoding({ tooltip: channelDef }, stack, config, opt) };\n }\n else {\n const datum = opt.reactiveGeom ? 'datum.datum' : 'datum';\n return wrapCondition(model, channelDef, 'tooltip', cDef => {\n // use valueRef based on channelDef first\n const tooltipRefFromChannelDef = textRef(cDef, config, datum);\n if (tooltipRefFromChannelDef) {\n return tooltipRefFromChannelDef;\n }\n if (cDef === null) {\n // Allow using encoding.tooltip = null to disable tooltip\n return undefined;\n }\n let markTooltip = getMarkPropOrConfig('tooltip', markDef, config);\n if (markTooltip === true) {\n markTooltip = { content: 'encoding' };\n }\n if (isString(markTooltip)) {\n return { value: markTooltip };\n }\n else if (isObject(markTooltip)) {\n // `tooltip` is `{fields: 'encodings' | 'fields'}`\n if (isSignalRef(markTooltip)) {\n return markTooltip;\n }\n else if (markTooltip.content === 'encoding') {\n return tooltipRefForEncoding(encoding, stack, config, opt);\n }\n else {\n return { signal: datum };\n }\n }\n return undefined;\n });\n }\n}\nexport function tooltipData(encoding, stack, config, { reactiveGeom } = {}) {\n const formatConfig = { ...config, ...config.tooltipFormat };\n const toSkip = {};\n const expr = reactiveGeom ? 'datum.datum' : 'datum';\n const tuples = [];\n function add(fDef, channel) {\n const mainChannel = getMainRangeChannel(channel);\n const fieldDef = isTypedFieldDef(fDef)\n ? fDef\n : {\n ...fDef,\n type: encoding[mainChannel].type // for secondary field def, copy type from main channel\n };\n const title = fieldDef.title || defaultTitle(fieldDef, formatConfig);\n const key = array(title).join(', ').replaceAll(/\"/g, '\\\\\"');\n let value;\n if (isXorY(channel)) {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = getFieldDef(encoding[channel2]);\n if (isBinned(fieldDef.bin) && fieldDef2) {\n const startField = vgField(fieldDef, { expr });\n const endField = vgField(fieldDef2, { expr });\n const { format, formatType } = getFormatMixins(fieldDef);\n value = binFormatExpression(startField, endField, format, formatType, formatConfig);\n toSkip[channel2] = true;\n }\n }\n if ((isXorY(channel) || channel === THETA || channel === RADIUS) &&\n stack &&\n stack.fieldChannel === channel &&\n stack.offset === 'normalize') {\n const { format, formatType } = getFormatMixins(fieldDef);\n value = formatSignalRef({\n fieldOrDatumDef: fieldDef,\n format,\n formatType,\n expr,\n config: formatConfig,\n normalizeStack: true\n }).signal;\n }\n value ?? (value = textRef(fieldDef, formatConfig, expr).signal);\n tuples.push({ channel, key, value });\n }\n forEach(encoding, (channelDef, channel) => {\n if (isFieldDef(channelDef)) {\n add(channelDef, channel);\n }\n else if (hasConditionalFieldDef(channelDef)) {\n add(channelDef.condition, channel);\n }\n });\n const out = {};\n for (const { channel, key, value } of tuples) {\n if (!toSkip[channel] && !out[key]) {\n out[key] = value;\n }\n }\n return out;\n}\nexport function tooltipRefForEncoding(encoding, stack, config, { reactiveGeom } = {}) {\n const data = tooltipData(encoding, stack, config, { reactiveGeom });\n const keyValues = entries(data).map(([key, value]) => `\"${key}\": ${value}`);\n return keyValues.length > 0 ? { signal: `{${keyValues.join(', ')}}` } : undefined;\n}\n//# sourceMappingURL=tooltip.js.map","import { entries, isEmpty } from '../../../util';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nimport { VG_MARK_INDEX } from './../../../vega.schema';\nimport { wrapCondition } from './conditional';\nimport { textRef } from './text';\nimport { tooltipData } from './tooltip';\nexport function aria(model) {\n const { markDef, config } = model;\n const enableAria = getMarkPropOrConfig('aria', markDef, config);\n // We can ignore other aria properties if ariaHidden is true.\n if (enableAria === false) {\n // getMarkGroups sets aria to false already so we don't have to set it in the encode block\n return {};\n }\n return {\n ...(enableAria ? { aria: enableAria } : {}),\n ...ariaRoleDescription(model),\n ...description(model)\n };\n}\nfunction ariaRoleDescription(model) {\n const { mark, markDef, config } = model;\n if (config.aria === false) {\n return {};\n }\n const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config);\n if (ariaRoleDesc != null) {\n return { ariaRoleDescription: { value: ariaRoleDesc } };\n }\n return mark in VG_MARK_INDEX ? {} : { ariaRoleDescription: { value: mark } };\n}\nexport function description(model) {\n const { encoding, markDef, config, stack } = model;\n const channelDef = encoding.description;\n if (channelDef) {\n return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config));\n }\n // Use default from mark def or config if defined.\n // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here.\n const descriptionValue = getMarkPropOrConfig('description', markDef, config);\n if (descriptionValue != null) {\n return {\n description: signalOrValueRef(descriptionValue)\n };\n }\n if (config.aria === false) {\n return {};\n }\n const data = tooltipData(encoding, stack, config);\n if (isEmpty(data)) {\n return undefined;\n }\n return {\n description: {\n signal: entries(data)\n .map(([key, value], index) => `\"${index > 0 ? '; ' : ''}${key}: \" + (${value})`)\n .join(' + ')\n }\n };\n}\n//# sourceMappingURL=aria.js.map","import { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nimport { wrapCondition } from './conditional';\nimport * as ref from './valueref';\n/**\n * Return encode for non-positional channels with scales. (Text doesn't have scale.)\n */\nexport function nonPosition(channel, model, opt = {}) {\n const { markDef, encoding, config } = model;\n const { vgChannel } = opt;\n let { defaultRef, defaultValue } = opt;\n if (defaultRef === undefined) {\n // prettier-ignore\n defaultValue ?? (defaultValue = getMarkPropOrConfig(channel, markDef, config, { vgChannel, ignoreVgConfig: true }));\n if (defaultValue !== undefined) {\n defaultRef = signalOrValueRef(defaultValue);\n }\n }\n const channelDef = encoding[channel];\n return wrapCondition(model, channelDef, vgChannel ?? channel, cDef => {\n return ref.midPoint({\n channel,\n channelDef: cDef,\n markDef,\n config,\n scaleName: model.scaleName(channel),\n scale: model.getScaleComponent(channel),\n stack: null,\n defaultRef\n });\n });\n}\n//# sourceMappingURL=nonposition.js.map","import * as log from '../../../log';\nimport { contains } from '../../../util';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nimport { nonPosition } from './nonposition';\nexport function color(model, opt = { filled: undefined }) {\n const { markDef, encoding, config } = model;\n const { type: markType } = markDef;\n // Allow filled to be overridden (for trail's \"filled\")\n const filled = opt.filled ?? getMarkPropOrConfig('filled', markDef, config);\n const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType)\n ? 'transparent'\n : undefined;\n const defaultFill = getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, { vgChannel: 'fill' }) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === true && 'color'] ??\n // If there is no fill, always fill symbols, bar, geoshape\n // with transparent fills https://github.com/vega/vega-lite/issues/1316\n transparentIfNeeded;\n const defaultStroke = getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, { vgChannel: 'stroke' }) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === false && 'color'];\n const colorVgChannel = filled ? 'fill' : 'stroke';\n const fillStrokeMarkDefAndConfig = {\n ...(defaultFill ? { fill: signalOrValueRef(defaultFill) } : {}),\n ...(defaultStroke ? { stroke: signalOrValueRef(defaultStroke) } : {})\n };\n if (markDef.color && (filled ? markDef.fill : markDef.stroke)) {\n log.warn(log.message.droppingColor('property', { fill: 'fill' in markDef, stroke: 'stroke' in markDef }));\n }\n return {\n ...fillStrokeMarkDefAndConfig,\n ...nonPosition('color', model, {\n vgChannel: colorVgChannel,\n defaultValue: filled ? defaultFill : defaultStroke\n }),\n ...nonPosition('fill', model, {\n // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding\n defaultValue: encoding.fill ? defaultFill : undefined\n }),\n ...nonPosition('stroke', model, {\n // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding\n defaultValue: encoding.stroke ? defaultStroke : undefined\n })\n };\n}\n//# sourceMappingURL=color.js.map","import { isValueDef } from '../../../channeldef';\nimport { isPathMark } from '../../../mark';\nimport { signalOrValueRef } from '../../common';\nimport { wrapCondition } from './conditional';\nexport function zindex(model) {\n const { encoding, mark } = model;\n const order = encoding.order;\n if (!isPathMark(mark) && isValueDef(order)) {\n return wrapCondition(model, order, 'zindex', cd => signalOrValueRef(cd.value));\n }\n return {};\n}\n//# sourceMappingURL=zindex.js.map","import { signalOrValueRef } from '../../common';\nimport { midPoint } from './valueref';\nexport function positionOffset({ channel: baseChannel, markDef, encoding = {}, model, bandPosition }) {\n const channel = `${baseChannel}Offset`; // Need to cast as the type can't be inferred automatically\n const defaultValue = markDef[channel];\n const channelDef = encoding[channel];\n if ((channel === 'xOffset' || channel === 'yOffset') && channelDef) {\n const ref = midPoint({\n channel: channel,\n channelDef,\n markDef,\n config: model?.config,\n scaleName: model.scaleName(channel),\n scale: model.getScaleComponent(channel),\n stack: null,\n defaultRef: signalOrValueRef(defaultValue),\n bandPosition\n });\n return { offsetType: 'encoding', offset: ref };\n }\n const markDefOffsetValue = markDef[channel];\n if (markDefOffsetValue) {\n return { offsetType: 'visual', offset: markDefOffsetValue };\n }\n return {};\n}\n//# sourceMappingURL=offset.js.map","import { getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel, isXorY } from '../../../channel';\nimport { isFieldDef, isFieldOrDatumDef } from '../../../channeldef';\nimport { ScaleType } from '../../../scale';\nimport { contains } from '../../../util';\nimport { getMarkPropOrConfig } from '../../common';\nimport { positionOffset } from './offset';\nimport * as ref from './valueref';\n/**\n * Return encode for point (non-band) position channels.\n */\nexport function pointPosition(channel, model, { defaultPos, vgChannel }) {\n const { encoding, markDef, config, stack } = model;\n const channelDef = encoding[channel];\n const channel2Def = encoding[getSecondaryRangeChannel(channel)];\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n const { offset, offsetType } = positionOffset({\n channel,\n markDef,\n encoding,\n model,\n bandPosition: 0.5\n });\n // Get default position or position from mark def\n const defaultRef = pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n });\n const valueRef = !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude)\n ? // use geopoint output if there are lat/long and there is no point position overriding lat/long.\n { field: model.getName(channel) }\n : positionRef({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef,\n bandPosition: offsetType === 'encoding' ? 0 : undefined\n });\n return valueRef ? { [vgChannel || channel]: valueRef } : undefined;\n}\n// TODO: we need to find a way to refactor these so that scaleName is a part of scale\n// but that's complicated. For now, this is a huge step moving forward.\n/**\n * @return Vega ValueRef for normal x- or y-position without projection\n */\nexport function positionRef(params) {\n const { channel, channelDef, scaleName, stack, offset, markDef } = params;\n // This isn't a part of midPoint because we use midPoint for non-position too\n if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) {\n if (isFieldDef(channelDef)) {\n let bandPosition = channelDef.bandPosition;\n if (bandPosition === undefined && markDef.type === 'text' && (channel === 'radius' || channel === 'theta')) {\n // theta and radius of text mark should use bandPosition = 0.5 by default\n // so that labels for arc marks are centered automatically\n bandPosition = 0.5;\n }\n if (bandPosition !== undefined) {\n return ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef,\n startSuffix: 'start',\n bandPosition,\n offset\n });\n }\n }\n // x or y use stack_end so that stacked line's point mark use stack_end too.\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, { suffix: 'end' }, { offset });\n }\n return ref.midPointRefWithPositionInvalidTest(params);\n}\nexport function pointPositionDefaultRef({ model, defaultPos, channel, scaleName, scale }) {\n const { markDef, config } = model;\n return () => {\n const mainChannel = getMainRangeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, { vgChannel });\n if (definedValueOrConfig !== undefined) {\n return ref.widthHeightValueOrSignalRef(channel, definedValueOrConfig);\n }\n switch (defaultPos) {\n case 'zeroOrMin':\n case 'zeroOrMax':\n if (scaleName) {\n const scaleType = scale.get('type');\n if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) {\n // Log scales cannot have zero.\n // Zero in time scale is arbitrary, and does not affect ratio.\n // (Time is an interval level of measurement, not ratio).\n // See https://en.wikipedia.org/wiki/Level_of_measurement for more info.\n }\n else {\n if (scale.domainDefinitelyIncludesZero()) {\n return {\n scale: scaleName,\n value: 0\n };\n }\n }\n }\n if (defaultPos === 'zeroOrMin') {\n return mainChannel === 'y' ? { field: { group: 'height' } } : { value: 0 };\n }\n else {\n // zeroOrMax\n switch (mainChannel) {\n case 'radius':\n // max of radius is min(width, height) / 2\n return {\n signal: `min(${model.width.signal},${model.height.signal})/2`\n };\n case 'theta':\n return { signal: '2*PI' };\n case 'x':\n return { field: { group: 'width' } };\n case 'y':\n return { value: 0 };\n }\n }\n break;\n case 'mid': {\n const sizeRef = model[getSizeChannel(channel)];\n return { ...sizeRef, mult: 0.5 };\n }\n }\n // defaultPos === null\n return undefined;\n };\n}\n//# sourceMappingURL=position-point.js.map","import { getVgPositionChannel } from '../../../channel';\nimport * as log from '../../../log';\nimport { isSignalRef } from '../../../vega.schema';\nimport { getMarkPropOrConfig } from '../../common';\nconst ALIGNED_X_CHANNEL = {\n left: 'x',\n center: 'xc',\n right: 'x2'\n};\nconst BASELINED_Y_CHANNEL = {\n top: 'y',\n middle: 'yc',\n bottom: 'y2'\n};\nexport function vgAlignedPositionChannel(channel, markDef, config, defaultAlign = 'middle') {\n if (channel === 'radius' || channel === 'theta') {\n return getVgPositionChannel(channel);\n }\n const alignChannel = channel === 'x' ? 'align' : 'baseline';\n const align = getMarkPropOrConfig(alignChannel, markDef, config);\n let alignExcludingSignal;\n if (isSignalRef(align)) {\n log.warn(log.message.rangeMarkAlignmentCannotBeExpression(alignChannel));\n alignExcludingSignal = undefined;\n }\n else {\n alignExcludingSignal = align;\n }\n if (channel === 'x') {\n return ALIGNED_X_CHANNEL[alignExcludingSignal || (defaultAlign === 'top' ? 'left' : 'center')];\n }\n else {\n return BASELINED_Y_CHANNEL[alignExcludingSignal || defaultAlign];\n }\n}\n//# sourceMappingURL=position-align.js.map","import { getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel } from '../../../channel';\nimport { isFieldOrDatumDef } from '../../../channeldef';\nimport * as log from '../../../log';\nimport { isRelativeBandSize } from '../../../mark';\nimport { getMarkStyleConfig } from '../../common';\nimport { positionOffset } from './offset';\nimport { vgAlignedPositionChannel } from './position-align';\nimport { pointPosition, pointPositionDefaultRef } from './position-point';\nimport * as ref from './valueref';\n/**\n * Utility for area/rule position, which can be either point or range.\n * (One of the axes should be point and the other should be range.)\n */\nexport function pointOrRangePosition(channel, model, { defaultPos, defaultPos2, range }) {\n if (range) {\n return rangePosition(channel, model, { defaultPos, defaultPos2 });\n }\n return pointPosition(channel, model, { defaultPos });\n}\nexport function rangePosition(channel, model, { defaultPos, defaultPos2 }) {\n const { markDef, config } = model;\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2);\n const vgChannel = pos2Mixins[sizeChannel]\n ? // If there is width/height, we need to position the marks based on the alignment.\n vgAlignedPositionChannel(channel, markDef, config)\n : // Otherwise, make sure to apply to the right Vg Channel (for arc mark)\n getVgPositionChannel(channel);\n return {\n ...pointPosition(channel, model, { defaultPos, vgChannel }),\n ...pos2Mixins\n };\n}\n/**\n * Return encode for x2, y2.\n * If channel is not specified, return one channel based on orientation.\n */\nfunction pointPosition2OrSize(model, defaultPos, channel) {\n const { encoding, mark, markDef, stack, config } = model;\n const baseChannel = getMainRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n const channelDef = encoding[baseChannel];\n const scaleName = model.scaleName(baseChannel);\n const scale = model.getScaleComponent(baseChannel);\n const { offset } = channel in encoding || channel in markDef\n ? positionOffset({ channel, markDef, encoding, model })\n : positionOffset({ channel: baseChannel, markDef, encoding, model });\n if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) {\n const vgSizeChannel = getSizeChannel(channel);\n const size = model.markDef[vgSizeChannel];\n if (size != null) {\n return {\n [vgSizeChannel]: { value: size }\n };\n }\n else {\n return {\n [vgChannel]: { field: model.getName(channel) }\n };\n }\n }\n const valueRef = position2Ref({\n channel,\n channelDef,\n channel2Def: encoding[channel],\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: undefined\n });\n if (valueRef !== undefined) {\n return { [vgChannel]: valueRef };\n }\n // TODO: check width/height encoding here once we add them\n // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence:\n // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark)\n return (position2orSize(channel, markDef) ||\n position2orSize(channel, {\n [channel]: getMarkStyleConfig(channel, markDef, config.style),\n [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style)\n }) ||\n position2orSize(channel, config[mark]) ||\n position2orSize(channel, config.mark) || {\n [vgChannel]: pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n })()\n });\n}\nexport function position2Ref({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef }) {\n if (isFieldOrDatumDef(channelDef) &&\n stack &&\n // If fieldChannel is X and channel is X2 (or Y and Y2)\n channel.charAt(0) === stack.fieldChannel.charAt(0)) {\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, { suffix: 'start' }, { offset });\n }\n return ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: channel2Def,\n scaleName,\n scale,\n stack,\n markDef,\n config,\n offset,\n defaultRef\n });\n}\nfunction position2orSize(channel, markDef) {\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n if (markDef[vgChannel] !== undefined) {\n return { [vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[vgChannel]) };\n }\n else if (markDef[channel] !== undefined) {\n return { [vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[channel]) };\n }\n else if (markDef[sizeChannel]) {\n const dimensionSize = markDef[sizeChannel];\n if (isRelativeBandSize(dimensionSize)) {\n log.warn(log.message.relativeBandSizeNotSupported(sizeChannel));\n }\n else {\n return { [sizeChannel]: ref.widthHeightValueOrSignalRef(channel, dimensionSize) };\n }\n }\n return undefined;\n}\n//# sourceMappingURL=position-range.js.map","import { isArray, isNumber } from 'vega-util';\nimport { isBinned, isBinning, isBinParams } from '../../../bin';\nimport { getOffsetChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel, isPolarPositionChannel, isXorY } from '../../../channel';\nimport { getBandPosition, getBandSize, isFieldDef, isFieldOrDatumDef, vgField } from '../../../channeldef';\nimport { getViewConfigDiscreteStep } from '../../../config';\nimport * as log from '../../../log';\nimport { isRelativeBandSize } from '../../../mark';\nimport { hasDiscreteDomain } from '../../../scale';\nimport { isSignalRef, isVgRangeStep } from '../../../vega.schema';\nimport { getMarkConfig, getMarkPropOrConfig, signalOrStringValue, signalOrValueRef } from '../../common';\nimport { nonPosition } from './nonposition';\nimport { positionOffset } from './offset';\nimport { vgAlignedPositionChannel } from './position-align';\nimport { pointPositionDefaultRef } from './position-point';\nimport { rangePosition } from './position-range';\nimport * as ref from './valueref';\nimport { getOffsetScaleChannel } from '../../../channel';\nimport { getFirstDefined } from '../../../util';\nimport { OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX } from '../../data/timeunit';\nexport function rectPosition(model, channel) {\n const { config, encoding, markDef } = model;\n const mark = markDef.type;\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const channelDef = encoding[channel];\n const channelDef2 = encoding[channel2];\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n const orient = markDef.orient;\n const hasSizeDef = encoding[sizeChannel] ?? encoding.size ?? getMarkPropOrConfig('size', markDef, config, { vgChannel: sizeChannel });\n const offsetScaleChannel = getOffsetChannel(channel);\n const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal');\n // x, x2, and width -- we must specify two of these in all conditions\n if (isFieldDef(channelDef) &&\n (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) &&\n !(hasSizeDef && !isRelativeBandSize(hasSizeDef)) &&\n !encoding[offsetScaleChannel] &&\n !hasDiscreteDomain(scaleType)) {\n return rectBinPosition({\n fieldDef: channelDef,\n fieldDef2: channelDef2,\n channel,\n model\n });\n }\n else if (((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType)) || isBarBand) && !channelDef2) {\n return positionAndSize(channelDef, channel, model);\n }\n else {\n return rangePosition(channel, model, { defaultPos: 'zeroOrMax', defaultPos2: 'zeroOrMin' });\n }\n}\nfunction defaultSizeRef(sizeChannel, scaleName, scale, config, bandSize, hasFieldDef, mark) {\n if (isRelativeBandSize(bandSize)) {\n if (scale) {\n const scaleType = scale.get('type');\n if (scaleType === 'band') {\n let bandWidth = `bandwidth('${scaleName}')`;\n if (bandSize.band !== 1) {\n bandWidth = `${bandSize.band} * ${bandWidth}`;\n }\n const minBandSize = getMarkConfig('minBandSize', { type: mark }, config);\n return { signal: minBandSize ? `max(${signalOrStringValue(minBandSize)}, ${bandWidth})` : bandWidth };\n }\n else if (bandSize.band !== 1) {\n log.warn(log.message.cannotUseRelativeBandSizeWithNonBandScale(scaleType));\n bandSize = undefined;\n }\n }\n else {\n return {\n mult: bandSize.band,\n field: { group: sizeChannel }\n };\n }\n }\n else if (isSignalRef(bandSize)) {\n return bandSize;\n }\n else if (bandSize) {\n return { value: bandSize };\n }\n // no valid band size\n if (scale) {\n const scaleRange = scale.get('range');\n if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return { value: scaleRange.step - 2 };\n }\n }\n if (!hasFieldDef) {\n const { bandPaddingInner, barBandPaddingInner, rectBandPaddingInner } = config.scale;\n const padding = getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); // this part is like paddingInner in scale.ts\n if (isSignalRef(padding)) {\n return { signal: `(1 - (${padding.signal})) * ${sizeChannel}` };\n }\n else if (isNumber(padding)) {\n return { signal: `${1 - padding} * ${sizeChannel}` };\n }\n }\n const defaultStep = getViewConfigDiscreteStep(config.view, sizeChannel);\n return { value: defaultStep - 2 };\n}\n/**\n * Output position encoding and its size encoding for continuous, point, and band scales.\n */\nfunction positionAndSize(fieldDef, channel, model) {\n const { markDef, encoding, config, stack } = model;\n const orient = markDef.orient;\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n const vgSizeChannel = getSizeChannel(channel);\n const channel2 = getSecondaryRangeChannel(channel);\n const offsetScaleChannel = getOffsetChannel(channel);\n const offsetScaleName = model.scaleName(offsetScaleChannel);\n const offsetScale = model.getScaleComponent(getOffsetScaleChannel(channel));\n // use \"size\" channel for bars, if there is orient and the channel matches the right orientation\n const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x');\n // Use size encoding / mark property / config if it exists\n let sizeMixins;\n if (encoding.size || markDef.size) {\n if (useVlSizeChannel) {\n sizeMixins = nonPosition('size', model, {\n vgChannel: vgSizeChannel,\n defaultRef: signalOrValueRef(markDef.size)\n });\n }\n else {\n log.warn(log.message.cannotApplySizeToNonOrientedMark(markDef.type));\n }\n }\n const hasSizeFromMarkOrEncoding = !!sizeMixins;\n // Otherwise, apply default value\n const bandSize = getBandSize({\n channel,\n fieldDef,\n markDef,\n config,\n scaleType: (scale || offsetScale)?.get('type'),\n useVlSizeChannel\n });\n sizeMixins = sizeMixins || {\n [vgSizeChannel]: defaultSizeRef(vgSizeChannel, offsetScaleName || scaleName, offsetScale || scale, config, bandSize, !!fieldDef, markDef.type)\n };\n /*\n Band scales with size value and all point scales, use xc/yc + band=0.5\n \n Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2.\n In this case, size_band is the band specified in the x/y-encoding.\n By default band is 1, so `(1 - band) / 2` = 0.\n If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2\n */\n const defaultBandAlign = (scale || offsetScale)?.get('type') === 'band' && isRelativeBandSize(bandSize) && !hasSizeFromMarkOrEncoding\n ? 'top'\n : 'middle';\n const vgChannel = vgAlignedPositionChannel(channel, markDef, config, defaultBandAlign);\n const center = vgChannel === 'xc' || vgChannel === 'yc';\n const { offset, offsetType } = positionOffset({ channel, markDef, encoding, model, bandPosition: center ? 0.5 : 0 });\n const posRef = ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: fieldDef,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: pointPositionDefaultRef({ model, defaultPos: 'mid', channel, scaleName, scale }),\n bandPosition: center\n ? offsetType === 'encoding'\n ? 0\n : 0.5\n : isSignalRef(bandSize)\n ? { signal: `(1-${bandSize})/2` }\n : isRelativeBandSize(bandSize)\n ? (1 - bandSize.band) / 2\n : 0\n });\n if (vgSizeChannel) {\n return { [vgChannel]: posRef, ...sizeMixins };\n }\n else {\n // otherwise, we must simulate size by setting position2 = position + size\n // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth)\n const vgChannel2 = getVgPositionChannel(channel2);\n const sizeRef = sizeMixins[vgSizeChannel];\n const sizeOffset = offset ? { ...sizeRef, offset } : sizeRef;\n return {\n [vgChannel]: posRef,\n // posRef might be an array that wraps position invalid test\n [vgChannel2]: isArray(posRef)\n ? [posRef[0], { ...posRef[1], offset: sizeOffset }]\n : {\n ...posRef,\n offset: sizeOffset\n }\n };\n }\n}\nfunction getBinSpacing(channel, spacing, reverse, axisTranslate, offset, minBandSize, bandSizeExpr) {\n if (isPolarPositionChannel(channel)) {\n return 0;\n }\n const isEnd = channel === 'x' || channel === 'y2';\n const spacingOffset = isEnd ? -spacing / 2 : spacing / 2;\n if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(axisTranslate) || minBandSize) {\n const reverseExpr = signalOrStringValue(reverse);\n const offsetExpr = signalOrStringValue(offset);\n const axisTranslateExpr = signalOrStringValue(axisTranslate);\n const minBandSizeExpr = signalOrStringValue(minBandSize);\n const sign = isEnd ? '' : '-';\n const spacingAndSizeOffset = minBandSize\n ? `(${bandSizeExpr} < ${minBandSizeExpr} ? ${sign}0.5 * (${minBandSizeExpr} - (${bandSizeExpr})) : ${spacingOffset})`\n : spacingOffset;\n const t = axisTranslateExpr ? `${axisTranslateExpr} + ` : '';\n const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : '';\n const o = offsetExpr ? `(${offsetExpr} + ${spacingAndSizeOffset})` : spacingAndSizeOffset;\n return {\n signal: t + r + o\n };\n }\n else {\n offset = offset || 0;\n return axisTranslate + (reverse ? -offset - spacingOffset : +offset + spacingOffset);\n }\n}\nfunction rectBinPosition({ fieldDef, fieldDef2, channel, model }) {\n const { config, markDef, encoding } = model;\n const scale = model.getScaleComponent(channel);\n const scaleName = model.scaleName(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n const reverse = scale.get('reverse');\n const bandSize = getBandSize({ channel, fieldDef, markDef, config, scaleType });\n const axis = model.component.axes[channel]?.[0];\n const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5\n const spacing = isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) ?? 0 : 0;\n const channel2 = getSecondaryRangeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n const vgChannel2 = getVgPositionChannel(channel2);\n const minBandSize = getMarkConfig('minBandSize', markDef, config);\n const { offset } = positionOffset({ channel, markDef, encoding, model, bandPosition: 0 });\n const { offset: offset2 } = positionOffset({ channel: channel2, markDef, encoding, model, bandPosition: 0 });\n const bandSizeExpr = ref.binSizeExpr({ fieldDef, scaleName });\n const binSpacingOffset = getBinSpacing(channel, spacing, reverse, axisTranslate, offset, minBandSize, bandSizeExpr);\n const binSpacingOffset2 = getBinSpacing(channel2, spacing, reverse, axisTranslate, offset2 ?? offset, minBandSize, bandSizeExpr);\n const bandPositionForBandSize = isSignalRef(bandSize)\n ? { signal: `(1-${bandSize.signal})/2` }\n : isRelativeBandSize(bandSize)\n ? (1 - bandSize.band) / 2\n : 0.5;\n const bandPosition = getBandPosition({ fieldDef, fieldDef2, markDef, config });\n if (isBinning(fieldDef.bin) || fieldDef.timeUnit) {\n const useRectOffsetField = fieldDef.timeUnit && bandPosition !== 0.5;\n return {\n [vgChannel2]: rectBinRef({\n fieldDef,\n scaleName,\n bandPosition: bandPositionForBandSize,\n offset: binSpacingOffset2,\n useRectOffsetField\n }),\n [vgChannel]: rectBinRef({\n fieldDef,\n scaleName,\n bandPosition: isSignalRef(bandPositionForBandSize)\n ? { signal: `1-${bandPositionForBandSize.signal}` }\n : 1 - bandPositionForBandSize,\n offset: binSpacingOffset,\n useRectOffsetField\n })\n };\n }\n else if (isBinned(fieldDef.bin)) {\n const startRef = ref.valueRefForFieldOrDatumDef(fieldDef, scaleName, {}, { offset: binSpacingOffset2 });\n if (isFieldDef(fieldDef2)) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: ref.valueRefForFieldOrDatumDef(fieldDef2, scaleName, {}, { offset: binSpacingOffset })\n };\n }\n else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: {\n signal: `scale(\"${scaleName}\", ${vgField(fieldDef, { expr: 'datum' })} + ${fieldDef.bin.step})`,\n offset: binSpacingOffset\n }\n };\n }\n }\n log.warn(log.message.channelRequiredForBinned(channel2));\n return undefined;\n}\n/**\n * Value Ref for binned fields\n */\nfunction rectBinRef({ fieldDef, scaleName, bandPosition, offset, useRectOffsetField }) {\n return ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: fieldDef,\n bandPosition,\n offset,\n ...(useRectOffsetField\n ? {\n startSuffix: OFFSETTED_RECT_START_SUFFIX,\n endSuffix: OFFSETTED_RECT_END_SUFFIX\n }\n : {})\n });\n}\n//# sourceMappingURL=position-rect.js.map","import { array } from 'vega-util';\nimport { SCALE_CHANNELS } from '../../../channel';\nimport { isPathMark } from '../../../mark';\nimport { hasContinuousDomain } from '../../../scale';\nimport { keys } from '../../../util';\nimport { VG_MARK_CONFIGS } from '../../../vega.schema';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nimport { aria } from './aria';\nimport { color } from './color';\nimport { nonPosition } from './nonposition';\nimport { text } from './text';\nimport { tooltip } from './tooltip';\nimport { fieldInvalidPredicate } from './valueref';\nimport { zindex } from './zindex';\nexport { color } from './color';\nexport { wrapCondition } from './conditional';\nexport { nonPosition } from './nonposition';\nexport { pointPosition } from './position-point';\nexport { pointOrRangePosition, rangePosition } from './position-range';\nexport { rectPosition } from './position-rect';\nexport { text } from './text';\nexport { tooltip } from './tooltip';\nconst ALWAYS_IGNORE = new Set(['aria', 'width', 'height']);\nexport function baseEncodeEntry(model, ignore) {\n const { fill = undefined, stroke = undefined } = ignore.color === 'include' ? color(model) : {};\n return {\n ...markDefProperties(model.markDef, ignore),\n ...wrapAllFieldsInvalid(model, 'fill', fill),\n ...wrapAllFieldsInvalid(model, 'stroke', stroke),\n ...nonPosition('opacity', model),\n ...nonPosition('fillOpacity', model),\n ...nonPosition('strokeOpacity', model),\n ...nonPosition('strokeWidth', model),\n ...nonPosition('strokeDash', model),\n ...zindex(model),\n ...tooltip(model),\n ...text(model, 'href'),\n ...aria(model)\n };\n}\n// TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987\nfunction wrapAllFieldsInvalid(model, channel, valueRef) {\n const { config, mark, markDef } = model;\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid === 'hide' && valueRef && !isPathMark(mark)) {\n // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains.\n // For path marks, we will use \"defined\" property and skip these values instead.\n const test = allFieldsInvalidPredicate(model, { invalid: true, channels: SCALE_CHANNELS });\n if (test) {\n return {\n [channel]: [\n // prepend the invalid case\n // TODO: support custom value\n { test, value: null },\n ...array(valueRef)\n ]\n };\n }\n }\n return valueRef ? { [channel]: valueRef } : {};\n}\nfunction markDefProperties(mark, ignore) {\n return VG_MARK_CONFIGS.reduce((m, prop) => {\n if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') {\n m[prop] = signalOrValueRef(mark[prop]);\n }\n return m;\n }, {});\n}\nfunction allFieldsInvalidPredicate(model, { invalid = false, channels }) {\n const filterIndex = channels.reduce((aggregator, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, { expr: 'datum' });\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\n//# sourceMappingURL=base.js.map","import { POSITION_SCALE_CHANNELS } from '../../../channel';\nimport { hasContinuousDomain } from '../../../scale';\nimport { keys } from '../../../util';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../../common';\nimport { fieldInvalidPredicate } from './valueref';\nexport function defined(model) {\n const { config, markDef } = model;\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid) {\n const signal = allFieldsInvalidPredicate(model, { channels: POSITION_SCALE_CHANNELS });\n if (signal) {\n return { defined: { signal } };\n }\n }\n return {};\n}\nfunction allFieldsInvalidPredicate(model, { invalid = false, channels }) {\n const filterIndex = channels.reduce((aggregator, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, { expr: 'datum', binSuffix: model.stack?.impute ? 'mid' : undefined });\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\nexport function valueIfDefined(prop, value) {\n if (value !== undefined) {\n return { [prop]: signalOrValueRef(value) };\n }\n return undefined;\n}\n//# sourceMappingURL=defined.js.map","import * as log from '../../log';\nimport { isPathMark } from '../../mark';\nimport { tooltip } from '../mark/encode';\nconst VORONOI = 'voronoi';\nconst nearest = {\n defined: selCmpt => {\n return selCmpt.type === 'point' && selCmpt.nearest;\n },\n parse: (model, selCmpt) => {\n // Scope selection events to the voronoi mark to prevent capturing\n // events that occur on the group mark (https://github.com/vega/vega/issues/2112).\n if (selCmpt.events) {\n for (const s of selCmpt.events) {\n s.markname = model.getName(VORONOI);\n }\n }\n },\n marks: (model, selCmpt, marks) => {\n const { x, y } = selCmpt.project.hasChannel;\n const markType = model.mark;\n if (isPathMark(markType)) {\n log.warn(log.message.nearestNotSupportForContinuous(markType));\n return marks;\n }\n const cellDef = {\n name: model.getName(VORONOI),\n type: 'path',\n interactive: true,\n from: { data: model.getName('marks') },\n encode: {\n update: {\n fill: { value: 'transparent' },\n strokeWidth: { value: 0.35 },\n stroke: { value: 'transparent' },\n isVoronoi: { value: true },\n ...tooltip(model, { reactiveGeom: true })\n }\n },\n transform: [\n {\n type: 'voronoi',\n x: { expr: x || !y ? 'datum.datum.x || 0' : '0' },\n y: { expr: y || !x ? 'datum.datum.y || 0' : '0' },\n size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')]\n }\n ]\n };\n let index = 0;\n let exists = false;\n marks.forEach((mark, i) => {\n const name = mark.name ?? '';\n if (name === model.component.mark[0].name) {\n index = i;\n }\n else if (name.indexOf(VORONOI) >= 0) {\n exists = true;\n }\n });\n if (!exists) {\n marks.splice(index + 1, 0, cellDef);\n }\n return marks;\n }\n};\nexport default nearest;\n//# sourceMappingURL=nearest.js.map","import { stringValue } from 'vega-util';\nimport { disableDirectManipulation, TUPLE } from '.';\nimport { varName } from '../../util';\nimport { assembleInit } from './assemble';\nimport nearest from './nearest';\nimport { TUPLE_FIELDS } from './project';\nimport { isLegendBinding } from '../../selection';\nconst inputBindings = {\n defined: selCmpt => {\n return (selCmpt.type === 'point' &&\n selCmpt.resolve === 'global' &&\n selCmpt.bind &&\n selCmpt.bind !== 'scales' &&\n !isLegendBinding(selCmpt.bind));\n },\n parse: (model, selCmpt, selDef) => disableDirectManipulation(selCmpt, selDef),\n topLevelSignals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const bind = selCmpt.bind;\n const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value).\n const datum = nearest.defined(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum';\n proj.items.forEach((p, i) => {\n const sgname = varName(`${name}_${p.field}`);\n const hasSignal = signals.filter(s => s.name === sgname);\n if (!hasSignal.length) {\n signals.unshift({\n name: sgname,\n ...(init ? { init: assembleInit(init[i]) } : { value: null }),\n on: selCmpt.events\n ? [\n {\n events: selCmpt.events,\n update: `datum && item().mark.marktype !== 'group' ? ${datum}[${stringValue(p.field)}] : null`\n }\n ]\n : [],\n bind: bind[p.field] ?? bind[p.channel] ?? bind\n });\n }\n });\n return signals;\n },\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const signal = signals.filter(s => s.name === name + TUPLE)[0];\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.map(p => varName(`${name}_${p.field}`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n if (values.length) {\n signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n }\n delete signal.value;\n delete signal.on;\n return signals;\n }\n};\nexport default inputBindings;\n//# sourceMappingURL=inputs.js.map","import { TUPLE, unitName } from '.';\nexport const TOGGLE = '_toggle';\nconst toggle = {\n defined: selCmpt => {\n return selCmpt.type === 'point' && !!selCmpt.toggle;\n },\n signals: (model, selCmpt, signals) => {\n return signals.concat({\n name: selCmpt.name + TOGGLE,\n value: false,\n on: [{ events: selCmpt.events, update: selCmpt.toggle }]\n });\n },\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n const signal = selCmpt.name + TOGGLE;\n return (`${signal} ? null : ${tpl}, ` +\n (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) +\n `${signal} ? ${tpl} : null`);\n }\n};\nexport default toggle;\n//# sourceMappingURL=toggle.js.map","import { parseSelector } from 'vega-event-selector';\nimport { isString } from 'vega-util';\nimport { TUPLE } from '.';\nimport { varName } from '../../util';\nimport inputBindings from './inputs';\nimport toggle, { TOGGLE } from './toggle';\nconst clear = {\n defined: selCmpt => {\n return selCmpt.clear !== undefined && selCmpt.clear !== false;\n },\n parse: (model, selCmpt) => {\n if (selCmpt.clear) {\n selCmpt.clear = isString(selCmpt.clear) ? parseSelector(selCmpt.clear, 'view') : selCmpt.clear;\n }\n },\n topLevelSignals: (model, selCmpt, signals) => {\n if (inputBindings.defined(selCmpt)) {\n for (const proj of selCmpt.project.items) {\n const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`));\n if (idx !== -1) {\n signals[idx].on.push({ events: selCmpt.clear, update: 'null' });\n }\n }\n }\n return signals;\n },\n signals: (model, selCmpt, signals) => {\n function addClear(idx, update) {\n if (idx !== -1 && signals[idx].on) {\n signals[idx].on.push({ events: selCmpt.clear, update });\n }\n }\n // Be as minimalist as possible when adding clear triggers to minimize dataflow execution.\n if (selCmpt.type === 'interval') {\n for (const proj of selCmpt.project.items) {\n const vIdx = signals.findIndex(n => n.name === proj.signals.visual);\n addClear(vIdx, '[0, 0]');\n if (vIdx === -1) {\n const dIdx = signals.findIndex(n => n.name === proj.signals.data);\n addClear(dIdx, 'null');\n }\n }\n }\n else {\n let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE);\n addClear(tIdx, 'null');\n if (toggle.defined(selCmpt)) {\n tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE);\n addClear(tIdx, 'false');\n }\n }\n return signals;\n }\n};\nexport default clear;\n//# sourceMappingURL=clear.js.map","import { isObject } from 'vega';\nimport { parseSelector } from 'vega-event-selector';\nimport { array, isString } from 'vega-util';\nimport { disableDirectManipulation, TUPLE } from '.';\nimport * as log from '../../log';\nimport { isLegendBinding, isLegendStreamBinding, SELECTION_ID } from '../../selection';\nimport { duplicate, vals, varName } from '../../util';\nimport { TUPLE_FIELDS } from './project';\nimport { TOGGLE } from './toggle';\nconst legendBindings = {\n defined: selCmpt => {\n const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind);\n const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID;\n if (spec && !projLen) {\n log.warn(log.message.LEGEND_BINDINGS_MUST_HAVE_PROJECTION);\n }\n return spec && projLen;\n },\n parse: (model, selCmpt, selDef) => {\n // Allow legend items to be toggleable by default even though direct manipulation is disabled.\n const selDef_ = duplicate(selDef);\n selDef_.select = isString(selDef_.select)\n ? { type: selDef_.select, toggle: selCmpt.toggle }\n : { ...selDef_.select, toggle: selCmpt.toggle };\n disableDirectManipulation(selCmpt, selDef_);\n if (isObject(selDef.select) && (selDef.select.on || selDef.select.clear)) {\n const legendFilter = 'event.item && indexof(event.item.mark.role, \"legend\") < 0';\n for (const evt of selCmpt.events) {\n evt.filter = array(evt.filter ?? []);\n if (!evt.filter.includes(legendFilter)) {\n evt.filter.push(legendFilter);\n }\n }\n }\n const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click';\n const stream = isString(evt) ? parseSelector(evt, 'view') : array(evt);\n selCmpt.bind = { legend: { merge: stream } };\n },\n topLevelSignals: (model, selCmpt, signals) => {\n const selName = selCmpt.name;\n const stream = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend;\n const markName = (name) => (s) => {\n const ds = duplicate(s);\n ds.markname = name;\n return ds;\n };\n for (const proj of selCmpt.project.items) {\n if (!proj.hasLegend)\n continue;\n const prefix = `${varName(proj.field)}_legend`;\n const sgName = `${selName}_${prefix}`;\n const hasSignal = signals.filter(s => s.name === sgName);\n if (hasSignal.length === 0) {\n const events = stream.merge\n .map(markName(`${prefix}_symbols`))\n .concat(stream.merge.map(markName(`${prefix}_labels`)))\n .concat(stream.merge.map(markName(`${prefix}_entries`)));\n signals.unshift({\n name: sgName,\n ...(!selCmpt.init ? { value: null } : {}),\n on: [\n // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum.\n {\n events,\n update: 'isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value',\n force: true\n },\n { events: stream.merge, update: `!event.item || !datum ? null : ${sgName}`, force: true }\n ]\n });\n }\n }\n return signals;\n },\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const tuple = signals.find(s => s.name === name + TUPLE);\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n if (selCmpt.events && values.length > 0) {\n tuple.on.push({\n events: values.map(signal => ({ signal })),\n update\n });\n }\n else if (values.length > 0) {\n tuple.update = update;\n delete tuple.value;\n delete tuple.on;\n }\n const toggle = signals.find(s => s.name === name + TOGGLE);\n const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend;\n if (toggle) {\n if (!selCmpt.events)\n toggle.on[0].events = events;\n else\n toggle.on.push({ ...toggle.on[0], events });\n }\n return signals;\n }\n};\nexport default legendBindings;\nexport function parseInteractiveLegend(model, channel, legendCmpt) {\n const field = model.fieldDef(channel)?.field;\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const proj = selCmpt.project.hasField[field] ?? selCmpt.project.hasChannel[channel];\n if (proj && legendBindings.defined(selCmpt)) {\n const legendSelections = legendCmpt.get('selections') ?? [];\n legendSelections.push(selCmpt.name);\n legendCmpt.set('selections', legendSelections, false);\n proj.hasLegend = true;\n }\n }\n}\n//# sourceMappingURL=legends.js.map","import { parseSelector } from 'vega-event-selector';\nimport { X, Y } from '../../channel';\nimport { BRUSH as INTERVAL_BRUSH } from './interval';\nimport scalesCompiler, { domain } from './scales';\nconst ANCHOR = '_translate_anchor';\nconst DELTA = '_translate_delta';\nconst translate = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.translate;\n },\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const boundScales = scalesCompiler.defined(selCmpt);\n const anchor = name + ANCHOR;\n const { x, y } = selCmpt.project.hasChannel;\n let events = parseSelector(selCmpt.translate, 'scope');\n if (!boundScales) {\n events = events.map(e => ((e.between[0].markname = name + INTERVAL_BRUSH), e));\n }\n signals.push({\n name: anchor,\n value: {},\n on: [\n {\n events: events.map(e => e.between[0]),\n update: '{x: x(unit), y: y(unit)' +\n (x !== undefined ? `, extent_x: ${boundScales ? domain(model, X) : `slice(${x.signals.visual})`}` : '') +\n (y !== undefined ? `, extent_y: ${boundScales ? domain(model, Y) : `slice(${y.signals.visual})`}` : '') +\n '}'\n }\n ]\n }, {\n name: name + DELTA,\n value: {},\n on: [\n {\n events,\n update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}`\n }\n ]\n });\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n return signals;\n }\n};\nexport default translate;\nfunction onDelta(model, selCmpt, proj, size, signals) {\n const name = selCmpt.name;\n const anchor = name + ANCHOR;\n const delta = name + DELTA;\n const channel = proj.channel;\n const boundScales = scalesCompiler.defined(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt && scaleCmpt.get('type');\n const reversed = scaleCmpt && scaleCmpt.get('reverse'); // scale parsing sets this flag for fieldDef.sort\n const sign = !boundScales ? '' : channel === X ? (reversed ? '' : '-') : reversed ? '-' : '';\n const extent = `${anchor}.extent_${channel}`;\n const offset = `${sign}${delta}.${channel} / ${boundScales ? `${sizeSg}` : `span(${extent})`}`;\n const panFn = !boundScales || !scaleCmpt\n ? 'panLinear'\n : scaleType === 'log'\n ? 'panLog'\n : scaleType === 'symlog'\n ? 'panSymlog'\n : scaleType === 'pow'\n ? 'panPow'\n : 'panLinear';\n const arg = !boundScales\n ? ''\n : scaleType === 'pow'\n ? `, ${scaleCmpt.get('exponent') ?? 1}`\n : scaleType === 'symlog'\n ? `, ${scaleCmpt.get('constant') ?? 1}`\n : '';\n const update = `${panFn}(${extent}, ${offset}${arg})`;\n signal.on.push({\n events: { signal: delta },\n update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n//# sourceMappingURL=translate.js.map","import { parseSelector } from 'vega-event-selector';\nimport { stringValue } from 'vega-util';\nimport { X, Y } from '../../channel';\nimport { BRUSH as INTERVAL_BRUSH } from './interval';\nimport { default as scalesCompiler, domain } from './scales';\nconst ANCHOR = '_zoom_anchor';\nconst DELTA = '_zoom_delta';\nconst zoom = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.zoom;\n },\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const boundScales = scalesCompiler.defined(selCmpt);\n const delta = name + DELTA;\n const { x, y } = selCmpt.project.hasChannel;\n const sx = stringValue(model.scaleName(X));\n const sy = stringValue(model.scaleName(Y));\n let events = parseSelector(selCmpt.zoom, 'scope');\n if (!boundScales) {\n events = events.map(e => ((e.markname = name + INTERVAL_BRUSH), e));\n }\n signals.push({\n name: name + ANCHOR,\n on: [\n {\n events,\n update: !boundScales\n ? `{x: x(unit), y: y(unit)}`\n : '{' +\n [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : '']\n .filter(expr => expr)\n .join(', ') +\n '}'\n }\n ]\n }, {\n name: delta,\n on: [\n {\n events,\n force: true,\n update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))'\n }\n ]\n });\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n return signals;\n }\n};\nexport default zoom;\nfunction onDelta(model, selCmpt, proj, size, signals) {\n const name = selCmpt.name;\n const channel = proj.channel;\n const boundScales = scalesCompiler.defined(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt && scaleCmpt.get('type');\n const base = boundScales ? domain(model, channel) : signal.name;\n const delta = name + DELTA;\n const anchor = `${name}${ANCHOR}.${channel}`;\n const zoomFn = !boundScales || !scaleCmpt\n ? 'zoomLinear'\n : scaleType === 'log'\n ? 'zoomLog'\n : scaleType === 'symlog'\n ? 'zoomSymlog'\n : scaleType === 'pow'\n ? 'zoomPow'\n : 'zoomLinear';\n const arg = !boundScales\n ? ''\n : scaleType === 'pow'\n ? `, ${scaleCmpt.get('exponent') ?? 1}`\n : scaleType === 'symlog'\n ? `, ${scaleCmpt.get('constant') ?? 1}`\n : '';\n const update = `${zoomFn}(${base}, ${anchor}, ${delta}${arg})`;\n signal.on.push({\n events: { signal: delta },\n update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n//# sourceMappingURL=zoom.js.map","import { isString } from 'vega';\nimport { stringValue } from 'vega-util';\nimport { FACET_CHANNELS } from '../../channel';\nimport { vals } from '../../util';\nimport { isFacetModel } from '../model';\nimport interval from './interval';\nimport point from './point';\nimport clear from './clear';\nimport inputs from './inputs';\nimport nearest from './nearest';\nimport project from './project';\nimport scales from './scales';\nimport legends from './legends';\nimport toggle from './toggle';\nimport translate from './translate';\nimport zoom from './zoom';\nexport const STORE = '_store';\nexport const TUPLE = '_tuple';\nexport const MODIFY = '_modify';\nexport const SELECTION_DOMAIN = '_selection_domain_';\nexport const VL_SELECTION_RESOLVE = 'vlSelectionResolve';\n// Order matters for parsing and assembly.\nexport const selectionCompilers = [\n point,\n interval,\n project,\n toggle,\n // Bindings may disable direct manipulation.\n inputs,\n scales,\n legends,\n clear,\n translate,\n zoom,\n nearest\n];\nfunction getFacetModel(model) {\n let parent = model.parent;\n while (parent) {\n if (isFacetModel(parent))\n break;\n parent = parent.parent;\n }\n return parent;\n}\nexport function unitName(model, { escape } = { escape: true }) {\n let name = escape ? stringValue(model.name) : model.name;\n const facetModel = getFacetModel(model);\n if (facetModel) {\n const { facet } = facetModel;\n for (const channel of FACET_CHANNELS) {\n if (facet[channel]) {\n name += ` + '__facet_${channel}_' + (facet[${stringValue(facetModel.vgField(channel))}])`;\n }\n }\n }\n return name;\n}\nexport function requiresSelectionId(model) {\n return vals(model.component.selection ?? {}).reduce((identifier, selCmpt) => {\n return identifier || selCmpt.project.hasSelectionId;\n }, false);\n}\n// Binding a point selection to query widgets or legends disables default direct manipulation interaction.\n// A user can choose to re-enable it by explicitly specifying triggering input events.\nexport function disableDirectManipulation(selCmpt, selDef) {\n if (isString(selDef.select) || !selDef.select.on)\n delete selCmpt.events;\n if (isString(selDef.select) || !selDef.select.clear)\n delete selCmpt.clear;\n if (isString(selDef.select) || !selDef.select.toggle)\n delete selCmpt.toggle;\n}\n//# sourceMappingURL=index.js.map","import { parseExpression } from 'vega-expression';\nfunction getName(node) {\n const name = [];\n if (node.type === 'Identifier') {\n return [node.name];\n }\n if (node.type === 'Literal') {\n return [node.value];\n }\n if (node.type === 'MemberExpression') {\n name.push(...getName(node.object));\n name.push(...getName(node.property));\n }\n return name;\n}\nfunction startsWithDatum(node) {\n if (node.object.type === 'MemberExpression') {\n return startsWithDatum(node.object);\n }\n return node.object.name === 'datum';\n}\nexport function getDependentFields(expression) {\n const ast = parseExpression(expression);\n const dependents = new Set();\n // visit is missing in types https://github.com/vega/vega/issues/3298\n ast.visit((node) => {\n if (node.type === 'MemberExpression' && startsWithDatum(node)) {\n dependents.add(getName(node).slice(1).join('.'));\n }\n });\n return dependents;\n}\n//# sourceMappingURL=expressions.js.map","import { duplicate } from '../../util';\nimport { expression } from '../predicate';\nimport { DataFlowNode } from './dataflow';\nimport { getDependentFields } from './expressions';\nexport class FilterNode extends DataFlowNode {\n clone() {\n return new FilterNode(null, this.model, duplicate(this.filter));\n }\n constructor(parent, model, filter) {\n super(parent);\n this.model = model;\n this.filter = filter;\n // TODO: refactor this to not take a node and\n // then add a static function makeFromOperand and make the constructor take only an expression\n this.expr = expression(this.model, this.filter, this);\n this._dependentFields = getDependentFields(this.expr);\n }\n dependentFields() {\n return this._dependentFields;\n }\n producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n assemble() {\n return {\n type: 'filter',\n expr: this.expr\n };\n }\n hash() {\n return `Filter ${this.expr}`;\n }\n}\n//# sourceMappingURL=filter.js.map","import { parseSelector } from 'vega-event-selector';\nimport { array, isObject, isString, stringValue } from 'vega-util';\nimport { selectionCompilers, STORE } from '.';\nimport { warn } from '../../log';\nimport { duplicate, entries, replacePathInField, varName } from '../../util';\nimport { OutputNode } from '../data/dataflow';\nimport { FilterNode } from '../data/filter';\nimport { DataSourceType } from '../../data';\nexport function parseUnitSelection(model, selDefs) {\n const selCmpts = {};\n const selectionConfig = model.config.selection;\n if (!selDefs || !selDefs.length)\n return selCmpts;\n for (const def of selDefs) {\n const name = varName(def.name);\n const selDef = def.select;\n const type = isString(selDef) ? selDef : selDef.type;\n const defaults = isObject(selDef) ? duplicate(selDef) : { type };\n // Set default values from config if a property hasn't been specified,\n // or if it is true. E.g., \"translate\": true should use the default\n // event handlers for translate. However, true may be a valid value for\n // a property (e.g., \"nearest\": true).\n const cfg = selectionConfig[type];\n for (const key in cfg) {\n // Project transform applies its defaults.\n if (key === 'fields' || key === 'encodings') {\n continue;\n }\n if (key === 'mark') {\n defaults[key] = { ...cfg[key], ...defaults[key] };\n }\n if (defaults[key] === undefined || defaults[key] === true) {\n defaults[key] = duplicate(cfg[key] ?? defaults[key]);\n }\n }\n const selCmpt = (selCmpts[name] = {\n ...defaults,\n name,\n type,\n init: def.value,\n bind: def.bind,\n events: isString(defaults.on) ? parseSelector(defaults.on, 'scope') : array(duplicate(defaults.on))\n });\n const def_ = duplicate(def); // defensive copy to prevent compilers from causing side effects\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.parse) {\n c.parse(model, selCmpt, def_);\n }\n }\n }\n return selCmpts;\n}\nexport function parseSelectionPredicate(model, pred, dfnode, datum = 'datum') {\n const name = isString(pred) ? pred : pred.param;\n const vname = varName(name);\n const store = stringValue(vname + STORE);\n let selCmpt;\n try {\n selCmpt = model.getSelectionComponent(vname, name);\n }\n catch (e) {\n // If a selection isn't found, treat as a variable parameter and coerce to boolean.\n return `!!${vname}`;\n }\n if (selCmpt.project.timeUnit) {\n const child = dfnode ?? model.component.data.raw;\n const tunode = selCmpt.project.timeUnit.clone();\n if (child.parent) {\n tunode.insertAsParentOf(child);\n }\n else {\n child.parent = tunode;\n }\n }\n const fn = selCmpt.project.hasSelectionId ? 'vlSelectionIdTest(' : 'vlSelectionTest(';\n const resolve = selCmpt.resolve === 'global' ? ')' : `, ${stringValue(selCmpt.resolve)})`;\n const test = `${fn}${store}, ${datum}${resolve}`;\n const length = `length(data(${store}))`;\n return pred.empty === false ? `${length} && ${test}` : `!${length} || ${test}`;\n}\nexport function parseSelectionExtent(model, name, extent) {\n const vname = varName(name);\n const encoding = extent['encoding'];\n let field = extent['field'];\n let selCmpt;\n try {\n selCmpt = model.getSelectionComponent(vname, name);\n }\n catch (e) {\n // If a selection isn't found, treat it as a variable parameter.\n return vname;\n }\n if (!encoding && !field) {\n field = selCmpt.project.items[0].field;\n if (selCmpt.project.items.length > 1) {\n warn('A \"field\" or \"encoding\" must be specified when using a selection as a scale domain. ' +\n `Using \"field\": ${stringValue(field)}.`);\n }\n }\n else if (encoding && !field) {\n const encodings = selCmpt.project.items.filter(p => p.channel === encoding);\n if (!encodings.length || encodings.length > 1) {\n field = selCmpt.project.items[0].field;\n warn((!encodings.length ? 'No ' : 'Multiple ') +\n `matching ${stringValue(encoding)} encoding found for selection ${stringValue(extent.param)}. ` +\n `Using \"field\": ${stringValue(field)}.`);\n }\n else {\n field = encodings[0].field;\n }\n }\n return `${selCmpt.name}[${stringValue(replacePathInField(field))}]`;\n}\nexport function materializeSelections(model, main) {\n for (const [selection, selCmpt] of entries(model.component.selection ?? {})) {\n const lookupName = model.getName(`lookup_${selection}`);\n model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(new FilterNode(main, model, { param: selection }), lookupName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts);\n }\n}\n//# sourceMappingURL=parse.js.map","import { isString } from 'vega-util';\nimport { fieldFilterExpression, isSelectionPredicate } from '../predicate';\nimport { logicalExpr } from '../util';\nimport { parseSelectionPredicate } from './selection/parse';\n/**\n * Converts a predicate into an expression.\n */\n// model is only used for selection filters.\nexport function expression(model, filterOp, node) {\n return logicalExpr(filterOp, (predicate) => {\n if (isString(predicate)) {\n return predicate;\n }\n else if (isSelectionPredicate(predicate)) {\n return parseSelectionPredicate(model, predicate, node);\n }\n else {\n // Filter Object\n return fieldFilterExpression(predicate);\n }\n });\n}\n//# sourceMappingURL=predicate.js.map","import { array, isArray } from 'vega-util';\nimport { AXIS_PARTS, AXIS_PROPERTY_TYPE, CONDITIONAL_AXIS_PROP_INDEX, isConditionalAxisValue } from '../../axis';\nimport { POSITION_SCALE_CHANNELS } from '../../channel';\nimport { defaultTitle } from '../../channeldef';\nimport { isText } from '../../title';\nimport { contains, getFirstDefined, isEmpty, replaceAll } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { exprFromValueRefOrSignalRef } from '../common';\nimport { expression } from '../predicate';\nfunction assembleTitle(title, config) {\n if (!title) {\n return undefined;\n }\n if (isArray(title) && !isText(title)) {\n return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', ');\n }\n return title;\n}\nfunction setAxisEncode(axis, part, vgProp, vgRef) {\n var _a, _b;\n axis.encode ?? (axis.encode = {});\n (_a = axis.encode)[part] ?? (_a[part] = {});\n (_b = axis.encode[part]).update ?? (_b.update = {});\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n axis.encode[part].update[vgProp] = vgRef;\n}\nexport function assembleAxis(axisCmpt, kind, config, opt = { header: false }) {\n const { disable, orient, scale, labelExpr, title, zindex, ...axis } = axisCmpt.combine();\n if (disable) {\n return undefined;\n }\n for (const prop in axis) {\n const propType = AXIS_PROPERTY_TYPE[prop];\n const propValue = axis[prop];\n if (propType && propType !== kind && propType !== 'both') {\n // Remove properties that are not valid for this kind of axis\n delete axis[prop];\n }\n else if (isConditionalAxisValue(propValue)) {\n // deal with conditional axis value\n const { condition, ...valueOrSignalRef } = propValue;\n const conditions = array(condition);\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const { vgProp, part } = propIndex;\n // If there is a corresponding Vega property for the channel,\n // use Vega's custom axis encoding and delete the original axis property to avoid conflicts\n const vgRef = [\n ...conditions.map(c => {\n const { test, ...valueOrSignalCRef } = c;\n return {\n test: expression(null, test),\n ...valueOrSignalCRef\n };\n }),\n valueOrSignalRef\n ];\n setAxisEncode(axis, part, vgProp, vgRef);\n delete axis[prop];\n }\n else if (propIndex === null) {\n // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead.\n const signalRef = {\n signal: conditions\n .map(c => {\n const { test, ...valueOrSignalCRef } = c;\n return `${expression(null, test)} ? ${exprFromValueRefOrSignalRef(valueOrSignalCRef)} : `;\n })\n .join('') + exprFromValueRefOrSignalRef(valueOrSignalRef)\n };\n axis[prop] = signalRef;\n }\n }\n else if (isSignalRef(propValue)) {\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const { vgProp, part } = propIndex;\n setAxisEncode(axis, part, vgProp, propValue);\n delete axis[prop];\n } // else do nothing since the property already supports signal\n }\n // Do not pass labelAlign/Baseline = null to Vega since it won't pass the schema\n // Note that we need to use null so the default labelAlign is preserved.\n if (contains(['labelAlign', 'labelBaseline'], prop) && axis[prop] === null) {\n delete axis[prop];\n }\n }\n if (kind === 'grid') {\n if (!axis.grid) {\n return undefined;\n }\n // Remove unnecessary encode block\n if (axis.encode) {\n // Only need to keep encode block for grid\n const { grid } = axis.encode;\n axis.encode = {\n ...(grid ? { grid } : {})\n };\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n return {\n scale,\n orient,\n ...axis,\n domain: false,\n labels: false,\n aria: false,\n // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent`\n // would not affect gridAxis\n maxExtent: 0,\n minExtent: 0,\n ticks: false,\n zindex: getFirstDefined(zindex, 0) // put grid behind marks by default\n };\n }\n else {\n // kind === 'main'\n if (!opt.header && axisCmpt.mainExtracted) {\n // if mainExtracted has been extracted to a separate facet\n return undefined;\n }\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (axis.encode?.labels?.update && isSignalRef(axis.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal);\n }\n setAxisEncode(axis, 'labels', 'text', { signal: expr });\n }\n if (axis.labelAlign === null) {\n delete axis.labelAlign;\n }\n // Remove unnecessary encode block\n if (axis.encode) {\n for (const part of AXIS_PARTS) {\n if (!axisCmpt.hasAxisPart(part)) {\n delete axis.encode[part];\n }\n }\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n const titleString = assembleTitle(title, config);\n return {\n scale,\n orient,\n grid: false,\n ...(titleString ? { title: titleString } : {}),\n ...axis,\n ...(config.aria === false ? { aria: false } : {}),\n zindex: getFirstDefined(zindex, 0) // put axis line above marks by default\n };\n }\n}\n/**\n * Add axis signals so grid line works correctly\n * (Fix https://github.com/vega/vega-lite/issues/4226)\n */\nexport function assembleAxisSignals(model) {\n const { axes } = model.component;\n const signals = [];\n for (const channel of POSITION_SCALE_CHANNELS) {\n if (axes[channel]) {\n for (const axis of axes[channel]) {\n if (!axis.get('disable') && !axis.get('gridScale')) {\n // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width.\n const sizeType = channel === 'x' ? 'height' : 'width';\n const update = model.getSizeSignalRef(sizeType).signal;\n if (sizeType !== update) {\n signals.push({\n name: sizeType,\n update\n });\n }\n }\n }\n }\n }\n return signals;\n}\nexport function assembleAxes(axisComponents, config) {\n const { x = [], y = [] } = axisComponents;\n return [\n ...x.map(a => assembleAxis(a, 'grid', config)),\n ...y.map(a => assembleAxis(a, 'grid', config)),\n ...x.map(a => assembleAxis(a, 'main', config)),\n ...y.map(a => assembleAxis(a, 'main', config))\n ].filter(a => a); // filter undefined\n}\n//# sourceMappingURL=assemble.js.map","import { array } from 'vega-util';\nimport { isQuantitative } from '../../scale';\nimport { keys, titleCase } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { getStyleConfig, signalOrStringValue } from '../common';\nfunction getAxisConfigFromConfigTypes(configTypes, config, channel, orient) {\n // TODO: add special casing to add conditional value based on orient signal\n return Object.assign.apply(null, [\n {},\n ...configTypes.map(configType => {\n if (configType === 'axisOrient') {\n const orient1 = channel === 'x' ? 'bottom' : 'left';\n const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {};\n const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {};\n const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]);\n const conditionalOrientAxisConfig = {};\n for (const prop of props.values()) {\n conditionalOrientAxisConfig[prop] = {\n // orient is surely signal in this case\n signal: `${orient['signal']} === \"${orient1}\" ? ${signalOrStringValue(orientConfig1[prop])} : ${signalOrStringValue(orientConfig2[prop])}`\n };\n }\n return conditionalOrientAxisConfig;\n }\n return config[configType];\n })\n ]);\n}\nexport function getAxisConfigs(channel, scaleType, orient, config) {\n const typeBasedConfigTypes = scaleType === 'band'\n ? ['axisDiscrete', 'axisBand']\n : scaleType === 'point'\n ? ['axisDiscrete', 'axisPoint']\n : isQuantitative(scaleType)\n ? ['axisQuantitative']\n : scaleType === 'time' || scaleType === 'utc'\n ? ['axisTemporal']\n : [];\n const axisChannel = channel === 'x' ? 'axisX' : 'axisY';\n const axisOrient = isSignalRef(orient) ? 'axisOrient' : `axis${titleCase(orient)}`; // axisTop, axisBottom, ...\n const vlOnlyConfigTypes = [\n // technically Vega does have axisBand, but if we make another separation here,\n // it will further introduce complexity in the code\n ...typeBasedConfigTypes,\n ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4))\n ];\n const vgConfigTypes = ['axis', axisOrient, axisChannel];\n return {\n vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient),\n vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient),\n axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config)\n };\n}\nexport function getAxisConfigStyle(axisConfigTypes, config) {\n const toMerge = [{}];\n for (const configType of axisConfigTypes) {\n // TODO: add special casing to add conditional value based on orient signal\n let style = config[configType]?.style;\n if (style) {\n style = array(style);\n for (const s of style) {\n toMerge.push(config.style[s]);\n }\n }\n }\n return Object.assign.apply(null, toMerge);\n}\nexport function getAxisConfig(property, styleConfigIndex, style, axisConfigs = {}) {\n const styleConfig = getStyleConfig(property, style, styleConfigIndex);\n if (styleConfig !== undefined) {\n return {\n configFrom: 'style',\n configValue: styleConfig\n };\n }\n for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) {\n if (axisConfigs[configFrom]?.[property] !== undefined) {\n return { configFrom, configValue: axisConfigs[configFrom][property] };\n }\n }\n return {};\n}\n//# sourceMappingURL=config.js.map","import { isArray, isObject } from 'vega-util';\nimport { isBinned, isBinning } from '../../bin';\nimport { X } from '../../channel';\nimport { isDiscrete, isFieldDef, toFieldDefBase, valueArray } from '../../channeldef';\nimport { hasDiscreteDomain } from '../../scale';\nimport { durationExpr, normalizeTimeUnit } from '../../timeunit';\nimport { NOMINAL, ORDINAL } from '../../type';\nimport { contains, normalizeAngle } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { mergeTitle, mergeTitleFieldDefs } from '../common';\nimport { getAxisConfig } from './config';\nexport const axisRules = {\n scale: ({ model, channel }) => model.scaleName(channel),\n format: ({ format }) => format,\n formatType: ({ formatType }) => formatType,\n grid: ({ fieldOrDatumDef, axis, scaleType }) => axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef),\n gridScale: ({ model, channel }) => gridScale(model, channel),\n labelAlign: ({ axis, labelAngle, orient, channel }) => axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel),\n labelAngle: ({ labelAngle }) => labelAngle,\n labelBaseline: ({ axis, labelAngle, orient, channel }) => axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel),\n labelFlush: ({ axis, fieldOrDatumDef, channel }) => axis.labelFlush ?? defaultLabelFlush(fieldOrDatumDef.type, channel),\n labelOverlap: ({ axis, fieldOrDatumDef, scaleType }) => axis.labelOverlap ??\n defaultLabelOverlap(fieldOrDatumDef.type, scaleType, isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit, isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined),\n // we already calculate orient in parse\n orient: ({ orient }) => orient,\n tickCount: ({ channel, model, axis, fieldOrDatumDef, scaleType }) => {\n const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined;\n const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined;\n return axis.tickCount ?? defaultTickCount({ fieldOrDatumDef, scaleType, size, values: axis.values });\n },\n tickMinStep: defaultTickMinStep,\n title: ({ axis, model, channel }) => {\n if (axis.title !== undefined) {\n return axis.title;\n }\n const fieldDefTitle = getFieldDefTitle(model, channel);\n if (fieldDefTitle !== undefined) {\n return fieldDefTitle;\n }\n const fieldDef = model.typedFieldDef(channel);\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = model.fieldDef(channel2);\n // If title not specified, store base parts of fieldDef (and fieldDef2 if exists)\n return mergeTitleFieldDefs(fieldDef ? [toFieldDefBase(fieldDef)] : [], isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []);\n },\n values: ({ axis, fieldOrDatumDef }) => values(axis, fieldOrDatumDef),\n zindex: ({ axis, fieldOrDatumDef, mark }) => axis.zindex ?? defaultZindex(mark, fieldOrDatumDef)\n};\n// TODO: we need to refactor this method after we take care of config refactoring\n/**\n * Default rules for whether to show a grid should be shown for a channel.\n * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned\n */\nexport function defaultGrid(scaleType, fieldDef) {\n return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin) && !isBinned(fieldDef?.bin);\n}\nexport function gridScale(model, channel) {\n const gridChannel = channel === 'x' ? 'y' : 'x';\n if (model.getScaleComponent(gridChannel)) {\n return model.scaleName(gridChannel);\n }\n return undefined;\n}\nexport function getLabelAngle(fieldOrDatumDef, axis, channel, styleConfig, axisConfigs) {\n const labelAngle = axis?.labelAngle;\n // try axis value\n if (labelAngle !== undefined) {\n return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle);\n }\n else {\n // try axis config value\n const { configValue: angle } = getAxisConfig('labelAngle', styleConfig, axis?.style, axisConfigs);\n if (angle !== undefined) {\n return normalizeAngle(angle);\n }\n else {\n // get default value\n if (channel === X &&\n contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) &&\n !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)) {\n return 270;\n }\n // no default\n return undefined;\n }\n }\n}\nexport function normalizeAngleExpr(angle) {\n return `(((${angle.signal} % 360) + 360) % 360)`;\n}\nexport function defaultLabelBaseline(angle, orient, channel, alwaysIncludeMiddle) {\n if (angle !== undefined) {\n if (channel === 'x') {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === \"top\")` : orient === 'top';\n return {\n signal: `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? \"middle\" :` +\n `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? \"bottom\" : \"top\"`\n };\n }\n if ((45 < angle && angle < 135) || (225 < angle && angle < 315)) {\n return 'middle';\n }\n if (isSignalRef(orient)) {\n const op = angle <= 45 || 315 <= angle ? '===' : '!==';\n return { signal: `${orient.signal} ${op} \"top\" ? \"bottom\" : \"top\"` };\n }\n return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top';\n }\n else {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === \"left\")` : orient === 'left';\n const middle = alwaysIncludeMiddle ? '\"middle\"' : 'null';\n return {\n signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? \"top\" : \"bottom\"`\n };\n }\n if (angle <= 45 || 315 <= angle || (135 <= angle && angle <= 225)) {\n return alwaysIncludeMiddle ? 'middle' : null;\n }\n if (isSignalRef(orient)) {\n const op = 45 <= angle && angle <= 135 ? '===' : '!==';\n return { signal: `${orient.signal} ${op} \"left\" ? \"top\" : \"bottom\"` };\n }\n return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom';\n }\n }\n return undefined;\n}\nexport function defaultLabelAlign(angle, orient, channel) {\n if (angle === undefined) {\n return undefined;\n }\n const isX = channel === 'x';\n const startAngle = isX ? 0 : 90;\n const mainOrient = isX ? 'bottom' : 'left';\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === \"${mainOrient}\")` : orient === mainOrient;\n return {\n signal: `(${startAngle ? `(${a} + 90)` : a} % 180 === 0) ? ${isX ? null : '\"center\"'} :` +\n `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n if ((angle + startAngle) % 180 === 0) {\n // For bottom, use default label align so label flush still works\n return isX ? null : 'center';\n }\n if (isSignalRef(orient)) {\n const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!==';\n const orientIsMain = `${orient.signal} ${op} \"${mainOrient}\"`;\n return {\n signal: `${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) {\n return 'left';\n }\n return 'right';\n}\nexport function defaultLabelFlush(type, channel) {\n if (channel === 'x' && contains(['quantitative', 'temporal'], type)) {\n return true;\n }\n return undefined;\n}\nexport function defaultLabelOverlap(type, scaleType, hasTimeUnit, sort) {\n // do not prevent overlap for nominal data because there is no way to infer what the missing labels are\n if ((hasTimeUnit && !isObject(sort)) || (type !== 'nominal' && type !== 'ordinal')) {\n if (scaleType === 'log' || scaleType === 'symlog') {\n return 'greedy';\n }\n return true;\n }\n return undefined;\n}\nexport function defaultOrient(channel) {\n return channel === 'x' ? 'bottom' : 'left';\n}\nexport function defaultTickCount({ fieldOrDatumDef, scaleType, size, values: vals }) {\n if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') {\n if (isFieldDef(fieldOrDatumDef)) {\n if (isBinning(fieldOrDatumDef.bin)) {\n // for binned data, we don't want more ticks than maxbins\n return { signal: `ceil(${size.signal}/10)` };\n }\n if (fieldOrDatumDef.timeUnit &&\n contains(['month', 'hours', 'day', 'quarter'], normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit)) {\n return undefined;\n }\n }\n return { signal: `ceil(${size.signal}/40)` };\n }\n return undefined;\n}\nexport function defaultTickMinStep({ format, fieldOrDatumDef }) {\n if (format === 'd') {\n return 1;\n }\n if (isFieldDef(fieldOrDatumDef)) {\n const { timeUnit } = fieldOrDatumDef;\n if (timeUnit) {\n const signal = durationExpr(timeUnit);\n if (signal) {\n return { signal };\n }\n }\n }\n return undefined;\n}\nexport function getFieldDefTitle(model, channel) {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef = model.fieldDef(channel);\n const fieldDef2 = model.fieldDef(channel2);\n const title1 = fieldDef ? fieldDef.title : undefined;\n const title2 = fieldDef2 ? fieldDef2.title : undefined;\n if (title1 && title2) {\n return mergeTitle(title1, title2);\n }\n else if (title1) {\n return title1;\n }\n else if (title2) {\n return title2;\n }\n else if (title1 !== undefined) {\n // falsy value to disable config\n return title1;\n }\n else if (title2 !== undefined) {\n // falsy value to disable config\n return title2;\n }\n return undefined;\n}\nexport function values(axis, fieldOrDatumDef) {\n const vals = axis.values;\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n }\n else if (isSignalRef(vals)) {\n return vals;\n }\n return undefined;\n}\nexport function defaultZindex(mark, fieldDef) {\n if (mark === 'rect' && isDiscrete(fieldDef)) {\n return 1;\n }\n return 0;\n}\n//# sourceMappingURL=properties.js.map","import { isScaleFieldDef, vgField } from '../../channeldef';\nimport { fieldFilterExpression } from '../../predicate';\nimport { isSortArray } from '../../sort';\nimport { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nimport { getDependentFields } from './expressions';\nexport class CalculateNode extends DataFlowNode {\n clone() {\n return new CalculateNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this._dependentFields = getDependentFields(this.transform.calculate);\n }\n static parseAllForSortIndex(parent, model) {\n // get all the encoding with sort fields from model\n model.forEachFieldDef((fieldDef, channel) => {\n if (!isScaleFieldDef(fieldDef)) {\n return;\n }\n if (isSortArray(fieldDef.sort)) {\n const { field, timeUnit } = fieldDef;\n const sort = fieldDef.sort;\n // generate `datum[\"a\"] === val0 ? 0 : datum[\"a\"] === val1 ? 1 : ... : n` via FieldEqualPredicate\n const calculate = sort\n .map((sortValue, i) => {\n return `${fieldFilterExpression({ field, timeUnit, equal: sortValue })} ? ${i} : `;\n })\n .join('') + sort.length;\n parent = new CalculateNode(parent, {\n calculate,\n as: sortArrayIndexField(fieldDef, channel, { forAs: true })\n });\n }\n });\n return parent;\n }\n producedFields() {\n return new Set([this.transform.as]);\n }\n dependentFields() {\n return this._dependentFields;\n }\n assemble() {\n return {\n type: 'formula',\n expr: this.transform.calculate,\n as: this.transform.as\n };\n }\n hash() {\n return `Calculate ${hash(this.transform)}`;\n }\n}\nexport function sortArrayIndexField(fieldDef, channel, opt) {\n return vgField(fieldDef, { prefix: channel, suffix: 'sort_index', ...(opt ?? {}) });\n}\n//# sourceMappingURL=calculate.js.map","import { contains, getFirstDefined } from '../../util';\n/**\n * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet.\n */\nexport function getHeaderChannel(channel, orient) {\n if (contains(['top', 'bottom'], orient)) {\n return 'column';\n }\n else if (contains(['left', 'right'], orient)) {\n return 'row';\n }\n return channel === 'row' ? 'row' : 'column';\n}\nexport function getHeaderProperty(prop, header, config, channel) {\n const headerSpecificConfig = channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet;\n return getFirstDefined((header || {})[prop], headerSpecificConfig[prop], config.header[prop]);\n}\nexport function getHeaderProperties(properties, header, config, channel) {\n const props = {};\n for (const prop of properties) {\n const value = getHeaderProperty(prop, header || {}, config, channel);\n if (value !== undefined) {\n props[prop] = value;\n }\n }\n return props;\n}\n//# sourceMappingURL=common.js.map","export const HEADER_CHANNELS = ['row', 'column'];\nexport const HEADER_TYPES = ['header', 'footer'];\n//# sourceMappingURL=component.js.map","/**\n * Utility for generating row / column headers\n */\nimport { isArray } from 'vega-util';\nimport { FACET_CHANNELS } from '../../channel';\nimport { vgField } from '../../channeldef';\nimport { HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP } from '../../header';\nimport { isSortField } from '../../sort';\nimport { isFacetMapping } from '../../spec/facet';\nimport { contains, isEmpty, normalizeAngle, replaceAll } from '../../util';\nimport { defaultLabelAlign, defaultLabelBaseline } from '../axis/properties';\nimport { sortArrayIndexField } from '../data/calculate';\nimport { formatSignalRef } from '../format';\nimport { isFacetModel } from '../model';\nimport { getHeaderChannel, getHeaderProperties, getHeaderProperty } from './common';\nimport { HEADER_TYPES } from './component';\n// TODO: rename to assembleHeaderTitleGroup\nexport function assembleTitleGroup(model, channel) {\n const title = model.component.layoutHeaders[channel].title;\n const config = model.config ? model.config : undefined;\n const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef\n ? model.component.layoutHeaders[channel].facetFieldDef\n : undefined;\n const { titleAnchor, titleAngle: ta, titleOrient } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef.header, config, channel);\n const headerChannel = getHeaderChannel(channel, titleOrient);\n const titleAngle = normalizeAngle(ta);\n return {\n name: `${channel}-title`,\n type: 'group',\n role: `${headerChannel}-title`,\n title: {\n text: title,\n ...(channel === 'row' ? { orient: 'left' } : {}),\n style: 'guide-title',\n ...defaultHeaderGuideBaseline(titleAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP)\n }\n };\n}\nexport function defaultHeaderGuideAlign(headerChannel, angle, anchor = 'middle') {\n switch (anchor) {\n case 'start':\n return { align: 'left' };\n case 'end':\n return { align: 'right' };\n }\n const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x');\n return align ? { align } : {};\n}\nexport function defaultHeaderGuideBaseline(angle, channel) {\n const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true);\n return baseline ? { baseline } : {};\n}\nexport function assembleHeaderGroups(model, channel) {\n const layoutHeader = model.component.layoutHeaders[channel];\n const groups = [];\n for (const headerType of HEADER_TYPES) {\n if (layoutHeader[headerType]) {\n for (const headerComponent of layoutHeader[headerType]) {\n const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent);\n if (group != null) {\n groups.push(group);\n }\n }\n }\n }\n return groups;\n}\nfunction getSort(facetFieldDef, channel) {\n const { sort } = facetFieldDef;\n if (isSortField(sort)) {\n return {\n field: vgField(sort, { expr: 'datum' }),\n order: sort.order ?? 'ascending'\n };\n }\n else if (isArray(sort)) {\n return {\n field: sortArrayIndexField(facetFieldDef, channel, { expr: 'datum' }),\n order: 'ascending'\n };\n }\n else {\n return {\n field: vgField(facetFieldDef, { expr: 'datum' }),\n order: sort ?? 'ascending'\n };\n }\n}\nexport function assembleLabelTitle(facetFieldDef, channel, config) {\n const { format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr } = getHeaderProperties(['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'], facetFieldDef.header, config, channel);\n const titleTextExpr = formatSignalRef({\n fieldOrDatumDef: facetFieldDef,\n format,\n formatType,\n expr: 'parent',\n config\n }).signal;\n const headerChannel = getHeaderChannel(channel, labelOrient);\n return {\n text: {\n signal: labelExpr\n ? replaceAll(replaceAll(labelExpr, 'datum.label', titleTextExpr), 'datum.value', vgField(facetFieldDef, { expr: 'parent' }))\n : titleTextExpr\n },\n ...(channel === 'row' ? { orient: 'left' } : {}),\n style: 'guide-label',\n frame: 'group',\n ...defaultHeaderGuideBaseline(labelAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP)\n };\n}\nexport function assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent) {\n if (headerComponent) {\n let title = null;\n const { facetFieldDef } = layoutHeader;\n const config = model.config ? model.config : undefined;\n if (facetFieldDef && headerComponent.labels) {\n const { labelOrient } = getHeaderProperties(['labelOrient'], facetFieldDef.header, config, channel);\n // Include label title in the header if orient aligns with the channel\n if ((channel === 'row' && !contains(['top', 'bottom'], labelOrient)) ||\n (channel === 'column' && !contains(['left', 'right'], labelOrient))) {\n title = assembleLabelTitle(facetFieldDef, channel, config);\n }\n }\n const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet);\n const axes = headerComponent.axes;\n const hasAxes = axes?.length > 0;\n if (title || hasAxes) {\n const sizeChannel = channel === 'row' ? 'height' : 'width';\n return {\n name: model.getName(`${channel}_${headerType}`),\n type: 'group',\n role: `${channel}-${headerType}`,\n ...(layoutHeader.facetFieldDef\n ? {\n from: { data: model.getName(`${channel}_domain`) },\n sort: getSort(facetFieldDef, channel)\n }\n : {}),\n ...(hasAxes && isFacetWithoutRowCol\n ? {\n from: { data: model.getName(`facet_domain_${channel}`) }\n }\n : {}),\n ...(title ? { title } : {}),\n ...(headerComponent.sizeSignal\n ? {\n encode: {\n update: {\n [sizeChannel]: headerComponent.sizeSignal\n }\n }\n }\n : {}),\n ...(hasAxes ? { axes } : {})\n };\n }\n }\n return null;\n}\nconst LAYOUT_TITLE_BAND = {\n column: {\n start: 0,\n end: 1\n },\n row: {\n start: 1,\n end: 0\n }\n};\nexport function getLayoutTitleBand(titleAnchor, headerChannel) {\n return LAYOUT_TITLE_BAND[headerChannel][titleAnchor];\n}\nexport function assembleLayoutTitleBand(headerComponentIndex, config) {\n const titleBand = {};\n for (const channel of FACET_CHANNELS) {\n const headerComponent = headerComponentIndex[channel];\n if (headerComponent?.facetFieldDef) {\n const { titleAnchor, titleOrient } = getHeaderProperties(['titleAnchor', 'titleOrient'], headerComponent.facetFieldDef.header, config, channel);\n const headerChannel = getHeaderChannel(channel, titleOrient);\n const band = getLayoutTitleBand(titleAnchor, headerChannel);\n if (band !== undefined) {\n titleBand[headerChannel] = band;\n }\n }\n }\n return isEmpty(titleBand) ? undefined : titleBand;\n}\nexport function assembleHeaderProperties(config, facetFieldDef, channel, properties, propertiesMap) {\n const props = {};\n for (const prop of properties) {\n if (!propertiesMap[prop]) {\n continue;\n }\n const value = getHeaderProperty(prop, facetFieldDef?.header, config, channel);\n if (value !== undefined) {\n props[propertiesMap[prop]] = value;\n }\n }\n return props;\n}\n//# sourceMappingURL=assemble.js.map","import { getViewConfigContinuousSize } from '../../config';\nimport { hasDiscreteDomain } from '../../scale';\nimport { getFirstDefined } from '../../util';\nimport { isSignalRef, isVgRangeStep } from '../../vega.schema';\nimport { signalOrStringValue } from '../common';\nimport { isFacetModel } from '../model';\nexport function assembleLayoutSignals(model) {\n return [\n ...sizeSignals(model, 'width'),\n ...sizeSignals(model, 'height'),\n ...sizeSignals(model, 'childWidth'),\n ...sizeSignals(model, 'childHeight')\n ];\n}\nexport function sizeSignals(model, sizeType) {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const size = model.component.layoutSize.get(sizeType);\n if (!size || size === 'merged') {\n return [];\n }\n // Read size signal name from name map, just in case it is the top-level size signal that got renamed.\n const name = model.getSizeSignalRef(sizeType).signal;\n if (size === 'step') {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = model.scaleName(channel);\n if (isFacetModel(model.parent)) {\n // If parent is facet and this is an independent scale, return only signal signal\n // as the width/height will be calculated using the cardinality from\n // facet's aggregate rather than reading from scale domain\n const parentResolve = model.parent.component.resolve;\n if (parentResolve.scale[channel] === 'independent') {\n return [stepSignal(scaleName, range)];\n }\n }\n return [\n stepSignal(scaleName, range),\n {\n name,\n update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`)\n }\n ];\n }\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('layout size is step although width/height is not step.');\n }\n else if (size == 'container') {\n const isWidth = name.endsWith('width');\n const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]';\n const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height');\n const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`;\n return [{ name, init: safeExpr, on: [{ update: safeExpr, events: 'window:resize' }] }];\n }\n else {\n return [\n {\n name,\n value: size\n }\n ];\n }\n}\nfunction stepSignal(scaleName, range) {\n const name = `${scaleName}_step`;\n if (isSignalRef(range.step)) {\n return { name, update: range.step.signal };\n }\n else {\n return { name, value: range.step };\n }\n}\nexport function sizeExpr(scaleName, scaleComponent, cardinality) {\n const type = scaleComponent.get('type');\n const padding = scaleComponent.get('padding');\n const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding);\n let paddingInner = scaleComponent.get('paddingInner');\n paddingInner =\n type === 'band'\n ? // only band has real paddingInner\n paddingInner !== undefined\n ? paddingInner\n : padding\n : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128,\n // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points.\n 1;\n return `bandspace(${cardinality}, ${signalOrStringValue(paddingInner)}, ${signalOrStringValue(paddingOuter)}) * ${scaleName}_step`;\n}\n//# sourceMappingURL=assemble.js.map","export function getSizeTypeFromLayoutSizeType(layoutSizeType) {\n return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType;\n}\n//# sourceMappingURL=component.js.map","import { keys } from '../util';\nimport { signalOrValueRef } from './common';\nimport { wrapCondition } from './mark/encode';\nexport function guideEncodeEntry(encoding, model) {\n return keys(encoding).reduce((encode, channel) => {\n const valueDef = encoding[channel];\n return {\n ...encode,\n ...wrapCondition(model, valueDef, channel, def => signalOrValueRef(def.value))\n };\n }, {});\n}\n//# sourceMappingURL=guide.js.map","import { isXorY } from '../channel';\nimport * as log from '../log';\nimport { isConcatModel, isFacetModel, isLayerModel } from './model';\nexport function defaultScaleResolve(channel, model) {\n if (isFacetModel(model)) {\n return channel === 'theta' ? 'independent' : 'shared';\n }\n else if (isLayerModel(model)) {\n return 'shared';\n }\n else if (isConcatModel(model)) {\n return isXorY(channel) || channel === 'theta' || channel === 'radius' ? 'independent' : 'shared';\n }\n /* istanbul ignore next: should never reach here. */\n throw new Error('invalid model type for resolve');\n}\nexport function parseGuideResolve(resolve, channel) {\n const channelScaleResolve = resolve.scale[channel];\n const guide = isXorY(channel) ? 'axis' : 'legend';\n if (channelScaleResolve === 'independent') {\n if (resolve[guide][channel] === 'shared') {\n log.warn(log.message.independentScaleMeansIndependentGuide(channel));\n }\n return 'independent';\n }\n return resolve[guide][channel] || 'shared';\n}\n//# sourceMappingURL=resolve.js.map","import { COMMON_LEGEND_PROPERTY_INDEX } from '../../legend';\nimport { keys } from '../../util';\nimport { Split } from '../split';\nconst LEGEND_COMPONENT_PROPERTY_INDEX = {\n ...COMMON_LEGEND_PROPERTY_INDEX,\n disable: 1,\n labelExpr: 1,\n selections: 1,\n // channel scales\n opacity: 1,\n shape: 1,\n stroke: 1,\n fill: 1,\n size: 1,\n strokeWidth: 1,\n strokeDash: 1,\n // encode\n encode: 1\n};\nexport const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX);\nexport class LegendComponent extends Split {\n}\n//# sourceMappingURL=component.js.map","import { array, isArray, stringValue } from 'vega-util';\nimport { COLOR, OPACITY } from '../../channel';\nimport { hasConditionalValueDef, isFieldDef, isValueDef } from '../../channeldef';\nimport { FILL_STROKE_CONFIG } from '../../mark';\nimport { getFirstDefined, isEmpty, varName } from '../../util';\nimport { applyMarkConfig, signalOrValueRef } from '../common';\nimport { formatCustomType, isCustomFormatType } from '../format';\nimport * as mixins from '../mark/encode';\nimport { STORE } from '../selection';\nexport const legendEncodeRules = {\n symbols,\n gradient,\n labels,\n entries\n};\nexport function symbols(symbolsSpec, { fieldOrDatumDef, model, channel, legendCmpt, legendType }) {\n if (legendType !== 'symbol') {\n return undefined;\n }\n const { markDef, encoding, config, mark } = model;\n const filled = markDef.filled && mark !== 'trail';\n let out = {\n ...applyMarkConfig({}, model, FILL_STROKE_CONFIG),\n ...mixins.color(model, { filled })\n }; // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry\n const symbolOpacity = legendCmpt.get('symbolOpacity') ?? config.legend.symbolOpacity;\n const symbolFillColor = legendCmpt.get('symbolFillColor') ?? config.legend.symbolFillColor;\n const symbolStrokeColor = legendCmpt.get('symbolStrokeColor') ?? config.legend.symbolStrokeColor;\n const opacity = symbolOpacity === undefined ? getMaxValue(encoding.opacity) ?? markDef.opacity : undefined;\n if (out.fill) {\n // for fill legend, we don't want any fill in symbol\n if (channel === 'fill' || (filled && channel === COLOR)) {\n delete out.fill;\n }\n else {\n if (out.fill['field']) {\n // For others, set fill to some opaque value (or nothing if a color is already set)\n if (symbolFillColor) {\n delete out.fill;\n }\n else {\n out.fill = signalOrValueRef(config.legend.symbolBaseFillColor ?? 'black');\n out.fillOpacity = signalOrValueRef(opacity ?? 1);\n }\n }\n else if (isArray(out.fill)) {\n const fill = getFirstConditionValue(encoding.fill ?? encoding.color) ?? markDef.fill ?? (filled && markDef.color);\n if (fill) {\n out.fill = signalOrValueRef(fill);\n }\n }\n }\n }\n if (out.stroke) {\n if (channel === 'stroke' || (!filled && channel === COLOR)) {\n delete out.stroke;\n }\n else {\n if (out.stroke['field'] || symbolStrokeColor) {\n // For others, remove stroke field\n delete out.stroke;\n }\n else if (isArray(out.stroke)) {\n const stroke = getFirstDefined(getFirstConditionValue(encoding.stroke || encoding.color), markDef.stroke, filled ? markDef.color : undefined);\n if (stroke) {\n out.stroke = { value: stroke };\n }\n }\n }\n }\n if (channel !== OPACITY) {\n const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef);\n if (condition) {\n out.opacity = [\n { test: condition, ...signalOrValueRef(opacity ?? 1) },\n signalOrValueRef(config.legend.unselectedOpacity)\n ];\n }\n else if (opacity) {\n out.opacity = signalOrValueRef(opacity);\n }\n }\n out = { ...out, ...symbolsSpec };\n return isEmpty(out) ? undefined : out;\n}\nexport function gradient(gradientSpec, { model, legendType, legendCmpt }) {\n if (legendType !== 'gradient') {\n return undefined;\n }\n const { config, markDef, encoding } = model;\n let out = {};\n const gradientOpacity = legendCmpt.get('gradientOpacity') ?? config.legend.gradientOpacity;\n const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined;\n if (opacity) {\n // only apply opacity if it is neither zero or undefined\n out.opacity = signalOrValueRef(opacity);\n }\n out = { ...out, ...gradientSpec };\n return isEmpty(out) ? undefined : out;\n}\nexport function labels(specifiedlabelsSpec, { fieldOrDatumDef, model, channel, legendCmpt }) {\n const legend = model.legend(channel) || {};\n const config = model.config;\n const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined;\n const opacity = condition ? [{ test: condition, value: 1 }, { value: config.legend.unselectedOpacity }] : undefined;\n const { format, formatType } = legend;\n let text = undefined;\n if (isCustomFormatType(formatType)) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n });\n }\n else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (fieldOrDatumDef.type === 'quantitative' && config.numberFormatType) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.numberFormat,\n formatType: config.numberFormatType,\n config\n });\n }\n else if (fieldOrDatumDef.type === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n fieldOrDatumDef.timeUnit === undefined) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.timeFormat,\n formatType: config.timeFormatType,\n config\n });\n }\n }\n const labelsSpec = {\n ...(opacity ? { opacity } : {}),\n ...(text ? { text } : {}),\n ...specifiedlabelsSpec\n };\n return isEmpty(labelsSpec) ? undefined : labelsSpec;\n}\nexport function entries(entriesSpec, { legendCmpt }) {\n const selections = legendCmpt.get('selections');\n return selections?.length ? { ...entriesSpec, fill: { value: 'transparent' } } : entriesSpec;\n}\nfunction getMaxValue(channelDef) {\n return getConditionValue(channelDef, (v, conditionalDef) => Math.max(v, conditionalDef.value));\n}\nexport function getFirstConditionValue(channelDef) {\n return getConditionValue(channelDef, (v, conditionalDef) => {\n return getFirstDefined(v, conditionalDef.value);\n });\n}\nfunction getConditionValue(channelDef, reducer) {\n if (hasConditionalValueDef(channelDef)) {\n return array(channelDef.condition).reduce(reducer, channelDef.value);\n }\n else if (isValueDef(channelDef)) {\n return channelDef.value;\n }\n return undefined;\n}\nfunction selectedCondition(model, legendCmpt, fieldDef) {\n const selections = legendCmpt.get('selections');\n if (!selections?.length)\n return undefined;\n const field = stringValue(fieldDef.field);\n return selections\n .map(name => {\n const store = stringValue(varName(name) + STORE);\n return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`;\n })\n .join(' || ');\n}\n//# sourceMappingURL=encode.js.map","import { isArray } from 'vega-util';\nimport { isColorChannel } from '../../channel';\nimport { title as fieldDefTitle, valueArray } from '../../channeldef';\nimport { isContinuousToContinuous } from '../../scale';\nimport { contains, getFirstDefined } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { guideFormat, guideFormatType } from '../format';\nimport { getFirstConditionValue } from './encode';\nexport const legendRules = {\n direction: ({ direction }) => direction,\n format: ({ fieldOrDatumDef, legend, config }) => {\n const { format, formatType } = legend;\n return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false);\n },\n formatType: ({ legend, fieldOrDatumDef, scaleType }) => {\n const { formatType } = legend;\n return guideFormatType(formatType, fieldOrDatumDef, scaleType);\n },\n gradientLength: params => {\n const { legend, legendConfig } = params;\n return legend.gradientLength ?? legendConfig.gradientLength ?? defaultGradientLength(params);\n },\n labelOverlap: ({ legend, legendConfig, scaleType }) => legend.labelOverlap ?? legendConfig.labelOverlap ?? defaultLabelOverlap(scaleType),\n symbolType: ({ legend, markDef, channel, encoding }) => legend.symbolType ?? defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape),\n title: ({ fieldOrDatumDef, config }) => fieldDefTitle(fieldOrDatumDef, config, { allowDisabling: true }),\n type: ({ legendType, scaleType, channel }) => {\n if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) {\n if (legendType === 'gradient') {\n return undefined;\n }\n }\n else if (legendType === 'symbol') {\n return undefined;\n }\n return legendType;\n },\n values: ({ fieldOrDatumDef, legend }) => values(legend, fieldOrDatumDef)\n};\nexport function values(legend, fieldOrDatumDef) {\n const vals = legend.values;\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n }\n else if (isSignalRef(vals)) {\n return vals;\n }\n return undefined;\n}\nexport function defaultSymbolType(mark, channel, shapeChannelDef, markShape) {\n if (channel !== 'shape') {\n // use the value from the shape encoding or the mark config if they exist\n const shape = getFirstConditionValue(shapeChannelDef) ?? markShape;\n if (shape) {\n return shape;\n }\n }\n switch (mark) {\n case 'bar':\n case 'rect':\n case 'image':\n case 'square':\n return 'square';\n case 'line':\n case 'trail':\n case 'rule':\n return 'stroke';\n case 'arc':\n case 'point':\n case 'circle':\n case 'tick':\n case 'geoshape':\n case 'area':\n case 'text':\n return 'circle';\n }\n}\nexport function clipHeight(legendType) {\n if (legendType === 'gradient') {\n return 20;\n }\n return undefined;\n}\nexport function getLegendType(params) {\n const { legend } = params;\n return getFirstDefined(legend.type, defaultType(params));\n}\nexport function defaultType({ channel, timeUnit, scaleType }) {\n // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js\n if (isColorChannel(channel)) {\n if (contains(['quarter', 'month', 'day'], timeUnit)) {\n return 'symbol';\n }\n if (isContinuousToContinuous(scaleType)) {\n return 'gradient';\n }\n }\n return 'symbol';\n}\nexport function getDirection({ legendConfig, legendType, orient, legend }) {\n return (legend.direction ??\n legendConfig[legendType ? 'gradientDirection' : 'symbolDirection'] ??\n defaultDirection(orient, legendType));\n}\nexport function defaultDirection(orient, legendType) {\n switch (orient) {\n case 'top':\n case 'bottom':\n return 'horizontal';\n case 'left':\n case 'right':\n case 'none':\n case undefined: // undefined = \"right\" in Vega\n return undefined; // vertical is Vega's default\n default:\n // top-left / ...\n // For inner legend, uses compact layout like Tableau\n return legendType === 'gradient' ? 'horizontal' : undefined;\n }\n}\nexport function defaultGradientLength({ legendConfig, model, direction, orient, scaleType }) {\n const { gradientHorizontalMaxLength, gradientHorizontalMinLength, gradientVerticalMaxLength, gradientVerticalMinLength } = legendConfig;\n if (isContinuousToContinuous(scaleType)) {\n if (direction === 'horizontal') {\n if (orient === 'top' || orient === 'bottom') {\n return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength);\n }\n else {\n return gradientHorizontalMinLength;\n }\n }\n else {\n // vertical / undefined (Vega uses vertical by default)\n return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength);\n }\n }\n return undefined;\n}\nfunction gradientLengthSignal(model, sizeType, min, max) {\n const sizeSignal = model.getSizeSignalRef(sizeType).signal;\n return { signal: `clamp(${sizeSignal}, ${min}, ${max})` };\n}\nexport function defaultLabelOverlap(scaleType) {\n if (contains(['quantile', 'threshold', 'log', 'symlog'], scaleType)) {\n return 'greedy';\n }\n return undefined;\n}\n//# sourceMappingURL=properties.js.map","import { COLOR, SHAPE } from '../../channel';\nimport { getFieldOrDatumDef, isFieldDef } from '../../channeldef';\nimport { LEGEND_SCALE_CHANNELS } from '../../legend';\nimport { normalizeTimeUnit } from '../../timeunit';\nimport { GEOJSON } from '../../type';\nimport { deleteNestedProperty, isEmpty, keys, varName } from '../../util';\nimport { mergeTitleComponent } from '../common';\nimport { guideEncodeEntry } from '../guide';\nimport { isUnitModel } from '../model';\nimport { parseGuideResolve } from '../resolve';\nimport { parseInteractiveLegend } from '../selection/legends';\nimport { defaultTieBreaker, makeImplicit, mergeValuesWithExplicit } from '../split';\nimport { LegendComponent, LEGEND_COMPONENT_PROPERTIES } from './component';\nimport { legendEncodeRules } from './encode';\nimport { getDirection, getLegendType, legendRules } from './properties';\nexport function parseLegend(model) {\n const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model);\n model.component.legends = legendComponent;\n return legendComponent;\n}\nfunction parseUnitLegend(model) {\n const { encoding } = model;\n const legendComponent = {};\n for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) {\n const def = getFieldOrDatumDef(encoding[channel]);\n if (!def || !model.getScaleComponent(channel)) {\n continue;\n }\n if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) {\n continue;\n }\n legendComponent[channel] = parseLegendForChannel(model, channel);\n }\n return legendComponent;\n}\nfunction getLegendDefWithScale(model, channel) {\n const scale = model.scaleName(channel);\n if (model.mark === 'trail') {\n if (channel === 'color') {\n // trail is a filled mark, but its default symbolType (\"stroke\") should use \"stroke\"\n return { stroke: scale };\n }\n else if (channel === 'size') {\n return { strokeWidth: scale };\n }\n }\n if (channel === 'color') {\n return model.markDef.filled ? { fill: scale } : { stroke: scale };\n }\n return { [channel]: scale };\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isExplicit(value, property, legend, fieldDef) {\n switch (property) {\n case 'disable':\n return legend !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit\n case 'values':\n // specified legend.values is already respected, but may get transformed.\n return !!legend?.values;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (property === 'title' && value === fieldDef?.title) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === (legend || {})[property];\n}\nexport function parseLegendForChannel(model, channel) {\n let legend = model.legend(channel);\n const { markDef, encoding, config } = model;\n const legendConfig = config.legend;\n const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel));\n parseInteractiveLegend(model, channel, legendCmpt);\n const disable = legend !== undefined ? !legend : legendConfig.disable;\n legendCmpt.set('disable', disable, legend !== undefined);\n if (disable) {\n return legendCmpt;\n }\n legend = legend || {};\n const scaleType = model.getScaleComponent(channel).get('type');\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]);\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n const orient = legend.orient || config.legend.orient || 'right';\n const legendType = getLegendType({ legend, channel, timeUnit, scaleType });\n const direction = getDirection({ legend, legendType, orient, legendConfig });\n const ruleParams = {\n legend,\n channel,\n model,\n markDef,\n encoding,\n fieldOrDatumDef,\n legendConfig,\n config,\n scaleType,\n orient,\n legendType,\n direction\n };\n for (const property of LEGEND_COMPONENT_PROPERTIES) {\n if ((legendType === 'gradient' && property.startsWith('symbol')) ||\n (legendType === 'symbol' && property.startsWith('gradient'))) {\n continue;\n }\n const value = property in legendRules ? legendRules[property](ruleParams) : legend[property];\n if (value !== undefined) {\n const explicit = isExplicit(value, property, legend, model.fieldDef(channel));\n if (explicit || config.legend[property] === undefined) {\n legendCmpt.set(property, value, explicit);\n }\n }\n }\n const legendEncoding = legend?.encoding ?? {};\n const selections = legendCmpt.get('selections');\n const legendEncode = {};\n const legendEncodeParams = { fieldOrDatumDef, model, channel, legendCmpt, legendType };\n for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) {\n const legendEncodingPart = guideEncodeEntry(legendEncoding[part] ?? {}, model);\n const value = part in legendEncodeRules\n ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule\n : legendEncodingPart; // no rule -- just default values\n if (value !== undefined && !isEmpty(value)) {\n legendEncode[part] = {\n ...(selections?.length && isFieldDef(fieldOrDatumDef)\n ? { name: `${varName(fieldOrDatumDef.field)}_legend_${part}` }\n : {}),\n ...(selections?.length ? { interactive: !!selections } : {}),\n update: value\n };\n }\n }\n if (!isEmpty(legendEncode)) {\n legendCmpt.set('encode', legendEncode, !!legend?.encoding);\n }\n return legendCmpt;\n}\nfunction parseNonUnitLegend(model) {\n const { legends, resolve } = model.component;\n for (const child of model.children) {\n parseLegend(child);\n for (const channel of keys(child.component.legends)) {\n resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel);\n if (resolve.legend[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]);\n if (!legends[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the legend shared.\n // Thus, mark legend as independent and remove the legend component.\n resolve.legend[channel] = 'independent';\n delete legends[channel];\n }\n }\n }\n }\n for (const channel of keys(legends)) {\n for (const child of model.children) {\n if (!child.component.legends[channel]) {\n // skip if the child does not have a particular legend\n continue;\n }\n if (resolve.legend[channel] === 'shared') {\n // After merging shared legend, make sure to remove legend from child\n delete child.component.legends[channel];\n }\n }\n }\n return legends;\n}\nexport function mergeLegendComponent(mergedLegend, childLegend) {\n if (!mergedLegend) {\n return childLegend.clone();\n }\n const mergedOrient = mergedLegend.getWithExplicit('orient');\n const childOrient = childLegend.getWithExplicit('orient');\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n // Cannot merge due to inconsistent orient\n return undefined;\n }\n let typeMerged = false;\n // Otherwise, let's merge\n for (const prop of LEGEND_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(mergedLegend.getWithExplicit(prop), childLegend.getWithExplicit(prop), prop, 'legend', \n // Tie breaker function\n (v1, v2) => {\n switch (prop) {\n case 'symbolType':\n return mergeSymbolType(v1, v2);\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'type':\n // There are only two types. If we have different types, then prefer symbol over gradient.\n typeMerged = true;\n return makeImplicit('symbol');\n }\n return defaultTieBreaker(v1, v2, prop, 'legend');\n });\n mergedLegend.setWithExplicit(prop, mergedValueWithExplicit);\n }\n if (typeMerged) {\n if (mergedLegend.implicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']);\n }\n if (mergedLegend.explicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']);\n }\n }\n return mergedLegend;\n}\nfunction mergeSymbolType(st1, st2) {\n if (st2.value === 'circle') {\n // prefer \"circle\" over \"stroke\"\n return st2;\n }\n return st1;\n}\n//# sourceMappingURL=parse.js.map","import { LEGEND_SCALE_CHANNELS } from '../../legend';\nimport { keys, replaceAll, stringify, vals } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { mergeLegendComponent } from './parse';\nfunction setLegendEncode(legend, part, vgProp, vgRef) {\n var _a, _b;\n legend.encode ?? (legend.encode = {});\n (_a = legend.encode)[part] ?? (_a[part] = {});\n (_b = legend.encode[part]).update ?? (_b.update = {});\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n legend.encode[part].update[vgProp] = vgRef;\n}\nexport function assembleLegends(model) {\n const legendComponentIndex = model.component.legends;\n const legendByDomain = {};\n for (const channel of keys(legendComponentIndex)) {\n const scaleComponent = model.getScaleComponent(channel);\n const domainHash = stringify(scaleComponent.get('domains'));\n if (legendByDomain[domainHash]) {\n for (const mergedLegendComponent of legendByDomain[domainHash]) {\n const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]);\n if (!merged) {\n // If cannot merge, need to add this legend separately\n legendByDomain[domainHash].push(legendComponentIndex[channel]);\n }\n }\n }\n else {\n legendByDomain[domainHash] = [legendComponentIndex[channel].clone()];\n }\n }\n const legends = vals(legendByDomain)\n .flat()\n .map(l => assembleLegend(l, model.config))\n .filter(l => l !== undefined);\n return legends;\n}\nexport function assembleLegend(legendCmpt, config) {\n const { disable, labelExpr, selections, ...legend } = legendCmpt.combine();\n if (disable) {\n return undefined;\n }\n if (config.aria === false && legend.aria == undefined) {\n legend.aria = false;\n }\n if (legend.encode?.symbols) {\n const out = legend.encode.symbols.update;\n if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) {\n // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used.\n out.stroke = { value: 'transparent' };\n }\n // Remove properties that the legend is encoding.\n for (const property of LEGEND_SCALE_CHANNELS) {\n if (legend[property]) {\n delete out[property];\n }\n }\n }\n if (!legend.title) {\n // title schema doesn't include null, ''\n delete legend.title;\n }\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (legend.encode?.labels?.update && isSignalRef(legend.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal);\n }\n setLegendEncode(legend, 'labels', 'text', { signal: expr });\n }\n return legend;\n}\n//# sourceMappingURL=assemble.js.map","import { contains } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { isConcatModel, isLayerModel } from '../model';\nexport function assembleProjections(model) {\n if (isLayerModel(model) || isConcatModel(model)) {\n return assembleProjectionsForModelAndChildren(model);\n }\n else {\n return assembleProjectionForModel(model);\n }\n}\nexport function assembleProjectionsForModelAndChildren(model) {\n return model.children.reduce((projections, child) => {\n return projections.concat(child.assembleProjections());\n }, assembleProjectionForModel(model));\n}\nexport function assembleProjectionForModel(model) {\n const component = model.component.projection;\n if (!component || component.merged) {\n return [];\n }\n const projection = component.combine();\n const { name } = projection; // we need to extract name so that it is always present in the output and pass TS type validation\n if (!component.data) {\n // generate custom projection, no automatic fitting\n return [\n {\n name,\n // translate to center by default\n ...{ translate: { signal: '[width / 2, height / 2]' } },\n // parameters, overwrite default translate if specified\n ...projection\n }\n ];\n }\n else {\n // generate projection that uses extent fitting\n const size = {\n signal: `[${component.size.map(ref => ref.signal).join(', ')}]`\n };\n const fits = component.data.reduce((sources, data) => {\n const source = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`;\n if (!contains(sources, source)) {\n // build a unique list of sources\n sources.push(source);\n }\n return sources;\n }, []);\n if (fits.length <= 0) {\n throw new Error(\"Projection's fit didn't find any data sources\");\n }\n return [\n {\n name,\n size,\n fit: {\n signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0]\n },\n ...projection\n }\n ];\n }\n}\n//# sourceMappingURL=assemble.js.map","export const PROJECTION_PROPERTIES = [\n 'type',\n 'clipAngle',\n 'clipExtent',\n 'center',\n 'rotate',\n 'precision',\n 'reflectX',\n 'reflectY',\n 'coefficient',\n 'distance',\n 'fraction',\n 'lobes',\n 'parallel',\n 'radius',\n 'ratio',\n 'spacing',\n 'tilt'\n];\n//# sourceMappingURL=projection.js.map","import { Split } from '../split';\nexport class ProjectionComponent extends Split {\n constructor(name, specifiedProjection, size, data) {\n super({ ...specifiedProjection }, // all explicit properties of projection\n { name } // name as initial implicit property\n );\n this.specifiedProjection = specifiedProjection;\n this.size = size;\n this.data = data;\n this.merged = false;\n }\n /**\n * Whether the projection parameters should fit provided data.\n */\n get isFit() {\n return !!this.data;\n }\n}\n//# sourceMappingURL=component.js.map","import { hasOwnProperty } from 'vega-util';\nimport { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE } from '../../channel';\nimport { getFieldOrDatumDef } from '../../channeldef';\nimport { DataSourceType } from '../../data';\nimport { replaceExprRef } from '../../expr';\nimport { PROJECTION_PROPERTIES } from '../../projection';\nimport { GEOJSON } from '../../type';\nimport { deepEqual, duplicate, every } from '../../util';\nimport { isUnitModel } from '../model';\nimport { ProjectionComponent } from './component';\nexport function parseProjection(model) {\n model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model);\n}\nfunction parseUnitProjection(model) {\n if (model.hasProjection) {\n const proj = replaceExprRef(model.specifiedProjection);\n const fit = !(proj && (proj.scale != null || proj.translate != null));\n const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined;\n const data = fit ? gatherFitData(model) : undefined;\n const projComp = new ProjectionComponent(model.projectionName(true), {\n ...(replaceExprRef(model.config.projection) ?? {}),\n ...(proj ?? {})\n }, size, data);\n if (!projComp.get('type')) {\n projComp.set('type', 'equalEarth', false);\n }\n return projComp;\n }\n return undefined;\n}\nfunction gatherFitData(model) {\n const data = [];\n const { encoding } = model;\n for (const posssiblePair of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ]) {\n if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n }\n if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n if (data.length === 0) {\n // main source is geojson, so we can just use that\n data.push(model.requestDataName(DataSourceType.Main));\n }\n return data;\n}\nfunction mergeIfNoConflict(first, second) {\n const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => {\n // neither has the property\n if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) {\n return true;\n }\n // both have property and an equal value for property\n if (hasOwnProperty(first.explicit, prop) &&\n hasOwnProperty(second.explicit, prop) &&\n // some properties might be signals or objects and require hashing for comparison\n deepEqual(first.get(prop), second.get(prop))) {\n return true;\n }\n return false;\n });\n const size = deepEqual(first.size, second.size);\n if (size) {\n if (allPropertiesShared) {\n return first;\n }\n else if (deepEqual(first.explicit, {})) {\n return second;\n }\n else if (deepEqual(second.explicit, {})) {\n return first;\n }\n }\n // if all properties don't match, let each unit spec have its own projection\n return null;\n}\nfunction parseNonUnitProjections(model) {\n if (model.children.length === 0) {\n return undefined;\n }\n let nonUnitProjection;\n // parse all children first\n for (const child of model.children) {\n parseProjection(child);\n }\n // analyze parsed projections, attempt to merge\n const mergable = every(model.children, child => {\n const projection = child.component.projection;\n if (!projection) {\n // child layer does not use a projection\n return true;\n }\n else if (!nonUnitProjection) {\n // cached 'projection' is null, cache this one\n nonUnitProjection = projection;\n return true;\n }\n else {\n const merge = mergeIfNoConflict(nonUnitProjection, projection);\n if (merge) {\n nonUnitProjection = merge;\n }\n return !!merge;\n }\n });\n // if cached one and all other children share the same projection,\n if (nonUnitProjection && mergable) {\n // so we can elevate it to the layer level\n const name = model.projectionName(true);\n const modelProjection = new ProjectionComponent(name, nonUnitProjection.specifiedProjection, nonUnitProjection.size, duplicate(nonUnitProjection.data));\n // rename and assign all others as merged\n for (const child of model.children) {\n const projection = child.component.projection;\n if (projection) {\n if (projection.isFit) {\n modelProjection.data.push(...child.component.projection.data);\n }\n child.renameProjection(projection.get('name'), name);\n projection.merged = true;\n }\n }\n return modelProjection;\n }\n return undefined;\n}\n//# sourceMappingURL=parse.js.map","import { isString } from 'vega-util';\nimport { binToString, isBinning, isParameterExtent } from '../../bin';\nimport { binRequiresRange, isTypedFieldDef, normalizeBin, vgField } from '../../channeldef';\nimport { duplicate, hash, isEmpty, keys, replacePathInField, unique, vals } from '../../util';\nimport { binFormatExpression } from '../format';\nimport { isUnitModel } from '../model';\nimport { parseSelectionExtent } from '../selection/parse';\nimport { DataFlowNode } from './dataflow';\nfunction rangeFormula(model, fieldDef, channel, config) {\n if (binRequiresRange(fieldDef, channel)) {\n // read format from axis or legend, if there is no format then use config.numberFormat\n const guide = isUnitModel(model)\n ? model.axis(channel) ?? model.legend(channel) ?? {}\n : {};\n const startField = vgField(fieldDef, { expr: 'datum' });\n const endField = vgField(fieldDef, { expr: 'datum', binSuffix: 'end' });\n return {\n formulaAs: vgField(fieldDef, { binSuffix: 'range', forAs: true }),\n formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config)\n };\n }\n return {};\n}\nfunction binKey(bin, field) {\n return `${binToString(bin)}_${field}`;\n}\nfunction getSignalsFromModel(model, key) {\n return {\n signal: model.getName(`${key}_bins`),\n extentSignal: model.getName(`${key}_extent`)\n };\n}\nexport function getBinSignalName(model, field, bin) {\n const normalizedBin = normalizeBin(bin, undefined) ?? {};\n const key = binKey(normalizedBin, field);\n return model.getName(`${key}_bins`);\n}\nfunction isBinTransform(t) {\n return 'as' in t;\n}\nfunction createBinComponent(t, bin, model) {\n let as;\n let span;\n if (isBinTransform(t)) {\n as = isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]];\n }\n else {\n as = [vgField(t, { forAs: true }), vgField(t, { binSuffix: 'end', forAs: true })];\n }\n const normalizedBin = { ...normalizeBin(bin, undefined) };\n const key = binKey(normalizedBin, t.field);\n const { signal, extentSignal } = getSignalsFromModel(model, key);\n if (isParameterExtent(normalizedBin.extent)) {\n const ext = normalizedBin.extent;\n span = parseSelectionExtent(model, ext.param, ext);\n delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property.\n }\n const binComponent = {\n bin: normalizedBin,\n field: t.field,\n as: [as],\n ...(signal ? { signal } : {}),\n ...(extentSignal ? { extentSignal } : {}),\n ...(span ? { span } : {})\n };\n return { key, binComponent };\n}\nexport class BinNode extends DataFlowNode {\n clone() {\n return new BinNode(null, duplicate(this.bins));\n }\n constructor(parent, bins) {\n super(parent);\n this.bins = bins;\n }\n static makeFromEncoding(parent, model) {\n const bins = model.reduceFieldDef((binComponentIndex, fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n const { key, binComponent } = createBinComponent(fieldDef, fieldDef.bin, model);\n binComponentIndex[key] = {\n ...binComponent,\n ...binComponentIndex[key],\n ...rangeFormula(model, fieldDef, channel, model.config)\n };\n }\n return binComponentIndex;\n }, {});\n if (isEmpty(bins)) {\n return null;\n }\n return new BinNode(parent, bins);\n }\n /**\n * Creates a bin node from BinTransform.\n * The optional parameter should provide\n */\n static makeFromTransform(parent, t, model) {\n const { key, binComponent } = createBinComponent(t, t.bin, model);\n return new BinNode(parent, {\n [key]: binComponent\n });\n }\n /**\n * Merge bin nodes. This method either integrates the bin config from the other node\n * or if this node already has a bin config, renames the corresponding signal in the model.\n */\n merge(other, renameSignal) {\n for (const key of keys(other.bins)) {\n if (key in this.bins) {\n renameSignal(other.bins[key].signal, this.bins[key].signal);\n // Ensure that we don't have duplicate names for signal pairs\n this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash);\n }\n else {\n this.bins[key] = other.bins[key];\n }\n }\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n other.remove();\n }\n producedFields() {\n return new Set(vals(this.bins)\n .map(c => c.as)\n .flat(2));\n }\n dependentFields() {\n return new Set(vals(this.bins).map(c => c.field));\n }\n hash() {\n return `Bin ${hash(this.bins)}`;\n }\n assemble() {\n return vals(this.bins).flatMap(bin => {\n const transform = [];\n const [binAs, ...remainingAs] = bin.as;\n const { extent, ...params } = bin.bin;\n const binTrans = {\n type: 'bin',\n field: replacePathInField(bin.field),\n as: binAs,\n signal: bin.signal,\n ...(!isParameterExtent(extent) ? { extent } : { extent: null }),\n ...(bin.span ? { span: { signal: `span(${bin.span})` } } : {}),\n ...params\n };\n if (!extent && bin.extentSignal) {\n transform.push({\n type: 'extent',\n field: replacePathInField(bin.field),\n signal: bin.extentSignal\n });\n binTrans.extent = { signal: bin.extentSignal };\n }\n transform.push(binTrans);\n for (const as of remainingAs) {\n for (let i = 0; i < 2; i++) {\n transform.push({\n type: 'formula',\n expr: vgField({ field: binAs[i] }, { expr: 'datum' }),\n as: as[i]\n });\n }\n }\n if (bin.formula) {\n transform.push({\n type: 'formula',\n expr: bin.formula,\n as: bin.formulaAs\n });\n }\n return transform;\n });\n }\n}\n//# sourceMappingURL=bin.js.map","import { isArgmaxDef, isArgminDef } from '../../aggregate';\nimport { getPositionChannelFromLatLong, getSecondaryRangeChannel, isGeoPositionChannel, isScaleChannel, isXorY } from '../../channel';\nimport { binRequiresRange, getBandPosition, hasBandEnd, isScaleFieldDef, isTypedFieldDef, vgField } from '../../channeldef';\nimport * as log from '../../log';\nimport { isFieldRange } from '../../scale';\nimport { duplicate, hash, keys, replacePathInField, setEqual } from '../../util';\nimport { isUnitModel } from '../model';\nimport { DataFlowNode } from './dataflow';\nimport { isRectBasedMark } from '../../mark';\nimport { OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX } from './timeunit';\nfunction addDimension(dims, channel, fieldDef, model) {\n const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined;\n if (isTypedFieldDef(fieldDef) &&\n isUnitModel(model) &&\n hasBandEnd(fieldDef, channelDef2, model.markDef, model.config)) {\n dims.add(vgField(fieldDef, {}));\n dims.add(vgField(fieldDef, { suffix: 'end' }));\n const { mark, markDef, config } = model;\n const bandPosition = getBandPosition({ fieldDef, markDef, config });\n if (isRectBasedMark(mark) && bandPosition !== 0.5 && isXorY(channel)) {\n dims.add(vgField(fieldDef, { suffix: OFFSETTED_RECT_START_SUFFIX }));\n dims.add(vgField(fieldDef, { suffix: OFFSETTED_RECT_END_SUFFIX }));\n }\n if (fieldDef.bin && binRequiresRange(fieldDef, channel)) {\n dims.add(vgField(fieldDef, { binSuffix: 'range' }));\n }\n }\n else if (isGeoPositionChannel(channel)) {\n const posChannel = getPositionChannelFromLatLong(channel);\n dims.add(model.getName(posChannel));\n }\n else {\n dims.add(vgField(fieldDef));\n }\n if (isScaleFieldDef(fieldDef) && isFieldRange(fieldDef.scale?.range)) {\n dims.add(fieldDef.scale.range.field);\n }\n return dims;\n}\nfunction mergeMeasures(parentMeasures, childMeasures) {\n for (const field of keys(childMeasures)) {\n // when we merge a measure, we either have to add an aggregation operator or even a new field\n const ops = childMeasures[field];\n for (const op of keys(ops)) {\n if (field in parentMeasures) {\n // add operator to existing measure field\n parentMeasures[field][op] = new Set([...(parentMeasures[field][op] ?? []), ...ops[op]]);\n }\n else {\n parentMeasures[field] = { [op]: ops[op] };\n }\n }\n }\n}\nexport class AggregateNode extends DataFlowNode {\n clone() {\n return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures));\n }\n /**\n * @param dimensions string set for dimensions\n * @param measures dictionary mapping field name => dict of aggregation functions and names to use\n */\n constructor(parent, dimensions, measures) {\n super(parent);\n this.dimensions = dimensions;\n this.measures = measures;\n }\n get groupBy() {\n return this.dimensions;\n }\n static makeFromEncoding(parent, model) {\n let isAggregate = false;\n model.forEachFieldDef(fd => {\n if (fd.aggregate) {\n isAggregate = true;\n }\n });\n const meas = {};\n const dims = new Set();\n if (!isAggregate) {\n // no need to create this node if the model has no aggregation\n return null;\n }\n model.forEachFieldDef((fieldDef, channel) => {\n const { aggregate, field } = fieldDef;\n if (aggregate) {\n if (aggregate === 'count') {\n meas['*'] ?? (meas['*'] = {});\n meas['*']['count'] = new Set([vgField(fieldDef, { forAs: true })]);\n }\n else {\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n const op = isArgminDef(aggregate) ? 'argmin' : 'argmax';\n const argField = aggregate[op];\n meas[argField] ?? (meas[argField] = {});\n meas[argField][op] = new Set([vgField({ op, field: argField }, { forAs: true })]);\n }\n else {\n meas[field] ?? (meas[field] = {});\n meas[field][aggregate] = new Set([vgField(fieldDef, { forAs: true })]);\n }\n // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain\n if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') {\n meas[field] ?? (meas[field] = {});\n meas[field]['min'] = new Set([vgField({ field, aggregate: 'min' }, { forAs: true })]);\n meas[field]['max'] = new Set([vgField({ field, aggregate: 'max' }, { forAs: true })]);\n }\n }\n }\n else {\n addDimension(dims, channel, fieldDef, model);\n }\n });\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n return new AggregateNode(parent, dims, meas);\n }\n static makeFromTransform(parent, t) {\n const dims = new Set();\n const meas = {};\n for (const s of t.aggregate) {\n const { op, field, as } = s;\n if (op) {\n if (op === 'count') {\n meas['*'] ?? (meas['*'] = {});\n meas['*']['count'] = new Set([as ? as : vgField(s, { forAs: true })]);\n }\n else {\n meas[field] ?? (meas[field] = {});\n meas[field][op] = new Set([as ? as : vgField(s, { forAs: true })]);\n }\n }\n }\n for (const s of t.groupby ?? []) {\n dims.add(s);\n }\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n return new AggregateNode(parent, dims, meas);\n }\n merge(other) {\n if (setEqual(this.dimensions, other.dimensions)) {\n mergeMeasures(this.measures, other.measures);\n return true;\n }\n log.debug('different dimensions, cannot merge');\n return false;\n }\n addDimensions(fields) {\n fields.forEach(this.dimensions.add, this.dimensions);\n }\n dependentFields() {\n return new Set([...this.dimensions, ...keys(this.measures)]);\n }\n producedFields() {\n const out = new Set();\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n const m = this.measures[field][op];\n if (m.size === 0) {\n out.add(`${op}_${field}`);\n }\n else {\n m.forEach(out.add, out);\n }\n }\n }\n return out;\n }\n hash() {\n return `Aggregate ${hash({ dimensions: this.dimensions, measures: this.measures })}`;\n }\n assemble() {\n const ops = [];\n const fields = [];\n const as = [];\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n for (const alias of this.measures[field][op]) {\n as.push(alias);\n ops.push(op);\n fields.push(field === '*' ? null : replacePathInField(field));\n }\n }\n }\n const result = {\n type: 'aggregate',\n groupby: [...this.dimensions].map(replacePathInField),\n ops,\n fields,\n as\n };\n return result;\n }\n}\n//# sourceMappingURL=aggregate.js.map","import { isArray } from 'vega-util';\nimport { isBinning } from '../../bin';\nimport { COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW } from '../../channel';\nimport { vgField } from '../../channeldef';\nimport * as log from '../../log';\nimport { hasDiscreteDomain } from '../../scale';\nimport { DEFAULT_SORT_OP, isSortField } from '../../sort';\nimport { hash } from '../../util';\nimport { isVgRangeStep } from '../../vega.schema';\nimport { HEADER_CHANNELS, HEADER_TYPES } from '../header/component';\nimport { assembleDomain, getFieldFromDomain } from '../scale/domain';\nimport { sortArrayIndexField } from './calculate';\nimport { DataFlowNode } from './dataflow';\n/**\n * A node that helps us track what fields we are faceting by.\n */\nexport class FacetNode extends DataFlowNode {\n /**\n * @param model The facet model.\n * @param name The name that this facet source will have.\n * @param data The source data for this facet data.\n */\n constructor(parent, model, name, data) {\n super(parent);\n this.model = model;\n this.name = name;\n this.data = data;\n for (const channel of FACET_CHANNELS) {\n const fieldDef = model.facet[channel];\n if (fieldDef) {\n const { bin, sort } = fieldDef;\n this[channel] = {\n name: model.getName(`${channel}_domain`),\n fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, { binSuffix: 'end' })] : [])],\n ...(isSortField(sort)\n ? { sortField: sort }\n : isArray(sort)\n ? { sortIndexField: sortArrayIndexField(fieldDef, channel) }\n : {})\n };\n }\n }\n this.childModel = model.child;\n }\n hash() {\n let out = `Facet`;\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n out += ` ${channel.charAt(0)}:${hash(this[channel])}`;\n }\n }\n return out;\n }\n get fields() {\n const f = [];\n for (const channel of FACET_CHANNELS) {\n if (this[channel]?.fields) {\n f.push(...this[channel].fields);\n }\n }\n return f;\n }\n dependentFields() {\n const depFields = new Set(this.fields);\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n if (this[channel].sortField) {\n depFields.add(this[channel].sortField.field);\n }\n if (this[channel].sortIndexField) {\n depFields.add(this[channel].sortIndexField);\n }\n }\n }\n return depFields;\n }\n producedFields() {\n return new Set(); // facet does not produce any new fields\n }\n /**\n * The name to reference this source is its name.\n */\n getSource() {\n return this.name;\n }\n getChildIndependentFieldsWithStep() {\n const childIndependentFieldsWithStep = {};\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.childModel.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n // independent scale\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.childModel, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n childIndependentFieldsWithStep[channel] = field;\n }\n else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n return childIndependentFieldsWithStep;\n }\n assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep) {\n const childChannel = { row: 'y', column: 'x', facet: undefined }[channel];\n const fields = [];\n const ops = [];\n const as = [];\n if (childChannel && childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) {\n if (crossedDataName) {\n // If there is a crossed data, calculate max\n fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n ops.push('max');\n }\n else {\n // If there is no crossed data, just calculate distinct\n fields.push(childIndependentFieldsWithStep[childChannel]);\n ops.push('distinct');\n }\n // Although it is technically a max, just name it distinct so it's easier to refer to it\n as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n }\n const { sortField, sortIndexField } = this[channel];\n if (sortField) {\n const { op = DEFAULT_SORT_OP, field } = sortField;\n fields.push(field);\n ops.push(op);\n as.push(vgField(sortField, { forAs: true }));\n }\n else if (sortIndexField) {\n fields.push(sortIndexField);\n ops.push('max');\n as.push(sortIndexField);\n }\n return {\n name: this[channel].name,\n // Use data from the crossed one if it exist\n source: crossedDataName ?? this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this[channel].fields,\n ...(fields.length\n ? {\n fields,\n ops,\n as\n }\n : {})\n }\n ]\n };\n }\n assembleFacetHeaderData(childIndependentFieldsWithStep) {\n const { columns } = this.model.layout;\n const { layoutHeaders } = this.model.component;\n const data = [];\n const hasSharedAxis = {};\n for (const headerChannel of HEADER_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const headers = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) ?? [];\n for (const header of headers) {\n if (header.axes?.length > 0) {\n hasSharedAxis[headerChannel] = true;\n break;\n }\n }\n }\n if (hasSharedAxis[headerChannel]) {\n const cardinality = `length(data(\"${this.facet.name}\"))`;\n const stop = headerChannel === 'row'\n ? columns\n ? { signal: `ceil(${cardinality} / ${columns})` }\n : 1\n : columns\n ? { signal: `min(${cardinality}, ${columns})` }\n : { signal: cardinality };\n data.push({\n name: `${this.facet.name}_${headerChannel}`,\n transform: [\n {\n type: 'sequence',\n start: 0,\n stop\n }\n ]\n });\n }\n }\n const { row, column } = hasSharedAxis;\n if (row || column) {\n data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep));\n }\n return data;\n }\n assemble() {\n const data = [];\n let crossedDataName = null;\n const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep();\n const { column, row, facet } = this;\n if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) {\n // Need to create a cross dataset to correctly calculate cardinality\n crossedDataName = `cross_${this.column.name}_${this.row.name}`;\n const fields = [].concat(childIndependentFieldsWithStep.x ?? [], childIndependentFieldsWithStep.y ?? []);\n const ops = fields.map(() => 'distinct');\n data.push({\n name: crossedDataName,\n source: this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this.fields,\n fields,\n ops\n }\n ]\n });\n }\n for (const channel of [COLUMN, ROW]) {\n if (this[channel]) {\n data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep));\n }\n }\n if (facet) {\n const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep);\n if (facetData) {\n data.push(...facetData);\n }\n }\n return data;\n }\n}\n//# sourceMappingURL=facet.js.map","import { isNumber, isString } from 'vega-util';\nimport { isMinMaxOp } from '../../aggregate';\nimport { getMainRangeChannel } from '../../channel';\nimport { isFieldDef, isFieldOrDatumDefForTimeFormat, isScaleFieldDef, isTypedFieldDef } from '../../channeldef';\nimport { isGenerator } from '../../data';\nimport { isDateTime } from '../../datetime';\nimport * as log from '../../log';\nimport { forEachLeaf } from '../../logical';\nimport { isPathMark } from '../../mark';\nimport { isFieldEqualPredicate, isFieldGTEPredicate, isFieldGTPredicate, isFieldLTEPredicate, isFieldLTPredicate, isFieldOneOfPredicate, isFieldPredicate, isFieldRangePredicate } from '../../predicate';\nimport { isSortField } from '../../sort';\nimport { accessPathDepth, accessPathWithDatum, duplicate, hash, keys, removePathFromField } from '../../util';\nimport { signalRefOrValue } from '../common';\nimport { isFacetModel, isUnitModel } from '../model';\nimport { Split } from '../split';\nimport { DataFlowNode } from './dataflow';\n/**\n * Remove quotes from a string.\n */\nfunction unquote(pattern) {\n if ((pattern.startsWith(\"'\") && pattern.endsWith(\"'\")) || (pattern.startsWith('\"') && pattern.endsWith('\"'))) {\n return pattern.slice(1, -1);\n }\n return pattern;\n}\n/**\n * @param field The field.\n * @param parse What to parse the field as.\n */\nfunction parseExpression(field, parse) {\n const f = accessPathWithDatum(field);\n if (parse === 'number') {\n return `toNumber(${f})`;\n }\n else if (parse === 'boolean') {\n return `toBoolean(${f})`;\n }\n else if (parse === 'string') {\n return `toString(${f})`;\n }\n else if (parse === 'date') {\n return `toDate(${f})`;\n }\n else if (parse === 'flatten') {\n return f;\n }\n else if (parse.startsWith('date:')) {\n const specifier = unquote(parse.slice(5, parse.length));\n return `timeParse(${f},'${specifier}')`;\n }\n else if (parse.startsWith('utc:')) {\n const specifier = unquote(parse.slice(4, parse.length));\n return `utcParse(${f},'${specifier}')`;\n }\n else {\n log.warn(log.message.unrecognizedParse(parse));\n return null;\n }\n}\nexport function getImplicitFromFilterTransform(transform) {\n const implicit = {};\n forEachLeaf(transform.filter, filter => {\n if (isFieldPredicate(filter)) {\n // Automatically add a parse node for filters with filter objects\n let val = null;\n // For EqualFilter, just use the equal property.\n // For RangeFilter and OneOfFilter, all array members should have\n // the same type, so we only use the first one.\n if (isFieldEqualPredicate(filter)) {\n val = signalRefOrValue(filter.equal);\n }\n else if (isFieldLTEPredicate(filter)) {\n val = signalRefOrValue(filter.lte);\n }\n else if (isFieldLTPredicate(filter)) {\n val = signalRefOrValue(filter.lt);\n }\n else if (isFieldGTPredicate(filter)) {\n val = signalRefOrValue(filter.gt);\n }\n else if (isFieldGTEPredicate(filter)) {\n val = signalRefOrValue(filter.gte);\n }\n else if (isFieldRangePredicate(filter)) {\n val = filter.range[0];\n }\n else if (isFieldOneOfPredicate(filter)) {\n val = (filter.oneOf ?? filter['in'])[0];\n } // else -- for filter expression, we can't infer anything\n if (val) {\n if (isDateTime(val)) {\n implicit[filter.field] = 'date';\n }\n else if (isNumber(val)) {\n implicit[filter.field] = 'number';\n }\n else if (isString(val)) {\n implicit[filter.field] = 'string';\n }\n }\n if (filter.timeUnit) {\n implicit[filter.field] = 'date';\n }\n }\n });\n return implicit;\n}\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromEncoding(model) {\n const implicit = {};\n function add(fieldDef) {\n if (isFieldOrDatumDefForTimeFormat(fieldDef)) {\n implicit[fieldDef.field] = 'date';\n }\n else if (fieldDef.type === 'quantitative' &&\n isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max\n ) {\n implicit[fieldDef.field] = 'number';\n }\n else if (accessPathDepth(fieldDef.field) > 1) {\n // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field.\n // (Parsing numbers / dates already flattens numeric and temporal fields.)\n if (!(fieldDef.field in implicit)) {\n implicit[fieldDef.field] = 'flatten';\n }\n }\n else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) {\n // Flatten fields that we sort by but that are not otherwise flattened.\n if (!(fieldDef.sort.field in implicit)) {\n implicit[fieldDef.sort.field] = 'flatten';\n }\n }\n }\n if (isUnitModel(model) || isFacetModel(model)) {\n // Parse encoded fields\n model.forEachFieldDef((fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef)) {\n add(fieldDef);\n }\n else {\n const mainChannel = getMainRangeChannel(channel);\n const mainFieldDef = model.fieldDef(mainChannel);\n add({\n ...fieldDef,\n type: mainFieldDef.type\n });\n }\n });\n }\n // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly.\n if (isUnitModel(model)) {\n const { mark, markDef, encoding } = model;\n if (isPathMark(mark) &&\n // No need to sort by dimension if we have a connected scatterplot (order channel is present)\n !model.encoding.order) {\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (isFieldDef(dimensionChannelDef) &&\n dimensionChannelDef.type === 'quantitative' &&\n !(dimensionChannelDef.field in implicit)) {\n implicit[dimensionChannelDef.field] = 'number';\n }\n }\n }\n return implicit;\n}\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromSelection(model) {\n const implicit = {};\n if (isUnitModel(model) && model.component.selection) {\n for (const name of keys(model.component.selection)) {\n const selCmpt = model.component.selection[name];\n for (const proj of selCmpt.project.items) {\n if (!proj.channel && accessPathDepth(proj.field) > 1) {\n implicit[proj.field] = 'flatten';\n }\n }\n }\n }\n return implicit;\n}\nexport class ParseNode extends DataFlowNode {\n clone() {\n return new ParseNode(null, duplicate(this._parse));\n }\n constructor(parent, parse) {\n super(parent);\n this._parse = parse;\n }\n hash() {\n return `Parse ${hash(this._parse)}`;\n }\n /**\n * Creates a parse node from a data.format.parse and updates ancestorParse.\n */\n static makeExplicit(parent, model, ancestorParse) {\n // Custom parse\n let explicit = {};\n const data = model.data;\n if (!isGenerator(data) && data?.format?.parse) {\n explicit = data.format.parse;\n }\n return this.makeWithAncestors(parent, explicit, {}, ancestorParse);\n }\n /**\n * Creates a parse node from \"explicit\" parse and \"implicit\" parse and updates ancestorParse.\n */\n static makeWithAncestors(parent, explicit, implicit, ancestorParse) {\n // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as \"derived\"). We also don't need to flatten a field that has already been parsed.\n for (const field of keys(implicit)) {\n const parsedAs = ancestorParse.getWithExplicit(field);\n if (parsedAs.value !== undefined) {\n // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types.\n if (parsedAs.explicit ||\n parsedAs.value === implicit[field] ||\n parsedAs.value === 'derived' ||\n implicit[field] === 'flatten') {\n delete implicit[field];\n }\n else {\n log.warn(log.message.differentParse(field, implicit[field], parsedAs.value));\n }\n }\n }\n for (const field of keys(explicit)) {\n const parsedAs = ancestorParse.get(field);\n if (parsedAs !== undefined) {\n // Don't parse a field again if it has been parsed with the same type already.\n if (parsedAs === explicit[field]) {\n delete explicit[field];\n }\n else {\n log.warn(log.message.differentParse(field, explicit[field], parsedAs));\n }\n }\n }\n const parse = new Split(explicit, implicit);\n // add the format parse from this model so that children don't parse the same field again\n ancestorParse.copyAll(parse);\n // copy only non-null parses\n const p = {};\n for (const key of keys(parse.combine())) {\n const val = parse.get(key);\n if (val !== null) {\n p[key] = val;\n }\n }\n if (keys(p).length === 0 || ancestorParse.parseNothing) {\n return null;\n }\n return new ParseNode(parent, p);\n }\n get parse() {\n return this._parse;\n }\n merge(other) {\n this._parse = { ...this._parse, ...other.parse };\n other.remove();\n }\n /**\n * Assemble an object for Vega's format.parse property.\n */\n assembleFormatParse() {\n const formatParse = {};\n for (const field of keys(this._parse)) {\n const p = this._parse[field];\n if (accessPathDepth(field) === 1) {\n formatParse[field] = p;\n }\n }\n return formatParse;\n }\n // format parse depends and produces all fields in its parse\n producedFields() {\n return new Set(keys(this._parse));\n }\n dependentFields() {\n return new Set(keys(this._parse));\n }\n assembleTransforms(onlyNested = false) {\n return keys(this._parse)\n .filter(field => (onlyNested ? accessPathDepth(field) > 1 : true))\n .map(field => {\n const expr = parseExpression(field, this._parse[field]);\n if (!expr) {\n return null;\n }\n const formula = {\n type: 'formula',\n expr,\n as: removePathFromField(field) // Vega output is always flattened\n };\n return formula;\n })\n .filter(t => t !== null);\n }\n}\n//# sourceMappingURL=formatparse.js.map","import { SELECTION_ID } from '../../selection';\nimport { DataFlowNode } from './dataflow';\nexport class IdentifierNode extends DataFlowNode {\n clone() {\n return new IdentifierNode(null);\n }\n constructor(parent) {\n super(parent);\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return new Set([SELECTION_ID]);\n }\n hash() {\n return 'Identifier';\n }\n assemble() {\n return { type: 'identifier', as: SELECTION_ID };\n }\n}\n//# sourceMappingURL=identifier.js.map","import { hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class GraticuleNode extends DataFlowNode {\n clone() {\n return new GraticuleNode(null, this.params);\n }\n constructor(parent, params) {\n super(parent);\n this.params = params;\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return undefined; // there should never be a node before graticule\n }\n hash() {\n return `Graticule ${hash(this.params)}`;\n }\n assemble() {\n return {\n type: 'graticule',\n ...(this.params === true ? {} : this.params)\n };\n }\n}\n//# sourceMappingURL=graticule.js.map","import { hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class SequenceNode extends DataFlowNode {\n clone() {\n return new SequenceNode(null, this.params);\n }\n constructor(parent, params) {\n super(parent);\n this.params = params;\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return new Set([this.params.as ?? 'data']);\n }\n hash() {\n return `Hash ${hash(this.params)}`;\n }\n assemble() {\n return {\n type: 'sequence',\n ...this.params\n };\n }\n}\n//# sourceMappingURL=sequence.js.map","import { isGenerator, isInlineData, isNamedData, isSphereGenerator, isUrlData } from '../../data';\nimport { contains, isEmpty, omit } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class SourceNode extends DataFlowNode {\n constructor(data) {\n super(null); // source cannot have parent\n data ?? (data = { name: 'source' });\n let format;\n if (!isGenerator(data)) {\n format = data.format ? { ...omit(data.format, ['parse']) } : {};\n }\n if (isInlineData(data)) {\n this._data = { values: data.values };\n }\n else if (isUrlData(data)) {\n this._data = { url: data.url };\n if (!format.type) {\n // Extract extension from URL using snippet from\n // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript\n let defaultExtension = /(?:\\.([^.]+))?$/.exec(data.url)[1];\n if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) {\n defaultExtension = 'json';\n }\n // defaultExtension has type string but we ensure that it is DataFormatType above\n format.type = defaultExtension;\n }\n }\n else if (isSphereGenerator(data)) {\n // hardwire GeoJSON sphere data into output specification\n this._data = { values: [{ type: 'Sphere' }] };\n }\n else if (isNamedData(data) || isGenerator(data)) {\n this._data = {};\n }\n // set flag to check if generator\n this._generator = isGenerator(data);\n // any dataset can be named\n if (data.name) {\n this._name = data.name;\n }\n if (format && !isEmpty(format)) {\n this._data.format = format;\n }\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return undefined; // we don't know what this source produces\n }\n get data() {\n return this._data;\n }\n hasName() {\n return !!this._name;\n }\n get isGenerator() {\n return this._generator;\n }\n get dataName() {\n return this._name;\n }\n set dataName(name) {\n this._name = name;\n }\n set parent(parent) {\n throw new Error('Source nodes have to be roots.');\n }\n remove() {\n throw new Error('Source nodes are roots and cannot be removed.');\n }\n hash() {\n throw new Error('Cannot hash sources');\n }\n assemble() {\n return {\n name: this._name,\n ...this._data,\n transform: []\n };\n }\n}\n//# sourceMappingURL=source.js.map","var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _Optimizer_modified;\nimport { GraticuleNode } from './graticule';\nimport { SequenceNode } from './sequence';\nimport { SourceNode } from './source';\n/**\n * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator.\n */\nexport function isDataSourceNode(node) {\n return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode;\n}\n/**\n * Abstract base class for Dataflow optimizers.\n * Contains only mutation handling logic. Subclasses need to implement iteration logic.\n */\nexport class Optimizer {\n constructor() {\n _Optimizer_modified.set(this, void 0);\n __classPrivateFieldSet(this, _Optimizer_modified, false, \"f\");\n }\n // Once true, #modified is never set to false\n setModified() {\n __classPrivateFieldSet(this, _Optimizer_modified, true, \"f\");\n }\n get modifiedFlag() {\n return __classPrivateFieldGet(this, _Optimizer_modified, \"f\");\n }\n}\n_Optimizer_modified = new WeakMap();\n/**\n * Starts from a node and runs the optimization function (the \"run\" method) upwards to the root,\n * depending on the continue and modified flag values returned by the optimization function.\n */\nexport class BottomUpOptimizer extends Optimizer {\n /**\n * Compute a map of node depths that we can use to determine a topological sort order.\n */\n getNodeDepths(node, depth, depths) {\n depths.set(node, depth);\n for (const child of node.children) {\n this.getNodeDepths(child, depth + 1, depths);\n }\n return depths;\n }\n /**\n * Run the optimizer on all nodes starting from the leaves.\n */\n optimize(node) {\n const depths = this.getNodeDepths(node, 0, new Map());\n const topologicalSort = [...depths.entries()].sort((a, b) => b[1] - a[1]);\n for (const tuple of topologicalSort) {\n this.run(tuple[0]);\n }\n return this.modifiedFlag;\n }\n}\n/**\n * The optimizer function (the \"run\" method), is invoked on the given node and then continues recursively.\n */\nexport class TopDownOptimizer extends Optimizer {\n /**\n * Run the optimizer depth first on all nodes starting from the roots.\n */\n optimize(node) {\n this.run(node);\n for (const child of node.children) {\n this.optimize(child);\n }\n return this.modifiedFlag;\n }\n}\n//# sourceMappingURL=optimizer.js.map","import { fieldIntersection, hash, hasIntersection, isEmpty, keys, some } from '../../util';\nimport { requiresSelectionId } from '../selection';\nimport { AggregateNode } from './aggregate';\nimport { BinNode } from './bin';\nimport { OutputNode } from './dataflow';\nimport { FacetNode } from './facet';\nimport { FilterNode } from './filter';\nimport { ParseNode } from './formatparse';\nimport { IdentifierNode } from './identifier';\nimport { BottomUpOptimizer, isDataSourceNode, Optimizer, TopDownOptimizer } from './optimizer';\nimport { SourceNode } from './source';\nimport { TimeUnitNode } from './timeunit';\n/**\n * Merge identical nodes at forks by comparing hashes.\n *\n * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler.\n */\nexport class MergeIdenticalNodes extends TopDownOptimizer {\n mergeNodes(parent, nodes) {\n const mergedNode = nodes.shift();\n for (const node of nodes) {\n parent.removeChild(node);\n node.parent = mergedNode;\n node.remove();\n }\n }\n run(node) {\n const hashes = node.children.map(x => x.hash());\n const buckets = {};\n for (let i = 0; i < hashes.length; i++) {\n if (buckets[hashes[i]] === undefined) {\n buckets[hashes[i]] = [node.children[i]];\n }\n else {\n buckets[hashes[i]].push(node.children[i]);\n }\n }\n for (const k of keys(buckets)) {\n if (buckets[k].length > 1) {\n this.setModified();\n this.mergeNodes(node, buckets[k]);\n }\n }\n }\n}\n/**\n * Optimizer that removes identifier nodes that are not needed for selections.\n */\nexport class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer {\n constructor(model) {\n super();\n this.requiresSelectionId = model && requiresSelectionId(model);\n }\n run(node) {\n if (node instanceof IdentifierNode) {\n // Only preserve IdentifierNodes if we have default discrete selections\n // in our model tree, and if the nodes come after tuple producing nodes.\n if (!(this.requiresSelectionId &&\n (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode))) {\n this.setModified();\n node.remove();\n }\n }\n }\n}\n/**\n * Removes duplicate time unit nodes (as determined by the name of the output field) that may be generated due to\n * selections projected over time units. Only keeps the first time unit in any branch.\n *\n * This optimizer is a custom top down optimizer that keep track of produced fields in a branch.\n */\nexport class RemoveDuplicateTimeUnits extends Optimizer {\n optimize(node) {\n this.run(node, new Set());\n return this.modifiedFlag;\n }\n run(node, timeUnitFields) {\n let producedFields = new Set();\n if (node instanceof TimeUnitNode) {\n producedFields = node.producedFields();\n if (hasIntersection(producedFields, timeUnitFields)) {\n this.setModified();\n node.removeFormulas(timeUnitFields);\n if (node.producedFields.length === 0) {\n node.remove();\n }\n }\n }\n for (const child of node.children) {\n this.run(child, new Set([...timeUnitFields, ...producedFields]));\n }\n }\n}\n/**\n * Remove output nodes that are not required.\n */\nexport class RemoveUnnecessaryOutputNodes extends TopDownOptimizer {\n constructor() {\n super();\n }\n run(node) {\n if (node instanceof OutputNode && !node.isRequired()) {\n this.setModified();\n node.remove();\n }\n }\n}\n/**\n * Move parse nodes up to forks and merges them if possible.\n */\nexport class MoveParseUp extends BottomUpOptimizer {\n run(node) {\n if (isDataSourceNode(node)) {\n return;\n }\n if (node.numChildren() > 1) {\n // Don't move parse further up but continue with parent.\n return;\n }\n for (const child of node.children) {\n if (child instanceof ParseNode) {\n if (node instanceof ParseNode) {\n this.setModified();\n node.merge(child);\n }\n else {\n // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup).\n if (fieldIntersection(node.producedFields(), child.dependentFields())) {\n continue;\n }\n this.setModified();\n child.swapWithParent();\n }\n }\n }\n return;\n }\n}\n/**\n * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes.\n *\n * We assume that dependent paths that do not have a parse node can be just merged.\n */\nexport class MergeParse extends BottomUpOptimizer {\n run(node) {\n const originalChildren = [...node.children];\n const parseChildren = node.children.filter((child) => child instanceof ParseNode);\n if (node.numChildren() > 1 && parseChildren.length >= 1) {\n const commonParse = {};\n const conflictingParse = new Set();\n for (const parseNode of parseChildren) {\n const parse = parseNode.parse;\n for (const k of keys(parse)) {\n if (!(k in commonParse)) {\n commonParse[k] = parse[k];\n }\n else if (commonParse[k] !== parse[k]) {\n conflictingParse.add(k);\n }\n }\n }\n for (const field of conflictingParse) {\n delete commonParse[field];\n }\n if (!isEmpty(commonParse)) {\n this.setModified();\n const mergedParseNode = new ParseNode(node, commonParse);\n for (const childNode of originalChildren) {\n if (childNode instanceof ParseNode) {\n for (const key of keys(commonParse)) {\n delete childNode.parse[key];\n }\n }\n node.removeChild(childNode);\n childNode.parent = mergedParseNode;\n // remove empty parse nodes\n if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) {\n childNode.remove();\n }\n }\n }\n }\n }\n}\n/**\n * Repeatedly remove leaf nodes that are not output or facet nodes.\n * The reason is that we don't need subtrees that don't have any output nodes.\n * Facet nodes are needed for the row or column domains.\n */\nexport class RemoveUnusedSubtrees extends BottomUpOptimizer {\n run(node) {\n if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) {\n // no need to continue with parent because it is output node or will have children (there was a fork)\n }\n else if (node instanceof SourceNode) {\n // ignore empty unused sources as they will be removed in optimizationDataflowHelper\n }\n else {\n this.setModified();\n node.remove();\n }\n }\n}\n/**\n * Merge adjacent time unit nodes.\n */\nexport class MergeTimeUnits extends BottomUpOptimizer {\n run(node) {\n const timeUnitChildren = node.children.filter((x) => x instanceof TimeUnitNode);\n const combination = timeUnitChildren.pop();\n for (const timeUnit of timeUnitChildren) {\n this.setModified();\n combination.merge(timeUnit);\n }\n }\n}\nexport class MergeAggregates extends BottomUpOptimizer {\n run(node) {\n const aggChildren = node.children.filter((child) => child instanceof AggregateNode);\n // Object which we'll use to map the fields which an aggregate is grouped by to\n // the set of aggregates with that grouping. This is useful as only aggregates\n // with the same group by can be merged\n const groupedAggregates = {};\n // Build groupedAggregates\n for (const agg of aggChildren) {\n const groupBys = hash(agg.groupBy);\n if (!(groupBys in groupedAggregates)) {\n groupedAggregates[groupBys] = [];\n }\n groupedAggregates[groupBys].push(agg);\n }\n // Merge aggregateNodes with same key in groupedAggregates\n for (const group of keys(groupedAggregates)) {\n const mergeableAggs = groupedAggregates[group];\n if (mergeableAggs.length > 1) {\n const mergedAggs = mergeableAggs.pop();\n for (const agg of mergeableAggs) {\n if (mergedAggs.merge(agg)) {\n node.removeChild(agg);\n agg.parent = mergedAggs;\n agg.remove();\n this.setModified();\n }\n }\n }\n }\n }\n}\n/**\n * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node.\n */\nexport class MergeBins extends BottomUpOptimizer {\n constructor(model) {\n super();\n this.model = model;\n }\n run(node) {\n const moveBinsUp = !(isDataSourceNode(node) ||\n node instanceof FilterNode ||\n node instanceof ParseNode ||\n node instanceof IdentifierNode);\n const promotableBins = [];\n const remainingBins = [];\n for (const child of node.children) {\n if (child instanceof BinNode) {\n if (moveBinsUp && !fieldIntersection(node.producedFields(), child.dependentFields())) {\n promotableBins.push(child);\n }\n else {\n remainingBins.push(child);\n }\n }\n }\n if (promotableBins.length > 0) {\n const promotedBin = promotableBins.pop();\n for (const bin of promotableBins) {\n promotedBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setModified();\n if (node instanceof BinNode) {\n node.merge(promotedBin, this.model.renameSignal.bind(this.model));\n }\n else {\n promotedBin.swapWithParent();\n }\n }\n if (remainingBins.length > 1) {\n const remainingBin = remainingBins.pop();\n for (const bin of remainingBins) {\n remainingBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setModified();\n }\n }\n}\n/**\n * This optimizer takes output nodes that are at a fork and moves them before the fork.\n *\n * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes.\n * It then moves all output nodes before that main output node. All other children (and the children of the output nodes)\n * are inserted after the main output node.\n */\nexport class MergeOutputs extends BottomUpOptimizer {\n run(node) {\n const children = [...node.children];\n const hasOutputChild = some(children, child => child instanceof OutputNode);\n if (!hasOutputChild || node.numChildren() <= 1) {\n return;\n }\n const otherChildren = [];\n // The output node we will connect all other nodes to.\n // Output nodes will be added before the new node, other nodes after.\n let mainOutput;\n for (const child of children) {\n if (child instanceof OutputNode) {\n let lastOutput = child;\n while (lastOutput.numChildren() === 1) {\n const [theChild] = lastOutput.children;\n if (theChild instanceof OutputNode) {\n lastOutput = theChild;\n }\n else {\n break;\n }\n }\n otherChildren.push(...lastOutput.children);\n if (mainOutput) {\n // Move the output nodes before the mainOutput. We do this by setting\n // the parent of the first not to the parent of the main output and\n // the main output's parent to the last output.\n // note: the child is the first output\n node.removeChild(child);\n child.parent = mainOutput.parent;\n mainOutput.parent.removeChild(mainOutput);\n mainOutput.parent = lastOutput;\n this.setModified();\n }\n else {\n mainOutput = lastOutput;\n }\n }\n else {\n otherChildren.push(child);\n }\n }\n if (otherChildren.length) {\n this.setModified();\n for (const child of otherChildren) {\n child.parent.removeChild(child);\n child.parent = mainOutput;\n }\n }\n }\n}\n//# sourceMappingURL=optimizers.js.map","import { vgField } from '../../channeldef';\nimport { duplicate, hash } from '../../util';\nimport { unique } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for the join aggregate transform nodes.\n */\nexport class JoinAggregateTransformNode extends DataFlowNode {\n clone() {\n return new JoinAggregateTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n }\n addDimensions(fields) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n dependentFields() {\n const out = new Set();\n if (this.transform.groupby) {\n this.transform.groupby.forEach(out.add, out);\n }\n this.transform.joinaggregate\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n return out;\n }\n producedFields() {\n return new Set(this.transform.joinaggregate.map(this.getDefaultName));\n }\n getDefaultName(joinAggregateFieldDef) {\n return joinAggregateFieldDef.as ?? vgField(joinAggregateFieldDef);\n }\n hash() {\n return `JoinAggregateTransform ${hash(this.transform)}`;\n }\n assemble() {\n const fields = [];\n const ops = [];\n const as = [];\n for (const joinaggregate of this.transform.joinaggregate) {\n ops.push(joinaggregate.op);\n as.push(this.getDefaultName(joinaggregate));\n fields.push(joinaggregate.field === undefined ? null : joinaggregate.field);\n }\n const groupby = this.transform.groupby;\n return {\n type: 'joinaggregate',\n as,\n ops,\n fields,\n ...(groupby !== undefined ? { groupby } : {})\n };\n }\n}\n//# sourceMappingURL=joinaggregate.js.map","import { isArray, isString } from 'vega-util';\nimport { getFieldDef, isFieldDef, isOrderOnlyDef, vgField } from '../../channeldef';\nimport { duplicate, getFirstDefined, hash } from '../../util';\nimport { sortParams } from '../common';\nimport { DataFlowNode } from './dataflow';\nfunction getStackByFields(model) {\n return model.stack.stackBy.reduce((fields, by) => {\n const fieldDef = by.fieldDef;\n const _field = vgField(fieldDef);\n if (_field) {\n fields.push(_field);\n }\n return fields;\n }, []);\n}\nfunction isValidAsArray(as) {\n return isArray(as) && as.every(s => isString(s)) && as.length > 1;\n}\nexport class StackNode extends DataFlowNode {\n clone() {\n return new StackNode(null, duplicate(this._stack));\n }\n constructor(parent, stack) {\n super(parent);\n this._stack = stack;\n }\n static makeFromTransform(parent, stackTransform) {\n const { stack, groupby, as, offset = 'zero' } = stackTransform;\n const sortFields = [];\n const sortOrder = [];\n if (stackTransform.sort !== undefined) {\n for (const sortField of stackTransform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(getFirstDefined(sortField.order, 'ascending'));\n }\n }\n const sort = {\n field: sortFields,\n order: sortOrder\n };\n let normalizedAs;\n if (isValidAsArray(as)) {\n normalizedAs = as;\n }\n else if (isString(as)) {\n normalizedAs = [as, `${as}_end`];\n }\n else {\n normalizedAs = [`${stackTransform.stack}_start`, `${stackTransform.stack}_end`];\n }\n return new StackNode(parent, {\n dimensionFieldDefs: [],\n stackField: stack,\n groupby,\n offset,\n sort,\n facetby: [],\n as: normalizedAs\n });\n }\n static makeFromEncoding(parent, model) {\n const stackProperties = model.stack;\n const { encoding } = model;\n if (!stackProperties) {\n return null;\n }\n const { groupbyChannels, fieldChannel, offset, impute } = stackProperties;\n const dimensionFieldDefs = groupbyChannels\n .map(groupbyChannel => {\n const cDef = encoding[groupbyChannel];\n return getFieldDef(cDef);\n })\n .filter(def => !!def);\n const stackby = getStackByFields(model);\n const orderDef = model.encoding.order;\n let sort;\n if (isArray(orderDef) || isFieldDef(orderDef)) {\n sort = sortParams(orderDef);\n }\n else {\n const sortOrder = isOrderOnlyDef(orderDef) ? orderDef.sort : fieldChannel === 'y' ? 'descending' : 'ascending';\n // default = descending by stackFields\n // FIXME is the default here correct for binned fields?\n sort = stackby.reduce((s, field) => {\n s.field.push(field);\n s.order.push(sortOrder);\n return s;\n }, { field: [], order: [] });\n }\n return new StackNode(parent, {\n dimensionFieldDefs,\n stackField: model.vgField(fieldChannel),\n facetby: [],\n stackby,\n sort,\n offset,\n impute,\n as: [\n model.vgField(fieldChannel, { suffix: 'start', forAs: true }),\n model.vgField(fieldChannel, { suffix: 'end', forAs: true })\n ]\n });\n }\n get stack() {\n return this._stack;\n }\n addDimensions(fields) {\n this._stack.facetby.push(...fields);\n }\n dependentFields() {\n const out = new Set();\n out.add(this._stack.stackField);\n this.getGroupbyFields().forEach(out.add, out);\n this._stack.facetby.forEach(out.add, out);\n this._stack.sort.field.forEach(out.add, out);\n return out;\n }\n producedFields() {\n return new Set(this._stack.as);\n }\n hash() {\n return `Stack ${hash(this._stack)}`;\n }\n getGroupbyFields() {\n const { dimensionFieldDefs, impute, groupby } = this._stack;\n if (dimensionFieldDefs.length > 0) {\n return dimensionFieldDefs\n .map(dimensionFieldDef => {\n if (dimensionFieldDef.bin) {\n if (impute) {\n // For binned group by field with impute, we calculate bin_mid\n // as we cannot impute two fields simultaneously\n return [vgField(dimensionFieldDef, { binSuffix: 'mid' })];\n }\n return [\n // For binned group by field without impute, we need both bin (start) and bin_end\n vgField(dimensionFieldDef, {}),\n vgField(dimensionFieldDef, { binSuffix: 'end' })\n ];\n }\n return [vgField(dimensionFieldDef)];\n })\n .flat();\n }\n return groupby ?? [];\n }\n assemble() {\n const transform = [];\n const { facetby, dimensionFieldDefs, stackField: field, stackby, sort, offset, impute, as } = this._stack;\n // Impute\n if (impute) {\n for (const dimensionFieldDef of dimensionFieldDefs) {\n const { bandPosition = 0.5, bin } = dimensionFieldDef;\n if (bin) {\n // As we can only impute one field at a time, we need to calculate\n // mid point for a binned field\n const binStart = vgField(dimensionFieldDef, { expr: 'datum' });\n const binEnd = vgField(dimensionFieldDef, { expr: 'datum', binSuffix: 'end' });\n transform.push({\n type: 'formula',\n expr: `${bandPosition}*${binStart}+${1 - bandPosition}*${binEnd}`,\n as: vgField(dimensionFieldDef, { binSuffix: 'mid', forAs: true })\n });\n }\n transform.push({\n type: 'impute',\n field,\n groupby: [...stackby, ...facetby],\n key: vgField(dimensionFieldDef, { binSuffix: 'mid' }),\n method: 'value',\n value: 0\n });\n }\n }\n // Stack\n transform.push({\n type: 'stack',\n groupby: [...this.getGroupbyFields(), ...facetby],\n field,\n sort,\n as,\n offset\n });\n return transform;\n }\n}\n//# sourceMappingURL=stack.js.map","import { isAggregateOp } from '../../aggregate';\nimport { vgField } from '../../channeldef';\nimport { duplicate, hash } from '../../util';\nimport { unique } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for the window transform nodes\n */\nexport class WindowTransformNode extends DataFlowNode {\n clone() {\n return new WindowTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n }\n addDimensions(fields) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n dependentFields() {\n const out = new Set();\n (this.transform.groupby ?? []).forEach(out.add, out);\n (this.transform.sort ?? []).forEach(m => out.add(m.field));\n this.transform.window\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n return out;\n }\n producedFields() {\n return new Set(this.transform.window.map(this.getDefaultName));\n }\n getDefaultName(windowFieldDef) {\n return windowFieldDef.as ?? vgField(windowFieldDef);\n }\n hash() {\n return `WindowTransform ${hash(this.transform)}`;\n }\n assemble() {\n const fields = [];\n const ops = [];\n const as = [];\n const params = [];\n for (const window of this.transform.window) {\n ops.push(window.op);\n as.push(this.getDefaultName(window));\n params.push(window.param === undefined ? null : window.param);\n fields.push(window.field === undefined ? null : window.field);\n }\n const frame = this.transform.frame;\n const groupby = this.transform.groupby;\n if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) {\n // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate\n return {\n type: 'joinaggregate',\n as,\n ops: ops,\n fields,\n ...(groupby !== undefined ? { groupby } : {})\n };\n }\n const sortFields = [];\n const sortOrder = [];\n if (this.transform.sort !== undefined) {\n for (const sortField of this.transform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(sortField.order ?? 'ascending');\n }\n }\n const sort = {\n field: sortFields,\n order: sortOrder\n };\n const ignorePeers = this.transform.ignorePeers;\n return {\n type: 'window',\n params,\n as,\n ops,\n fields,\n sort,\n ...(ignorePeers !== undefined ? { ignorePeers } : {}),\n ...(groupby !== undefined ? { groupby } : {}),\n ...(frame !== undefined ? { frame } : {})\n };\n }\n}\n//# sourceMappingURL=window.js.map","import { DataSourceType } from '../../data';\nimport { AggregateNode } from './aggregate';\nimport { OutputNode } from './dataflow';\nimport { FacetNode } from './facet';\nimport { JoinAggregateTransformNode } from './joinaggregate';\nimport { FACET_SCALE_PREFIX } from './optimize';\nimport { StackNode } from './stack';\nimport { WindowTransformNode } from './window';\n/**\n * Clones the subtree and ignores output nodes except for the leaves, which are renamed.\n */\nfunction cloneSubtree(facet) {\n function clone(node) {\n if (!(node instanceof FacetNode)) {\n const copy = node.clone();\n if (copy instanceof OutputNode) {\n const newName = FACET_SCALE_PREFIX + copy.getSource();\n copy.setSource(newName);\n facet.model.component.data.outputNodes[newName] = copy;\n }\n else if (copy instanceof AggregateNode ||\n copy instanceof StackNode ||\n copy instanceof WindowTransformNode ||\n copy instanceof JoinAggregateTransformNode) {\n copy.addDimensions(facet.fields);\n }\n for (const n of node.children.flatMap(clone)) {\n n.parent = copy;\n }\n return [copy];\n }\n return node.children.flatMap(clone);\n }\n return clone;\n}\n/**\n * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node.\n * After moving down the facet node, make a copy of the subtree and make it a child of the main output.\n */\nexport function moveFacetDown(node) {\n if (node instanceof FacetNode) {\n if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) {\n // move down until we hit a fork or output node\n const child = node.children[0];\n if (child instanceof AggregateNode ||\n child instanceof StackNode ||\n child instanceof WindowTransformNode ||\n child instanceof JoinAggregateTransformNode) {\n child.addDimensions(node.fields);\n }\n child.swapWithParent();\n moveFacetDown(node);\n }\n else {\n // move main to facet\n const facetMain = node.model.component.data.main;\n moveMainDownToFacet(facetMain);\n // replicate the subtree and place it before the facet's main node\n const cloner = cloneSubtree(node);\n const copy = node.children.map(cloner).flat();\n for (const c of copy) {\n c.parent = facetMain;\n }\n }\n }\n else {\n node.children.map(moveFacetDown);\n }\n}\nfunction moveMainDownToFacet(node) {\n if (node instanceof OutputNode && node.type === DataSourceType.Main) {\n if (node.numChildren() === 1) {\n const child = node.children[0];\n if (!(child instanceof FacetNode)) {\n child.swapWithParent();\n moveMainDownToFacet(node);\n }\n }\n }\n}\n//# sourceMappingURL=subtree.js.map","import * as log from '../../log';\nimport * as optimizers from './optimizers';\nimport { moveFacetDown } from './subtree';\nexport const FACET_SCALE_PREFIX = 'scale_';\nexport const MAX_OPTIMIZATION_RUNS = 5;\n/**\n * Iterates over a dataflow graph and checks whether all links are consistent.\n */\nexport function checkLinks(nodes) {\n for (const node of nodes) {\n for (const child of node.children) {\n if (child.parent !== node) {\n // log.error('Dataflow graph is inconsistent.', node, child);\n return false;\n }\n }\n if (!checkLinks(node.children)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Run the specified optimizer on the provided nodes.\n *\n * @param optimizer The optimizer instance to run.\n * @param nodes A set of nodes to optimize.\n */\nfunction runOptimizer(optimizer, nodes) {\n let modified = false;\n for (const node of nodes) {\n modified = optimizer.optimize(node) || modified;\n }\n return modified;\n}\nfunction optimizationDataflowHelper(dataComponent, model, firstPass) {\n let roots = dataComponent.sources;\n let modified = false;\n modified = runOptimizer(new optimizers.RemoveUnnecessaryOutputNodes(), roots) || modified;\n modified = runOptimizer(new optimizers.RemoveUnnecessaryIdentifierNodes(model), roots) || modified;\n // remove source nodes that don't have any children because they also don't have output nodes\n roots = roots.filter(r => r.numChildren() > 0);\n modified = runOptimizer(new optimizers.RemoveUnusedSubtrees(), roots) || modified;\n roots = roots.filter(r => r.numChildren() > 0);\n if (!firstPass) {\n // Only run these optimizations after the optimizer has moved down the facet node.\n // With this change, we can be more aggressive in the optimizations.\n modified = runOptimizer(new optimizers.MoveParseUp(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeBins(model), roots) || modified;\n modified = runOptimizer(new optimizers.RemoveDuplicateTimeUnits(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeParse(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeAggregates(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeTimeUnits(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeIdenticalNodes(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeOutputs(), roots) || modified;\n }\n dataComponent.sources = roots;\n return modified;\n}\n/**\n * Optimizes the dataflow of the passed in data component.\n */\nexport function optimizeDataflow(data, model) {\n // check before optimizations\n checkLinks(data.sources);\n let firstPassCounter = 0;\n let secondPassCounter = 0;\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, true)) {\n break;\n }\n firstPassCounter++;\n }\n // move facets down and make a copy of the subtree so that we can have scales at the top level\n data.sources.map(moveFacetDown);\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, false)) {\n break;\n }\n secondPassCounter++;\n }\n // check after optimizations\n checkLinks(data.sources);\n if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) {\n log.warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`);\n }\n}\n//# sourceMappingURL=optimize.js.map","/**\n * A class that behaves like a SignalRef but lazily generates the signal.\n * The provided generator function should use `Model.getSignalName` to use the correct signal name.\n */\nexport class SignalRefWrapper {\n constructor(exprGenerator) {\n Object.defineProperty(this, 'signal', {\n enumerable: true,\n get: exprGenerator\n });\n }\n static fromName(rename, signalName) {\n return new SignalRefWrapper(() => rename(signalName));\n }\n}\n//# sourceMappingURL=signal.js.map","import { isObject, isString } from 'vega-util';\nimport { isAggregateOp, isArgmaxDef, isArgminDef, MULTIDOMAIN_SORT_OP_INDEX as UNIONDOMAIN_SORT_OP_INDEX, SHARED_DOMAIN_OPS } from '../../aggregate';\nimport { isBinning, isBinParams, isParameterExtent } from '../../bin';\nimport { getSecondaryRangeChannel, isScaleChannel, isXorY } from '../../channel';\nimport { binRequiresRange, getBandPosition, getFieldOrDatumDef, hasBandEnd, isDatumDef, isFieldDef, valueExpr, vgField } from '../../channeldef';\nimport { DataSourceType } from '../../data';\nimport * as log from '../../log';\nimport { hasDiscreteDomain, isDomainUnionWith, isParameterDomain } from '../../scale';\nimport { DEFAULT_SORT_OP, isSortArray, isSortByEncoding, isSortField } from '../../sort';\nimport { normalizeTimeUnit } from '../../timeunit';\nimport * as util from '../../util';\nimport { isDataRefDomain, isDataRefUnionedDomain, isFieldRefUnionDomain, isSignalRef } from '../../vega.schema';\nimport { getBinSignalName } from '../data/bin';\nimport { sortArrayIndexField } from '../data/calculate';\nimport { FACET_SCALE_PREFIX } from '../data/optimize';\nimport { isFacetModel, isUnitModel } from '../model';\nimport { SignalRefWrapper } from '../signal';\nimport { makeExplicit, makeImplicit, mergeValuesWithExplicit } from '../split';\nimport { isRectBasedMark } from '../../mark';\nimport { OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX } from '../data/timeunit';\nexport function parseScaleDomain(model) {\n if (isUnitModel(model)) {\n parseUnitScaleDomain(model);\n }\n else {\n parseNonUnitScaleDomain(model);\n }\n}\nfunction parseUnitScaleDomain(model) {\n const localScaleComponents = model.component.scales;\n for (const channel of util.keys(localScaleComponents)) {\n const domains = parseDomainForChannel(model, channel);\n const localScaleCmpt = localScaleComponents[channel];\n localScaleCmpt.setWithExplicit('domains', domains);\n parseSelectionDomain(model, channel);\n if (model.component.data.isFaceted) {\n // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not\n let facetParent = model;\n while (!isFacetModel(facetParent) && facetParent.parent) {\n facetParent = facetParent.parent;\n }\n const resolve = facetParent.component.resolve.scale[channel];\n if (resolve === 'shared') {\n for (const domain of domains.value) {\n // Replace the scale domain with data output from a cloned subtree after the facet.\n if (isDataRefDomain(domain)) {\n // use data from cloned subtree (which is the same as data but with a prefix added once)\n domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, '');\n }\n }\n }\n }\n }\n}\nfunction parseNonUnitScaleDomain(model) {\n for (const child of model.children) {\n parseScaleDomain(child);\n }\n const localScaleComponents = model.component.scales;\n for (const channel of util.keys(localScaleComponents)) {\n let domains;\n let selectionExtent = null;\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n if (domains === undefined) {\n domains = childComponent.getWithExplicit('domains');\n }\n else {\n domains = mergeValuesWithExplicit(domains, childComponent.getWithExplicit('domains'), 'domains', 'scale', domainsTieBreaker);\n }\n const se = childComponent.get('selectionExtent');\n if (selectionExtent && se && selectionExtent.param !== se.param) {\n log.warn(log.message.NEEDS_SAME_SELECTION);\n }\n selectionExtent = se;\n }\n }\n localScaleComponents[channel].setWithExplicit('domains', domains);\n if (selectionExtent) {\n localScaleComponents[channel].set('selectionExtent', selectionExtent, true);\n }\n }\n}\n/**\n * Remove unaggregated domain if it is not applicable\n * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true.\n */\nfunction normalizeUnaggregatedDomain(domain, fieldDef, scaleType, scaleConfig) {\n if (domain === 'unaggregated') {\n const { valid, reason } = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (!valid) {\n log.warn(reason);\n return undefined;\n }\n }\n else if (domain === undefined && scaleConfig.useUnaggregatedDomain) {\n // Apply config if domain is not specified.\n const { valid } = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (valid) {\n return 'unaggregated';\n }\n }\n return domain;\n}\nexport function parseDomainForChannel(model, channel) {\n const scaleType = model.getScaleComponent(channel).get('type');\n const { encoding } = model;\n const domain = normalizeUnaggregatedDomain(model.scaleDomain(channel), model.typedFieldDef(channel), scaleType, model.config.scale);\n if (domain !== model.scaleDomain(channel)) {\n model.specifiedScales[channel] = {\n ...model.specifiedScales[channel],\n domain\n };\n }\n // If channel is either X or Y then union them with X2 & Y2 if they exist\n if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) {\n if (getFieldOrDatumDef(encoding.x)) {\n return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'x'), parseSingleChannelDomain(scaleType, domain, model, 'x2'), 'domain', 'scale', domainsTieBreaker);\n }\n else {\n return parseSingleChannelDomain(scaleType, domain, model, 'x2');\n }\n }\n else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) {\n if (getFieldOrDatumDef(encoding.y)) {\n return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'y'), parseSingleChannelDomain(scaleType, domain, model, 'y2'), 'domain', 'scale', domainsTieBreaker);\n }\n else {\n return parseSingleChannelDomain(scaleType, domain, model, 'y2');\n }\n }\n return parseSingleChannelDomain(scaleType, domain, model, channel);\n}\nfunction mapDomainToDataSignal(domain, type, timeUnit) {\n return domain.map(v => {\n const data = valueExpr(v, { timeUnit, type });\n return { signal: `{data: ${data}}` };\n });\n}\nfunction convertDomainIfItIsDateTime(domain, type, timeUnit) {\n // explicit value\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit)?.unit;\n if (type === 'temporal' || normalizedTimeUnit) {\n return mapDomainToDataSignal(domain, type, normalizedTimeUnit);\n }\n return [domain]; // Date time won't make sense\n}\nfunction parseSingleChannelDomain(scaleType, domain, model, channel) {\n const { encoding, markDef, mark, config, stack } = model;\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]);\n const { type } = fieldOrDatumDef;\n const timeUnit = fieldOrDatumDef['timeUnit'];\n if (isDomainUnionWith(domain)) {\n const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel);\n const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit);\n return makeExplicit([...unionWith, ...defaultDomain.value]);\n }\n else if (isSignalRef(domain)) {\n return makeExplicit([domain]);\n }\n else if (domain && domain !== 'unaggregated' && !isParameterDomain(domain)) {\n return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit));\n }\n if (stack && channel === stack.fieldChannel) {\n if (stack.offset === 'normalize') {\n return makeImplicit([[0, 1]]);\n }\n const data = model.requestDataName(DataSourceType.Main);\n return makeImplicit([\n {\n data,\n field: model.vgField(channel, { suffix: 'start' })\n },\n {\n data,\n field: model.vgField(channel, { suffix: 'end' })\n }\n ]);\n }\n const sort = isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined;\n if (isDatumDef(fieldOrDatumDef)) {\n const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit);\n return makeImplicit(d);\n }\n const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef\n if (domain === 'unaggregated') {\n const data = model.requestDataName(DataSourceType.Main);\n const { field } = fieldOrDatumDef;\n return makeImplicit([\n {\n data,\n field: vgField({ field, aggregate: 'min' })\n },\n {\n data,\n field: vgField({ field, aggregate: 'max' })\n }\n ]);\n }\n else if (isBinning(fieldDef.bin)) {\n if (hasDiscreteDomain(scaleType)) {\n if (scaleType === 'bin-ordinal') {\n // we can omit the domain as it is inferred from the `bins` property\n return makeImplicit([]);\n }\n // ordinal bin scale takes domain from bin_range, ordered by bin start\n // This is useful for both axis-based scale (x/y) and legend-based scale (other channels).\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n // Use range if we added it and the scale does not support computing a range as a signal.\n field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? { binSuffix: 'range' } : {}),\n // we have to use a sort object if sort = true to make the sort correct by bin start\n sort: sort === true || !isObject(sort)\n ? {\n field: model.vgField(channel, {}),\n op: 'min' // min or max doesn't matter since we sort by the start of the bin range\n }\n : sort\n }\n ]);\n }\n else {\n // continuous scales\n const { bin } = fieldDef;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return makeImplicit([\n new SignalRefWrapper(() => {\n const signal = model.getSignalName(binSignal);\n return `[${signal}.start, ${signal}.stop]`;\n })\n ]);\n }\n else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel, {})\n }\n ]);\n }\n }\n }\n else if (fieldDef.timeUnit && util.contains(['time', 'utc'], scaleType)) {\n const fieldDef2 = encoding[getSecondaryRangeChannel(channel)];\n if (hasBandEnd(fieldDef, fieldDef2, markDef, config)) {\n const data = model.requestDataName(DataSourceType.Main);\n const bandPosition = getBandPosition({ fieldDef, fieldDef2, markDef, config });\n const isRectWithOffset = isRectBasedMark(mark) && bandPosition !== 0.5 && isXorY(channel);\n return makeImplicit([\n {\n data,\n field: model.vgField(channel, isRectWithOffset ? { suffix: OFFSETTED_RECT_START_SUFFIX } : {})\n },\n {\n data,\n field: model.vgField(channel, { suffix: isRectWithOffset ? OFFSETTED_RECT_END_SUFFIX : 'end' })\n }\n ]);\n }\n }\n if (sort) {\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n field: model.vgField(channel),\n sort\n }\n ]);\n }\n else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel)\n }\n ]);\n }\n}\nfunction normalizeSortField(sort, isStackedMeasure) {\n const { op, field, order } = sort;\n return {\n // Apply default op\n op: op ?? (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP),\n // flatten nested fields\n ...(field ? { field: util.replacePathInField(field) } : {}),\n ...(order ? { order } : {})\n };\n}\nfunction parseSelectionDomain(model, channel) {\n const scale = model.component.scales[channel];\n const spec = model.specifiedScales[channel].domain;\n const bin = model.fieldDef(channel)?.bin;\n const domain = isParameterDomain(spec) && spec;\n const extent = isBinParams(bin) && isParameterExtent(bin.extent) && bin.extent;\n if (domain || extent) {\n // As scale parsing occurs before selection parsing, we cannot set\n // domainRaw directly. So instead, we store the selectionExtent on\n // the scale component, and then add domainRaw during scale assembly.\n scale.set('selectionExtent', domain ?? extent, true);\n }\n}\nexport function domainSort(model, channel, scaleType) {\n if (!hasDiscreteDomain(scaleType)) {\n return undefined;\n }\n // save to cast as the only exception is the geojson type for shape, which would not generate a scale\n const fieldDef = model.fieldDef(channel);\n const sort = fieldDef.sort;\n // if the sort is specified with array, use the derived sort index field\n if (isSortArray(sort)) {\n return {\n op: 'min',\n field: sortArrayIndexField(fieldDef, channel),\n order: 'ascending'\n };\n }\n const { stack } = model;\n const stackDimensions = stack\n ? new Set([...stack.groupbyFields, ...stack.stackBy.map(s => s.fieldDef.field)])\n : undefined;\n // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)\n if (isSortField(sort)) {\n const isStackedMeasure = stack && !stackDimensions.has(sort.field);\n return normalizeSortField(sort, isStackedMeasure);\n }\n else if (isSortByEncoding(sort)) {\n const { encoding, order } = sort;\n const fieldDefToSortBy = model.fieldDef(encoding);\n const { aggregate, field } = fieldDefToSortBy;\n const isStackedMeasure = stack && !stackDimensions.has(field);\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n return normalizeSortField({\n field: vgField(fieldDefToSortBy),\n order\n }, isStackedMeasure);\n }\n else if (isAggregateOp(aggregate) || !aggregate) {\n return normalizeSortField({\n op: aggregate,\n field,\n order\n }, isStackedMeasure);\n }\n }\n else if (sort === 'descending') {\n return {\n op: 'min',\n field: model.vgField(channel),\n order: 'descending'\n };\n }\n else if (util.contains(['ascending', undefined /* default =ascending*/], sort)) {\n return true;\n }\n // sort == null\n return undefined;\n}\n/**\n * Determine if a scale can use unaggregated domain.\n * @return {Boolean} Returns true if all of the following conditions apply:\n * 1. `scale.domain` is `unaggregated`\n * 2. Aggregation function is not `count` or `sum`\n * 3. The scale is quantitative or time scale.\n */\nexport function canUseUnaggregatedDomain(fieldDef, scaleType) {\n const { aggregate, type } = fieldDef;\n if (!aggregate) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainHasNoEffectForRawField(fieldDef)\n };\n }\n if (isString(aggregate) && !SHARED_DOMAIN_OPS.has(aggregate)) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainWithNonSharedDomainOp(aggregate)\n };\n }\n if (type === 'quantitative') {\n if (scaleType === 'log') {\n return {\n valid: false,\n reason: log.message.unaggregatedDomainWithLogScale(fieldDef)\n };\n }\n }\n return { valid: true };\n}\n/**\n * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values.\n */\nfunction domainsTieBreaker(v1, v2, property, propertyOf) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, concat the domains so that we union them later.\n return { explicit: v1.explicit, value: [...v1.value, ...v2.value] };\n}\n/**\n * Converts an array of domains to a single Vega scale domain.\n */\nexport function mergeDomains(domains) {\n const uniqueDomains = util.unique(domains.map(domain => {\n // ignore sort property when computing the unique domains\n if (isDataRefDomain(domain)) {\n const { sort: _s, ...domainWithoutSort } = domain;\n return domainWithoutSort;\n }\n return domain;\n }), util.hash);\n const sorts = util.unique(domains\n .map(d => {\n if (isDataRefDomain(d)) {\n const s = d.sort;\n if (s !== undefined && !util.isBoolean(s)) {\n if ('op' in s && s.op === 'count') {\n // let's make sure that if op is count, we don't use a field\n delete s.field;\n }\n if (s.order === 'ascending') {\n // drop order: ascending as it is the default\n delete s.order;\n }\n }\n return s;\n }\n return undefined;\n })\n .filter(s => s !== undefined), util.hash);\n if (uniqueDomains.length === 0) {\n return undefined;\n }\n else if (uniqueDomains.length === 1) {\n const domain = domains[0];\n if (isDataRefDomain(domain) && sorts.length > 0) {\n let sort = sorts[0];\n if (sorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n // Get sorts with non-default ops\n const filteredSorts = sorts.filter(s => isObject(s) && 'op' in s && s.op !== 'min');\n if (sorts.every(s => isObject(s) && 'op' in s) && filteredSorts.length === 1) {\n sort = filteredSorts[0];\n }\n else {\n sort = true;\n }\n }\n else {\n // Simplify domain sort by removing field and op when the field is the same as the domain field.\n if (isObject(sort) && 'field' in sort) {\n const sortField = sort.field;\n if (domain.field === sortField) {\n sort = sort.order ? { order: sort.order } : true;\n }\n }\n }\n return {\n ...domain,\n sort\n };\n }\n return domain;\n }\n // only keep sort properties that work with unioned domains\n const unionDomainSorts = util.unique(sorts.map(s => {\n if (util.isBoolean(s) || !('op' in s) || (isString(s.op) && s.op in UNIONDOMAIN_SORT_OP_INDEX)) {\n return s;\n }\n log.warn(log.message.domainSortDropped(s));\n return true;\n }), util.hash);\n let sort;\n if (unionDomainSorts.length === 1) {\n sort = unionDomainSorts[0];\n }\n else if (unionDomainSorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n sort = true;\n }\n const allData = util.unique(domains.map(d => {\n if (isDataRefDomain(d)) {\n return d.data;\n }\n return null;\n }), x => x);\n if (allData.length === 1 && allData[0] !== null) {\n // create a union domain of different fields with a single data source\n const domain = {\n data: allData[0],\n fields: uniqueDomains.map(d => d.field),\n ...(sort ? { sort } : {})\n };\n return domain;\n }\n return { fields: uniqueDomains, ...(sort ? { sort } : {}) };\n}\n/**\n * Return a field if a scale uses a single field.\n * Return `undefined` otherwise.\n */\nexport function getFieldFromDomain(domain) {\n if (isDataRefDomain(domain) && isString(domain.field)) {\n return domain.field;\n }\n else if (isDataRefUnionedDomain(domain)) {\n let field;\n for (const nonUnionDomain of domain.fields) {\n if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) {\n if (!field) {\n field = nonUnionDomain.field;\n }\n else if (field !== nonUnionDomain.field) {\n log.warn(log.message.FACETED_INDEPENDENT_DIFFERENT_SOURCES);\n return field;\n }\n }\n }\n log.warn(log.message.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES);\n return field;\n }\n else if (isFieldRefUnionDomain(domain)) {\n log.warn(log.message.FACETED_INDEPENDENT_SAME_SOURCE);\n const field = domain.fields[0];\n return isString(field) ? field : undefined;\n }\n return undefined;\n}\nexport function assembleDomain(model, channel) {\n const scaleComponent = model.component.scales[channel];\n const domains = scaleComponent.get('domains').map((domain) => {\n // Correct references to data as the original domain's data was determined\n // in parseScale, which happens before parseData. Thus the original data\n // reference can be incorrect.\n if (isDataRefDomain(domain)) {\n domain.data = model.lookupDataSource(domain.data);\n }\n return domain;\n });\n // domains is an array that has to be merged into a single vega domain\n return mergeDomains(domains);\n}\n//# sourceMappingURL=domain.js.map","import { isObject } from 'vega-util';\nimport { isXorY } from '../../channel';\nimport { keys } from '../../util';\nimport { isDataRefDomain, isVgRangeStep } from '../../vega.schema';\nimport { isConcatModel, isLayerModel } from '../model';\nimport { assembleSelectionScaleDomain } from '../selection/assemble';\nimport { assembleDomain } from './domain';\nexport function assembleScales(model) {\n if (isLayerModel(model) || isConcatModel(model)) {\n // For concat and layer, include scales of children too\n return model.children.reduce((scales, child) => {\n return scales.concat(assembleScales(child));\n }, assembleScalesForModel(model));\n }\n else {\n // For facet, child scales would not be included in the parent's scope.\n // For unit, there is no child.\n return assembleScalesForModel(model);\n }\n}\nexport function assembleScalesForModel(model) {\n return keys(model.component.scales).reduce((scales, channel) => {\n const scaleComponent = model.component.scales[channel];\n if (scaleComponent.merged) {\n // Skipped merged scales\n return scales;\n }\n const scale = scaleComponent.combine();\n const { name, type, selectionExtent, domains: _d, range: _r, reverse, ...otherScaleProps } = scale;\n const range = assembleScaleRange(scale.range, name, channel, model);\n const domain = assembleDomain(model, channel);\n const domainRaw = selectionExtent\n ? assembleSelectionScaleDomain(model, selectionExtent, scaleComponent, domain)\n : null;\n scales.push({\n name,\n type,\n ...(domain ? { domain } : {}),\n ...(domainRaw ? { domainRaw } : {}),\n range,\n ...(reverse !== undefined ? { reverse: reverse } : {}),\n ...otherScaleProps\n });\n return scales;\n }, []);\n}\nexport function assembleScaleRange(scaleRange, scaleName, channel, model) {\n // add signals to x/y range\n if (isXorY(channel)) {\n if (isVgRangeStep(scaleRange)) {\n // For width/height step, use a signal created in layout assemble instead of a constant step.\n return {\n step: { signal: `${scaleName}_step` }\n };\n }\n }\n else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) {\n return {\n ...scaleRange,\n data: model.lookupDataSource(scaleRange.data)\n };\n }\n return scaleRange;\n}\n//# sourceMappingURL=assemble.js.map","import { isArray, isNumber } from 'vega-util';\nimport { some } from '../../util';\nimport { Split } from '../split';\nexport class ScaleComponent extends Split {\n constructor(name, typeWithExplicit) {\n super({}, // no initial explicit property\n { name } // name as initial implicit property\n );\n this.merged = false;\n this.setWithExplicit('type', typeWithExplicit);\n }\n /**\n * Whether the scale definitely includes zero in the domain\n */\n domainDefinitelyIncludesZero() {\n if (this.get('zero') !== false) {\n return true;\n }\n return some(this.get('domains'), d => isArray(d) && d.length === 2 && isNumber(d[0]) && d[0] <= 0 && isNumber(d[1]) && d[1] >= 0);\n }\n}\n//# sourceMappingURL=component.js.map","import { isArray, isNumber, isObject } from 'vega-util';\nimport { isBinning } from '../../bin';\nimport { ANGLE, COLOR, FILL, FILLOPACITY, getOffsetScaleChannel, getSizeChannel, isXorY, isXorYOffset, OPACITY, RADIUS, SCALE_CHANNELS, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, THETA, X, XOFFSET, Y, YOFFSET } from '../../channel';\nimport { getBandPosition, getFieldOrDatumDef, isFieldDef, isFieldOrDatumDef } from '../../channeldef';\nimport { getViewConfigDiscreteSize, getViewConfigDiscreteStep } from '../../config';\nimport { DataSourceType } from '../../data';\nimport { channelHasFieldOrDatum } from '../../encoding';\nimport * as log from '../../log';\nimport { channelScalePropertyIncompatability, hasContinuousDomain, hasDiscreteDomain, isContinuousToDiscrete, isExtendedScheme, scaleTypeSupportProperty } from '../../scale';\nimport { getStepFor, isStep } from '../../spec/base';\nimport { isDiscrete } from '../../type';\nimport * as util from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { exprFromSignalRefOrValue, signalOrStringValue } from '../common';\nimport { getBinSignalName } from '../data/bin';\nimport { SignalRefWrapper } from '../signal';\nimport { makeExplicit, makeImplicit } from '../split';\nimport { durationExpr } from '../../timeunit';\nexport const RANGE_PROPERTIES = ['range', 'scheme'];\nexport function parseUnitScaleRange(model) {\n const localScaleComponents = model.component.scales;\n // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first!\n for (const channel of SCALE_CHANNELS) {\n const localScaleCmpt = localScaleComponents[channel];\n if (!localScaleCmpt) {\n continue;\n }\n const rangeWithExplicit = parseRangeForChannel(channel, model);\n localScaleCmpt.setWithExplicit('range', rangeWithExplicit);\n }\n}\nfunction getBinStepSignal(model, channel) {\n const fieldDef = model.fieldDef(channel);\n if (fieldDef?.bin) {\n const { bin, field } = fieldDef;\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n if (isObject(bin) && bin.binned && bin.step !== undefined) {\n return new SignalRefWrapper(() => {\n const scaleName = model.scaleName(channel);\n const binCount = `(domain(\"${scaleName}\")[1] - domain(\"${scaleName}\")[0]) / ${bin.step}`;\n return `${model.getSignalName(sizeSignal)} / (${binCount})`;\n });\n }\n else if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, field, bin);\n // TODO: extract this to be range step signal\n return new SignalRefWrapper(() => {\n const updatedName = model.getSignalName(binSignal);\n const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`;\n return `${model.getSignalName(sizeSignal)} / (${binCount})`;\n });\n }\n }\n return undefined;\n}\n/**\n * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme).\n */\nexport function parseRangeForChannel(channel, model) {\n const specifiedScale = model.specifiedScales[channel];\n const { size } = model;\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n // Check if any of the range properties is specified.\n // If so, check if it is compatible and make sure that we only output one of the properties\n for (const property of RANGE_PROPERTIES) {\n if (specifiedScale[property] !== undefined) {\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n }\n else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n }\n else {\n switch (property) {\n case 'range': {\n const range = specifiedScale.range;\n if (isArray(range)) {\n if (isXorY(channel)) {\n return makeExplicit(range.map(v => {\n if (v === 'width' || v === 'height') {\n // get signal for width/height\n // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames.\n const sizeSignal = model.getName(v);\n const getSignalName = model.getSignalName.bind(model);\n return SignalRefWrapper.fromName(getSignalName, sizeSignal);\n }\n return v;\n }));\n }\n }\n else if (isObject(range)) {\n return makeExplicit({\n data: model.requestDataName(DataSourceType.Main),\n field: range.field,\n sort: { op: 'min', field: model.vgField(channel) }\n });\n }\n return makeExplicit(range);\n }\n case 'scheme':\n return makeExplicit(parseScheme(specifiedScale[property]));\n }\n }\n }\n }\n const sizeChannel = channel === X || channel === 'xOffset' ? 'width' : 'height';\n const sizeValue = size[sizeChannel];\n if (isStep(sizeValue)) {\n if (isXorY(channel)) {\n if (hasDiscreteDomain(scaleType)) {\n const step = getPositionStep(sizeValue, model, channel);\n // Need to be explicit so layer with step wins over layer without step\n if (step) {\n return makeExplicit({ step });\n }\n }\n else {\n log.warn(log.message.stepDropped(sizeChannel));\n }\n }\n else if (isXorYOffset(channel)) {\n const positionChannel = channel === XOFFSET ? 'x' : 'y';\n const positionScaleCmpt = model.getScaleComponent(positionChannel);\n const positionScaleType = positionScaleCmpt.get('type');\n if (positionScaleType === 'band') {\n const step = getOffsetStep(sizeValue, scaleType);\n if (step) {\n return makeExplicit(step);\n }\n }\n }\n }\n const { rangeMin, rangeMax } = specifiedScale;\n const d = defaultRange(channel, model);\n if ((rangeMin !== undefined || rangeMax !== undefined) &&\n // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same\n scaleTypeSupportProperty(scaleType, 'rangeMin') &&\n isArray(d) &&\n d.length === 2) {\n return makeExplicit([rangeMin ?? d[0], rangeMax ?? d[1]]);\n }\n return makeImplicit(d);\n}\nfunction parseScheme(scheme) {\n if (isExtendedScheme(scheme)) {\n return {\n scheme: scheme.name,\n ...util.omit(scheme, ['name'])\n };\n }\n return { scheme };\n}\nfunction fullWidthOrHeightRange(channel, model, scaleType, { center } = {}) {\n // If step is null, use zero to width or height.\n // Note that we use SignalRefWrapper to account for potential merges and renames.\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n const getSignalName = model.getSignalName.bind(model);\n if (channel === Y && hasContinuousDomain(scaleType)) {\n // For y continuous scale, we have to start from the height as the bottom part has the max value.\n return center\n ? [\n SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal),\n SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal)\n ]\n : [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0];\n }\n else {\n return center\n ? [\n SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal),\n SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal)\n ]\n : [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)];\n }\n}\nfunction defaultRange(channel, model) {\n const { size, config, mark, encoding } = model;\n const { type } = getFieldOrDatumDef(encoding[channel]);\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n const { domain, domainMid } = model.specifiedScales[channel];\n switch (channel) {\n case X:\n case Y: {\n // If there is no explicit width/height for discrete x/y scales\n if (util.contains(['point', 'band'], scaleType)) {\n const positionSize = getDiscretePositionSize(channel, size, config.view);\n if (isStep(positionSize)) {\n const step = getPositionStep(positionSize, model, channel);\n return { step };\n }\n }\n return fullWidthOrHeightRange(channel, model, scaleType);\n }\n case XOFFSET:\n case YOFFSET:\n return getOffsetRange(channel, model, scaleType);\n case SIZE: {\n // TODO: support custom rangeMin, rangeMax\n const zero = model.component.scales[channel].get('zero');\n const rangeMin = sizeRangeMin(mark, zero, config);\n const rangeMax = sizeRangeMax(mark, size, model, config);\n if (isContinuousToDiscrete(scaleType)) {\n return interpolateRange(rangeMin, rangeMax, defaultContinuousToDiscreteCount(scaleType, config, domain, channel));\n }\n else {\n return [rangeMin, rangeMax];\n }\n }\n case THETA:\n return [0, Math.PI * 2];\n case ANGLE:\n // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks.\n // (It's weird to add just config.scale.min/maxAngleDegree for now)\n return [0, 360];\n case RADIUS: {\n // max radius = half od min(width,height)\n return [\n 0,\n new SignalRefWrapper(() => {\n const w = model.getSignalName('width');\n const h = model.getSignalName('height');\n return `min(${w},${h})/2`;\n })\n ];\n }\n case STROKEWIDTH:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth];\n case STROKEDASH:\n return [\n // TODO: add this to Vega's config.range?\n [1, 0],\n [4, 2],\n [2, 1],\n [1, 1],\n [1, 2, 4, 2]\n ];\n case SHAPE:\n return 'symbol';\n case COLOR:\n case FILL:\n case STROKE:\n if (scaleType === 'ordinal') {\n // Only nominal data uses ordinal scale by default\n return type === 'nominal' ? 'category' : 'ordinal';\n }\n else {\n if (domainMid !== undefined) {\n return 'diverging';\n }\n else {\n return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp';\n }\n }\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minOpacity, config.scale.maxOpacity];\n }\n}\nfunction getPositionStep(step, model, channel) {\n const { encoding } = model;\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const offsetChannel = getOffsetScaleChannel(channel);\n const offsetDef = encoding[offsetChannel];\n const stepFor = getStepFor({ step, offsetIsDiscrete: isFieldOrDatumDef(offsetDef) && isDiscrete(offsetDef.type) });\n if (stepFor === 'offset' && channelHasFieldOrDatum(encoding, offsetChannel)) {\n const offsetScaleCmpt = model.getScaleComponent(offsetChannel);\n const offsetScaleName = model.scaleName(offsetChannel);\n let stepCount = `domain('${offsetScaleName}').length`;\n if (offsetScaleCmpt.get('type') === 'band') {\n const offsetPaddingInner = offsetScaleCmpt.get('paddingInner') ?? offsetScaleCmpt.get('padding') ?? 0;\n const offsetPaddingOuter = offsetScaleCmpt.get('paddingOuter') ?? offsetScaleCmpt.get('padding') ?? 0;\n stepCount = `bandspace(${stepCount}, ${offsetPaddingInner}, ${offsetPaddingOuter})`;\n }\n const paddingInner = mergedScaleCmpt.get('paddingInner') ?? mergedScaleCmpt.get('padding');\n return {\n signal: `${step.step} * ${stepCount} / (1-${exprFromSignalRefOrValue(paddingInner)})`\n };\n }\n else {\n return step.step;\n }\n}\nfunction getOffsetStep(step, offsetScaleType) {\n const stepFor = getStepFor({ step, offsetIsDiscrete: hasDiscreteDomain(offsetScaleType) });\n if (stepFor === 'offset') {\n return { step: step.step };\n }\n return undefined;\n}\nfunction getOffsetRange(channel, model, offsetScaleType) {\n const positionChannel = channel === XOFFSET ? 'x' : 'y';\n const positionScaleCmpt = model.getScaleComponent(positionChannel);\n if (!positionScaleCmpt) {\n return fullWidthOrHeightRange(positionChannel, model, offsetScaleType, { center: true });\n }\n const positionScaleType = positionScaleCmpt.get('type');\n const positionScaleName = model.scaleName(positionChannel);\n const { markDef, config } = model;\n if (positionScaleType === 'band') {\n const size = getDiscretePositionSize(positionChannel, model.size, model.config.view);\n if (isStep(size)) {\n // step is for offset\n const step = getOffsetStep(size, offsetScaleType);\n if (step) {\n return step;\n }\n }\n // otherwise use the position\n return [0, { signal: `bandwidth('${positionScaleName}')` }];\n }\n else {\n // continuous scale\n const positionDef = model.encoding[positionChannel];\n if (isFieldDef(positionDef) && positionDef.timeUnit) {\n const duration = durationExpr(positionDef.timeUnit, expr => `scale('${positionScaleName}', ${expr})`);\n const padding = model.config.scale.bandWithNestedOffsetPaddingInner;\n const bandPositionOffset = getBandPosition({\n fieldDef: positionDef,\n markDef,\n config\n }) - 0.5;\n const bandPositionOffsetExpr = bandPositionOffset !== 0 ? ` + ${bandPositionOffset}` : '';\n if (padding) {\n const startRatio = isSignalRef(padding)\n ? `${padding.signal}/2` + bandPositionOffsetExpr\n : `${padding / 2 + bandPositionOffset}`;\n const endRatio = isSignalRef(padding)\n ? `(1 - ${padding.signal}/2)` + bandPositionOffsetExpr\n : `${1 - padding / 2 + bandPositionOffset}`;\n return [{ signal: `${startRatio} * (${duration})` }, { signal: `${endRatio} * (${duration})` }];\n }\n return [0, { signal: duration }];\n }\n return util.never(`Cannot use ${channel} scale if ${positionChannel} scale is not discrete.`);\n }\n}\nfunction getDiscretePositionSize(channel, size, viewConfig) {\n const sizeChannel = channel === X ? 'width' : 'height';\n const sizeValue = size[sizeChannel];\n if (sizeValue) {\n return sizeValue;\n }\n return getViewConfigDiscreteSize(viewConfig, sizeChannel);\n}\nexport function defaultContinuousToDiscreteCount(scaleType, config, domain, channel) {\n switch (scaleType) {\n case 'quantile':\n return config.scale.quantileCount;\n case 'quantize':\n return config.scale.quantizeCount;\n case 'threshold':\n if (domain !== undefined && isArray(domain)) {\n return domain.length + 1;\n }\n else {\n log.warn(log.message.domainRequiredForThresholdScale(channel));\n // default threshold boundaries for threshold scale since domain has cardinality of 2\n return 3;\n }\n }\n}\n/**\n * Returns the linear interpolation of the range according to the cardinality\n *\n * @param rangeMin start of the range\n * @param rangeMax end of the range\n * @param cardinality number of values in the output range\n */\nexport function interpolateRange(rangeMin, rangeMax, cardinality) {\n // always return a signal since it's better to compute the sequence in Vega later\n const f = () => {\n const rMax = signalOrStringValue(rangeMax);\n const rMin = signalOrStringValue(rangeMin);\n const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`;\n return `sequence(${rMin}, ${rMax} + ${step}, ${step})`;\n };\n if (isSignalRef(rangeMax)) {\n return new SignalRefWrapper(f);\n }\n else {\n return { signal: f() };\n }\n}\nfunction sizeRangeMin(mark, zero, config) {\n if (zero) {\n if (isSignalRef(zero)) {\n return { signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}` };\n }\n else {\n return 0;\n }\n }\n switch (mark) {\n case 'bar':\n case 'tick':\n return config.scale.minBandSize;\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.minStrokeWidth;\n case 'text':\n return config.scale.minFontSize;\n case 'point':\n case 'square':\n case 'circle':\n return config.scale.minSize;\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMin not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\nexport const MAX_SIZE_RANGE_STEP_RATIO = 0.95;\nfunction sizeRangeMax(mark, size, model, config) {\n const xyStepSignals = {\n x: getBinStepSignal(model, 'x'),\n y: getBinStepSignal(model, 'y')\n };\n switch (mark) {\n case 'bar':\n case 'tick': {\n if (config.scale.maxBandSize !== undefined) {\n return config.scale.maxBandSize;\n }\n const min = minXYStep(size, xyStepSignals, config.view);\n if (isNumber(min)) {\n return min - 1;\n }\n else {\n return new SignalRefWrapper(() => `${min.signal} - 1`);\n }\n }\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.maxStrokeWidth;\n case 'text':\n return config.scale.maxFontSize;\n case 'point':\n case 'square':\n case 'circle': {\n if (config.scale.maxSize) {\n return config.scale.maxSize;\n }\n const pointStep = minXYStep(size, xyStepSignals, config.view);\n if (isNumber(pointStep)) {\n return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2);\n }\n else {\n return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`);\n }\n }\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMax not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\n/**\n * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale.\n */\nfunction minXYStep(size, xyStepSignals, viewConfig) {\n const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width');\n const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height');\n if (xyStepSignals.x || xyStepSignals.y) {\n return new SignalRefWrapper(() => {\n const exprs = [\n xyStepSignals.x ? xyStepSignals.x.signal : widthStep,\n xyStepSignals.y ? xyStepSignals.y.signal : heightStep\n ];\n return `min(${exprs.join(', ')})`;\n });\n }\n return Math.min(widthStep, heightStep);\n}\n//# sourceMappingURL=range.js.map","import { isArray, isNumber } from 'vega-util';\nimport { isBinned, isBinning, isBinParams } from '../../bin';\nimport { COLOR, FILL, getSecondaryRangeChannel, isXorY, isXorYOffset, POLAR_POSITION_SCALE_CHANNELS, POSITION_SCALE_CHANNELS, STROKE } from '../../channel';\nimport { getFieldDef, getFieldOrDatumDef, isFieldDef, valueExpr } from '../../channeldef';\nimport { isDateTime } from '../../datetime';\nimport { channelHasNestedOffsetScale } from '../../encoding';\nimport * as log from '../../log';\nimport { channelScalePropertyIncompatability, hasContinuousDomain, isContinuousToContinuous, isContinuousToDiscrete, ScaleType, scaleTypeSupportProperty } from '../../scale';\nimport * as util from '../../util';\nimport { contains, getFirstDefined, keys } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { getBinSignalName } from '../data/bin';\nimport { isUnitModel } from '../model';\nimport { SignalRefWrapper } from '../signal';\nimport { mergeValuesWithExplicit, tieBreakByComparing } from '../split';\nimport { parseUnitScaleRange } from './range';\nexport function parseScaleProperty(model, property) {\n if (isUnitModel(model)) {\n parseUnitScaleProperty(model, property);\n }\n else {\n parseNonUnitScaleProperty(model, property);\n }\n}\nfunction parseUnitScaleProperty(model, property) {\n const localScaleComponents = model.component.scales;\n const { config, encoding, markDef, specifiedScales } = model;\n for (const channel of keys(localScaleComponents)) {\n const specifiedScale = specifiedScales[channel];\n const localScaleCmpt = localScaleComponents[channel];\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]);\n const specifiedValue = specifiedScale[property];\n const scaleType = mergedScaleCmpt.get('type');\n const scalePadding = mergedScaleCmpt.get('padding');\n const scalePaddingInner = mergedScaleCmpt.get('paddingInner');\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n if (specifiedValue !== undefined) {\n // If there is a specified value, check if it is compatible with scale type and channel\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n }\n else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n }\n }\n if (supportedByScaleType && channelIncompatability === undefined) {\n if (specifiedValue !== undefined) {\n const timeUnit = fieldOrDatumDef['timeUnit'];\n const type = fieldOrDatumDef.type;\n switch (property) {\n // domainMax/Min to signal if the value is a datetime object\n case 'domainMax':\n case 'domainMin':\n if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) {\n localScaleCmpt.set(property, { signal: valueExpr(specifiedScale[property], { type, timeUnit }) }, true);\n }\n else {\n localScaleCmpt.set(property, specifiedScale[property], true);\n }\n break;\n default:\n localScaleCmpt.copyKeyFromObject(property, specifiedScale);\n }\n }\n else {\n const value = property in scaleRules\n ? scaleRules[property]({\n model,\n channel,\n fieldOrDatumDef,\n scaleType,\n scalePadding,\n scalePaddingInner,\n domain: specifiedScale.domain,\n domainMin: specifiedScale.domainMin,\n domainMax: specifiedScale.domainMax,\n markDef,\n config,\n hasNestedOffsetScale: channelHasNestedOffsetScale(encoding, channel),\n hasSecondaryRangeChannel: !!encoding[getSecondaryRangeChannel(channel)]\n })\n : config.scale[property];\n if (value !== undefined) {\n localScaleCmpt.set(property, value, false);\n }\n }\n }\n }\n}\nexport const scaleRules = {\n bins: ({ model, fieldOrDatumDef }) => (isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined),\n interpolate: ({ channel, fieldOrDatumDef }) => interpolate(channel, fieldOrDatumDef.type),\n nice: ({ scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef }) => nice(scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef),\n padding: ({ channel, scaleType, fieldOrDatumDef, markDef, config }) => padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar),\n paddingInner: ({ scalePadding, channel, markDef, scaleType, config, hasNestedOffsetScale }) => paddingInner(scalePadding, channel, markDef.type, scaleType, config.scale, hasNestedOffsetScale),\n paddingOuter: ({ scalePadding, channel, scaleType, scalePaddingInner, config, hasNestedOffsetScale }) => paddingOuter(scalePadding, channel, scaleType, scalePaddingInner, config.scale, hasNestedOffsetScale),\n reverse: ({ fieldOrDatumDef, scaleType, channel, config }) => {\n const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined;\n return reverse(scaleType, sort, channel, config.scale);\n },\n zero: ({ channel, fieldOrDatumDef, domain, markDef, scaleType, config, hasSecondaryRangeChannel }) => zero(channel, fieldOrDatumDef, domain, markDef, scaleType, config.scale, hasSecondaryRangeChannel)\n};\n// This method is here rather than in range.ts to avoid circular dependency.\nexport function parseScaleRange(model) {\n if (isUnitModel(model)) {\n parseUnitScaleRange(model);\n }\n else {\n parseNonUnitScaleProperty(model, 'range');\n }\n}\nexport function parseNonUnitScaleProperty(model, property) {\n const localScaleComponents = model.component.scales;\n for (const child of model.children) {\n if (property === 'range') {\n parseScaleRange(child);\n }\n else {\n parseScaleProperty(child, property);\n }\n }\n for (const channel of keys(localScaleComponents)) {\n let valueWithExplicit;\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n const childValueWithExplicit = childComponent.getWithExplicit(property);\n valueWithExplicit = mergeValuesWithExplicit(valueWithExplicit, childValueWithExplicit, property, 'scale', tieBreakByComparing((v1, v2) => {\n switch (property) {\n case 'range':\n // For step, prefer larger step\n if (v1.step && v2.step) {\n return v1.step - v2.step;\n }\n return 0;\n // TODO: precedence rule for other properties\n }\n return 0;\n }));\n }\n }\n localScaleComponents[channel].setWithExplicit(property, valueWithExplicit);\n }\n}\nexport function bins(model, fieldDef) {\n const bin = fieldDef.bin;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return new SignalRefWrapper(() => {\n return model.getSignalName(binSignal);\n });\n }\n else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) {\n // start and stop will be determined from the scale domain\n return {\n step: bin.step\n };\n }\n return undefined;\n}\nexport function interpolate(channel, type) {\n if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') {\n return 'hcl';\n }\n return undefined;\n}\nexport function nice(scaleType, channel, specifiedDomain, domainMin, domainMax, fieldOrDatumDef) {\n if (getFieldDef(fieldOrDatumDef)?.bin ||\n isArray(specifiedDomain) ||\n domainMax != null ||\n domainMin != null ||\n util.contains([ScaleType.TIME, ScaleType.UTC], scaleType)) {\n return undefined;\n }\n return isXorY(channel) ? true : undefined;\n}\nexport function padding(channel, scaleType, scaleConfig, fieldOrDatumDef, markDef, barConfig) {\n if (isXorY(channel)) {\n if (isContinuousToContinuous(scaleType)) {\n if (scaleConfig.continuousPadding !== undefined) {\n return scaleConfig.continuousPadding;\n }\n const { type, orient } = markDef;\n if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) {\n if ((orient === 'vertical' && channel === 'x') || (orient === 'horizontal' && channel === 'y')) {\n return barConfig.continuousBandSize;\n }\n }\n }\n if (scaleType === ScaleType.POINT) {\n return scaleConfig.pointPadding;\n }\n }\n return undefined;\n}\nexport function paddingInner(paddingValue, channel, mark, scaleType, scaleConfig, hasNestedOffsetScale = false) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingInner.\n return undefined;\n }\n if (isXorY(channel)) {\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n // paddingOuter would only be called if it's a band scale, just return the default for bandScale.\n const { bandPaddingInner, barBandPaddingInner, rectBandPaddingInner, bandWithNestedOffsetPaddingInner } = scaleConfig;\n if (hasNestedOffsetScale) {\n return bandWithNestedOffsetPaddingInner;\n }\n return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner);\n }\n else if (isXorYOffset(channel)) {\n if (scaleType === ScaleType.BAND) {\n return scaleConfig.offsetBandPaddingInner;\n }\n }\n return undefined;\n}\nexport function paddingOuter(paddingValue, channel, scaleType, paddingInnerValue, scaleConfig, hasNestedOffsetScale = false) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingOuter.\n return undefined;\n }\n if (isXorY(channel)) {\n const { bandPaddingOuter, bandWithNestedOffsetPaddingOuter } = scaleConfig;\n if (hasNestedOffsetScale) {\n return bandWithNestedOffsetPaddingOuter;\n }\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n if (scaleType === ScaleType.BAND) {\n return getFirstDefined(bandPaddingOuter, \n /* By default, paddingOuter is paddingInner / 2. The reason is that\n size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter).\n and we want the width/height to be integer by default.\n Note that step (by default) and cardinality are integers.) */\n isSignalRef(paddingInnerValue) ? { signal: `${paddingInnerValue.signal}/2` } : paddingInnerValue / 2);\n }\n }\n else if (isXorYOffset(channel)) {\n if (scaleType === ScaleType.POINT) {\n return 0.5; // so the point positions align with centers of band scales.\n }\n else if (scaleType === ScaleType.BAND) {\n return scaleConfig.offsetBandPaddingOuter;\n }\n }\n return undefined;\n}\nexport function reverse(scaleType, sort, channel, scaleConfig) {\n if (channel === 'x' && scaleConfig.xReverse !== undefined) {\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n if (isSignalRef(scaleConfig.xReverse)) {\n return { signal: `!${scaleConfig.xReverse.signal}` };\n }\n else {\n return !scaleConfig.xReverse;\n }\n }\n return scaleConfig.xReverse;\n }\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n // For continuous domain scales, Vega does not support domain sort.\n // Thus, we reverse range instead if sort is descending\n return true;\n }\n return undefined;\n}\nexport function zero(channel, fieldDef, specifiedDomain, markDef, scaleType, scaleConfig, hasSecondaryRangeChannel) {\n // If users explicitly provide a domain, we should not augment zero as that will be unexpected.\n const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated';\n if (hasCustomDomain) {\n if (hasContinuousDomain(scaleType)) {\n if (isArray(specifiedDomain)) {\n const first = specifiedDomain[0];\n const last = specifiedDomain[specifiedDomain.length - 1];\n if (isNumber(first) && first <= 0 && isNumber(last) && last >= 0) {\n // if the domain includes zero, make zero remain true\n return true;\n }\n }\n return false;\n }\n }\n // If there is no custom domain, return configZero value (=`true` as default) only for the following cases:\n // 1) using quantitative field with size\n // While this can be either ratio or interval fields, our assumption is that\n // ratio are more common. However, if the scaleType is discretizing scale, we want to return\n // false so that range doesn't start at zero\n if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) {\n return true;\n }\n // 2) non-binned, quantitative x-scale or y-scale\n // (For binning, we should not include zero by default because binning are calculated without zero.)\n // (For area/bar charts with ratio scale chart, we should always include zero.)\n if (!(isFieldDef(fieldDef) && fieldDef.bin) &&\n util.contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel)) {\n const { orient, type } = markDef;\n if (contains(['bar', 'area', 'line', 'trail'], type)) {\n if ((orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x')) {\n return false;\n }\n }\n if (contains(['bar', 'area'], type) && !hasSecondaryRangeChannel) {\n return true;\n }\n return scaleConfig?.zero;\n }\n return false;\n}\n//# sourceMappingURL=properties.js.map","import { isBinning } from '../../bin';\nimport { getSizeChannel, isColorChannel, isScaleChannel, isXorY, isXorYOffset, rangeType } from '../../channel';\nimport { isFieldDef, isPositionFieldOrDatumDef } from '../../channeldef';\nimport * as log from '../../log';\nimport { isRelativeBandSize } from '../../mark';\nimport { channelSupportScaleType, scaleTypeSupportDataType } from '../../scale';\nimport { normalizeTimeUnit } from '../../timeunit';\nimport * as util from '../../util';\nimport { POLAR_POSITION_SCALE_CHANNEL_INDEX } from './../../channel';\n/**\n * Determine if there is a specified scale type and if it is appropriate,\n * or determine default type if type is unspecified or inappropriate.\n */\n// NOTE: CompassQL uses this method.\nexport function scaleType(specifiedScale, channel, fieldDef, mark, hasNestedOffsetScale = false) {\n const defaultScaleType = defaultType(channel, fieldDef, mark, hasNestedOffsetScale);\n const { type } = specifiedScale;\n if (!isScaleChannel(channel)) {\n // There is no scale for these channels\n return null;\n }\n if (type !== undefined) {\n // Check if explicitly specified scale type is supported by the channel\n if (!channelSupportScaleType(channel, type)) {\n log.warn(log.message.scaleTypeNotWorkWithChannel(channel, type, defaultScaleType));\n return defaultScaleType;\n }\n // Check if explicitly specified scale type is supported by the data type\n if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) {\n log.warn(log.message.scaleTypeNotWorkWithFieldDef(type, defaultScaleType));\n return defaultScaleType;\n }\n return type;\n }\n return defaultScaleType;\n}\n/**\n * Determine appropriate default scale type.\n */\n// NOTE: Voyager uses this method.\nfunction defaultType(channel, fieldDef, mark, hasNestedOffsetScale) {\n switch (fieldDef.type) {\n case 'nominal':\n case 'ordinal': {\n if (isColorChannel(channel) || rangeType(channel) === 'discrete') {\n if (channel === 'shape' && fieldDef.type === 'ordinal') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'ordinal'));\n }\n return 'ordinal';\n }\n if (isXorY(channel) || isXorYOffset(channel)) {\n if (util.contains(['rect', 'bar', 'image', 'rule'], mark.type)) {\n // The rect/bar mark should fit into a band.\n // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429\n return 'band';\n }\n if (hasNestedOffsetScale) {\n // If there is a nested offset scale, then there is a \"band\" for the span of the nested scale.\n return 'band';\n }\n }\n else if (mark.type === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) {\n return 'band';\n }\n const dimensionSize = mark[getSizeChannel(channel)];\n if (isRelativeBandSize(dimensionSize)) {\n return 'band';\n }\n if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand) {\n return 'band';\n }\n // Otherwise, use ordinal point scale so we can easily get center positions of the marks.\n return 'point';\n }\n case 'temporal':\n if (isColorChannel(channel)) {\n return 'time';\n }\n else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'temporal'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n }\n else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) {\n return 'utc';\n }\n return 'time';\n case 'quantitative':\n if (isColorChannel(channel)) {\n if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n return 'bin-ordinal';\n }\n return 'linear';\n }\n else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'quantitative'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n }\n return 'linear';\n case 'geojson':\n return undefined;\n }\n /* istanbul ignore next: should never reach this */\n throw new Error(log.message.invalidFieldType(fieldDef.type));\n}\n//# sourceMappingURL=type.js.map","import { SCALE_CHANNELS, SHAPE } from '../../channel';\nimport { getFieldOrDatumDef } from '../../channeldef';\nimport { channelHasNestedOffsetScale } from '../../encoding';\nimport { GEOSHAPE } from '../../mark';\nimport { NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES, scaleCompatible, scaleTypePrecedence } from '../../scale';\nimport { GEOJSON } from '../../type';\nimport { keys } from '../../util';\nimport { isUnitModel } from '../model';\nimport { defaultScaleResolve } from '../resolve';\nimport { mergeValuesWithExplicit, tieBreakByComparing } from '../split';\nimport { ScaleComponent } from './component';\nimport { parseScaleDomain } from './domain';\nimport { parseScaleProperty, parseScaleRange } from './properties';\nimport { scaleType } from './type';\nexport function parseScales(model, { ignoreRange } = {}) {\n parseScaleCore(model);\n parseScaleDomain(model);\n for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) {\n parseScaleProperty(model, prop);\n }\n if (!ignoreRange) {\n // range depends on zero\n parseScaleRange(model);\n }\n}\nexport function parseScaleCore(model) {\n if (isUnitModel(model)) {\n model.component.scales = parseUnitScaleCore(model);\n }\n else {\n model.component.scales = parseNonUnitScaleCore(model);\n }\n}\n/**\n * Parse scales for all channels of a model.\n */\nfunction parseUnitScaleCore(model) {\n const { encoding, mark, markDef } = model;\n const scaleComponents = {};\n for (const channel of SCALE_CHANNELS) {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); // must be typed def to have scale\n // Don't generate scale for shape of geoshape\n if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) {\n continue;\n }\n let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale'];\n if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) {\n specifiedScale ?? (specifiedScale = {});\n const hasNestedOffsetScale = channelHasNestedOffsetScale(encoding, channel);\n const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, markDef, hasNestedOffsetScale);\n scaleComponents[channel] = new ScaleComponent(model.scaleName(`${channel}`, true), {\n value: sType,\n explicit: specifiedScale.type === sType\n });\n }\n }\n return scaleComponents;\n}\nconst scaleTypeTieBreaker = tieBreakByComparing((st1, st2) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2));\nfunction parseNonUnitScaleCore(model) {\n var _a;\n const scaleComponents = (model.component.scales = {});\n const scaleTypeWithExplicitIndex = {};\n const resolve = model.component.resolve;\n // Parse each child scale and determine if a particular channel can be merged.\n for (const child of model.children) {\n parseScaleCore(child);\n // Instead of always merging right away -- check if it is compatible to merge first!\n for (const channel of keys(child.component.scales)) {\n // if resolve is undefined, set default first\n (_a = resolve.scale)[channel] ?? (_a[channel] = defaultScaleResolve(channel, model));\n if (resolve.scale[channel] === 'shared') {\n const explicitScaleType = scaleTypeWithExplicitIndex[channel];\n const childScaleType = child.component.scales[channel].getWithExplicit('type');\n if (explicitScaleType) {\n if (scaleCompatible(explicitScaleType.value, childScaleType.value)) {\n // merge scale component if type are compatible\n scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(explicitScaleType, childScaleType, 'type', 'scale', scaleTypeTieBreaker);\n }\n else {\n // Otherwise, update conflicting channel to be independent\n resolve.scale[channel] = 'independent';\n // Remove from the index so they don't get merged\n delete scaleTypeWithExplicitIndex[channel];\n }\n }\n else {\n scaleTypeWithExplicitIndex[channel] = childScaleType;\n }\n }\n }\n }\n // Merge each channel listed in the index\n for (const channel of keys(scaleTypeWithExplicitIndex)) {\n // Create new merged scale component\n const name = model.scaleName(channel, true);\n const typeWithExplicit = scaleTypeWithExplicitIndex[channel];\n scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit);\n // rename each child and mark them as merged\n for (const child of model.children) {\n const childScale = child.component.scales[channel];\n if (childScale) {\n child.renameScale(childScale.get('name'), name);\n childScale.merged = true;\n }\n }\n }\n return scaleComponents;\n}\n//# sourceMappingURL=parse.js.map","import { FACET_CHANNELS, getPositionScaleChannel, isChannel, isScaleChannel } from '../channel';\nimport { getFieldDef, vgField } from '../channeldef';\nimport { DataSourceType } from '../data';\nimport { forEach, reduce } from '../encoding';\nimport { replaceExprRef } from '../expr';\nimport * as log from '../log';\nimport { hasDiscreteDomain } from '../scale';\nimport { isFacetSpec } from '../spec';\nimport { extractCompositionLayout } from '../spec/base';\nimport { extractTitleConfig, isText } from '../title';\nimport { normalizeTransform } from '../transform';\nimport { contains, duplicate, isEmpty, keys, varName } from '../util';\nimport { isVgRangeStep } from '../vega.schema';\nimport { assembleAxes } from './axis/assemble';\nimport { signalOrValueRef } from './common';\nimport { assembleHeaderGroups, assembleLayoutTitleBand, assembleTitleGroup } from './header/assemble';\nimport { HEADER_CHANNELS } from './header/component';\nimport { sizeExpr } from './layoutsize/assemble';\nimport { getSizeTypeFromLayoutSizeType } from './layoutsize/component';\nimport { assembleLegends } from './legend/assemble';\nimport { parseLegend } from './legend/parse';\nimport { assembleProjections } from './projection/assemble';\nimport { parseProjection } from './projection/parse';\nimport { assembleScales } from './scale/assemble';\nimport { assembleDomain, getFieldFromDomain } from './scale/domain';\nimport { parseScales } from './scale/parse';\nimport { Split } from './split';\nexport class NameMap {\n constructor() {\n this.nameMap = {};\n }\n rename(oldName, newName) {\n this.nameMap[oldName] = newName;\n }\n has(name) {\n return this.nameMap[name] !== undefined;\n }\n get(name) {\n // If the name appears in the _nameMap, we need to read its new name.\n // We have to loop over the dict just in case the new name also gets renamed.\n while (this.nameMap[name] && name !== this.nameMap[name]) {\n name = this.nameMap[name];\n }\n return name;\n }\n}\n/*\n We use type guards instead of `instanceof` as `instanceof` makes\n different parts of the compiler depend on the actual implementation of\n the model classes, which in turn depend on different parts of the compiler.\n Thus, `instanceof` leads to circular dependency problems.\n\n On the other hand, type guards only make different parts of the compiler\n depend on the type of the model classes, but not the actual implementation.\n*/\nexport function isUnitModel(model) {\n return model?.type === 'unit';\n}\nexport function isFacetModel(model) {\n return model?.type === 'facet';\n}\nexport function isConcatModel(model) {\n return model?.type === 'concat';\n}\nexport function isLayerModel(model) {\n return model?.type === 'layer';\n}\nexport class Model {\n constructor(spec, type, parent, parentGivenName, config, resolve, view) {\n this.type = type;\n this.parent = parent;\n this.config = config;\n /**\n * Corrects the data references in marks after assemble.\n */\n this.correctDataNames = (mark) => {\n // TODO: make this correct\n // for normal data references\n if (mark.from?.data) {\n mark.from.data = this.lookupDataSource(mark.from.data);\n }\n // for access to facet data\n if (mark.from?.facet?.data) {\n mark.from.facet.data = this.lookupDataSource(mark.from.facet.data);\n }\n return mark;\n };\n this.parent = parent;\n this.config = config;\n this.view = replaceExprRef(view);\n // If name is not provided, always use parent's givenName to avoid name conflicts.\n this.name = spec.name ?? parentGivenName;\n this.title = isText(spec.title) ? { text: spec.title } : spec.title ? replaceExprRef(spec.title) : undefined;\n // Shared name maps\n this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap();\n this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap();\n this.signalNameMap = parent ? parent.signalNameMap : new NameMap();\n this.data = spec.data;\n this.description = spec.description;\n this.transforms = normalizeTransform(spec.transform ?? []);\n this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config);\n this.component = {\n data: {\n sources: parent ? parent.component.data.sources : [],\n outputNodes: parent ? parent.component.data.outputNodes : {},\n outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {},\n // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined\n isFaceted: isFacetSpec(spec) || (parent?.component.data.isFaceted && spec.data === undefined)\n },\n layoutSize: new Split(),\n layoutHeaders: { row: {}, column: {}, facet: {} },\n mark: null,\n resolve: {\n scale: {},\n axis: {},\n legend: {},\n ...(resolve ? duplicate(resolve) : {})\n },\n selection: null,\n scales: null,\n projection: null,\n axes: {},\n legends: {}\n };\n }\n get width() {\n return this.getSizeSignalRef('width');\n }\n get height() {\n return this.getSizeSignalRef('height');\n }\n parse() {\n this.parseScale();\n this.parseLayoutSize(); // depends on scale\n this.renameTopLevelLayoutSizeSignal();\n this.parseSelections();\n this.parseProjection();\n this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name.\n this.parseAxesAndHeaders(); // depends on scale and layout size\n this.parseLegends(); // depends on scale, markDef\n this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark.\n }\n parseScale() {\n parseScales(this);\n }\n parseProjection() {\n parseProjection(this);\n }\n /**\n * Rename top-level spec's size to be just width / height, ignoring model name.\n * This essentially merges the top-level spec's width/height signals with the width/height signals\n * to help us reduce redundant signals declaration.\n */\n renameTopLevelLayoutSizeSignal() {\n if (this.getName('width') !== 'width') {\n this.renameSignal(this.getName('width'), 'width');\n }\n if (this.getName('height') !== 'height') {\n this.renameSignal(this.getName('height'), 'height');\n }\n }\n parseLegends() {\n parseLegend(this);\n }\n assembleEncodeFromView(view) {\n // Exclude \"style\"\n const { style: _, ...baseView } = view;\n const e = {};\n for (const property of keys(baseView)) {\n const value = baseView[property];\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n return e;\n }\n assembleGroupEncodeEntry(isTopLevel) {\n let encodeEntry = {};\n if (this.view) {\n encodeEntry = this.assembleEncodeFromView(this.view);\n }\n if (!isTopLevel) {\n // Descriptions are already added to the top-level description so we only need to add them to the inner views.\n if (this.description) {\n encodeEntry['description'] = signalOrValueRef(this.description);\n }\n // For top-level spec, we can set the global width and height signal to adjust the group size.\n // For other child specs, we have to manually set width and height in the encode entry.\n if (this.type === 'unit' || this.type === 'layer') {\n return {\n width: this.getSizeSignalRef('width'),\n height: this.getSizeSignalRef('height'),\n ...(encodeEntry ?? {})\n };\n }\n }\n return isEmpty(encodeEntry) ? undefined : encodeEntry;\n }\n assembleLayout() {\n if (!this.layout) {\n return undefined;\n }\n const { spacing, ...layout } = this.layout;\n const { component, config } = this;\n const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config);\n return {\n padding: spacing,\n ...this.assembleDefaultLayout(),\n ...layout,\n ...(titleBand ? { titleBand } : {})\n };\n }\n assembleDefaultLayout() {\n return {};\n }\n assembleHeaderMarks() {\n const { layoutHeaders } = this.component;\n let headerMarks = [];\n for (const channel of FACET_CHANNELS) {\n if (layoutHeaders[channel].title) {\n headerMarks.push(assembleTitleGroup(this, channel));\n }\n }\n for (const channel of HEADER_CHANNELS) {\n headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel));\n }\n return headerMarks;\n }\n assembleAxes() {\n return assembleAxes(this.component.axes, this.config);\n }\n assembleLegends() {\n return assembleLegends(this);\n }\n assembleProjections() {\n return assembleProjections(this);\n }\n assembleTitle() {\n const { encoding, ...titleNoEncoding } = this.title ?? {};\n const title = {\n ...extractTitleConfig(this.config.title).nonMarkTitleProperties,\n ...titleNoEncoding,\n ...(encoding ? { encode: { update: encoding } } : {})\n };\n if (title.text) {\n if (contains(['unit', 'layer'], this.type)) {\n // Unit/Layer\n if (contains(['middle', undefined], title.anchor)) {\n title.frame ?? (title.frame = 'group');\n }\n }\n else {\n // composition with Vega layout\n // Set title = \"start\" by default for composition as \"middle\" does not look nice\n // https://github.com/vega/vega/issues/960#issuecomment-471360328\n title.anchor ?? (title.anchor = 'start');\n }\n return isEmpty(title) ? undefined : title;\n }\n return undefined;\n }\n /**\n * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals.\n */\n assembleGroup(signals = []) {\n const group = {};\n signals = signals.concat(this.assembleSignals());\n if (signals.length > 0) {\n group.signals = signals;\n }\n const layout = this.assembleLayout();\n if (layout) {\n group.layout = layout;\n }\n group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks());\n // Only include scales if this spec is top-level or if parent is facet.\n // (Otherwise, it will be merged with upper-level's scope.)\n const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : [];\n if (scales.length > 0) {\n group.scales = scales;\n }\n const axes = this.assembleAxes();\n if (axes.length > 0) {\n group.axes = axes;\n }\n const legends = this.assembleLegends();\n if (legends.length > 0) {\n group.legends = legends;\n }\n return group;\n }\n getName(text) {\n return varName((this.name ? `${this.name}_` : '') + text);\n }\n getDataName(type) {\n return this.getName(DataSourceType[type].toLowerCase());\n }\n /**\n * Request a data source name for the given data source type and mark that data source as required.\n * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData().\n * You can lookup the correct dataset name in assemble with `lookupDataSource`.\n */\n requestDataName(name) {\n const fullName = this.getDataName(name);\n // Increase ref count. This is critical because otherwise we won't create a data source.\n // We also increase the ref counts on OutputNode.getSource() calls.\n const refCounts = this.component.data.outputNodeRefCounts;\n refCounts[fullName] = (refCounts[fullName] || 0) + 1;\n return fullName;\n }\n getSizeSignalRef(layoutSizeType) {\n if (isFacetModel(this.parent)) {\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const scaleComponent = this.component.scales[channel];\n if (scaleComponent && !scaleComponent.merged) {\n // independent scale\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = scaleComponent.get('name');\n const domain = assembleDomain(this, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n const fieldRef = vgField({ aggregate: 'distinct', field }, { expr: 'datum' });\n return {\n signal: sizeExpr(scaleName, scaleComponent, fieldRef)\n };\n }\n else {\n log.warn(log.message.unknownField(channel));\n return null;\n }\n }\n }\n }\n return {\n signal: this.signalNameMap.get(this.getName(layoutSizeType))\n };\n }\n /**\n * Lookup the name of the datasource for an output node. You probably want to call this in assemble.\n */\n lookupDataSource(name) {\n const node = this.component.data.outputNodes[name];\n if (!node) {\n // Name not found in map so let's just return what we got.\n // This can happen if we already have the correct name.\n return name;\n }\n return node.getSource();\n }\n getSignalName(oldSignalName) {\n return this.signalNameMap.get(oldSignalName);\n }\n renameSignal(oldName, newName) {\n this.signalNameMap.rename(oldName, newName);\n }\n renameScale(oldName, newName) {\n this.scaleNameMap.rename(oldName, newName);\n }\n renameProjection(oldName, newName) {\n this.projectionNameMap.rename(oldName, newName);\n }\n /**\n * @return scale name for a given channel after the scale has been parsed and named.\n */\n scaleName(originalScaleName, parse) {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a scale can't be renamed\n // before it has the original name.\n return this.getName(originalScaleName);\n }\n // If there is a scale for the channel, it should either\n // be in the scale component or exist in the name map\n if (\n // If there is a scale for the channel, there should be a local scale component for it\n (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) ||\n // in the scale name map (the scale get merged by its parent)\n this.scaleNameMap.has(this.getName(originalScaleName))) {\n return this.scaleNameMap.get(this.getName(originalScaleName));\n }\n return undefined;\n }\n /**\n * @return projection name after the projection has been parsed and named.\n */\n projectionName(parse) {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a projection can't be renamed\n // before it has the original name.\n return this.getName('projection');\n }\n if ((this.component.projection && !this.component.projection.merged) ||\n this.projectionNameMap.has(this.getName('projection'))) {\n return this.projectionNameMap.get(this.getName('projection'));\n }\n return undefined;\n }\n /**\n * Traverse a model's hierarchy to get the scale component for a particular channel.\n */\n getScaleComponent(channel) {\n /* istanbul ignore next: This is warning for debugging test */\n if (!this.component.scales) {\n throw new Error('getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().');\n }\n const localScaleComponent = this.component.scales[channel];\n if (localScaleComponent && !localScaleComponent.merged) {\n return localScaleComponent;\n }\n return this.parent ? this.parent.getScaleComponent(channel) : undefined;\n }\n /**\n * Traverse a model's hierarchy to get a particular selection component.\n */\n getSelectionComponent(variableName, origName) {\n let sel = this.component.selection[variableName];\n if (!sel && this.parent) {\n sel = this.parent.getSelectionComponent(variableName, origName);\n }\n if (!sel) {\n throw new Error(log.message.selectionNotFound(origName));\n }\n return sel;\n }\n /**\n * Returns true if the model has a signalRef for an axis orient.\n */\n hasAxisOrientSignalRef() {\n return (this.component.axes.x?.some(a => a.hasOrientSignalRef()) ||\n this.component.axes.y?.some(a => a.hasOrientSignalRef()));\n }\n}\n/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */\nexport class ModelWithField extends Model {\n /** Get \"field\" reference for Vega */\n vgField(channel, opt = {}) {\n const fieldDef = this.fieldDef(channel);\n if (!fieldDef) {\n return undefined;\n }\n return vgField(fieldDef, opt);\n }\n reduceFieldDef(f, init) {\n return reduce(this.getMapping(), (acc, cd, c) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n return f(acc, fieldDef, c);\n }\n return acc;\n }, init);\n }\n forEachFieldDef(f, t) {\n forEach(this.getMapping(), (cd, c) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n f(fieldDef, c);\n }\n }, t);\n }\n}\n//# sourceMappingURL=model.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for density transform nodes\n */\nexport class DensityTransformNode extends DataFlowNode {\n clone() {\n return new DensityTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density'];\n }\n dependentFields() {\n return new Set([this.transform.density, ...(this.transform.groupby ?? [])]);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `DensityTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { density, ...rest } = this.transform;\n const result = {\n type: 'kde',\n field: density,\n ...rest\n };\n if (this.transform.groupby) {\n result.resolve = 'shared';\n }\n return result;\n }\n}\n//# sourceMappingURL=density.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for flatten transform nodes\n */\nexport class ExtentTransformNode extends DataFlowNode {\n clone() {\n return new ExtentTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform);\n }\n dependentFields() {\n return new Set([this.transform.extent]);\n }\n producedFields() {\n return new Set([]);\n }\n hash() {\n return `ExtentTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { extent, param } = this.transform;\n const result = {\n type: 'extent',\n field: extent,\n signal: param\n };\n return result;\n }\n}\n//# sourceMappingURL=extent.js.map","import { isScaleChannel } from '../../channel';\nimport { vgField as fieldRef } from '../../channeldef';\nimport { isPathMark } from '../../mark';\nimport { hasContinuousDomain } from '../../scale';\nimport { hash, keys } from '../../util';\nimport { getMarkPropOrConfig } from '../common';\nimport { DataFlowNode } from './dataflow';\nexport class FilterInvalidNode extends DataFlowNode {\n clone() {\n return new FilterInvalidNode(null, { ...this.filter });\n }\n constructor(parent, filter) {\n super(parent);\n this.filter = filter;\n }\n static make(parent, model) {\n const { config, mark, markDef } = model;\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid !== 'filter') {\n return null;\n }\n const filter = model.reduceFieldDef((aggregator, fieldDef, channel) => {\n const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n // While discrete domain scales can handle invalid values, continuous scales can't.\n // Thus, for non-path marks, we have to filter null for scales with continuous domains.\n // (For path marks, we will use \"defined\" property and skip these values instead.)\n if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) {\n aggregator[fieldDef.field] = fieldDef; // we know that the fieldDef is a typed field def\n }\n }\n return aggregator;\n }, {});\n if (!keys(filter).length) {\n return null;\n }\n return new FilterInvalidNode(parent, filter);\n }\n dependentFields() {\n return new Set(keys(this.filter));\n }\n producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n hash() {\n return `FilterInvalid ${hash(this.filter)}`;\n }\n /**\n * Create the VgTransforms for each of the filtered fields.\n */\n assemble() {\n const filters = keys(this.filter).reduce((vegaFilters, field) => {\n const fieldDef = this.filter[field];\n const ref = fieldRef(fieldDef, { expr: 'datum' });\n if (fieldDef !== null) {\n if (fieldDef.type === 'temporal') {\n vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`);\n }\n else if (fieldDef.type === 'quantitative') {\n vegaFilters.push(`isValid(${ref})`);\n vegaFilters.push(`isFinite(+${ref})`);\n }\n else {\n // should never get here\n }\n }\n return vegaFilters;\n }, []);\n return filters.length > 0\n ? {\n type: 'filter',\n expr: filters.join(' && ')\n }\n : null;\n }\n}\n//# sourceMappingURL=filterinvalid.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for flatten transform nodes\n */\nexport class FlattenTransformNode extends DataFlowNode {\n clone() {\n return new FlattenTransformNode(this.parent, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const { flatten, as = [] } = this.transform;\n this.transform.as = flatten.map((f, i) => as[i] ?? f);\n }\n dependentFields() {\n return new Set(this.transform.flatten);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `FlattenTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { flatten: fields, as } = this.transform;\n const result = {\n type: 'flatten',\n fields,\n as\n };\n return result;\n }\n}\n//# sourceMappingURL=flatten.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for flatten transform nodes\n */\nexport class FoldTransformNode extends DataFlowNode {\n clone() {\n return new FoldTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'key', specifiedAs[1] ?? 'value'];\n }\n dependentFields() {\n return new Set(this.transform.fold);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `FoldTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { fold, as } = this.transform;\n const result = {\n type: 'fold',\n fields: fold,\n as\n };\n return result;\n }\n}\n//# sourceMappingURL=fold.js.map","import { isString } from 'vega-util';\nimport { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE } from '../../channel';\nimport { getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef } from '../../channeldef';\nimport { GEOJSON } from '../../type';\nimport { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class GeoJSONNode extends DataFlowNode {\n clone() {\n return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal);\n }\n static parseAll(parent, model) {\n if (model.component.projection && !model.component.projection.isFit) {\n return parent;\n }\n let geoJsonCounter = 0;\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? { expr: `${def.datum}` }\n : isValueDef(def)\n ? { expr: `${def['value']}` }\n : undefined;\n });\n if (pair[0] || pair[1]) {\n parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n if (model.channelHasField(SHAPE)) {\n const fieldDef = model.typedFieldDef(SHAPE);\n if (fieldDef.type === GEOJSON) {\n parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n return parent;\n }\n constructor(parent, fields, geojson, signal) {\n super(parent);\n this.fields = fields;\n this.geojson = geojson;\n this.signal = signal;\n }\n dependentFields() {\n const fields = (this.fields ?? []).filter(isString);\n return new Set([...(this.geojson ? [this.geojson] : []), ...fields]);\n }\n producedFields() {\n return new Set();\n }\n hash() {\n return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`;\n }\n assemble() {\n return [\n ...(this.geojson\n ? [\n {\n type: 'filter',\n expr: `isValid(datum[\"${this.geojson}\"])`\n }\n ]\n : []),\n {\n type: 'geojson',\n ...(this.fields ? { fields: this.fields } : {}),\n ...(this.geojson ? { geojson: this.geojson } : {}),\n signal: this.signal\n }\n ];\n }\n}\n//# sourceMappingURL=geojson.js.map","import { isString } from 'vega-util';\nimport { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2 } from '../../channel';\nimport { getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef } from '../../channeldef';\nimport { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class GeoPointNode extends DataFlowNode {\n clone() {\n return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as));\n }\n constructor(parent, projection, fields, as) {\n super(parent);\n this.projection = projection;\n this.fields = fields;\n this.as = as;\n }\n static parseAll(parent, model) {\n if (!model.projectionName()) {\n return parent;\n }\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? { expr: `${def.datum}` }\n : isValueDef(def)\n ? { expr: `${def['value']}` }\n : undefined;\n });\n const suffix = coordinates[0] === LONGITUDE2 ? '2' : '';\n if (pair[0] || pair[1]) {\n parent = new GeoPointNode(parent, model.projectionName(), pair, [\n model.getName(`x${suffix}`),\n model.getName(`y${suffix}`)\n ]);\n }\n }\n return parent;\n }\n dependentFields() {\n return new Set(this.fields.filter(isString));\n }\n producedFields() {\n return new Set(this.as);\n }\n hash() {\n return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`;\n }\n assemble() {\n return {\n type: 'geopoint',\n projection: this.projection,\n fields: this.fields,\n as: this.as\n };\n }\n}\n//# sourceMappingURL=geopoint.js.map","import { isFieldDef } from '../../channeldef';\nimport { pathGroupingFields } from '../../encoding';\nimport { isImputeSequence } from '../../transform';\nimport { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\nexport class ImputeNode extends DataFlowNode {\n clone() {\n return new ImputeNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n }\n dependentFields() {\n return new Set([this.transform.impute, this.transform.key, ...(this.transform.groupby ?? [])]);\n }\n producedFields() {\n return new Set([this.transform.impute]);\n }\n processSequence(keyvals) {\n const { start = 0, stop, step } = keyvals;\n const result = [start, stop, ...(step ? [step] : [])].join(',');\n return { signal: `sequence(${result})` };\n }\n static makeFromTransform(parent, imputeTransform) {\n return new ImputeNode(parent, imputeTransform);\n }\n static makeFromEncoding(parent, model) {\n const encoding = model.encoding;\n const xDef = encoding.x;\n const yDef = encoding.y;\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined;\n if (imputedChannel === undefined) {\n return undefined;\n }\n const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined;\n const { method, value, frame, keyvals } = imputedChannel.impute;\n const groupbyFields = pathGroupingFields(model.mark, encoding);\n return new ImputeNode(parent, {\n impute: imputedChannel.field,\n key: keyChannel.field,\n ...(method ? { method } : {}),\n ...(value !== undefined ? { value } : {}),\n ...(frame ? { frame } : {}),\n ...(keyvals !== undefined ? { keyvals } : {}),\n ...(groupbyFields.length ? { groupby: groupbyFields } : {})\n });\n }\n return null;\n }\n hash() {\n return `Impute ${hash(this.transform)}`;\n }\n assemble() {\n const { impute, key, keyvals, method, groupby, value, frame = [null, null] } = this.transform;\n const imputeTransform = {\n type: 'impute',\n field: impute,\n key,\n ...(keyvals ? { keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals } : {}),\n method: 'value',\n ...(groupby ? { groupby } : {}),\n value: !method || method === 'value' ? value : null\n };\n if (method && method !== 'value') {\n const deriveNewField = {\n type: 'window',\n as: [`imputed_${impute}_value`],\n ops: [method],\n fields: [impute],\n frame,\n ignorePeers: false,\n ...(groupby ? { groupby } : {})\n };\n const replaceOriginal = {\n type: 'formula',\n expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`,\n as: impute\n };\n return [imputeTransform, deriveNewField, replaceOriginal];\n }\n else {\n return [imputeTransform];\n }\n }\n}\n//# sourceMappingURL=impute.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for loess transform nodes\n */\nexport class LoessTransformNode extends DataFlowNode {\n clone() {\n return new LoessTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.loess];\n }\n dependentFields() {\n return new Set([this.transform.loess, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `LoessTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { loess, on, ...rest } = this.transform;\n const result = {\n type: 'loess',\n x: on,\n y: loess,\n ...rest\n };\n return result;\n }\n}\n//# sourceMappingURL=loess.js.map","import { array, isString } from 'vega-util';\nimport * as log from '../../log';\nimport { isLookupData, isLookupSelection } from '../../transform';\nimport { duplicate, hash, varName } from '../../util';\nimport { DataFlowNode, OutputNode } from './dataflow';\nimport { findSource } from './parse';\nimport { SourceNode } from './source';\nimport { DataSourceType } from '../../data';\nexport class LookupNode extends DataFlowNode {\n clone() {\n return new LookupNode(null, duplicate(this.transform), this.secondary);\n }\n constructor(parent, transform, secondary) {\n super(parent);\n this.transform = transform;\n this.secondary = secondary;\n }\n static make(parent, model, transform, counter) {\n const sources = model.component.data.sources;\n const { from } = transform;\n let fromOutputNode = null;\n if (isLookupData(from)) {\n let fromSource = findSource(from.data, sources);\n if (!fromSource) {\n fromSource = new SourceNode(from.data);\n sources.push(fromSource);\n }\n const fromOutputName = model.getName(`lookup_${counter}`);\n fromOutputNode = new OutputNode(fromSource, fromOutputName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts);\n model.component.data.outputNodes[fromOutputName] = fromOutputNode;\n }\n else if (isLookupSelection(from)) {\n const selName = from.param;\n transform = { as: selName, ...transform };\n let selCmpt;\n try {\n selCmpt = model.getSelectionComponent(varName(selName), selName);\n }\n catch (e) {\n throw new Error(log.message.cannotLookupVariableParameter(selName));\n }\n fromOutputNode = selCmpt.materialized;\n if (!fromOutputNode) {\n throw new Error(log.message.noSameUnitLookup(selName));\n }\n }\n return new LookupNode(parent, transform, fromOutputNode.getSource());\n }\n dependentFields() {\n return new Set([this.transform.lookup]);\n }\n producedFields() {\n return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields);\n }\n hash() {\n return `Lookup ${hash({ transform: this.transform, secondary: this.secondary })}`;\n }\n assemble() {\n let foreign;\n if (this.transform.from.fields) {\n // lookup a few fields and add create a flat output\n foreign = {\n values: this.transform.from.fields,\n ...(this.transform.as ? { as: array(this.transform.as) } : {})\n };\n }\n else {\n // lookup full record and nest it\n let asName = this.transform.as;\n if (!isString(asName)) {\n log.warn(log.message.NO_FIELDS_NEEDS_AS);\n asName = '_lookup';\n }\n foreign = {\n as: [asName]\n };\n }\n return {\n type: 'lookup',\n from: this.secondary,\n key: this.transform.from.key,\n fields: [this.transform.lookup],\n ...foreign,\n ...(this.transform.default ? { default: this.transform.default } : {})\n };\n }\n}\n//# sourceMappingURL=lookup.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for quantile transform nodes\n */\nexport class QuantileTransformNode extends DataFlowNode {\n clone() {\n return new QuantileTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'prob', specifiedAs[1] ?? 'value'];\n }\n dependentFields() {\n return new Set([this.transform.quantile, ...(this.transform.groupby ?? [])]);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `QuantileTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { quantile, ...rest } = this.transform;\n const result = {\n type: 'quantile',\n field: quantile,\n ...rest\n };\n return result;\n }\n}\n//# sourceMappingURL=quantile.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for regression transform nodes\n */\nexport class RegressionTransformNode extends DataFlowNode {\n clone() {\n return new RegressionTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.regression];\n }\n dependentFields() {\n return new Set([this.transform.regression, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n producedFields() {\n return new Set(this.transform.as);\n }\n hash() {\n return `RegressionTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { regression, on, ...rest } = this.transform;\n const result = {\n type: 'regression',\n x: on,\n y: regression,\n ...rest\n };\n return result;\n }\n}\n//# sourceMappingURL=regression.js.map","import { duplicate, hash, unique } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for pivot transform nodes.\n */\nexport class PivotTransformNode extends DataFlowNode {\n clone() {\n return new PivotTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n }\n addDimensions(fields) {\n this.transform.groupby = unique((this.transform.groupby ?? []).concat(fields), d => d);\n }\n producedFields() {\n return undefined; // return undefined so that potentially everything can depend on the pivot\n }\n dependentFields() {\n return new Set([this.transform.pivot, this.transform.value, ...(this.transform.groupby ?? [])]);\n }\n hash() {\n return `PivotTransform ${hash(this.transform)}`;\n }\n assemble() {\n const { pivot, value, groupby, limit, op } = this.transform;\n return {\n type: 'pivot',\n field: pivot,\n value,\n ...(limit !== undefined ? { limit } : {}),\n ...(op !== undefined ? { op } : {}),\n ...(groupby !== undefined ? { groupby } : {})\n };\n }\n}\n//# sourceMappingURL=pivot.js.map","import { duplicate, hash } from '../../util';\nimport { DataFlowNode } from './dataflow';\n/**\n * A class for the sample transform nodes\n */\nexport class SampleTransformNode extends DataFlowNode {\n clone() {\n return new SampleTransformNode(null, duplicate(this.transform));\n }\n constructor(parent, transform) {\n super(parent);\n this.transform = transform;\n }\n dependentFields() {\n return new Set();\n }\n producedFields() {\n return new Set();\n }\n hash() {\n return `SampleTransform ${hash(this.transform)}`;\n }\n assemble() {\n return {\n type: 'sample',\n size: this.transform.sample\n };\n }\n}\n//# sourceMappingURL=sample.js.map","import { isUrlData } from '../../data';\nimport { AggregateNode } from './aggregate';\nimport { BinNode } from './bin';\nimport { CalculateNode } from './calculate';\nimport { OutputNode } from './dataflow';\nimport { DensityTransformNode } from './density';\nimport { ExtentTransformNode } from './extent';\nimport { FacetNode } from './facet';\nimport { FilterNode } from './filter';\nimport { FilterInvalidNode } from './filterinvalid';\nimport { FlattenTransformNode } from './flatten';\nimport { FoldTransformNode } from './fold';\nimport { ParseNode } from './formatparse';\nimport { GeoJSONNode } from './geojson';\nimport { GeoPointNode } from './geopoint';\nimport { GraticuleNode } from './graticule';\nimport { IdentifierNode } from './identifier';\nimport { ImputeNode } from './impute';\nimport { JoinAggregateTransformNode } from './joinaggregate';\nimport { LoessTransformNode } from './loess';\nimport { LookupNode } from './lookup';\nimport { QuantileTransformNode } from './quantile';\nimport { RegressionTransformNode } from './regression';\nimport { PivotTransformNode } from './pivot';\nimport { SampleTransformNode } from './sample';\nimport { SequenceNode } from './sequence';\nimport { SourceNode } from './source';\nimport { StackNode } from './stack';\nimport { TimeUnitNode } from './timeunit';\nimport { WindowTransformNode } from './window';\nfunction makeWalkTree(data) {\n // to name datasources\n let datasetIndex = 0;\n /**\n * Recursively walk down the tree.\n */\n function walkTree(node, dataSource) {\n if (node instanceof SourceNode) {\n // If the source is a named data source or a data source with values, we need\n // to put it in a different data source. Otherwise, Vega may override the data.\n if (!node.isGenerator && !isUrlData(node.data)) {\n data.push(dataSource);\n const newData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n if (node instanceof ParseNode) {\n if (node.parent instanceof SourceNode && !dataSource.source) {\n // If node's parent is a root source and the data source does not refer to another data source, use normal format parse\n dataSource.format = {\n ...(dataSource.format ?? {}),\n parse: node.assembleFormatParse()\n };\n // add calculates for all nested fields\n dataSource.transform.push(...node.assembleTransforms(true));\n }\n else {\n // Otherwise use Vega expression to parse\n dataSource.transform.push(...node.assembleTransforms());\n }\n }\n if (node instanceof FacetNode) {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n node.data = dataSource.name;\n }\n else {\n node.data = dataSource.source;\n }\n data.push(...node.assemble());\n // break here because the rest of the tree has to be taken care of by the facet.\n return;\n }\n if (node instanceof GraticuleNode ||\n node instanceof SequenceNode ||\n node instanceof FilterInvalidNode ||\n node instanceof FilterNode ||\n node instanceof CalculateNode ||\n node instanceof GeoPointNode ||\n node instanceof AggregateNode ||\n node instanceof LookupNode ||\n node instanceof WindowTransformNode ||\n node instanceof JoinAggregateTransformNode ||\n node instanceof FoldTransformNode ||\n node instanceof FlattenTransformNode ||\n node instanceof DensityTransformNode ||\n node instanceof LoessTransformNode ||\n node instanceof QuantileTransformNode ||\n node instanceof RegressionTransformNode ||\n node instanceof IdentifierNode ||\n node instanceof SampleTransformNode ||\n node instanceof PivotTransformNode ||\n node instanceof ExtentTransformNode) {\n dataSource.transform.push(node.assemble());\n }\n if (node instanceof BinNode ||\n node instanceof TimeUnitNode ||\n node instanceof ImputeNode ||\n node instanceof StackNode ||\n node instanceof GeoJSONNode) {\n dataSource.transform.push(...node.assemble());\n }\n if (node instanceof OutputNode) {\n if (dataSource.source && dataSource.transform.length === 0) {\n node.setSource(dataSource.source);\n }\n else if (node.parent instanceof OutputNode) {\n // Note that an output node may be required but we still do not assemble a\n // separate data source for it.\n node.setSource(dataSource.name);\n }\n else {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n // Here we set the name of the datasource we generated. From now on\n // other assemblers can use it.\n node.setSource(dataSource.name);\n // if this node has more than one child, we will add a datasource automatically\n if (node.numChildren() === 1) {\n data.push(dataSource);\n const newData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n }\n switch (node.numChildren()) {\n case 0:\n // done\n if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) {\n // do not push empty datasources that are simply references\n data.push(dataSource);\n }\n break;\n case 1:\n walkTree(node.children[0], dataSource);\n break;\n default: {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n let source = dataSource.name;\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n }\n else {\n source = dataSource.source;\n }\n for (const child of node.children) {\n const newData = {\n name: null,\n source,\n transform: []\n };\n walkTree(child, newData);\n }\n break;\n }\n }\n }\n return walkTree;\n}\n/**\n * Assemble data sources that are derived from faceted data.\n */\nexport function assembleFacetData(root) {\n const data = [];\n const walkTree = makeWalkTree(data);\n for (const child of root.children) {\n walkTree(child, {\n source: root.name,\n name: null,\n transform: []\n });\n }\n return data;\n}\n/**\n * Create Vega data array from a given compiled model and append all of them to the given array\n *\n * @param model\n * @param data array\n * @return modified data array\n */\nexport function assembleRootData(dataComponent, datasets) {\n const data = [];\n // dataComponent.sources.forEach(debug);\n // draw(dataComponent.sources);\n const walkTree = makeWalkTree(data);\n let sourceIndex = 0;\n for (const root of dataComponent.sources) {\n // assign a name if the source does not have a name yet\n if (!root.hasName()) {\n root.dataName = `source_${sourceIndex++}`;\n }\n const newData = root.assemble();\n walkTree(root, newData);\n }\n // remove empty transform arrays for cleaner output\n for (const d of data) {\n if (d.transform.length === 0) {\n delete d.transform;\n }\n }\n // move sources without transforms (the ones that are potentially used in lookups) to the beginning\n let whereTo = 0;\n for (const [i, d] of data.entries()) {\n if ((d.transform ?? []).length === 0 && !d.source) {\n data.splice(whereTo++, 0, data.splice(i, 1)[0]);\n }\n }\n // now fix the from references in lookup transforms\n for (const d of data) {\n for (const t of d.transform ?? []) {\n if (t.type === 'lookup') {\n t.from = dataComponent.outputNodes[t.from].getSource();\n }\n }\n }\n // inline values for datasets that are in the datastore\n for (const d of data) {\n if (d.name in datasets) {\n d.values = datasets[d.name];\n }\n }\n return data;\n}\n//# sourceMappingURL=assemble.js.map","import { isArray } from 'vega-util';\nimport { FACET_CHANNELS } from '../../channel';\nimport { title as fieldDefTitle } from '../../channeldef';\nimport { contains, getFirstDefined } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { assembleAxis } from '../axis/assemble';\nimport { parseGuideResolve } from '../resolve';\nimport { getHeaderProperty } from './common';\nexport function getHeaderType(orient) {\n if (orient === 'top' || orient === 'left' || isSignalRef(orient)) {\n // we always use header for orient signal since we can't dynamically make header becomes footer\n return 'header';\n }\n return 'footer';\n}\nexport function parseFacetHeaders(model) {\n for (const channel of FACET_CHANNELS) {\n parseFacetHeader(model, channel);\n }\n mergeChildAxis(model, 'x');\n mergeChildAxis(model, 'y');\n}\nfunction parseFacetHeader(model, channel) {\n const { facet, config, child, component } = model;\n if (model.channelHasField(channel)) {\n const fieldDef = facet[channel];\n const titleConfig = getHeaderProperty('title', null, config, channel);\n let title = fieldDefTitle(fieldDef, config, {\n allowDisabling: true,\n includeDefault: titleConfig === undefined || !!titleConfig\n });\n if (child.component.layoutHeaders[channel].title) {\n // TODO: better handle multiline titles\n title = isArray(title) ? title.join(', ') : title;\n // merge title with child to produce \"Title / Subtitle / Sub-subtitle\"\n title += ` / ${child.component.layoutHeaders[channel].title}`;\n child.component.layoutHeaders[channel].title = null;\n }\n const labelOrient = getHeaderProperty('labelOrient', fieldDef.header, config, channel);\n const labels = fieldDef.header !== null ? getFirstDefined(fieldDef.header?.labels, config.header.labels, true) : false;\n const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header';\n component.layoutHeaders[channel] = {\n title: fieldDef.header !== null ? title : null,\n facetFieldDef: fieldDef,\n [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)]\n };\n }\n}\nfunction makeHeaderComponent(model, channel, labels) {\n const sizeType = channel === 'row' ? 'height' : 'width';\n return {\n labels,\n sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined,\n axes: []\n };\n}\nfunction mergeChildAxis(model, channel) {\n const { child } = model;\n if (child.component.axes[channel]) {\n const { layoutHeaders, resolve } = model.component;\n resolve.axis[channel] = parseGuideResolve(resolve, channel);\n if (resolve.axis[channel] === 'shared') {\n // For shared axis, move the axes to facet's header or footer\n const headerChannel = channel === 'x' ? 'column' : 'row';\n const layoutHeader = layoutHeaders[headerChannel];\n for (const axisComponent of child.component.axes[channel]) {\n const headerType = getHeaderType(axisComponent.get('orient'));\n layoutHeader[headerType] ?? (layoutHeader[headerType] = [makeHeaderComponent(model, headerChannel, false)]);\n // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes\n const mainAxis = assembleAxis(axisComponent, 'main', model.config, { header: true });\n if (mainAxis) {\n // LayoutHeader no longer keep track of property precedence, thus let's combine.\n layoutHeader[headerType][0].axes.push(mainAxis);\n }\n axisComponent.mainExtracted = true;\n }\n }\n else {\n // Otherwise do nothing for independent axes\n }\n }\n}\n//# sourceMappingURL=parse.js.map","import { getPositionScaleChannel, getSizeChannel, POSITION_SCALE_CHANNELS } from '../../channel';\nimport { getViewConfigContinuousSize, getViewConfigDiscreteSize } from '../../config';\nimport { hasDiscreteDomain } from '../../scale';\nimport { isStep } from '../../spec/base';\nimport { isVgRangeStep } from '../../vega.schema';\nimport { defaultScaleResolve } from '../resolve';\nimport { mergeValuesWithExplicit } from '../split';\nimport { getSizeTypeFromLayoutSizeType } from './component';\nexport function parseLayerLayoutSize(model) {\n parseChildrenLayoutSize(model);\n parseNonUnitLayoutSizeForChannel(model, 'width');\n parseNonUnitLayoutSizeForChannel(model, 'height');\n}\nexport function parseConcatLayoutSize(model) {\n parseChildrenLayoutSize(model);\n // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth.\n const widthType = model.layout.columns === 1 ? 'width' : 'childWidth';\n // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight.\n const heightType = model.layout.columns === undefined ? 'height' : 'childHeight';\n parseNonUnitLayoutSizeForChannel(model, widthType);\n parseNonUnitLayoutSizeForChannel(model, heightType);\n}\nexport function parseChildrenLayoutSize(model) {\n for (const child of model.children) {\n child.parseLayoutSize();\n }\n}\n/**\n * Merge child layout size (width or height).\n */\nfunction parseNonUnitLayoutSizeForChannel(model, layoutSizeType) {\n /*\n * For concat, the parent width or height might not be the same as the children's shared height.\n * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width.\n *\n * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height)\n * while the sizeType represents the properties of the child.\n */\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const resolve = model.component.resolve;\n const layoutSizeCmpt = model.component.layoutSize;\n let mergedSize;\n // Try to merge layout size\n for (const child of model.children) {\n const childSize = child.component.layoutSize.getWithExplicit(sizeType);\n const scaleResolve = resolve.scale[channel] ?? defaultScaleResolve(channel, model);\n if (scaleResolve === 'independent' && childSize.value === 'step') {\n // Do not merge independent scales with range-step as their size depends\n // on the scale domains, which can be different between scales.\n mergedSize = undefined;\n break;\n }\n if (mergedSize) {\n if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) {\n // For independent scale, only merge if all the sizes are the same.\n // If the values are different, abandon the merge!\n mergedSize = undefined;\n break;\n }\n mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, '');\n }\n else {\n mergedSize = childSize;\n }\n }\n if (mergedSize) {\n // If merged, rename size and set size of all children.\n for (const child of model.children) {\n model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType));\n child.component.layoutSize.set(sizeType, 'merged', false);\n }\n layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize);\n }\n else {\n layoutSizeCmpt.setWithExplicit(layoutSizeType, {\n explicit: false,\n value: undefined\n });\n }\n}\nexport function parseUnitLayoutSize(model) {\n const { size, component } = model;\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n if (size[sizeType]) {\n const specifiedSize = size[sizeType];\n component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true);\n }\n else {\n const defaultSize = defaultUnitSize(model, sizeType);\n component.layoutSize.set(sizeType, defaultSize, false);\n }\n }\n}\nfunction defaultUnitSize(model, sizeType) {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const config = model.config;\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n if (hasDiscreteDomain(scaleType)) {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n if (isVgRangeStep(range) || isStep(size)) {\n // For discrete domain with range.step, use dynamic width/height\n return 'step';\n }\n else {\n return size;\n }\n }\n else {\n return getViewConfigContinuousSize(config.view, sizeType);\n }\n }\n else if (model.hasProjection || model.mark === 'arc') {\n // arc should use continuous size by default otherwise the pie is extremely small\n return getViewConfigContinuousSize(config.view, sizeType);\n }\n else {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n return isStep(size) ? size.step : size;\n }\n}\n//# sourceMappingURL=parse.js.map","import { isArray } from 'vega-util';\nimport { isBinning } from '../bin';\nimport { COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW } from '../channel';\nimport { initFieldDef, vgField } from '../channeldef';\nimport { replaceExprRef } from '../expr';\nimport * as log from '../log';\nimport { hasDiscreteDomain } from '../scale';\nimport { DEFAULT_SORT_OP, isSortField } from '../sort';\nimport { isFacetMapping } from '../spec/facet';\nimport { keys } from '../util';\nimport { isVgRangeStep } from '../vega.schema';\nimport { buildModel } from './buildmodel';\nimport { assembleFacetData } from './data/assemble';\nimport { sortArrayIndexField } from './data/calculate';\nimport { parseData } from './data/parse';\nimport { assembleLabelTitle } from './header/assemble';\nimport { getHeaderChannel, getHeaderProperty } from './header/common';\nimport { HEADER_CHANNELS, HEADER_TYPES } from './header/component';\nimport { parseFacetHeaders } from './header/parse';\nimport { parseChildrenLayoutSize } from './layoutsize/parse';\nimport { ModelWithField } from './model';\nimport { assembleDomain, getFieldFromDomain } from './scale/domain';\nimport { assembleFacetSignals } from './selection/assemble';\nexport function facetSortFieldName(fieldDef, sort, opt) {\n return vgField(sort, { suffix: `by_${vgField(fieldDef)}`, ...(opt ?? {}) });\n}\nexport class FacetModel extends ModelWithField {\n constructor(spec, parent, parentGivenName, config) {\n super(spec, 'facet', parent, parentGivenName, config, spec.resolve);\n this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config);\n this.children = [this.child];\n this.facet = this.initFacet(spec.facet);\n }\n initFacet(facet) {\n // clone to prevent side effect to the original spec\n if (!isFacetMapping(facet)) {\n return { facet: this.initFacetFieldDef(facet, 'facet') };\n }\n const channels = keys(facet);\n const normalizedFacet = {};\n for (const channel of channels) {\n if (![ROW, COLUMN].includes(channel)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, 'facet'));\n break;\n }\n const fieldDef = facet[channel];\n if (fieldDef.field === undefined) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n break;\n }\n normalizedFacet[channel] = this.initFacetFieldDef(fieldDef, channel);\n }\n return normalizedFacet;\n }\n initFacetFieldDef(fieldDef, channel) {\n // Cast because we call initFieldDef, which assumes general FieldDef.\n // However, FacetFieldDef is a bit more constrained than the general FieldDef\n const facetFieldDef = initFieldDef(fieldDef, channel);\n if (facetFieldDef.header) {\n facetFieldDef.header = replaceExprRef(facetFieldDef.header);\n }\n else if (facetFieldDef.header === null) {\n facetFieldDef.header = null;\n }\n return facetFieldDef;\n }\n channelHasField(channel) {\n return !!this.facet[channel];\n }\n fieldDef(channel) {\n return this.facet[channel];\n }\n parseData() {\n this.component.data = parseData(this);\n this.child.parseData();\n }\n parseLayoutSize() {\n parseChildrenLayoutSize(this);\n }\n parseSelections() {\n // As a facet has a single child, the selection components are the same.\n // The child maintains its selections to assemble signals, which remain\n // within its unit.\n this.child.parseSelections();\n this.component.selection = this.child.component.selection;\n }\n parseMarkGroup() {\n this.child.parseMarkGroup();\n }\n parseAxesAndHeaders() {\n this.child.parseAxesAndHeaders();\n parseFacetHeaders(this);\n }\n assembleSelectionTopLevelSignals(signals) {\n return this.child.assembleSelectionTopLevelSignals(signals);\n }\n assembleSignals() {\n this.child.assembleSignals();\n return [];\n }\n assembleSelectionData(data) {\n return this.child.assembleSelectionData(data);\n }\n getHeaderLayoutMixins() {\n const layoutMixins = {};\n for (const channel of FACET_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const layoutHeaderComponent = this.component.layoutHeaders[channel];\n const headerComponent = layoutHeaderComponent[headerType];\n const { facetFieldDef } = layoutHeaderComponent;\n if (facetFieldDef) {\n const titleOrient = getHeaderProperty('titleOrient', facetFieldDef.header, this.config, channel);\n if (['right', 'bottom'].includes(titleOrient)) {\n const headerChannel = getHeaderChannel(channel, titleOrient);\n layoutMixins.titleAnchor ?? (layoutMixins.titleAnchor = {});\n layoutMixins.titleAnchor[headerChannel] = 'end';\n }\n }\n if (headerComponent?.[0]) {\n // set header/footerBand\n const sizeType = channel === 'row' ? 'height' : 'width';\n const bandType = headerType === 'header' ? 'headerBand' : 'footerBand';\n if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) {\n // If facet child does not have size signal, then apply headerBand\n layoutMixins[bandType] ?? (layoutMixins[bandType] = {});\n layoutMixins[bandType][channel] = 0.5;\n }\n if (layoutHeaderComponent.title) {\n layoutMixins.offset ?? (layoutMixins.offset = {});\n layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10;\n }\n }\n }\n }\n return layoutMixins;\n }\n assembleDefaultLayout() {\n const { column, row } = this.facet;\n const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined;\n let align = 'all';\n // Do not align the cells if the scale corresponding to the direction is indepent.\n // We always align when we facet into both row and column.\n if (!row && this.component.resolve.scale.x === 'independent') {\n align = 'none';\n }\n else if (!column && this.component.resolve.scale.y === 'independent') {\n align = 'none';\n }\n return {\n ...this.getHeaderLayoutMixins(),\n ...(columns ? { columns } : {}),\n bounds: 'full',\n align\n };\n }\n assembleLayoutSignals() {\n // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales.\n return this.child.assembleLayoutSignals();\n }\n columnDistinctSignal() {\n if (this.parent && this.parent instanceof FacetModel) {\n // For nested facet, we will add columns to group mark instead\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return undefined;\n }\n else {\n // In facetNode.assemble(), the name is always this.getName('column') + '_layout'.\n const facetLayoutDataName = this.getName('column_domain');\n return { signal: `length(data('${facetLayoutDataName}'))` };\n }\n }\n assembleGroupStyle() {\n return undefined;\n }\n assembleGroup(signals) {\n if (this.parent && this.parent instanceof FacetModel) {\n // Provide number of columns for layout.\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return {\n ...(this.channelHasField('column')\n ? {\n encode: {\n update: {\n // TODO(https://github.com/vega/vega-lite/issues/2759):\n // Correct the signal for facet of concat of facet_column\n columns: { field: vgField(this.facet.column, { prefix: 'distinct' }) }\n }\n }\n }\n : {}),\n ...super.assembleGroup(signals)\n };\n }\n return super.assembleGroup(signals);\n }\n /**\n * Aggregate cardinality for calculating size\n */\n getCardinalityAggregateForChild() {\n const fields = [];\n const ops = [];\n const as = [];\n if (this.child instanceof FacetModel) {\n if (this.child.channelHasField('column')) {\n const field = vgField(this.child.facet.column);\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n }\n }\n else {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.child.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.child, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n }\n else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n }\n return { fields, ops, as };\n }\n assembleFacet() {\n const { name, data } = this.component.data.facetRoot;\n const { row, column } = this.facet;\n const { fields, ops, as } = this.getCardinalityAggregateForChild();\n const groupby = [];\n for (const channel of FACET_CHANNELS) {\n const fieldDef = this.facet[channel];\n if (fieldDef) {\n groupby.push(vgField(fieldDef));\n const { bin, sort } = fieldDef;\n if (isBinning(bin)) {\n groupby.push(vgField(fieldDef, { binSuffix: 'end' }));\n }\n if (isSortField(sort)) {\n const { field, op = DEFAULT_SORT_OP } = sort;\n const outputName = facetSortFieldName(fieldDef, sort);\n if (row && column) {\n // For crossed facet, use pre-calculate field as it requires a different groupby\n // For each calculated field, apply max and assign them to the same name as\n // all values of the same group should be the same anyway.\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n }\n else {\n fields.push(field);\n ops.push(op);\n as.push(outputName);\n }\n }\n else if (isArray(sort)) {\n const outputName = sortArrayIndexField(fieldDef, channel);\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n }\n }\n }\n const cross = !!row && !!column;\n return {\n name,\n data,\n groupby,\n ...(cross || fields.length > 0\n ? {\n aggregate: {\n ...(cross ? { cross } : {}),\n ...(fields.length ? { fields, ops, as } : {})\n }\n }\n : {})\n };\n }\n facetSortFields(channel) {\n const { facet } = this;\n const fieldDef = facet[channel];\n if (fieldDef) {\n if (isSortField(fieldDef.sort)) {\n return [facetSortFieldName(fieldDef, fieldDef.sort, { expr: 'datum' })];\n }\n else if (isArray(fieldDef.sort)) {\n return [sortArrayIndexField(fieldDef, channel, { expr: 'datum' })];\n }\n return [vgField(fieldDef, { expr: 'datum' })];\n }\n return [];\n }\n facetSortOrder(channel) {\n const { facet } = this;\n const fieldDef = facet[channel];\n if (fieldDef) {\n const { sort } = fieldDef;\n const order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending';\n return [order];\n }\n return [];\n }\n assembleLabelTitle() {\n const { facet, config } = this;\n if (facet.facet) {\n // Facet always uses title to display labels\n return assembleLabelTitle(facet.facet, 'facet', config);\n }\n const ORTHOGONAL_ORIENT = {\n row: ['top', 'bottom'],\n column: ['left', 'right']\n };\n for (const channel of HEADER_CHANNELS) {\n if (facet[channel]) {\n const labelOrient = getHeaderProperty('labelOrient', facet[channel]?.header, config, channel);\n if (ORTHOGONAL_ORIENT[channel].includes(labelOrient)) {\n // Row/Column with orthogonal labelOrient must use title to display labels\n return assembleLabelTitle(facet[channel], channel, config);\n }\n }\n }\n return undefined;\n }\n assembleMarks() {\n const { child } = this;\n // If we facet by two dimensions, we need to add a cross operator to the aggregation\n // so that we create all groups\n const facetRoot = this.component.data.facetRoot;\n const data = assembleFacetData(facetRoot);\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n const title = this.assembleLabelTitle() || child.assembleTitle();\n const style = child.assembleGroupStyle();\n const markGroup = {\n name: this.getName('cell'),\n type: 'group',\n ...(title ? { title } : {}),\n ...(style ? { style } : {}),\n from: {\n facet: this.assembleFacet()\n },\n // TODO: move this to after data\n sort: {\n field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(),\n order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat()\n },\n ...(data.length > 0 ? { data } : {}),\n ...(encodeEntry ? { encode: { update: encodeEntry } } : {}),\n ...child.assembleGroup(assembleFacetSignals(this, []))\n };\n return [markGroup];\n }\n getMapping() {\n return this.facet;\n }\n}\n//# sourceMappingURL=facet.js.map","import { AncestorParse } from '.';\nimport { isGenerator, isGraticuleGenerator, isInlineData, isNamedData, isSequenceGenerator, isUrlData, DataSourceType } from '../../data';\nimport * as log from '../../log';\nimport { isAggregate, isBin, isCalculate, isDensity, isExtent, isFilter, isFlatten, isFold, isImpute, isJoinAggregate, isLoess, isLookup, isPivot, isQuantile, isRegression, isSample, isStack, isTimeUnit, isWindow } from '../../transform';\nimport { deepEqual, mergeDeep } from '../../util';\nimport { isFacetModel, isLayerModel, isUnitModel } from '../model';\nimport { requiresSelectionId } from '../selection';\nimport { materializeSelections } from '../selection/parse';\nimport { AggregateNode } from './aggregate';\nimport { BinNode } from './bin';\nimport { CalculateNode } from './calculate';\nimport { OutputNode } from './dataflow';\nimport { DensityTransformNode } from './density';\nimport { ExtentTransformNode } from './extent';\nimport { FacetNode } from './facet';\nimport { FilterNode } from './filter';\nimport { FilterInvalidNode } from './filterinvalid';\nimport { FlattenTransformNode } from './flatten';\nimport { FoldTransformNode } from './fold';\nimport { getImplicitFromEncoding, getImplicitFromFilterTransform, getImplicitFromSelection, ParseNode } from './formatparse';\nimport { GeoJSONNode } from './geojson';\nimport { GeoPointNode } from './geopoint';\nimport { GraticuleNode } from './graticule';\nimport { IdentifierNode } from './identifier';\nimport { ImputeNode } from './impute';\nimport { JoinAggregateTransformNode } from './joinaggregate';\nimport { makeJoinAggregateFromFacet } from './joinaggregatefacet';\nimport { LoessTransformNode } from './loess';\nimport { LookupNode } from './lookup';\nimport { PivotTransformNode } from './pivot';\nimport { QuantileTransformNode } from './quantile';\nimport { RegressionTransformNode } from './regression';\nimport { SampleTransformNode } from './sample';\nimport { SequenceNode } from './sequence';\nimport { SourceNode } from './source';\nimport { StackNode } from './stack';\nimport { TimeUnitNode } from './timeunit';\nimport { WindowTransformNode } from './window';\nexport function findSource(data, sources) {\n for (const other of sources) {\n const otherData = other.data;\n // if both datasets have a name defined, we cannot merge\n if (data.name && other.hasName() && data.name !== other.dataName) {\n continue;\n }\n const formatMesh = data['format']?.mesh;\n const otherFeature = otherData.format?.feature;\n // feature and mesh are mutually exclusive\n if (formatMesh && otherFeature) {\n continue;\n }\n // we have to extract the same feature or mesh\n const formatFeature = data['format']?.feature;\n if ((formatFeature || otherFeature) && formatFeature !== otherFeature) {\n continue;\n }\n const otherMesh = otherData.format?.mesh;\n if ((formatMesh || otherMesh) && formatMesh !== otherMesh) {\n continue;\n }\n if (isInlineData(data) && isInlineData(otherData)) {\n if (deepEqual(data.values, otherData.values)) {\n return other;\n }\n }\n else if (isUrlData(data) && isUrlData(otherData)) {\n if (data.url === otherData.url) {\n return other;\n }\n }\n else if (isNamedData(data)) {\n if (data.name === other.dataName) {\n return other;\n }\n }\n }\n return null;\n}\nfunction parseRoot(model, sources) {\n if (model.data || !model.parent) {\n // if the model defines a data source or is the root, create a source node\n if (model.data === null) {\n // data: null means we should ignore the parent's data so we just create a new data source\n const source = new SourceNode({ values: [] });\n sources.push(source);\n return source;\n }\n const existingSource = findSource(model.data, sources);\n if (existingSource) {\n if (!isGenerator(model.data)) {\n existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format);\n }\n // if the new source has a name but the existing one does not, we can set it\n if (!existingSource.hasName() && model.data.name) {\n existingSource.dataName = model.data.name;\n }\n return existingSource;\n }\n else {\n const source = new SourceNode(model.data);\n sources.push(source);\n return source;\n }\n }\n else {\n // If we don't have a source defined (overriding parent's data), use the parent's facet root or main.\n return model.parent.component.data.facetRoot\n ? model.parent.component.data.facetRoot\n : model.parent.component.data.main;\n }\n}\n/**\n * Parses a transform array into a chain of connected dataflow nodes.\n */\nexport function parseTransformArray(head, model, ancestorParse) {\n let lookupCounter = 0;\n for (const t of model.transforms) {\n let derivedType = undefined;\n let transformNode;\n if (isCalculate(t)) {\n transformNode = head = new CalculateNode(head, t);\n derivedType = 'derived';\n }\n else if (isFilter(t)) {\n const implicit = getImplicitFromFilterTransform(t);\n transformNode = head = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse) ?? head;\n head = new FilterNode(head, model, t.filter);\n }\n else if (isBin(t)) {\n transformNode = head = BinNode.makeFromTransform(head, t, model);\n derivedType = 'number';\n }\n else if (isTimeUnit(t)) {\n derivedType = 'date';\n const parsedAs = ancestorParse.getWithExplicit(t.field);\n // Create parse node because the input to time unit is always date.\n if (parsedAs.value === undefined) {\n head = new ParseNode(head, { [t.field]: derivedType });\n ancestorParse.set(t.field, derivedType, false);\n }\n transformNode = head = TimeUnitNode.makeFromTransform(head, t);\n }\n else if (isAggregate(t)) {\n transformNode = head = AggregateNode.makeFromTransform(head, t);\n derivedType = 'number';\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n }\n else if (isLookup(t)) {\n transformNode = head = LookupNode.make(head, model, t, lookupCounter++);\n derivedType = 'derived';\n }\n else if (isWindow(t)) {\n transformNode = head = new WindowTransformNode(head, t);\n derivedType = 'number';\n }\n else if (isJoinAggregate(t)) {\n transformNode = head = new JoinAggregateTransformNode(head, t);\n derivedType = 'number';\n }\n else if (isStack(t)) {\n transformNode = head = StackNode.makeFromTransform(head, t);\n derivedType = 'derived';\n }\n else if (isFold(t)) {\n transformNode = head = new FoldTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isExtent(t)) {\n transformNode = head = new ExtentTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isFlatten(t)) {\n transformNode = head = new FlattenTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isPivot(t)) {\n transformNode = head = new PivotTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isSample(t)) {\n head = new SampleTransformNode(head, t);\n }\n else if (isImpute(t)) {\n transformNode = head = ImputeNode.makeFromTransform(head, t);\n derivedType = 'derived';\n }\n else if (isDensity(t)) {\n transformNode = head = new DensityTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isQuantile(t)) {\n transformNode = head = new QuantileTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isRegression(t)) {\n transformNode = head = new RegressionTransformNode(head, t);\n derivedType = 'derived';\n }\n else if (isLoess(t)) {\n transformNode = head = new LoessTransformNode(head, t);\n derivedType = 'derived';\n }\n else {\n log.warn(log.message.invalidTransformIgnored(t));\n continue;\n }\n if (transformNode && derivedType !== undefined) {\n for (const field of transformNode.producedFields() ?? []) {\n ancestorParse.set(field, derivedType, false);\n }\n }\n }\n return head;\n}\n/*\nDescription of the dataflow (http://asciiflow.com/):\n +--------+\n | Source |\n +---+----+\n |\n v\n FormatParse\n (explicit)\n |\n v\n Transforms\n(Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...)\n |\n v\n FormatParse\n (implicit)\n |\n v\n Binning (in `encoding`)\n |\n v\n Timeunit (in `encoding`)\n |\n v\nFormula From Sort Array\n |\n v\n +--+--+\n | Raw |\n +-----+\n |\n v\n Aggregate (in `encoding`)\n |\n v\n Stack (in `encoding`)\n |\n v\n Invalid Filter\n |\n v\n +----------+\n | Main |\n +----------+\n |\n v\n +-------+\n | Facet |----> \"column\", \"column-layout\", and \"row\"\n +-------+\n |\n v\n ...Child data...\n*/\nexport function parseData(model) {\n let head = parseRoot(model, model.component.data.sources);\n const { outputNodes, outputNodeRefCounts } = model.component.data;\n const data = model.data;\n const newData = data && (isGenerator(data) || isUrlData(data) || isInlineData(data));\n const ancestorParse = !newData && model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse();\n if (isGenerator(data)) {\n // insert generator transform\n if (isSequenceGenerator(data)) {\n head = new SequenceNode(head, data.sequence);\n }\n else if (isGraticuleGenerator(data)) {\n head = new GraticuleNode(head, data.graticule);\n }\n // no parsing necessary for generator\n ancestorParse.parseNothing = true;\n }\n else if (data?.format?.parse === null) {\n // format.parse: null means disable parsing\n ancestorParse.parseNothing = true;\n }\n head = ParseNode.makeExplicit(head, model, ancestorParse) ?? head;\n // Default discrete selections require an identifer transform to\n // uniquely identify data points. Add this transform at the head of\n // the pipeline such that the identifier field is available for all\n // subsequent datasets. During optimization, we will remove this\n // transform if it proves to be unnecessary. Additional identifier\n // transforms will be necessary when new tuples are constructed\n // (e.g., post-aggregation).\n head = new IdentifierNode(head);\n // HACK: This is equivalent for merging bin extent for union scale.\n // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale\n const parentIsLayer = model.parent && isLayerModel(model.parent);\n if (isUnitModel(model) || isFacetModel(model)) {\n if (parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n }\n if (model.transforms.length > 0) {\n head = parseTransformArray(head, model, ancestorParse);\n }\n // create parse nodes for fields that need to be parsed (or flattened) implicitly\n const implicitSelection = getImplicitFromSelection(model);\n const implicitEncoding = getImplicitFromEncoding(model);\n head = ParseNode.makeWithAncestors(head, {}, { ...implicitSelection, ...implicitEncoding }, ancestorParse) ?? head;\n if (isUnitModel(model)) {\n head = GeoJSONNode.parseAll(head, model);\n head = GeoPointNode.parseAll(head, model);\n }\n if (isUnitModel(model) || isFacetModel(model)) {\n if (!parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n head = TimeUnitNode.makeFromEncoding(head, model) ?? head;\n head = CalculateNode.parseAllForSortIndex(head, model);\n }\n // add an output node pre aggregation\n const rawName = model.getDataName(DataSourceType.Raw);\n const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts);\n outputNodes[rawName] = raw;\n head = raw;\n if (isUnitModel(model)) {\n const agg = AggregateNode.makeFromEncoding(head, model);\n if (agg) {\n head = agg;\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n }\n head = ImputeNode.makeFromEncoding(head, model) ?? head;\n head = StackNode.makeFromEncoding(head, model) ?? head;\n }\n if (isUnitModel(model)) {\n head = FilterInvalidNode.make(head, model) ?? head;\n }\n // output node for marks\n const mainName = model.getDataName(DataSourceType.Main);\n const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts);\n outputNodes[mainName] = main;\n head = main;\n if (isUnitModel(model)) {\n materializeSelections(model, main);\n }\n // add facet marker\n let facetRoot = null;\n if (isFacetModel(model)) {\n const facetName = model.getName('facet');\n // Derive new aggregate for facet's sort field\n // augment data source with new fields for crossed facet\n head = makeJoinAggregateFromFacet(head, model.facet) ?? head;\n facetRoot = new FacetNode(head, model, facetName, main.getSource());\n outputNodes[facetName] = facetRoot;\n }\n return {\n ...model.component.data,\n outputNodes,\n outputNodeRefCounts,\n raw,\n main,\n facetRoot,\n ancestorParse\n };\n}\n//# sourceMappingURL=parse.js.map","import { vgField } from '../../channeldef';\nimport { DEFAULT_SORT_OP, isSortField } from '../../sort';\nimport { facetSortFieldName } from '../facet';\nimport { JoinAggregateTransformNode } from './joinaggregate';\nexport function makeJoinAggregateFromFacet(parent, facet) {\n const { row, column } = facet;\n if (row && column) {\n let newParent = null;\n // only need to make one for crossed facet\n for (const fieldDef of [row, column]) {\n if (isSortField(fieldDef.sort)) {\n const { field, op = DEFAULT_SORT_OP } = fieldDef.sort;\n parent = newParent = new JoinAggregateTransformNode(parent, {\n joinaggregate: [\n {\n op,\n field,\n as: facetSortFieldName(fieldDef, fieldDef.sort, { forAs: true })\n }\n ],\n groupby: [vgField(fieldDef)]\n });\n }\n }\n return newParent;\n }\n return null;\n}\n//# sourceMappingURL=joinaggregatefacet.js.map","import * as log from '../log';\nimport { isHConcatSpec, isVConcatSpec } from '../spec';\nimport { keys } from '../util';\nimport { buildModel } from './buildmodel';\nimport { parseData } from './data/parse';\nimport { assembleLayoutSignals } from './layoutsize/assemble';\nimport { parseConcatLayoutSize } from './layoutsize/parse';\nimport { Model } from './model';\nexport class ConcatModel extends Model {\n constructor(spec, parent, parentGivenName, config) {\n super(spec, 'concat', parent, parentGivenName, config, spec.resolve);\n if (spec.resolve?.axis?.x === 'shared' || spec.resolve?.axis?.y === 'shared') {\n log.warn(log.message.CONCAT_CANNOT_SHARE_AXIS);\n }\n this.children = this.getChildren(spec).map((child, i) => {\n return buildModel(child, this, this.getName(`concat_${i}`), undefined, config);\n });\n }\n parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n parseAxesAndHeaders() {\n for (const child of this.children) {\n child.parseAxesAndHeaders();\n }\n // TODO(#2415): support shared axes\n }\n getChildren(spec) {\n if (isVConcatSpec(spec)) {\n return spec.vconcat;\n }\n else if (isHConcatSpec(spec)) {\n return spec.hconcat;\n }\n return spec.concat;\n }\n parseLayoutSize() {\n parseConcatLayoutSize(this);\n }\n parseAxisGroup() {\n return null;\n }\n assembleSelectionTopLevelSignals(signals) {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n assembleSignals() {\n this.children.forEach(child => child.assembleSignals());\n return [];\n }\n assembleLayoutSignals() {\n const layoutSignals = assembleLayoutSignals(this);\n for (const child of this.children) {\n layoutSignals.push(...child.assembleLayoutSignals());\n }\n return layoutSignals;\n }\n assembleSelectionData(data) {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n assembleMarks() {\n // only children have marks\n return this.children.map(child => {\n const title = child.assembleTitle();\n const style = child.assembleGroupStyle();\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n return {\n type: 'group',\n name: child.getName('group'),\n ...(title ? { title } : {}),\n ...(style ? { style } : {}),\n ...(encodeEntry ? { encode: { update: encodeEntry } } : {}),\n ...child.assembleGroup()\n };\n });\n }\n assembleGroupStyle() {\n return undefined;\n }\n assembleDefaultLayout() {\n const columns = this.layout.columns;\n return {\n ...(columns != null ? { columns } : {}),\n bounds: 'full',\n // Use align each so it can work with multiple plots with different size\n align: 'each'\n };\n }\n}\n//# sourceMappingURL=concat.js.map","import { COMMON_AXIS_PROPERTIES_INDEX } from '../../axis';\nimport { duplicate, keys } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { Split } from '../split';\nfunction isFalseOrNull(v) {\n return v === false || v === null;\n}\nconst AXIS_COMPONENT_PROPERTIES_INDEX = {\n disable: 1,\n gridScale: 1,\n scale: 1,\n ...COMMON_AXIS_PROPERTIES_INDEX,\n labelExpr: 1,\n encode: 1\n};\nexport const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX);\nexport class AxisComponent extends Split {\n constructor(explicit = {}, implicit = {}, mainExtracted = false) {\n super();\n this.explicit = explicit;\n this.implicit = implicit;\n this.mainExtracted = mainExtracted;\n }\n clone() {\n return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted);\n }\n hasAxisPart(part) {\n // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme.\n if (part === 'axis') {\n // always has the axis container part\n return true;\n }\n if (part === 'grid' || part === 'title') {\n return !!this.get(part);\n }\n // Other parts are enabled by default, so they should not be false or null.\n return !isFalseOrNull(this.get(part));\n }\n hasOrientSignalRef() {\n return isSignalRef(this.explicit.orient);\n }\n}\n//# sourceMappingURL=component.js.map","import { AXIS_PARTS, isAxisProperty, isConditionalAxisValue } from '../../axis';\nimport { POSITION_SCALE_CHANNELS } from '../../channel';\nimport { getFieldOrDatumDef } from '../../channeldef';\nimport { getFirstDefined, isEmpty, keys, normalizeAngle } from '../../util';\nimport { isSignalRef } from '../../vega.schema';\nimport { mergeTitleComponent } from '../common';\nimport { guideEncodeEntry } from '../guide';\nimport { parseGuideResolve } from '../resolve';\nimport { defaultTieBreaker, mergeValuesWithExplicit } from '../split';\nimport { AxisComponent, AXIS_COMPONENT_PROPERTIES } from './component';\nimport { getAxisConfig, getAxisConfigs } from './config';\nimport * as encode from './encode';\nimport { axisRules, defaultOrient, getFieldDefTitle, getLabelAngle } from './properties';\nimport { guideFormat, guideFormatType } from '../format';\nexport function parseUnitAxes(model) {\n return POSITION_SCALE_CHANNELS.reduce((axis, channel) => {\n if (model.component.scales[channel]) {\n axis[channel] = [parseAxis(channel, model)];\n }\n return axis;\n }, {});\n}\nconst OPPOSITE_ORIENT = {\n bottom: 'top',\n top: 'bottom',\n left: 'right',\n right: 'left'\n};\nexport function parseLayerAxes(model) {\n const { axes, resolve } = model.component;\n const axisCount = { top: 0, bottom: 0, right: 0, left: 0 };\n for (const child of model.children) {\n child.parseAxesAndHeaders();\n for (const channel of keys(child.component.axes)) {\n resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel);\n if (resolve.axis[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]);\n if (!axes[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the axis shared.\n // Thus, mark axis as independent and remove the axis component.\n resolve.axis[channel] = 'independent';\n delete axes[channel];\n }\n }\n }\n }\n // Move axes to layer's axis component and merge shared axes\n for (const channel of POSITION_SCALE_CHANNELS) {\n for (const child of model.children) {\n if (!child.component.axes[channel]) {\n // skip if the child does not have a particular axis\n continue;\n }\n if (resolve.axis[channel] === 'independent') {\n // If axes are independent, concat the axisComponent array.\n axes[channel] = (axes[channel] ?? []).concat(child.component.axes[channel]);\n // Automatically adjust orient\n for (const axisComponent of child.component.axes[channel]) {\n const { value: orient, explicit } = axisComponent.getWithExplicit('orient');\n if (isSignalRef(orient)) {\n continue;\n }\n if (axisCount[orient] > 0 && !explicit) {\n // Change axis orient if the number do not match\n const oppositeOrient = OPPOSITE_ORIENT[orient];\n if (axisCount[orient] > axisCount[oppositeOrient]) {\n axisComponent.set('orient', oppositeOrient, false);\n }\n }\n axisCount[orient]++;\n // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset?\n }\n }\n // After merging, make sure to remove axes from child\n delete child.component.axes[channel];\n }\n // Show gridlines for first axis only for dual-axis chart\n if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) {\n for (const [index, axisCmpt] of (axes[channel] || []).entries()) {\n if (index > 0 && !!axisCmpt.get('grid') && !axisCmpt.explicit.grid) {\n axisCmpt.implicit.grid = false;\n }\n }\n }\n }\n}\nfunction mergeAxisComponents(mergedAxisCmpts, childAxisCmpts) {\n if (mergedAxisCmpts) {\n // FIXME: this is a bit wrong once we support multiple axes\n if (mergedAxisCmpts.length !== childAxisCmpts.length) {\n return undefined; // Cannot merge axis component with different number of axes.\n }\n const length = mergedAxisCmpts.length;\n for (let i = 0; i < length; i++) {\n const merged = mergedAxisCmpts[i];\n const child = childAxisCmpts[i];\n if (!!merged !== !!child) {\n return undefined;\n }\n else if (merged && child) {\n const mergedOrient = merged.getWithExplicit('orient');\n const childOrient = child.getWithExplicit('orient');\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n // Cannot merge due to inconsistent orient\n return undefined;\n }\n else {\n mergedAxisCmpts[i] = mergeAxisComponent(merged, child);\n }\n }\n }\n }\n else {\n // For first one, return a copy of the child\n return childAxisCmpts.map(axisComponent => axisComponent.clone());\n }\n return mergedAxisCmpts;\n}\nfunction mergeAxisComponent(merged, child) {\n for (const prop of AXIS_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(merged.getWithExplicit(prop), child.getWithExplicit(prop), prop, 'axis', \n // Tie breaker function\n (v1, v2) => {\n switch (prop) {\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'gridScale':\n return {\n explicit: v1.explicit,\n value: getFirstDefined(v1.value, v2.value)\n };\n }\n return defaultTieBreaker(v1, v2, prop, 'axis');\n });\n merged.setWithExplicit(prop, mergedValueWithExplicit);\n }\n return merged;\n}\nfunction isExplicit(value, property, axis, model, channel) {\n if (property === 'disable') {\n return axis !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit\n }\n axis = axis || {};\n switch (property) {\n case 'titleAngle':\n case 'labelAngle':\n return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle));\n case 'values':\n return !!axis.values;\n // specified axis.values is already respected, but may get transformed.\n case 'encode':\n // both VL axis.encoding and axis.labelAngle affect VG axis.encode\n return !!axis.encoding || !!axis.labelAngle;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (value === getFieldDefTitle(model, channel)) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === axis[property];\n}\n/**\n * Properties to always include values from config\n */\nconst propsToAlwaysIncludeConfig = new Set([\n 'grid',\n 'translate',\n // the rest are not axis configs in Vega, but are in VL, so we need to set too.\n 'format',\n 'formatType',\n 'orient',\n 'labelExpr',\n 'tickCount',\n 'position',\n 'tickMinStep'\n]);\nfunction parseAxis(channel, model) {\n let axis = model.axis(channel);\n const axisComponent = new AxisComponent();\n const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]);\n const { mark, config } = model;\n const orient = axis?.orient ||\n config[channel === 'x' ? 'axisX' : 'axisY']?.orient ||\n config.axis?.orient ||\n defaultOrient(channel);\n const scaleType = model.getScaleComponent(channel).get('type');\n const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config);\n const disable = axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis?.style, axisConfigs).configValue;\n axisComponent.set('disable', disable, axis !== undefined);\n if (disable) {\n return axisComponent;\n }\n axis = axis || {};\n const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs);\n const formatType = guideFormatType(axis.formatType, fieldOrDatumDef, scaleType);\n const format = guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, axis.format, axis.formatType, config, true);\n const ruleParams = {\n fieldOrDatumDef,\n axis,\n channel,\n model,\n scaleType,\n orient,\n labelAngle,\n format,\n formatType,\n mark,\n config\n };\n // 1.2. Add properties\n for (const property of AXIS_COMPONENT_PROPERTIES) {\n const value = property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined;\n const hasValue = value !== undefined;\n const explicit = isExplicit(value, property, axis, model, channel);\n if (hasValue && explicit) {\n axisComponent.set(property, value, explicit);\n }\n else {\n const { configValue = undefined, configFrom = undefined } = isAxisProperty(property) && property !== 'values'\n ? getAxisConfig(property, config.style, axis.style, axisConfigs)\n : {};\n const hasConfigValue = configValue !== undefined;\n if (hasValue && !hasConfigValue) {\n // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config)\n axisComponent.set(property, value, explicit);\n }\n else if (\n // Cases need implicit values\n // 1. Axis config that aren't available in Vega\n !(configFrom === 'vgAxisConfig') ||\n // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details)\n (propsToAlwaysIncludeConfig.has(property) && hasConfigValue) ||\n // 3. Conditional axis values and signals\n isConditionalAxisValue(configValue) ||\n isSignalRef(configValue)) {\n // If a config is specified and is conditional, copy conditional value from axis config\n axisComponent.set(property, configValue, false);\n }\n }\n }\n // 2) Add guide encode definition groups\n const axisEncoding = axis.encoding ?? {};\n const axisEncode = AXIS_PARTS.reduce((e, part) => {\n if (!axisComponent.hasAxisPart(part)) {\n // No need to create encode for a disabled part.\n return e;\n }\n const axisEncodingPart = guideEncodeEntry(axisEncoding[part] ?? {}, model);\n const value = part === 'labels' ? encode.labels(model, channel, axisEncodingPart) : axisEncodingPart;\n if (value !== undefined && !isEmpty(value)) {\n e[part] = { update: value };\n }\n return e;\n }, {});\n // FIXME: By having encode as one property, we won't have fine grained encode merging.\n if (!isEmpty(axisEncode)) {\n axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined);\n }\n return axisComponent;\n}\n//# sourceMappingURL=parse.js.map","import { getSecondaryRangeChannel } from '../../channel';\nimport { channelDefType, getFieldOrDatumDef, isFieldDef, isPositionFieldOrDatumDef } from '../../channeldef';\nimport { formatCustomType, isCustomFormatType } from '../format';\nexport function labels(model, channel, specifiedLabelsSpec) {\n const { encoding, config } = model;\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) ?? getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]);\n const axis = model.axis(channel) || {};\n const { format, formatType } = axis;\n if (isCustomFormatType(formatType)) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (channelDefType(fieldOrDatumDef) === 'quantitative') {\n if (isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize' &&\n config.normalizedNumberFormatType) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.normalizedNumberFormat,\n formatType: config.normalizedNumberFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n else if (config.numberFormatType) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.numberFormat,\n formatType: config.numberFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n }\n if (channelDefType(fieldOrDatumDef) === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n !fieldOrDatumDef.timeUnit) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.timeFormat,\n formatType: config.timeFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n }\n return specifiedLabelsSpec;\n}\n//# sourceMappingURL=encode.js.map","import * as encode from './encode';\nfunction encodeEntry(model, fixedShape) {\n const { config } = model;\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid' }),\n ...encode.nonPosition('size', model),\n ...encode.nonPosition('angle', model),\n ...shapeMixins(model, config, fixedShape)\n };\n}\nexport function shapeMixins(model, config, fixedShape) {\n if (fixedShape) {\n return { shape: { value: fixedShape } };\n }\n return encode.nonPosition('shape', model);\n}\nexport const point = {\n vgMark: 'symbol',\n encodeEntry: (model) => {\n return encodeEntry(model);\n }\n};\nexport const circle = {\n vgMark: 'symbol',\n encodeEntry: (model) => {\n return encodeEntry(model, 'circle');\n }\n};\nexport const square = {\n vgMark: 'symbol',\n encodeEntry: (model) => {\n return encodeEntry(model, 'square');\n }\n};\n//# sourceMappingURL=point.js.map","import { getMarkPropOrConfig } from '../common';\nimport * as encode from './encode';\nexport const text = {\n vgMark: 'text',\n encodeEntry: (model) => {\n const { config, encoding } = model;\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'include',\n baseline: 'include',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'include'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid' }),\n ...encode.text(model),\n ...encode.nonPosition('size', model, {\n vgChannel: 'fontSize' // VL's text size is fontSize\n }),\n ...encode.nonPosition('angle', model),\n ...encode.valueIfDefined('align', align(model.markDef, encoding, config)),\n ...encode.valueIfDefined('baseline', baseline(model.markDef, encoding, config)),\n ...encode.pointPosition('radius', model, { defaultPos: null }),\n ...encode.pointPosition('theta', model, { defaultPos: null })\n };\n }\n};\nfunction align(markDef, encoding, config) {\n const a = getMarkPropOrConfig('align', markDef, config);\n if (a === undefined) {\n return 'center';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\nfunction baseline(markDef, encoding, config) {\n const b = getMarkPropOrConfig('baseline', markDef, config);\n if (b === undefined) {\n return 'middle';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\n//# sourceMappingURL=text.js.map","import { isNumber } from 'vega-util';\nimport { getViewConfigDiscreteStep } from '../../config';\nimport { isVgRangeStep } from '../../vega.schema';\nimport { getMarkPropOrConfig, signalOrValueRef } from '../common';\nimport * as encode from './encode';\nexport const tick = {\n vgMark: 'rect',\n encodeEntry: (model) => {\n const { config, markDef } = model;\n const orient = markDef.orient;\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width';\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid', vgChannel: 'xc' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid', vgChannel: 'yc' }),\n // size / thickness => width / height\n ...encode.nonPosition('size', model, {\n defaultValue: defaultSize(model),\n vgChannel: vgSizeChannel\n }),\n [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config))\n };\n }\n};\nfunction defaultSize(model) {\n const { config, markDef } = model;\n const { orient } = markDef;\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y');\n const markPropOrConfig = getMarkPropOrConfig('size', markDef, config, { vgChannel: vgSizeChannel }) ?? config.tick.bandSize;\n if (markPropOrConfig !== undefined) {\n return markPropOrConfig;\n }\n else {\n const scaleRange = scale ? scale.get('range') : undefined;\n if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return (scaleRange.step * 3) / 4;\n }\n const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel);\n return (defaultViewStep * 3) / 4;\n }\n}\n//# sourceMappingURL=tick.js.map","import { isArray } from 'vega-util';\nimport { isFieldDef, isValueDef, vgField } from '../../channeldef';\nimport { DataSourceType } from '../../data';\nimport { isAggregate, pathGroupingFields } from '../../encoding';\nimport { AREA, BAR, isPathMark, LINE, TRAIL } from '../../mark';\nimport { isSortByEncoding, isSortField } from '../../sort';\nimport { contains, getFirstDefined, isNullOrFalse, keys, omit, pick } from '../../util';\nimport { VG_CORNERRADIUS_CHANNELS } from '../../vega.schema';\nimport { getMarkConfig, getMarkPropOrConfig, getStyles, signalOrValueRef, sortParams } from '../common';\nimport { arc } from './arc';\nimport { area } from './area';\nimport { bar } from './bar';\nimport { geoshape } from './geoshape';\nimport { image } from './image';\nimport { line, trail } from './line';\nimport { circle, point, square } from './point';\nimport { rect } from './rect';\nimport { rule } from './rule';\nimport { text } from './text';\nimport { tick } from './tick';\nconst markCompiler = {\n arc,\n area,\n bar,\n circle,\n geoshape,\n image,\n line,\n point,\n rect,\n rule,\n square,\n text,\n tick,\n trail\n};\nexport function parseMarkGroups(model) {\n if (contains([LINE, AREA, TRAIL], model.mark)) {\n const details = pathGroupingFields(model.mark, model.encoding);\n if (details.length > 0) {\n return getPathGroups(model, details);\n }\n // otherwise use standard mark groups\n }\n else if (model.mark === BAR) {\n const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop => getMarkPropOrConfig(prop, model.markDef, model.config));\n if (model.stack && !model.fieldDef('size') && hasCornerRadius) {\n return getGroupsForStackedBarWithCornerRadius(model);\n }\n }\n return getMarkGroup(model);\n}\nconst FACETED_PATH_PREFIX = 'faceted_path_';\nfunction getPathGroups(model, details) {\n // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?)\n return [\n {\n name: model.getName('pathgroup'),\n type: 'group',\n from: {\n facet: {\n name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main),\n data: model.requestDataName(DataSourceType.Main),\n groupby: details\n }\n },\n encode: {\n update: {\n width: { field: { group: 'width' } },\n height: { field: { group: 'height' } }\n }\n },\n // With subfacet for line/area group, need to use faceted data from above.\n marks: getMarkGroup(model, { fromPrefix: FACETED_PATH_PREFIX })\n }\n ];\n}\nconst STACK_GROUP_PREFIX = 'stack_group_';\n/**\n * We need to put stacked bars into groups in order to enable cornerRadius for stacks.\n * If stack is used and the model doesn't have size encoding, we put the mark into groups,\n * and apply cornerRadius properties at the group.\n */\nfunction getGroupsForStackedBarWithCornerRadius(model) {\n // Generate the mark\n const [mark] = getMarkGroup(model, { fromPrefix: STACK_GROUP_PREFIX });\n // Get the scale for the stacked field\n const fieldScale = model.scaleName(model.stack.fieldChannel);\n const stackField = (opt = {}) => model.vgField(model.stack.fieldChannel, opt);\n // Find the min/max of the pixel value on the stacked direction\n const stackFieldGroup = (func, expr) => {\n const vgFieldMinMax = [\n stackField({ prefix: 'min', suffix: 'start', expr }),\n stackField({ prefix: 'max', suffix: 'start', expr }),\n stackField({ prefix: 'min', suffix: 'end', expr }),\n stackField({ prefix: 'max', suffix: 'end', expr })\n ];\n return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`;\n };\n let groupUpdate;\n let innerGroupUpdate;\n // Build the encoding for group and an inner group\n if (model.stack.fieldChannel === 'x') {\n // Move cornerRadius, y/yc/y2/height properties to group\n // Group x/x2 should be the min/max of the marks within\n groupUpdate = {\n ...pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS]),\n x: { signal: stackFieldGroup('min', 'datum') },\n x2: { signal: stackFieldGroup('max', 'datum') },\n clip: { value: true }\n };\n // Inner group should revert the x translation, and pass height through\n innerGroupUpdate = {\n x: { field: { group: 'x' }, mult: -1 },\n height: { field: { group: 'height' } }\n };\n // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group)\n // This is why size encoding is not supported yet\n mark.encode.update = {\n ...omit(mark.encode.update, ['y', 'yc', 'y2']),\n height: { field: { group: 'height' } }\n };\n }\n else {\n groupUpdate = {\n ...pick(mark.encode.update, ['x', 'xc', 'x2', 'width']),\n y: { signal: stackFieldGroup('min', 'datum') },\n y2: { signal: stackFieldGroup('max', 'datum') },\n clip: { value: true }\n };\n innerGroupUpdate = {\n y: { field: { group: 'y' }, mult: -1 },\n width: { field: { group: 'width' } }\n };\n mark.encode.update = {\n ...omit(mark.encode.update, ['x', 'xc', 'x2']),\n width: { field: { group: 'width' } }\n };\n }\n // Deal with cornerRadius properties\n for (const key of VG_CORNERRADIUS_CHANNELS) {\n const configValue = getMarkConfig(key, model.markDef, model.config);\n // Move from mark to group\n if (mark.encode.update[key]) {\n groupUpdate[key] = mark.encode.update[key];\n delete mark.encode.update[key];\n }\n else if (configValue) {\n groupUpdate[key] = signalOrValueRef(configValue);\n }\n // Overwrite any cornerRadius on mark set by config --- they are already moved to the group\n if (configValue) {\n mark.encode.update[key] = { value: 0 };\n }\n }\n const groupby = [];\n if (model.stack.groupbyChannels?.length > 0) {\n for (const groupbyChannel of model.stack.groupbyChannels) {\n // For bin and time unit, we have to add bin/timeunit -end channels.\n const groupByField = model.fieldDef(groupbyChannel);\n const field = vgField(groupByField);\n if (field) {\n groupby.push(field);\n }\n if (groupByField?.bin || groupByField?.timeUnit) {\n groupby.push(vgField(groupByField, { binSuffix: 'end' }));\n }\n }\n }\n const strokeProperties = [\n 'stroke',\n 'strokeWidth',\n 'strokeJoin',\n 'strokeCap',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeMiterLimit',\n 'strokeOpacity'\n ];\n // Generate stroke properties for the group\n groupUpdate = strokeProperties.reduce((encode, prop) => {\n if (mark.encode.update[prop]) {\n return { ...encode, [prop]: mark.encode.update[prop] };\n }\n else {\n const configValue = getMarkConfig(prop, model.markDef, model.config);\n if (configValue !== undefined) {\n return { ...encode, [prop]: signalOrValueRef(configValue) };\n }\n else {\n return encode;\n }\n }\n }, groupUpdate);\n // Apply strokeForeground and strokeOffset if stroke is used\n if (groupUpdate.stroke) {\n groupUpdate.strokeForeground = { value: true };\n groupUpdate.strokeOffset = { value: 0 };\n }\n return [\n {\n type: 'group',\n from: {\n facet: {\n data: model.requestDataName(DataSourceType.Main),\n name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main),\n groupby,\n aggregate: {\n fields: [\n stackField({ suffix: 'start' }),\n stackField({ suffix: 'start' }),\n stackField({ suffix: 'end' }),\n stackField({ suffix: 'end' })\n ],\n ops: ['min', 'max', 'min', 'max']\n }\n }\n },\n encode: {\n update: groupUpdate\n },\n marks: [\n {\n type: 'group',\n encode: { update: innerGroupUpdate },\n marks: [mark]\n }\n ]\n }\n ];\n}\nexport function getSort(model) {\n const { encoding, stack, mark, markDef, config } = model;\n const order = encoding.order;\n if ((!isArray(order) && isValueDef(order) && isNullOrFalse(order.value)) ||\n (!order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config)))) {\n return undefined;\n }\n else if ((isArray(order) || isFieldDef(order)) && !stack) {\n // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.)\n return sortParams(order, { expr: 'datum' });\n }\n else if (isPathMark(mark)) {\n // For both line and area, we sort values based on dimension by default\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (isFieldDef(dimensionChannelDef)) {\n const s = dimensionChannelDef.sort;\n if (isArray(s)) {\n return {\n field: vgField(dimensionChannelDef, { prefix: dimensionChannel, suffix: 'sort_index', expr: 'datum' })\n };\n }\n else if (isSortField(s)) {\n return {\n field: vgField({\n // FIXME: this op might not already exist?\n // FIXME: what if dimensionChannel (x or y) contains custom domain?\n aggregate: isAggregate(model.encoding) ? s.op : undefined,\n field: s.field\n }, { expr: 'datum' })\n };\n }\n else if (isSortByEncoding(s)) {\n const fieldDefToSort = model.fieldDef(s.encoding);\n return {\n field: vgField(fieldDefToSort, { expr: 'datum' }),\n order: s.order\n };\n }\n else if (s === null) {\n return undefined;\n }\n else {\n return {\n field: vgField(dimensionChannelDef, {\n // For stack with imputation, we only have bin_mid\n binSuffix: model.stack?.impute ? 'mid' : undefined,\n expr: 'datum'\n })\n };\n }\n }\n return undefined;\n }\n return undefined;\n}\nfunction getMarkGroup(model, opt = { fromPrefix: '' }) {\n const { mark, markDef, encoding, config } = model;\n const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model));\n const style = getStyles(markDef);\n const key = encoding.key;\n const sort = getSort(model);\n const interactive = interactiveFlag(model);\n const aria = getMarkPropOrConfig('aria', markDef, config);\n const postEncodingTransform = markCompiler[mark].postEncodingTransform\n ? markCompiler[mark].postEncodingTransform(model)\n : null;\n return [\n {\n name: model.getName('marks'),\n type: markCompiler[mark].vgMark,\n ...(clip ? { clip: true } : {}),\n ...(style ? { style } : {}),\n ...(key ? { key: key.field } : {}),\n ...(sort ? { sort } : {}),\n ...(interactive ? interactive : {}),\n ...(aria === false ? { aria } : {}),\n from: { data: opt.fromPrefix + model.requestDataName(DataSourceType.Main) },\n encode: {\n update: markCompiler[mark].encodeEntry(model)\n },\n ...(postEncodingTransform\n ? {\n transform: postEncodingTransform\n }\n : {})\n }\n ];\n}\n/**\n * If scales are bound to interval selections, we want to automatically clip\n * marks to account for panning/zooming interactions. We identify bound scales\n * by the selectionExtent property, which gets added during scale parsing.\n */\nfunction scaleClip(model) {\n const xScale = model.getScaleComponent('x');\n const yScale = model.getScaleComponent('y');\n return xScale?.get('selectionExtent') || yScale?.get('selectionExtent') ? true : undefined;\n}\n/**\n * If we use a custom projection with auto-fitting to the geodata extent,\n * we need to clip to ensure the chart size doesn't explode.\n */\nfunction projectionClip(model) {\n const projection = model.component.projection;\n return projection && !projection.isFit ? true : undefined;\n}\n/**\n * Only output interactive flags if we have selections defined somewhere in our model hierarchy.\n */\nfunction interactiveFlag(model) {\n if (!model.component.selection)\n return null;\n const unitCount = keys(model.component.selection).length;\n let parentCount = unitCount;\n let parent = model.parent;\n while (parent && parentCount === 0) {\n parentCount = keys(parent.component.selection).length;\n parent = parent.parent;\n }\n return parentCount\n ? {\n interactive: unitCount > 0 || model.mark === 'geoshape' || !!model.encoding.tooltip\n }\n : null;\n}\n//# sourceMappingURL=mark.js.map","import * as encode from './encode';\nexport const arc = {\n vgMark: 'arc',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid' }),\n // arcs are rectangles in polar coordinates\n ...encode.rectPosition(model, 'radius'),\n ...encode.rectPosition(model, 'theta')\n };\n }\n};\n//# sourceMappingURL=arc.js.map","import * as encode from './encode';\nexport const area = {\n vgMark: 'area',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'include',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'horizontal'\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'vertical'\n }),\n ...encode.defined(model)\n };\n }\n};\n//# sourceMappingURL=area.js.map","import * as encode from './encode';\nexport const bar = {\n vgMark: 'rect',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y')\n };\n }\n};\n//# sourceMappingURL=bar.js.map","import { isFieldDef, vgField } from '../../channeldef';\nimport { GEOJSON } from '../../type';\nimport * as encode from './encode';\nexport const geoshape = {\n vgMark: 'shape',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n })\n };\n },\n postEncodingTransform: (model) => {\n const { encoding } = model;\n const shapeDef = encoding.shape;\n const transform = {\n type: 'geoshape',\n projection: model.projectionName(),\n // as: 'shape',\n ...(shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON\n ? { field: vgField(shapeDef, { expr: 'datum' }) }\n : {})\n };\n return [transform];\n }\n};\n//# sourceMappingURL=geoshape.js.map","import * as encode from './encode';\nexport const image = {\n vgMark: 'image',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'ignore',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y'),\n ...encode.text(model, 'url')\n };\n }\n};\n//# sourceMappingURL=image.js.map","import * as encode from './encode';\nexport const line = {\n vgMark: 'line',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid' }),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's line size is strokeWidth\n }),\n ...encode.defined(model)\n };\n }\n};\nexport const trail = {\n vgMark: 'trail',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, { defaultPos: 'mid' }),\n ...encode.pointPosition('y', model, { defaultPos: 'mid' }),\n ...encode.nonPosition('size', model),\n ...encode.defined(model)\n };\n }\n};\n//# sourceMappingURL=line.js.map","import * as encode from './encode';\nexport const rect = {\n vgMark: 'rect',\n encodeEntry: (model) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y')\n };\n }\n};\n//# sourceMappingURL=rect.js.map","import * as encode from './encode';\nexport const rule = {\n vgMark: 'rule',\n encodeEntry: (model) => {\n const { markDef } = model;\n const orient = markDef.orient;\n if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) {\n // Show nothing if we have none of x, y, lat, and long.\n return {};\n }\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'vertical' // include x2 for horizontal or line segment rule\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'horizontal' // include y2 for vertical or line segment rule\n }),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's rule size is strokeWidth\n })\n };\n }\n};\n//# sourceMappingURL=rule.js.map","import { isArray } from 'vega-util';\nimport { isConditionalAxisValue } from '../axis';\nimport { GEOPOSITION_CHANNELS, NONPOSITION_SCALE_CHANNELS, POSITION_SCALE_CHANNELS, SCALE_CHANNELS, supportLegend, X, Y } from '../channel';\nimport { getFieldDef, getFieldOrDatumDef, isFieldOrDatumDef, isTypedFieldDef } from '../channeldef';\nimport { isGraticuleGenerator } from '../data';\nimport * as vlEncoding from '../encoding';\nimport { initEncoding } from '../encoding';\nimport { replaceExprRef } from '../expr';\nimport { GEOSHAPE, isMarkDef } from '../mark';\nimport { isSelectionParameter } from '../selection';\nimport { isFrameMixins } from '../spec/base';\nimport { stack } from '../stack';\nimport { keys } from '../util';\nimport { assembleAxisSignals } from './axis/assemble';\nimport { parseUnitAxes } from './axis/parse';\nimport { signalOrValueRefWithCondition, signalRefOrValue } from './common';\nimport { parseData } from './data/parse';\nimport { assembleLayoutSignals } from './layoutsize/assemble';\nimport { initLayoutSize } from './layoutsize/init';\nimport { parseUnitLayoutSize } from './layoutsize/parse';\nimport { defaultFilled, initMarkdef } from './mark/init';\nimport { parseMarkGroups } from './mark/mark';\nimport { isLayerModel, ModelWithField } from './model';\nimport { assembleTopLevelSignals, assembleUnitSelectionData, assembleUnitSelectionMarks, assembleUnitSelectionSignals } from './selection/assemble';\nimport { parseUnitSelection } from './selection/parse';\n/**\n * Internal model of Vega-Lite specification for the compiler.\n */\nexport class UnitModel extends ModelWithField {\n constructor(spec, parent, parentGivenName, parentGivenSize = {}, config) {\n super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined);\n this.specifiedScales = {};\n this.specifiedAxes = {};\n this.specifiedLegends = {};\n this.specifiedProjection = {};\n this.selection = [];\n this.children = [];\n const markDef = isMarkDef(spec.mark) ? { ...spec.mark } : { type: spec.mark };\n const mark = markDef.type;\n // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding\n if (markDef.filled === undefined) {\n markDef.filled = defaultFilled(markDef, config, {\n graticule: spec.data && isGraticuleGenerator(spec.data)\n });\n }\n const encoding = (this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config));\n this.markDef = initMarkdef(markDef, encoding, config);\n this.size = initLayoutSize({\n encoding,\n size: isFrameMixins(spec)\n ? {\n ...parentGivenSize,\n ...(spec.width ? { width: spec.width } : {}),\n ...(spec.height ? { height: spec.height } : {})\n }\n : parentGivenSize\n });\n // calculate stack properties\n this.stack = stack(this.markDef, encoding);\n this.specifiedScales = this.initScales(mark, encoding);\n this.specifiedAxes = this.initAxes(encoding);\n this.specifiedLegends = this.initLegends(encoding);\n this.specifiedProjection = spec.projection;\n // Selections will be initialized upon parse.\n this.selection = (spec.params ?? []).filter(p => isSelectionParameter(p));\n }\n get hasProjection() {\n const { encoding } = this;\n const isGeoShapeMark = this.mark === GEOSHAPE;\n const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel]));\n return isGeoShapeMark || hasGeoPosition;\n }\n /**\n * Return specified Vega-Lite scale domain for a particular channel\n * @param channel\n */\n scaleDomain(channel) {\n const scale = this.specifiedScales[channel];\n return scale ? scale.domain : undefined;\n }\n axis(channel) {\n return this.specifiedAxes[channel];\n }\n legend(channel) {\n return this.specifiedLegends[channel];\n }\n initScales(mark, encoding) {\n return SCALE_CHANNELS.reduce((scales, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]);\n if (fieldOrDatumDef) {\n scales[channel] = this.initScale(fieldOrDatumDef.scale ?? {});\n }\n return scales;\n }, {});\n }\n initScale(scale) {\n const { domain, range } = scale;\n // TODO: we could simplify this function if we had a recursive replace function\n const scaleInternal = replaceExprRef(scale);\n if (isArray(domain)) {\n scaleInternal.domain = domain.map(signalRefOrValue);\n }\n if (isArray(range)) {\n scaleInternal.range = range.map(signalRefOrValue);\n }\n return scaleInternal;\n }\n initAxes(encoding) {\n return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => {\n // Position Axis\n // TODO: handle ConditionFieldDef\n const channelDef = encoding[channel];\n if (isFieldOrDatumDef(channelDef) ||\n (channel === X && isFieldOrDatumDef(encoding.x2)) ||\n (channel === Y && isFieldOrDatumDef(encoding.y2))) {\n const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined;\n _axis[channel] = axisSpec\n ? this.initAxis({ ...axisSpec }) // convert truthy value to object\n : axisSpec;\n }\n return _axis;\n }, {});\n }\n initAxis(axis) {\n const props = keys(axis);\n const axisInternal = {};\n for (const prop of props) {\n const val = axis[prop];\n axisInternal[prop] = isConditionalAxisValue(val)\n ? signalOrValueRefWithCondition(val)\n : signalRefOrValue(val);\n }\n return axisInternal;\n }\n initLegends(encoding) {\n return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]);\n if (fieldOrDatumDef && supportLegend(channel)) {\n const legend = fieldOrDatumDef.legend;\n _legend[channel] = legend\n ? replaceExprRef(legend) // convert truthy value to object\n : legend;\n }\n return _legend;\n }, {});\n }\n parseData() {\n this.component.data = parseData(this);\n }\n parseLayoutSize() {\n parseUnitLayoutSize(this);\n }\n parseSelections() {\n this.component.selection = parseUnitSelection(this, this.selection);\n }\n parseMarkGroup() {\n this.component.mark = parseMarkGroups(this);\n }\n parseAxesAndHeaders() {\n this.component.axes = parseUnitAxes(this);\n }\n assembleSelectionTopLevelSignals(signals) {\n return assembleTopLevelSignals(this, signals);\n }\n assembleSignals() {\n return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])];\n }\n assembleSelectionData(data) {\n return assembleUnitSelectionData(this, data);\n }\n assembleLayout() {\n return null;\n }\n assembleLayoutSignals() {\n return assembleLayoutSignals(this);\n }\n assembleMarks() {\n let marks = this.component.mark ?? [];\n // If this unit is part of a layer, selections should augment\n // all in concert rather than each unit individually. This\n // ensures correct interleaving of clipping and brushed marks.\n if (!this.parent || !isLayerModel(this.parent)) {\n marks = assembleUnitSelectionMarks(this, marks);\n }\n return marks.map(this.correctDataNames);\n }\n assembleGroupStyle() {\n const { style } = this.view || {};\n if (style !== undefined) {\n return style;\n }\n if (this.encoding.x || this.encoding.y) {\n return 'cell';\n }\n else {\n return 'view';\n }\n }\n getMapping() {\n return this.encoding;\n }\n get mark() {\n return this.markDef.type;\n }\n channelHasField(channel) {\n return vlEncoding.channelHasField(this.encoding, channel);\n }\n fieldDef(channel) {\n const channelDef = this.encoding[channel];\n return getFieldDef(channelDef);\n }\n typedFieldDef(channel) {\n const fieldDef = this.fieldDef(channel);\n if (isTypedFieldDef(fieldDef)) {\n return fieldDef;\n }\n return null;\n }\n}\n//# sourceMappingURL=unit.js.map","import { getSizeChannel, POSITION_SCALE_CHANNELS } from '../../channel';\nimport { isContinuousFieldOrDatumDef } from '../../channeldef';\nimport * as log from '../../log';\nimport { isStep } from '../../spec/base';\nexport function initLayoutSize({ encoding, size }) {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n if (isStep(size[sizeType])) {\n if (isContinuousFieldOrDatumDef(encoding[channel])) {\n delete size[sizeType];\n log.warn(log.message.stepDropped(sizeType));\n }\n }\n }\n return size;\n}\n//# sourceMappingURL=init.js.map","import { array } from 'vega-util';\nimport * as log from '../log';\nimport { isLayerSpec, isUnitSpec } from '../spec';\nimport { keys } from '../util';\nimport { assembleAxisSignals } from './axis/assemble';\nimport { parseLayerAxes } from './axis/parse';\nimport { parseData } from './data/parse';\nimport { assembleLayoutSignals } from './layoutsize/assemble';\nimport { parseLayerLayoutSize } from './layoutsize/parse';\nimport { assembleLegends } from './legend/assemble';\nimport { Model } from './model';\nimport { assembleLayerSelectionMarks } from './selection/assemble';\nimport { UnitModel } from './unit';\nexport class LayerModel extends Model {\n constructor(spec, parent, parentGivenName, parentGivenSize, config) {\n super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view);\n const layoutSize = {\n ...parentGivenSize,\n ...(spec.width ? { width: spec.width } : {}),\n ...(spec.height ? { height: spec.height } : {})\n };\n this.children = spec.layer.map((layer, i) => {\n if (isLayerSpec(layer)) {\n return new LayerModel(layer, this, this.getName(`layer_${i}`), layoutSize, config);\n }\n else if (isUnitSpec(layer)) {\n return new UnitModel(layer, this, this.getName(`layer_${i}`), layoutSize, config);\n }\n throw new Error(log.message.invalidSpec(layer));\n });\n }\n parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n parseLayoutSize() {\n parseLayerLayoutSize(this);\n }\n parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n parseAxesAndHeaders() {\n parseLayerAxes(this);\n }\n assembleSelectionTopLevelSignals(signals) {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n // TODO: Support same named selections across children.\n assembleSignals() {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleSignals());\n }, assembleAxisSignals(this));\n }\n assembleLayoutSignals() {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleLayoutSignals());\n }, assembleLayoutSignals(this));\n }\n assembleSelectionData(data) {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n assembleGroupStyle() {\n const uniqueStyles = new Set();\n for (const child of this.children) {\n for (const style of array(child.assembleGroupStyle())) {\n uniqueStyles.add(style);\n }\n }\n const styles = Array.from(uniqueStyles);\n return styles.length > 1 ? styles : styles.length === 1 ? styles[0] : undefined;\n }\n assembleTitle() {\n let title = super.assembleTitle();\n if (title) {\n return title;\n }\n // If title does not provide layer, look into children\n for (const child of this.children) {\n title = child.assembleTitle();\n if (title) {\n return title;\n }\n }\n return undefined;\n }\n assembleLayout() {\n return null;\n }\n assembleMarks() {\n return assembleLayerSelectionMarks(this, this.children.flatMap(child => {\n return child.assembleMarks();\n }));\n }\n assembleLegends() {\n return this.children.reduce((legends, child) => {\n return legends.concat(child.assembleLegends());\n }, assembleLegends(this));\n }\n}\n//# sourceMappingURL=layer.js.map","import * as log from '../log';\nimport { isAnyConcatSpec, isFacetSpec, isLayerSpec, isUnitSpec } from '../spec';\nimport { ConcatModel } from './concat';\nimport { FacetModel } from './facet';\nimport { LayerModel } from './layer';\nimport { UnitModel } from './unit';\nexport function buildModel(spec, parent, parentGivenName, unitSize, config) {\n if (isFacetSpec(spec)) {\n return new FacetModel(spec, parent, parentGivenName, config);\n }\n else if (isLayerSpec(spec)) {\n return new LayerModel(spec, parent, parentGivenName, unitSize, config);\n }\n else if (isUnitSpec(spec)) {\n return new UnitModel(spec, parent, parentGivenName, unitSize, config);\n }\n else if (isAnyConcatSpec(spec)) {\n return new ConcatModel(spec, parent, parentGivenName, config);\n }\n throw new Error(log.message.invalidSpec(spec));\n}\n//# sourceMappingURL=buildmodel.js.map","import { isString, mergeConfig } from 'vega-util';\nimport { getPositionScaleChannel } from '../channel';\nimport * as vlFieldDef from '../channeldef';\nimport { initConfig, stripAndRedirectConfig } from '../config';\nimport * as log from '../log';\nimport { normalize } from '../normalize';\nimport { assembleParameterSignals } from '../parameter';\nimport { extractTopLevelProperties, getFitType, isFitType } from '../spec/toplevel';\nimport { keys } from '../util';\nimport { buildModel } from './buildmodel';\nimport { assembleRootData } from './data/assemble';\nimport { optimizeDataflow } from './data/optimize';\n/**\n * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec.\n *\n * At a high-level, we make the following transformations in different phases:\n *\n * Input spec\n * |\n * | (Normalization)\n * v\n * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.)\n * |\n * | (Build Model)\n * v\n * A model tree of the spec\n * |\n * | (Parse)\n * v\n * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged)\n * |\n * | (Optimize)\n * v\n * A model tree with parsed components with the data component optimized\n * |\n * | (Assemble)\n * v\n * Vega spec\n *\n * @param inputSpec The Vega-Lite specification.\n * @param opt Optional arguments passed to the Vega-Lite compiler.\n * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec.\n */\nexport function compile(inputSpec, opt = {}) {\n // 0. Augment opt with default opts\n if (opt.logger) {\n // set the singleton logger to the provided logger\n log.set(opt.logger);\n }\n if (opt.fieldTitle) {\n // set the singleton field title formatter\n vlFieldDef.setTitleFormatter(opt.fieldTitle);\n }\n try {\n // 1. Initialize config by deep merging default config with the config provided via option and the input spec.\n const config = initConfig(mergeConfig(opt.config, inputSpec.config));\n // 2. Normalize: Convert input spec -> normalized spec\n // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec.\n // - Normalize autosize and width or height spec\n const spec = normalize(inputSpec, config);\n // 3. Build Model: normalized spec -> Model (a tree structure)\n // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors.\n // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models.\n const model = buildModel(spec, null, '', undefined, config);\n // 4 Parse: Model --> Model with components\n // Note that components = intermediate representations that are equivalent to Vega specs.\n // We need these intermediate representation because we need to merge many visualization \"components\" like projections, scales, axes, and legends.\n // We will later convert these components into actual Vega specs in the assemble phase.\n // In this phase, we do a bottom-up traversal over the whole tree to\n // parse for each type of components once (e.g., data, layout, mark, scale).\n // By doing bottom-up traversal, we start parsing components of unit specs and\n // then merge child components of parent composite specs.\n //\n // Please see inside model.parse() for order of different components parsed.\n model.parse();\n // drawDataflow(model.component.data.sources);\n // 5. Optimize the dataflow. This will modify the data component of the model.\n optimizeDataflow(model.component.data, model);\n // drawDataflow(model.component.data.sources);\n // 6. Assemble: convert model components --> Vega Spec.\n const vgSpec = assembleTopLevelModel(model, getTopLevelProperties(inputSpec, spec.autosize, config, model), inputSpec.datasets, inputSpec.usermeta);\n return {\n spec: vgSpec,\n normalized: spec\n };\n }\n finally {\n // Reset the singleton logger if a logger is provided\n if (opt.logger) {\n log.reset();\n }\n // Reset the singleton field title formatter if provided\n if (opt.fieldTitle) {\n vlFieldDef.resetTitleFormatter();\n }\n }\n}\nfunction getTopLevelProperties(inputSpec, autosize, config, model) {\n const width = model.component.layoutSize.get('width');\n const height = model.component.layoutSize.get('height');\n if (autosize === undefined) {\n autosize = { type: 'pad' };\n if (model.hasAxisOrientSignalRef()) {\n autosize.resize = true;\n }\n }\n else if (isString(autosize)) {\n autosize = { type: autosize };\n }\n if (width && height && isFitType(autosize.type)) {\n if (width === 'step' && height === 'step') {\n log.warn(log.message.droppingFit());\n autosize.type = 'pad';\n }\n else if (width === 'step' || height === 'step') {\n // effectively XOR, because else if\n // get step dimension\n const sizeType = width === 'step' ? 'width' : 'height';\n // log that we're dropping fit for respective channel\n log.warn(log.message.droppingFit(getPositionScaleChannel(sizeType)));\n // setting type to inverse fit (so if we dropped fit-x, type is now fit-y)\n const inverseSizeType = sizeType === 'width' ? 'height' : 'width';\n autosize.type = getFitType(inverseSizeType);\n }\n }\n return {\n ...(keys(autosize).length === 1 && autosize.type\n ? autosize.type === 'pad'\n ? {}\n : { autosize: autosize.type }\n : { autosize }),\n ...extractTopLevelProperties(config, false),\n ...extractTopLevelProperties(inputSpec, true)\n };\n}\n/*\n * Assemble the top-level model to a Vega spec.\n *\n * Note: this couldn't be `model.assemble()` since the top-level model\n * needs some special treatment to generate top-level properties.\n */\nfunction assembleTopLevelModel(model, topLevelProperties, datasets = {}, usermeta) {\n // Config with Vega-Lite only config removed.\n const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined;\n const data = [].concat(model.assembleSelectionData([]), \n // only assemble data in the root\n assembleRootData(model.component.data, datasets));\n const projections = model.assembleProjections();\n const title = model.assembleTitle();\n const style = model.assembleGroupStyle();\n const encodeEntry = model.assembleGroupEncodeEntry(true);\n let layoutSignals = model.assembleLayoutSignals();\n // move width and height signals with values to top level\n layoutSignals = layoutSignals.filter(signal => {\n if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) {\n topLevelProperties[signal.name] = +signal.value;\n return false;\n }\n return true;\n });\n const { params, ...otherTopLevelProps } = topLevelProperties;\n return {\n $schema: 'https://vega.github.io/schema/vega/v5.json',\n ...(model.description ? { description: model.description } : {}),\n ...otherTopLevelProps,\n ...(title ? { title } : {}),\n ...(style ? { style } : {}),\n ...(encodeEntry ? { encode: { update: encodeEntry } } : {}),\n data,\n ...(projections.length > 0 ? { projections } : {}),\n ...model.assembleGroup([\n ...layoutSignals,\n ...model.assembleSelectionTopLevelSignals([]),\n ...assembleParameterSignals(params)\n ]),\n ...(vgConfig ? { config: vgConfig } : {}),\n ...(usermeta ? { usermeta } : {})\n };\n}\n//# sourceMappingURL=compile.js.map","import pkg from '../package.json';\nexport const version = pkg.version;\nexport { compile } from './compile/compile';\nexport { normalize } from './normalize';\nexport * from './util';\n//# sourceMappingURL=index.js.map","function e(e){const[n,r]=/schema\\/([\\w-]+)\\/([\\w\\.\\-]+)\\.json$/g.exec(e).slice(1,3);return{library:n,version:r}}export default e;\n//# sourceMappingURL=parser.module.js.map\n","var name = \"vega-themes\";\nvar version$1 = \"2.14.0\";\nvar description = \"Themes for stylized Vega and Vega-Lite visualizations.\";\nvar keywords = [\"vega\", \"vega-lite\", \"themes\", \"style\"];\nvar license = \"BSD-3-Clause\";\nvar author = {\n name: \"UW Interactive Data Lab\",\n url: \"https://idl.cs.washington.edu\"\n};\nvar contributors = [{\n name: \"Emily Gu\",\n url: \"https://github.com/emilygu\"\n}, {\n name: \"Arvind Satyanarayan\",\n url: \"http://arvindsatya.com\"\n}, {\n name: \"Jeffrey Heer\",\n url: \"https://idl.cs.washington.edu\"\n}, {\n name: \"Dominik Moritz\",\n url: \"https://www.domoritz.de\"\n}];\nvar main = \"build/vega-themes.js\";\nvar module = \"build/vega-themes.module.js\";\nvar unpkg = \"build/vega-themes.min.js\";\nvar jsdelivr = \"build/vega-themes.min.js\";\nvar types = \"build/vega-themes.module.d.ts\";\nvar repository = {\n type: \"git\",\n url: \"https://github.com/vega/vega-themes.git\"\n};\nvar files = [\"src\", \"build\"];\nvar scripts = {\n prebuild: \"yarn clean\",\n build: \"rollup -c\",\n clean: \"rimraf build && rimraf examples/build\",\n \"copy:data\": \"rsync -r node_modules/vega-datasets/data/* examples/data\",\n \"copy:build\": \"rsync -r build/* examples/build\",\n \"deploy:gh\": \"yarn build && mkdir -p examples/build && rsync -r build/* examples/build && gh-pages -d examples\",\n preversion: \"yarn lint\",\n serve: \"browser-sync start -s -f build examples --serveStatic examples\",\n start: \"yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'\",\n format: \"eslint . --fix\",\n lint: \"eslint .\",\n release: \"release-it\"\n};\nvar devDependencies = {\n \"@babel/core\": \"^7.22.9\",\n \"@babel/plugin-proposal-async-generator-functions\": \"^7.20.7\",\n \"@babel/plugin-proposal-json-strings\": \"^7.18.6\",\n \"@babel/plugin-proposal-object-rest-spread\": \"^7.20.7\",\n \"@babel/plugin-proposal-optional-catch-binding\": \"^7.18.6\",\n \"@babel/plugin-transform-runtime\": \"^7.22.9\",\n \"@babel/preset-env\": \"^7.22.9\",\n \"@babel/preset-typescript\": \"^7.22.5\",\n \"@release-it/conventional-changelog\": \"^7.0.0\",\n \"@rollup/plugin-json\": \"^6.0.0\",\n \"@rollup/plugin-node-resolve\": \"^15.1.0\",\n \"@rollup/plugin-terser\": \"^0.4.3\",\n \"@typescript-eslint/eslint-plugin\": \"^6.0.0\",\n \"@typescript-eslint/parser\": \"^6.0.0\",\n \"browser-sync\": \"^2.29.3\",\n concurrently: \"^8.2.0\",\n eslint: \"^8.45.0\",\n \"eslint-config-prettier\": \"^8.8.0\",\n \"eslint-plugin-prettier\": \"^5.0.0\",\n \"gh-pages\": \"^5.0.0\",\n prettier: \"^3.0.0\",\n \"release-it\": \"^16.1.0\",\n rollup: \"^3.26.2\",\n \"rollup-plugin-bundle-size\": \"^1.0.3\",\n \"rollup-plugin-ts\": \"^3.2.0\",\n typescript: \"^5.1.6\",\n vega: \"^5.25.0\",\n \"vega-lite\": \"^5.9.3\"\n};\nvar peerDependencies = {\n vega: \"*\",\n \"vega-lite\": \"*\"\n};\nvar dependencies = {};\nvar pkg = {\n name: name,\n version: version$1,\n description: description,\n keywords: keywords,\n license: license,\n author: author,\n contributors: contributors,\n main: main,\n module: module,\n unpkg: unpkg,\n jsdelivr: jsdelivr,\n types: types,\n repository: repository,\n files: files,\n scripts: scripts,\n devDependencies: devDependencies,\n peerDependencies: peerDependencies,\n dependencies: dependencies\n};\n\nconst lightColor = '#fff';\nconst medColor = '#888';\nconst darkTheme = {\n background: '#333',\n view: {\n stroke: medColor\n },\n title: {\n color: lightColor,\n subtitleColor: lightColor\n },\n style: {\n 'guide-label': {\n fill: lightColor\n },\n 'guide-title': {\n fill: lightColor\n }\n },\n axis: {\n domainColor: lightColor,\n gridColor: medColor,\n tickColor: lightColor\n }\n};\n\nconst markColor$7 = '#4572a7';\nconst excelTheme = {\n background: '#fff',\n arc: {\n fill: markColor$7\n },\n area: {\n fill: markColor$7\n },\n line: {\n stroke: markColor$7,\n strokeWidth: 2\n },\n path: {\n stroke: markColor$7\n },\n rect: {\n fill: markColor$7\n },\n shape: {\n stroke: markColor$7\n },\n symbol: {\n fill: markColor$7,\n strokeWidth: 1.5,\n size: 50\n },\n axis: {\n bandPosition: 0.5,\n grid: true,\n gridColor: '#000000',\n gridOpacity: 1,\n gridWidth: 0.5,\n labelPadding: 10,\n tickSize: 5,\n tickWidth: 0.5\n },\n axisBand: {\n grid: false,\n tickExtra: true\n },\n legend: {\n labelBaseline: 'middle',\n labelFontSize: 11,\n symbolSize: 50,\n symbolType: 'square'\n },\n range: {\n category: ['#4572a7', '#aa4643', '#8aa453', '#71598e', '#4598ae', '#d98445', '#94aace', '#d09393', '#b9cc98', '#a99cbc']\n }\n};\n\nconst markColor$6 = '#30a2da';\nconst axisColor$2 = '#cbcbcb';\nconst guideLabelColor = '#999';\nconst guideTitleColor = '#333';\nconst backgroundColor$2 = '#f0f0f0';\nconst blackTitle = '#333';\nconst fiveThirtyEightTheme = {\n arc: {\n fill: markColor$6\n },\n area: {\n fill: markColor$6\n },\n axis: {\n domainColor: axisColor$2,\n grid: true,\n gridColor: axisColor$2,\n gridWidth: 1,\n labelColor: guideLabelColor,\n labelFontSize: 10,\n titleColor: guideTitleColor,\n tickColor: axisColor$2,\n tickSize: 10,\n titleFontSize: 14,\n titlePadding: 10,\n labelPadding: 4\n },\n axisBand: {\n grid: false\n },\n background: backgroundColor$2,\n group: {\n fill: backgroundColor$2\n },\n legend: {\n labelColor: blackTitle,\n labelFontSize: 11,\n padding: 1,\n symbolSize: 30,\n symbolType: 'square',\n titleColor: blackTitle,\n titleFontSize: 14,\n titlePadding: 10\n },\n line: {\n stroke: markColor$6,\n strokeWidth: 2\n },\n path: {\n stroke: markColor$6,\n strokeWidth: 0.5\n },\n rect: {\n fill: markColor$6\n },\n range: {\n category: ['#30a2da', '#fc4f30', '#e5ae38', '#6d904f', '#8b8b8b', '#b96db8', '#ff9e27', '#56cc60', '#52d2ca', '#52689e', '#545454', '#9fe4f8'],\n diverging: ['#cc0020', '#e77866', '#f6e7e1', '#d6e8ed', '#91bfd9', '#1d78b5'],\n heatmap: ['#d6e8ed', '#cee0e5', '#91bfd9', '#549cc6', '#1d78b5']\n },\n point: {\n filled: true,\n shape: 'circle'\n },\n shape: {\n stroke: markColor$6\n },\n bar: {\n binSpacing: 2,\n fill: markColor$6,\n stroke: null\n },\n title: {\n anchor: 'start',\n fontSize: 24,\n fontWeight: 600,\n offset: 20\n }\n};\n\nconst markColor$5 = '#000';\nconst ggplot2Theme = {\n group: {\n fill: '#e5e5e5'\n },\n arc: {\n fill: markColor$5\n },\n area: {\n fill: markColor$5\n },\n line: {\n stroke: markColor$5\n },\n path: {\n stroke: markColor$5\n },\n rect: {\n fill: markColor$5\n },\n shape: {\n stroke: markColor$5\n },\n symbol: {\n fill: markColor$5,\n size: 40\n },\n axis: {\n domain: false,\n grid: true,\n gridColor: '#FFFFFF',\n gridOpacity: 1,\n labelColor: '#7F7F7F',\n labelPadding: 4,\n tickColor: '#7F7F7F',\n tickSize: 5.67,\n titleFontSize: 16,\n titleFontWeight: 'normal'\n },\n legend: {\n labelBaseline: 'middle',\n labelFontSize: 11,\n symbolSize: 40\n },\n range: {\n category: ['#000000', '#7F7F7F', '#1A1A1A', '#999999', '#333333', '#B0B0B0', '#4D4D4D', '#C9C9C9', '#666666', '#DCDCDC']\n }\n};\n\nconst headlineFontSize = 22;\nconst headlineFontWeight = 'normal';\nconst labelFont$1 = 'Benton Gothic, sans-serif';\nconst labelFontSize = 11.5;\nconst labelFontWeight = 'normal';\nconst markColor$4 = '#82c6df';\n// const markHighlight = '#006d8f';\n// const markDemocrat = '#5789b8';\n// const markRepublican = '#d94f54';\nconst titleFont = 'Benton Gothic Bold, sans-serif';\nconst titleFontWeight = 'normal';\nconst titleFontSize$1 = 13;\nconst colorSchemes$1 = {\n 'category-6': ['#ec8431', '#829eb1', '#c89d29', '#3580b1', '#adc839', '#ab7fb4'],\n 'fire-7': ['#fbf2c7', '#f9e39c', '#f8d36e', '#f4bb6a', '#e68a4f', '#d15a40', '#ab4232'],\n 'fireandice-6': ['#e68a4f', '#f4bb6a', '#f9e39c', '#dadfe2', '#a6b7c6', '#849eae'],\n 'ice-7': ['#edefee', '#dadfe2', '#c4ccd2', '#a6b7c6', '#849eae', '#607785', '#47525d']\n};\nconst latimesTheme = {\n background: '#ffffff',\n title: {\n anchor: 'start',\n color: '#000000',\n font: titleFont,\n fontSize: headlineFontSize,\n fontWeight: headlineFontWeight\n },\n arc: {\n fill: markColor$4\n },\n area: {\n fill: markColor$4\n },\n line: {\n stroke: markColor$4,\n strokeWidth: 2\n },\n path: {\n stroke: markColor$4\n },\n rect: {\n fill: markColor$4\n },\n shape: {\n stroke: markColor$4\n },\n symbol: {\n fill: markColor$4,\n size: 30\n },\n axis: {\n labelFont: labelFont$1,\n labelFontSize,\n labelFontWeight,\n titleFont,\n titleFontSize: titleFontSize$1,\n titleFontWeight\n },\n axisX: {\n labelAngle: 0,\n labelPadding: 4,\n tickSize: 3\n },\n axisY: {\n labelBaseline: 'middle',\n maxExtent: 45,\n minExtent: 45,\n tickSize: 2,\n titleAlign: 'left',\n titleAngle: 0,\n titleX: -45,\n titleY: -11\n },\n legend: {\n labelFont: labelFont$1,\n labelFontSize,\n symbolType: 'square',\n titleFont,\n titleFontSize: titleFontSize$1,\n titleFontWeight\n },\n range: {\n category: colorSchemes$1['category-6'],\n diverging: colorSchemes$1['fireandice-6'],\n heatmap: colorSchemes$1['fire-7'],\n ordinal: colorSchemes$1['fire-7'],\n ramp: colorSchemes$1['fire-7']\n }\n};\n\nconst markColor$3 = '#ab5787';\nconst axisColor$1 = '#979797';\nconst quartzTheme = {\n background: '#f9f9f9',\n arc: {\n fill: markColor$3\n },\n area: {\n fill: markColor$3\n },\n line: {\n stroke: markColor$3\n },\n path: {\n stroke: markColor$3\n },\n rect: {\n fill: markColor$3\n },\n shape: {\n stroke: markColor$3\n },\n symbol: {\n fill: markColor$3,\n size: 30\n },\n axis: {\n domainColor: axisColor$1,\n domainWidth: 0.5,\n gridWidth: 0.2,\n labelColor: axisColor$1,\n tickColor: axisColor$1,\n tickWidth: 0.2,\n titleColor: axisColor$1\n },\n axisBand: {\n grid: false\n },\n axisX: {\n grid: true,\n tickSize: 10\n },\n axisY: {\n domain: false,\n grid: true,\n tickSize: 0\n },\n legend: {\n labelFontSize: 11,\n padding: 1,\n symbolSize: 30,\n symbolType: 'square'\n },\n range: {\n category: ['#ab5787', '#51b2e5', '#703c5c', '#168dd9', '#d190b6', '#00609f', '#d365ba', '#154866', '#666666', '#c4c4c4']\n }\n};\n\nconst markColor$2 = '#3e5c69';\nconst voxTheme = {\n background: '#fff',\n arc: {\n fill: markColor$2\n },\n area: {\n fill: markColor$2\n },\n line: {\n stroke: markColor$2\n },\n path: {\n stroke: markColor$2\n },\n rect: {\n fill: markColor$2\n },\n shape: {\n stroke: markColor$2\n },\n symbol: {\n fill: markColor$2\n },\n axis: {\n domainWidth: 0.5,\n grid: true,\n labelPadding: 2,\n tickSize: 5,\n tickWidth: 0.5,\n titleFontWeight: 'normal'\n },\n axisBand: {\n grid: false\n },\n axisX: {\n gridWidth: 0.2\n },\n axisY: {\n gridDash: [3],\n gridWidth: 0.4\n },\n legend: {\n labelFontSize: 11,\n padding: 1,\n symbolType: 'square'\n },\n range: {\n category: ['#3e5c69', '#6793a6', '#182429', '#0570b0', '#3690c0', '#74a9cf', '#a6bddb', '#e2ddf2']\n }\n};\n\nconst markColor$1 = '#1696d2';\nconst axisColor = '#000000';\nconst backgroundColor$1 = '#FFFFFF';\nconst font = 'Lato';\nconst labelFont = 'Lato';\nconst sourceFont = 'Lato';\nconst gridColor$1 = '#DEDDDD';\nconst titleFontSize = 18;\nconst colorSchemes = {\n 'main-colors': ['#1696d2', '#d2d2d2', '#000000', '#fdbf11', '#ec008b', '#55b748', '#5c5859', '#db2b27'],\n 'shades-blue': ['#CFE8F3', '#A2D4EC', '#73BFE2', '#46ABDB', '#1696D2', '#12719E', '#0A4C6A', '#062635'],\n 'shades-gray': ['#F5F5F5', '#ECECEC', '#E3E3E3', '#DCDBDB', '#D2D2D2', '#9D9D9D', '#696969', '#353535'],\n 'shades-yellow': ['#FFF2CF', '#FCE39E', '#FDD870', '#FCCB41', '#FDBF11', '#E88E2D', '#CA5800', '#843215'],\n 'shades-magenta': ['#F5CBDF', '#EB99C2', '#E46AA7', '#E54096', '#EC008B', '#AF1F6B', '#761548', '#351123'],\n 'shades-green': ['#DCEDD9', '#BCDEB4', '#98CF90', '#78C26D', '#55B748', '#408941', '#2C5C2D', '#1A2E19'],\n 'shades-black': ['#D5D5D4', '#ADABAC', '#848081', '#5C5859', '#332D2F', '#262223', '#1A1717', '#0E0C0D'],\n 'shades-red': ['#F8D5D4', '#F1AAA9', '#E9807D', '#E25552', '#DB2B27', '#A4201D', '#6E1614', '#370B0A'],\n 'one-group': ['#1696d2', '#000000'],\n 'two-groups-cat-1': ['#1696d2', '#000000'],\n 'two-groups-cat-2': ['#1696d2', '#fdbf11'],\n 'two-groups-cat-3': ['#1696d2', '#db2b27'],\n 'two-groups-seq': ['#a2d4ec', '#1696d2'],\n 'three-groups-cat': ['#1696d2', '#fdbf11', '#000000'],\n 'three-groups-seq': ['#a2d4ec', '#1696d2', '#0a4c6a'],\n 'four-groups-cat-1': ['#000000', '#d2d2d2', '#fdbf11', '#1696d2'],\n 'four-groups-cat-2': ['#1696d2', '#ec0008b', '#fdbf11', '#5c5859'],\n 'four-groups-seq': ['#cfe8f3', '#73bf42', '#1696d2', '#0a4c6a'],\n 'five-groups-cat-1': ['#1696d2', '#fdbf11', '#d2d2d2', '#ec008b', '#000000'],\n 'five-groups-cat-2': ['#1696d2', '#0a4c6a', '#d2d2d2', '#fdbf11', '#332d2f'],\n 'five-groups-seq': ['#cfe8f3', '#73bf42', '#1696d2', '#0a4c6a', '#000000'],\n 'six-groups-cat-1': ['#1696d2', '#ec008b', '#fdbf11', '#000000', '#d2d2d2', '#55b748'],\n 'six-groups-cat-2': ['#1696d2', '#d2d2d2', '#ec008b', '#fdbf11', '#332d2f', '#0a4c6a'],\n 'six-groups-seq': ['#cfe8f3', '#a2d4ec', '#73bfe2', '#46abdb', '#1696d2', '#12719e'],\n 'diverging-colors': ['#ca5800', '#fdbf11', '#fdd870', '#fff2cf', '#cfe8f3', '#73bfe2', '#1696d2', '#0a4c6a']\n};\nconst urbanInstituteTheme = {\n background: backgroundColor$1,\n title: {\n anchor: 'start',\n fontSize: titleFontSize,\n font: font\n },\n axisX: {\n domain: true,\n domainColor: axisColor,\n domainWidth: 1,\n grid: false,\n labelFontSize: 12,\n labelFont: labelFont,\n labelAngle: 0,\n tickColor: axisColor,\n tickSize: 5,\n titleFontSize: 12,\n titlePadding: 10,\n titleFont: font\n },\n axisY: {\n domain: false,\n domainWidth: 1,\n grid: true,\n gridColor: gridColor$1,\n gridWidth: 1,\n labelFontSize: 12,\n labelFont: labelFont,\n labelPadding: 8,\n ticks: false,\n titleFontSize: 12,\n titlePadding: 10,\n titleFont: font,\n titleAngle: 0,\n titleY: -10,\n titleX: 18\n },\n legend: {\n labelFontSize: 12,\n labelFont: labelFont,\n symbolSize: 100,\n titleFontSize: 12,\n titlePadding: 10,\n titleFont: font,\n orient: 'right',\n offset: 10\n },\n view: {\n stroke: 'transparent'\n },\n range: {\n category: colorSchemes['six-groups-cat-1'],\n diverging: colorSchemes['diverging-colors'],\n heatmap: colorSchemes['diverging-colors'],\n ordinal: colorSchemes['six-groups-seq'],\n ramp: colorSchemes['shades-blue']\n },\n area: {\n fill: markColor$1\n },\n rect: {\n fill: markColor$1\n },\n line: {\n color: markColor$1,\n stroke: markColor$1,\n strokeWidth: 5\n },\n trail: {\n color: markColor$1,\n stroke: markColor$1,\n strokeWidth: 0,\n size: 1\n },\n path: {\n stroke: markColor$1,\n strokeWidth: 0.5\n },\n point: {\n filled: true\n },\n text: {\n font: sourceFont,\n color: markColor$1,\n fontSize: 11,\n align: 'center',\n fontWeight: 400,\n size: 11\n },\n style: {\n bar: {\n fill: markColor$1,\n stroke: null\n }\n },\n arc: {\n fill: markColor$1\n },\n shape: {\n stroke: markColor$1\n },\n symbol: {\n fill: markColor$1,\n size: 30\n }\n};\n\n/**\n * Copyright 2020 Google LLC.\n *\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file or at\n * https://developers.google.com/open-source/licenses/bsd\n */\n\nconst markColor = '#3366CC';\nconst gridColor = '#ccc';\nconst defaultFont$1 = 'Arial, sans-serif';\nconst googlechartsTheme = {\n arc: {\n fill: markColor\n },\n area: {\n fill: markColor\n },\n path: {\n stroke: markColor\n },\n rect: {\n fill: markColor\n },\n shape: {\n stroke: markColor\n },\n symbol: {\n stroke: markColor\n },\n circle: {\n fill: markColor\n },\n background: '#fff',\n padding: {\n top: 10,\n right: 10,\n bottom: 10,\n left: 10\n },\n style: {\n 'guide-label': {\n font: defaultFont$1,\n fontSize: 12\n },\n 'guide-title': {\n font: defaultFont$1,\n fontSize: 12\n },\n 'group-title': {\n font: defaultFont$1,\n fontSize: 12\n }\n },\n title: {\n font: defaultFont$1,\n fontSize: 14,\n fontWeight: 'bold',\n dy: -3,\n anchor: 'start'\n },\n axis: {\n gridColor: gridColor,\n tickColor: gridColor,\n domain: false,\n grid: true\n },\n range: {\n category: ['#4285F4', '#DB4437', '#F4B400', '#0F9D58', '#AB47BC', '#00ACC1', '#FF7043', '#9E9D24', '#5C6BC0', '#F06292', '#00796B', '#C2185B'],\n heatmap: ['#c6dafc', '#5e97f6', '#2a56c6']\n }\n};\n\nconst ptToPx = value => value * (1 / 3 + 1);\nconst fontSmallPx = ptToPx(9);\nconst legendFontPx = ptToPx(10);\nconst fontLargePx = ptToPx(12);\nconst fontStandard = 'Segoe UI';\nconst fontTitle = 'wf_standard-font, helvetica, arial, sans-serif';\nconst firstLevelElementColor = '#252423';\nconst secondLevelElementColor = '#605E5C';\nconst backgroundColor = 'transparent';\nconst backgroundSecondaryColor = '#C8C6C4';\nconst paletteColor1 = '#118DFF';\nconst paletteColor2 = '#12239E';\nconst paletteColor3 = '#E66C37';\nconst paletteColor4 = '#6B007B';\nconst paletteColor5 = '#E044A7';\nconst paletteColor6 = '#744EC2';\nconst paletteColor7 = '#D9B300';\nconst paletteColor8 = '#D64550';\nconst divergentColorMax = paletteColor1;\nconst divergentColorMin = '#DEEFFF';\nconst divergentPalette = [divergentColorMin, divergentColorMax];\nconst ordinalPalette = [divergentColorMin, '#c7e4ff', '#b0d9ff', '#9aceff', '#83c3ff', '#6cb9ff', '#55aeff', '#3fa3ff', '#2898ff', divergentColorMax];\nconst powerbiTheme = {\n view: {\n stroke: backgroundColor\n },\n background: backgroundColor,\n font: fontStandard,\n header: {\n titleFont: fontTitle,\n titleFontSize: fontLargePx,\n titleColor: firstLevelElementColor,\n labelFont: fontStandard,\n labelFontSize: legendFontPx,\n labelColor: secondLevelElementColor\n },\n axis: {\n ticks: false,\n grid: false,\n domain: false,\n labelColor: secondLevelElementColor,\n labelFontSize: fontSmallPx,\n titleFont: fontTitle,\n titleColor: firstLevelElementColor,\n titleFontSize: fontLargePx,\n titleFontWeight: 'normal'\n },\n axisQuantitative: {\n tickCount: 3,\n grid: true,\n gridColor: backgroundSecondaryColor,\n gridDash: [1, 5],\n labelFlush: false\n },\n axisBand: {\n tickExtra: true\n },\n axisX: {\n labelPadding: 5\n },\n axisY: {\n labelPadding: 10\n },\n bar: {\n fill: paletteColor1\n },\n line: {\n stroke: paletteColor1,\n strokeWidth: 3,\n strokeCap: 'round',\n strokeJoin: 'round'\n },\n text: {\n font: fontStandard,\n fontSize: fontSmallPx,\n fill: secondLevelElementColor\n },\n arc: {\n fill: paletteColor1\n },\n area: {\n fill: paletteColor1,\n line: true,\n opacity: 0.6\n },\n path: {\n stroke: paletteColor1\n },\n rect: {\n fill: paletteColor1\n },\n point: {\n fill: paletteColor1,\n filled: true,\n size: 75\n },\n shape: {\n stroke: paletteColor1\n },\n symbol: {\n fill: paletteColor1,\n strokeWidth: 1.5,\n size: 50\n },\n legend: {\n titleFont: fontStandard,\n titleFontWeight: 'bold',\n titleColor: secondLevelElementColor,\n labelFont: fontStandard,\n labelFontSize: legendFontPx,\n labelColor: secondLevelElementColor,\n symbolType: 'circle',\n symbolSize: 75\n },\n range: {\n category: [paletteColor1, paletteColor2, paletteColor3, paletteColor4, paletteColor5, paletteColor6, paletteColor7, paletteColor8],\n diverging: divergentPalette,\n heatmap: divergentPalette,\n ordinal: ordinalPalette\n }\n};\n\nconst defaultFont = 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif';\nconst fontWeight = 400;\nconst darkCategories = ['#8a3ffc', '#33b1ff', '#007d79', '#ff7eb6', '#fa4d56', '#fff1f1', '#6fdc8c', '#4589ff', '#d12771', '#d2a106', '#08bdba', '#bae6ff', '#ba4e00', '#d4bbff'];\nconst lightCategories = ['#6929c4', '#1192e8', '#005d5d', '#9f1853', '#fa4d56', '#570408', '#198038', '#002d9c', '#ee538b', '#b28600', '#009d9a', '#012749', '#8a3800', '#a56eff'];\nfunction genCarbonConfig({\n type,\n background\n}) {\n const viewbg = type === 'dark' ? '#161616' : '#ffffff';\n const textColor = type === 'dark' ? '#f4f4f4' : '#161616';\n const category = type === 'dark' ? darkCategories : lightCategories;\n const markColor = type === 'dark' ? '#d4bbff' : '#6929c4';\n return {\n background,\n arc: {\n fill: markColor\n },\n area: {\n fill: markColor\n },\n path: {\n stroke: markColor\n },\n rect: {\n fill: markColor\n },\n shape: {\n stroke: markColor\n },\n symbol: {\n stroke: markColor\n },\n circle: {\n fill: markColor\n },\n view: {\n fill: viewbg,\n stroke: viewbg\n },\n group: {\n fill: viewbg\n },\n title: {\n color: textColor,\n anchor: 'start',\n dy: -15,\n fontSize: 16,\n font: defaultFont,\n fontWeight: 600\n },\n axis: {\n labelColor: textColor,\n labelFontSize: 12,\n grid: true,\n gridColor: '#525252',\n titleColor: textColor,\n labelAngle: 0\n },\n style: {\n 'guide-label': {\n font: defaultFont,\n fill: textColor,\n fontWeight: fontWeight\n },\n 'guide-title': {\n font: defaultFont,\n fill: textColor,\n fontWeight: fontWeight\n }\n },\n range: {\n category,\n diverging: ['#750e13', '#a2191f', '#da1e28', '#fa4d56', '#ff8389', '#ffb3b8', '#ffd7d9', '#fff1f1', '#e5f6ff', '#bae6ff', '#82cfff', '#33b1ff', '#1192e8', '#0072c3', '#00539a', '#003a6d'],\n heatmap: ['#f6f2ff', '#e8daff', '#d4bbff', '#be95ff', '#a56eff', '#8a3ffc', '#6929c4', '#491d8b', '#31135e', '#1c0f30']\n }\n };\n}\n\nconst carbonwhite = genCarbonConfig({\n type: 'light',\n background: '#ffffff'\n});\n\nconst carbong10 = genCarbonConfig({\n type: 'light',\n background: '#f4f4f4'\n});\n\nconst carbong90 = genCarbonConfig({\n type: 'dark',\n background: '#262626'\n});\n\nconst carbong100 = genCarbonConfig({\n type: 'dark',\n background: '#161616'\n});\n\nconst version = pkg.version;\n\nexport { carbong10, carbong100, carbong90, carbonwhite, darkTheme as dark, excelTheme as excel, fiveThirtyEightTheme as fivethirtyeight, ggplot2Theme as ggplot2, googlechartsTheme as googlecharts, latimesTheme as latimes, powerbiTheme as powerbi, quartzTheme as quartz, urbanInstituteTheme as urbaninstitute, version, voxTheme as vox };\n","import { isArray, isString, isObject } from 'vega-util';\n\nvar name = \"vega-tooltip\";\nvar version$1 = \"0.33.0\";\nvar description = \"A tooltip plugin for Vega-Lite and Vega visualizations.\";\nvar keywords = [\"vega-lite\", \"vega\", \"tooltip\"];\nvar repository = {\n type: \"git\",\n url: \"https://github.com/vega/vega-tooltip.git\"\n};\nvar author = {\n name: \"UW Interactive Data Lab\",\n url: \"https://idl.cs.washington.edu\"\n};\nvar collaborators = [\"Dominik Moritz\", \"Sira Horradarn\", \"Zening Qu\", \"Kanit Wongsuphasawat\", \"Yuri Astrakhan\", \"Jeffrey Heer\"];\nvar license = \"BSD-3-Clause\";\nvar bugs = {\n url: \"https://github.com/vega/vega-tooltip/issues\"\n};\nvar homepage = \"https://github.com/vega/vega-tooltip#readme\";\nvar main = \"build/vega-tooltip.js\";\nvar module = \"build/vega-tooltip.module.js\";\nvar unpkg = \"build/vega-tooltip.min.js\";\nvar jsdelivr = \"build/vega-tooltip.min.js\";\nvar types = \"build/vega-tooltip.module.d.ts\";\nvar files = [\"src\", \"build\", \"types\"];\nvar scripts = {\n prebuild: \"yarn clean && yarn build:style\",\n build: \"rollup -c\",\n \"build:style\": \"./build-style.sh\",\n clean: \"rimraf build && rimraf src/style.ts\",\n \"copy:data\": \"rsync -r node_modules/vega-datasets/data/* examples/data\",\n \"copy:build\": \"rsync -r build/* examples/build\",\n \"deploy:gh\": \"yarn build && yarn copy:build && gh-pages -d examples && yarn clean\",\n prepublishOnly: \"yarn clean && yarn build\",\n preversion: \"yarn lint && yarn test\",\n serve: \"browser-sync start -s -f build examples --serveStatic examples\",\n start: \"yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'\",\n pretest: \"yarn build:style\",\n test: \"jest\",\n \"test:inspect\": \"node --inspect-brk ./node_modules/.bin/jest --runInBand\",\n prepare: \"yarn copy:data\",\n prettierbase: \"prettier '*.{css,scss,html}'\",\n format: \"eslint . --fix && yarn prettierbase --write\",\n lint: \"eslint . && yarn prettierbase --check\",\n release: \"release-it\"\n};\nvar devDependencies = {\n \"@babel/core\": \"^7.22.10\",\n \"@babel/plugin-proposal-async-generator-functions\": \"^7.20.7\",\n \"@babel/plugin-proposal-json-strings\": \"^7.18.6\",\n \"@babel/plugin-proposal-object-rest-spread\": \"^7.20.7\",\n \"@babel/plugin-proposal-optional-catch-binding\": \"^7.18.6\",\n \"@babel/plugin-transform-runtime\": \"^7.22.10\",\n \"@babel/preset-env\": \"^7.22.10\",\n \"@babel/preset-typescript\": \"^7.22.5\",\n \"@release-it/conventional-changelog\": \"^7.0.0\",\n \"@rollup/plugin-json\": \"^6.0.0\",\n \"@rollup/plugin-node-resolve\": \"^15.1.0\",\n \"@rollup/plugin-terser\": \"^0.4.3\",\n \"@types/jest\": \"^29.5.3\",\n \"@typescript-eslint/eslint-plugin\": \"^6.3.0\",\n \"@typescript-eslint/parser\": \"^6.3.0\",\n \"browser-sync\": \"^2.29.3\",\n concurrently: \"^8.2.0\",\n eslint: \"^8.46.0\",\n \"eslint-config-prettier\": \"^9.0.0\",\n \"eslint-plugin-jest\": \"^27.2.3\",\n \"eslint-plugin-prettier\": \"^5.0.0\",\n \"gh-pages\": \"^5.0.0\",\n jest: \"^29.6.2\",\n \"jest-environment-jsdom\": \"^29.6.2\",\n path: \"^0.12.7\",\n prettier: \"^3.0.1\",\n \"release-it\": \"^16.1.3\",\n rollup: \"^3.27.2\",\n \"rollup-plugin-bundle-size\": \"^1.0.3\",\n \"rollup-plugin-ts\": \"^3.4.3\",\n sass: \"^1.64.2\",\n typescript: \"~5.1.6\",\n \"vega-datasets\": \"^2.7.0\",\n \"vega-typings\": \"^0.24.2\"\n};\nvar dependencies = {\n \"vega-util\": \"^1.17.2\"\n};\nvar pkg = {\n name: name,\n version: version$1,\n description: description,\n keywords: keywords,\n repository: repository,\n author: author,\n collaborators: collaborators,\n license: license,\n bugs: bugs,\n homepage: homepage,\n main: main,\n module: module,\n unpkg: unpkg,\n jsdelivr: jsdelivr,\n types: types,\n files: files,\n scripts: scripts,\n devDependencies: devDependencies,\n dependencies: dependencies\n};\n\n/**\n * Format the value to be shown in the tooltip.\n *\n * @param value The value to show in the tooltip.\n * @param valueToHtml Function to convert a single cell value to an HTML string\n */\nfunction formatValue(value, valueToHtml, maxDepth) {\n if (isArray(value)) {\n return `[${value.map(v => valueToHtml(isString(v) ? v : stringify(v, maxDepth))).join(', ')}]`;\n }\n if (isObject(value)) {\n let content = '';\n const {\n title,\n image,\n ...rest\n } = value;\n if (title) {\n content += `

${valueToHtml(title)}

`;\n }\n if (image) {\n content += ``;\n }\n const keys = Object.keys(rest);\n if (keys.length > 0) {\n content += '';\n for (const key of keys) {\n let val = rest[key];\n\n // ignore undefined properties\n if (val === undefined) {\n continue;\n }\n if (isObject(val)) {\n val = stringify(val, maxDepth);\n }\n content += ``;\n }\n content += `
${valueToHtml(key)}${valueToHtml(val)}
`;\n }\n return content || '{}'; // show empty object if there are no properties\n }\n\n return valueToHtml(value);\n}\nfunction replacer(maxDepth) {\n const stack = [];\n return function (key, value) {\n if (typeof value !== 'object' || value === null) {\n return value;\n }\n const pos = stack.indexOf(this) + 1;\n stack.length = pos;\n if (stack.length > maxDepth) {\n return '[Object]';\n }\n if (stack.indexOf(value) >= 0) {\n return '[Circular]';\n }\n stack.push(value);\n return value;\n };\n}\n\n/**\n * Stringify any JS object to valid JSON\n */\nfunction stringify(obj, maxDepth) {\n return JSON.stringify(obj, replacer(maxDepth));\n}\n\n// generated with build-style.sh\nvar defaultStyle = `#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n`;\n\nconst EL_ID = 'vg-tooltip-element';\nconst DEFAULT_OPTIONS = {\n /**\n * X offset.\n */\n offsetX: 10,\n /**\n * Y offset.\n */\n offsetY: 10,\n /**\n * ID of the tooltip element.\n */\n id: EL_ID,\n /**\n * ID of the tooltip CSS style.\n */\n styleId: 'vega-tooltip-style',\n /**\n * The name of the theme. You can use the CSS class called [THEME]-theme to style the tooltips.\n *\n * There are two predefined themes: \"light\" (default) and \"dark\".\n */\n theme: 'light',\n /**\n * Do not use the default styles provided by Vega Tooltip. If you enable this option, you need to use your own styles. It is not necessary to disable the default style when using a custom theme.\n */\n disableDefaultStyle: false,\n /**\n * HTML sanitizer function that removes dangerous HTML to prevent XSS.\n *\n * This should be a function from string to string. You may replace it with a formatter such as a markdown formatter.\n */\n sanitize: escapeHTML,\n /**\n * The maximum recursion depth when printing objects in the tooltip.\n */\n maxDepth: 2,\n /**\n * A function to customize the rendered HTML of the tooltip.\n * @param value A value string, or object of value strings keyed by field\n * @param sanitize The `sanitize` function from `options.sanitize`\n * @returns {string} The returned string will become the `innerHTML` of the tooltip element\n */\n formatTooltip: formatValue\n};\n/**\n * Escape special HTML characters.\n *\n * @param value A value to convert to string and HTML-escape.\n */\nfunction escapeHTML(value) {\n return String(value).replace(/&/g, '&').replace(/ window.innerWidth) {\n x = +event.clientX - offsetX - tooltipBox.width;\n }\n let y = event.clientY + offsetY;\n if (y + tooltipBox.height > window.innerHeight) {\n y = +event.clientY - offsetY - tooltipBox.height;\n }\n return {\n x,\n y\n };\n}\n\n/**\n * The tooltip handler class.\n */\nclass Handler {\n /**\n * The handler function. We bind this to this function in the constructor.\n */\n\n /**\n * Complete tooltip options.\n */\n\n /**\n * The tooltip html element.\n */\n\n /**\n * Create the tooltip handler and initialize the element and style.\n *\n * @param options Tooltip Options\n */\n constructor(options) {\n this.options = {\n ...DEFAULT_OPTIONS,\n ...options\n };\n const elementId = this.options.id;\n this.el = null;\n\n // bind this to call\n this.call = this.tooltipHandler.bind(this);\n\n // prepend a default stylesheet for tooltips to the head\n if (!this.options.disableDefaultStyle && !document.getElementById(this.options.styleId)) {\n const style = document.createElement('style');\n style.setAttribute('id', this.options.styleId);\n style.innerHTML = createDefaultStyle(elementId);\n const head = document.head;\n if (head.childNodes.length > 0) {\n head.insertBefore(style, head.childNodes[0]);\n } else {\n head.appendChild(style);\n }\n }\n }\n\n /**\n * The tooltip handler function.\n */\n tooltipHandler(handler, event, item, value) {\n // console.log(handler, event, item, value);\n\n // append a div element that we use as a tooltip unless it already exists\n this.el = document.getElementById(this.options.id);\n if (!this.el) {\n this.el = document.createElement('div');\n this.el.setAttribute('id', this.options.id);\n this.el.classList.add('vg-tooltip');\n const tooltipContainer = document.fullscreenElement ?? document.body;\n tooltipContainer.appendChild(this.el);\n }\n\n // hide tooltip for null, undefined, or empty string values\n if (value == null || value === '') {\n this.el.classList.remove('visible', `${this.options.theme}-theme`);\n return;\n }\n\n // set the tooltip content\n this.el.innerHTML = this.options.formatTooltip(value, this.options.sanitize, this.options.maxDepth);\n\n // make the tooltip visible\n this.el.classList.add('visible', `${this.options.theme}-theme`);\n const {\n x,\n y\n } = calculatePosition(event, this.el.getBoundingClientRect(), this.options.offsetX, this.options.offsetY);\n this.el.style.top = `${y}px`;\n this.el.style.left = `${x}px`;\n }\n}\n\nconst version = pkg.version;\n\n/**\n * Create a tooltip handler and register it with the provided view.\n *\n * @param view The Vega view.\n * @param opt Tooltip options.\n */\nfunction index (view, opt) {\n const handler = new Handler(opt);\n view.tooltip(handler.call).run();\n return handler;\n}\n\nexport { DEFAULT_OPTIONS, Handler, calculatePosition, createDefaultStyle, index as default, escapeHTML, formatValue, replacer, stringify, version };\n//# sourceMappingURL=vega-tooltip.module.js.map\n","import { applyPatch } from 'fast-json-patch';\nimport stringify from 'json-stringify-pretty-compact';\nimport * as vegaImport from 'vega';\nimport { writeConfig, isString, mergeConfig, isBoolean, isObject } from 'vega';\nimport { expressionInterpreter } from 'vega-interpreter';\nimport * as vegaLiteImport from 'vega-lite';\nimport schemaParser from 'vega-schema-url-parser';\nimport * as themes from 'vega-themes';\nimport { Handler } from 'vega-tooltip';\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}\n\nfunction _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}\n\nfunction _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}\n\nfunction _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nvar iterator;\nvar hasRequiredIterator;\nfunction requireIterator() {\n if (hasRequiredIterator) return iterator;\n hasRequiredIterator = 1;\n iterator = function (Yallist) {\n Yallist.prototype[Symbol.iterator] = function* () {\n for (let walker = this.head; walker; walker = walker.next) {\n yield walker.value;\n }\n };\n };\n return iterator;\n}\n\nvar yallist = Yallist$1;\nYallist$1.Node = Node;\nYallist$1.create = Yallist$1;\nfunction Yallist$1(list) {\n var self = this;\n if (!(self instanceof Yallist$1)) {\n self = new Yallist$1();\n }\n self.tail = null;\n self.head = null;\n self.length = 0;\n if (list && typeof list.forEach === 'function') {\n list.forEach(function (item) {\n self.push(item);\n });\n } else if (arguments.length > 0) {\n for (var i = 0, l = arguments.length; i < l; i++) {\n self.push(arguments[i]);\n }\n }\n return self;\n}\nYallist$1.prototype.removeNode = function (node) {\n if (node.list !== this) {\n throw new Error('removing node which does not belong to this list');\n }\n var next = node.next;\n var prev = node.prev;\n if (next) {\n next.prev = prev;\n }\n if (prev) {\n prev.next = next;\n }\n if (node === this.head) {\n this.head = next;\n }\n if (node === this.tail) {\n this.tail = prev;\n }\n node.list.length--;\n node.next = null;\n node.prev = null;\n node.list = null;\n return next;\n};\nYallist$1.prototype.unshiftNode = function (node) {\n if (node === this.head) {\n return;\n }\n if (node.list) {\n node.list.removeNode(node);\n }\n var head = this.head;\n node.list = this;\n node.next = head;\n if (head) {\n head.prev = node;\n }\n this.head = node;\n if (!this.tail) {\n this.tail = node;\n }\n this.length++;\n};\nYallist$1.prototype.pushNode = function (node) {\n if (node === this.tail) {\n return;\n }\n if (node.list) {\n node.list.removeNode(node);\n }\n var tail = this.tail;\n node.list = this;\n node.prev = tail;\n if (tail) {\n tail.next = node;\n }\n this.tail = node;\n if (!this.head) {\n this.head = node;\n }\n this.length++;\n};\nYallist$1.prototype.push = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n push(this, arguments[i]);\n }\n return this.length;\n};\nYallist$1.prototype.unshift = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n unshift(this, arguments[i]);\n }\n return this.length;\n};\nYallist$1.prototype.pop = function () {\n if (!this.tail) {\n return undefined;\n }\n var res = this.tail.value;\n this.tail = this.tail.prev;\n if (this.tail) {\n this.tail.next = null;\n } else {\n this.head = null;\n }\n this.length--;\n return res;\n};\nYallist$1.prototype.shift = function () {\n if (!this.head) {\n return undefined;\n }\n var res = this.head.value;\n this.head = this.head.next;\n if (this.head) {\n this.head.prev = null;\n } else {\n this.tail = null;\n }\n this.length--;\n return res;\n};\nYallist$1.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this;\n for (var walker = this.head, i = 0; walker !== null; i++) {\n fn.call(thisp, walker.value, i, this);\n walker = walker.next;\n }\n};\nYallist$1.prototype.forEachReverse = function (fn, thisp) {\n thisp = thisp || this;\n for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n fn.call(thisp, walker.value, i, this);\n walker = walker.prev;\n }\n};\nYallist$1.prototype.get = function (n) {\n for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.next;\n }\n if (i === n && walker !== null) {\n return walker.value;\n }\n};\nYallist$1.prototype.getReverse = function (n) {\n for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev;\n }\n if (i === n && walker !== null) {\n return walker.value;\n }\n};\nYallist$1.prototype.map = function (fn, thisp) {\n thisp = thisp || this;\n var res = new Yallist$1();\n for (var walker = this.head; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this));\n walker = walker.next;\n }\n return res;\n};\nYallist$1.prototype.mapReverse = function (fn, thisp) {\n thisp = thisp || this;\n var res = new Yallist$1();\n for (var walker = this.tail; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this));\n walker = walker.prev;\n }\n return res;\n};\nYallist$1.prototype.reduce = function (fn, initial) {\n var acc;\n var walker = this.head;\n if (arguments.length > 1) {\n acc = initial;\n } else if (this.head) {\n walker = this.head.next;\n acc = this.head.value;\n } else {\n throw new TypeError('Reduce of empty list with no initial value');\n }\n for (var i = 0; walker !== null; i++) {\n acc = fn(acc, walker.value, i);\n walker = walker.next;\n }\n return acc;\n};\nYallist$1.prototype.reduceReverse = function (fn, initial) {\n var acc;\n var walker = this.tail;\n if (arguments.length > 1) {\n acc = initial;\n } else if (this.tail) {\n walker = this.tail.prev;\n acc = this.tail.value;\n } else {\n throw new TypeError('Reduce of empty list with no initial value');\n }\n for (var i = this.length - 1; walker !== null; i--) {\n acc = fn(acc, walker.value, i);\n walker = walker.prev;\n }\n return acc;\n};\nYallist$1.prototype.toArray = function () {\n var arr = new Array(this.length);\n for (var i = 0, walker = this.head; walker !== null; i++) {\n arr[i] = walker.value;\n walker = walker.next;\n }\n return arr;\n};\nYallist$1.prototype.toArrayReverse = function () {\n var arr = new Array(this.length);\n for (var i = 0, walker = this.tail; walker !== null; i++) {\n arr[i] = walker.value;\n walker = walker.prev;\n }\n return arr;\n};\nYallist$1.prototype.slice = function (from, to) {\n to = to || this.length;\n if (to < 0) {\n to += this.length;\n }\n from = from || 0;\n if (from < 0) {\n from += this.length;\n }\n var ret = new Yallist$1();\n if (to < from || to < 0) {\n return ret;\n }\n if (from < 0) {\n from = 0;\n }\n if (to > this.length) {\n to = this.length;\n }\n for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n walker = walker.next;\n }\n for (; walker !== null && i < to; i++, walker = walker.next) {\n ret.push(walker.value);\n }\n return ret;\n};\nYallist$1.prototype.sliceReverse = function (from, to) {\n to = to || this.length;\n if (to < 0) {\n to += this.length;\n }\n from = from || 0;\n if (from < 0) {\n from += this.length;\n }\n var ret = new Yallist$1();\n if (to < from || to < 0) {\n return ret;\n }\n if (from < 0) {\n from = 0;\n }\n if (to > this.length) {\n to = this.length;\n }\n for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n walker = walker.prev;\n }\n for (; walker !== null && i > from; i--, walker = walker.prev) {\n ret.push(walker.value);\n }\n return ret;\n};\nYallist$1.prototype.splice = function (start, deleteCount, ...nodes) {\n if (start > this.length) {\n start = this.length - 1;\n }\n if (start < 0) {\n start = this.length + start;\n }\n for (var i = 0, walker = this.head; walker !== null && i < start; i++) {\n walker = walker.next;\n }\n var ret = [];\n for (var i = 0; walker && i < deleteCount; i++) {\n ret.push(walker.value);\n walker = this.removeNode(walker);\n }\n if (walker === null) {\n walker = this.tail;\n }\n if (walker !== this.head && walker !== this.tail) {\n walker = walker.prev;\n }\n for (var i = 0; i < nodes.length; i++) {\n walker = insert(this, walker, nodes[i]);\n }\n return ret;\n};\nYallist$1.prototype.reverse = function () {\n var head = this.head;\n var tail = this.tail;\n for (var walker = head; walker !== null; walker = walker.prev) {\n var p = walker.prev;\n walker.prev = walker.next;\n walker.next = p;\n }\n this.head = tail;\n this.tail = head;\n return this;\n};\nfunction insert(self, node, value) {\n var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);\n if (inserted.next === null) {\n self.tail = inserted;\n }\n if (inserted.prev === null) {\n self.head = inserted;\n }\n self.length++;\n return inserted;\n}\nfunction push(self, item) {\n self.tail = new Node(item, self.tail, null, self);\n if (!self.head) {\n self.head = self.tail;\n }\n self.length++;\n}\nfunction unshift(self, item) {\n self.head = new Node(item, null, self.head, self);\n if (!self.tail) {\n self.tail = self.head;\n }\n self.length++;\n}\nfunction Node(value, prev, next, list) {\n if (!(this instanceof Node)) {\n return new Node(value, prev, next, list);\n }\n this.list = list;\n this.value = value;\n if (prev) {\n prev.next = this;\n this.prev = prev;\n } else {\n this.prev = null;\n }\n if (next) {\n next.prev = this;\n this.next = next;\n } else {\n this.next = null;\n }\n}\ntry {\n // add if support for Symbol.iterator is present\n requireIterator()(Yallist$1);\n} catch (er) {}\n\n// A linked list to keep track of recently-used-ness\nconst Yallist = yallist;\nconst MAX = Symbol('max');\nconst LENGTH = Symbol('length');\nconst LENGTH_CALCULATOR = Symbol('lengthCalculator');\nconst ALLOW_STALE = Symbol('allowStale');\nconst MAX_AGE = Symbol('maxAge');\nconst DISPOSE = Symbol('dispose');\nconst NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');\nconst LRU_LIST = Symbol('lruList');\nconst CACHE = Symbol('cache');\nconst UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');\nconst naiveLength = () => 1;\n\n// lruList is a yallist where the head is the youngest\n// item, and the tail is the oldest. the list contains the Hit\n// objects as the entries.\n// Each Hit object has a reference to its Yallist.Node. This\n// never changes.\n//\n// cache is a Map (or PseudoMap) that matches the keys to\n// the Yallist.Node object.\nclass LRUCache {\n constructor(options) {\n if (typeof options === 'number') options = {\n max: options\n };\n if (!options) options = {};\n if (options.max && (typeof options.max !== 'number' || options.max < 0)) throw new TypeError('max must be a non-negative number');\n // Kind of weird to have a default max of Infinity, but oh well.\n this[MAX] = options.max || Infinity;\n const lc = options.length || naiveLength;\n this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc;\n this[ALLOW_STALE] = options.stale || false;\n if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number');\n this[MAX_AGE] = options.maxAge || 0;\n this[DISPOSE] = options.dispose;\n this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;\n this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;\n this.reset();\n }\n\n // resize the cache when the max changes.\n set max(mL) {\n if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number');\n this[MAX] = mL || Infinity;\n trim(this);\n }\n get max() {\n return this[MAX];\n }\n set allowStale(allowStale) {\n this[ALLOW_STALE] = !!allowStale;\n }\n get allowStale() {\n return this[ALLOW_STALE];\n }\n set maxAge(mA) {\n if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number');\n this[MAX_AGE] = mA;\n trim(this);\n }\n get maxAge() {\n return this[MAX_AGE];\n }\n\n // resize the cache when the lengthCalculator changes.\n set lengthCalculator(lC) {\n if (typeof lC !== 'function') lC = naiveLength;\n if (lC !== this[LENGTH_CALCULATOR]) {\n this[LENGTH_CALCULATOR] = lC;\n this[LENGTH] = 0;\n this[LRU_LIST].forEach(hit => {\n hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);\n this[LENGTH] += hit.length;\n });\n }\n trim(this);\n }\n get lengthCalculator() {\n return this[LENGTH_CALCULATOR];\n }\n get length() {\n return this[LENGTH];\n }\n get itemCount() {\n return this[LRU_LIST].length;\n }\n rforEach(fn, thisp) {\n thisp = thisp || this;\n for (let walker = this[LRU_LIST].tail; walker !== null;) {\n const prev = walker.prev;\n forEachStep(this, fn, walker, thisp);\n walker = prev;\n }\n }\n forEach(fn, thisp) {\n thisp = thisp || this;\n for (let walker = this[LRU_LIST].head; walker !== null;) {\n const next = walker.next;\n forEachStep(this, fn, walker, thisp);\n walker = next;\n }\n }\n keys() {\n return this[LRU_LIST].toArray().map(k => k.key);\n }\n values() {\n return this[LRU_LIST].toArray().map(k => k.value);\n }\n reset() {\n if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {\n this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));\n }\n this[CACHE] = new Map(); // hash of items by key\n this[LRU_LIST] = new Yallist(); // list of items in order of use recency\n this[LENGTH] = 0; // length of items in the list\n }\n\n dump() {\n return this[LRU_LIST].map(hit => isStale(this, hit) ? false : {\n k: hit.key,\n v: hit.value,\n e: hit.now + (hit.maxAge || 0)\n }).toArray().filter(h => h);\n }\n dumpLru() {\n return this[LRU_LIST];\n }\n set(key, value, maxAge) {\n maxAge = maxAge || this[MAX_AGE];\n if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number');\n const now = maxAge ? Date.now() : 0;\n const len = this[LENGTH_CALCULATOR](value, key);\n if (this[CACHE].has(key)) {\n if (len > this[MAX]) {\n del(this, this[CACHE].get(key));\n return false;\n }\n const node = this[CACHE].get(key);\n const item = node.value;\n\n // dispose of the old one before overwriting\n // split out into 2 ifs for better coverage tracking\n if (this[DISPOSE]) {\n if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value);\n }\n item.now = now;\n item.maxAge = maxAge;\n item.value = value;\n this[LENGTH] += len - item.length;\n item.length = len;\n this.get(key);\n trim(this);\n return true;\n }\n const hit = new Entry(key, value, len, now, maxAge);\n\n // oversized objects fall out of cache automatically.\n if (hit.length > this[MAX]) {\n if (this[DISPOSE]) this[DISPOSE](key, value);\n return false;\n }\n this[LENGTH] += hit.length;\n this[LRU_LIST].unshift(hit);\n this[CACHE].set(key, this[LRU_LIST].head);\n trim(this);\n return true;\n }\n has(key) {\n if (!this[CACHE].has(key)) return false;\n const hit = this[CACHE].get(key).value;\n return !isStale(this, hit);\n }\n get(key) {\n return get(this, key, true);\n }\n peek(key) {\n return get(this, key, false);\n }\n pop() {\n const node = this[LRU_LIST].tail;\n if (!node) return null;\n del(this, node);\n return node.value;\n }\n del(key) {\n del(this, this[CACHE].get(key));\n }\n load(arr) {\n // reset the cache\n this.reset();\n const now = Date.now();\n // A previous serialized cache has the most recent items first\n for (let l = arr.length - 1; l >= 0; l--) {\n const hit = arr[l];\n const expiresAt = hit.e || 0;\n if (expiresAt === 0)\n // the item was created without expiration in a non aged cache\n this.set(hit.k, hit.v);else {\n const maxAge = expiresAt - now;\n // dont add already expired items\n if (maxAge > 0) {\n this.set(hit.k, hit.v, maxAge);\n }\n }\n }\n }\n prune() {\n this[CACHE].forEach((value, key) => get(this, key, false));\n }\n}\nconst get = (self, key, doUse) => {\n const node = self[CACHE].get(key);\n if (node) {\n const hit = node.value;\n if (isStale(self, hit)) {\n del(self, node);\n if (!self[ALLOW_STALE]) return undefined;\n } else {\n if (doUse) {\n if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now();\n self[LRU_LIST].unshiftNode(node);\n }\n }\n return hit.value;\n }\n};\nconst isStale = (self, hit) => {\n if (!hit || !hit.maxAge && !self[MAX_AGE]) return false;\n const diff = Date.now() - hit.now;\n return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];\n};\nconst trim = self => {\n if (self[LENGTH] > self[MAX]) {\n for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) {\n // We know that we're about to delete this one, and also\n // what the next least recently used key will be, so just\n // go ahead and set it now.\n const prev = walker.prev;\n del(self, walker);\n walker = prev;\n }\n }\n};\nconst del = (self, node) => {\n if (node) {\n const hit = node.value;\n if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value);\n self[LENGTH] -= hit.length;\n self[CACHE].delete(hit.key);\n self[LRU_LIST].removeNode(node);\n }\n};\nclass Entry {\n constructor(key, value, length, now, maxAge) {\n this.key = key;\n this.value = value;\n this.length = length;\n this.now = now;\n this.maxAge = maxAge || 0;\n }\n}\nconst forEachStep = (self, fn, node, thisp) => {\n let hit = node.value;\n if (isStale(self, hit)) {\n del(self, node);\n if (!self[ALLOW_STALE]) hit = undefined;\n }\n if (hit) fn.call(thisp, hit.value, hit.key, self);\n};\nvar lruCache = LRUCache;\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({\n loose: true\n});\nconst emptyOpts = Object.freeze({});\nconst parseOptions$1 = options => {\n if (!options) {\n return emptyOpts;\n }\n if (typeof options !== 'object') {\n return looseOption;\n }\n return options;\n};\nvar parseOptions_1 = parseOptions$1;\n\nvar re$1 = {exports: {}};\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0';\nconst MAX_LENGTH$1 = 256;\nconst MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16;\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;\nconst RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];\nvar constants = {\n MAX_LENGTH: MAX_LENGTH$1,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010\n};\n\nconst debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\\bsemver\\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {};\nvar debug_1 = debug$1;\n\n(function (module, exports) {\n const {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH\n } = constants;\n const debug = debug_1;\n exports = module.exports = {};\n\n // The actual regexps go on exports.re\n const re = exports.re = [];\n const safeRe = exports.safeRe = [];\n const src = exports.src = [];\n const t = exports.t = {};\n let R = 0;\n const LETTERDASHNUMBER = '[a-zA-Z0-9-]';\n\n // Replace some greedy regex tokens to prevent regex dos issues. These regex are\n // used internally via the safeRe object since all inputs in this library get\n // normalized first to trim and collapse all extra whitespace. The original\n // regexes are exported for userland consumption and lower level usage. A\n // future breaking change could export the safer regex only with a note that\n // all input should have extra whitespace removed.\n const safeRegexReplacements = [['\\\\s', 1], ['\\\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]];\n const makeSafeRegex = value => {\n for (const [token, max] of safeRegexReplacements) {\n value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);\n }\n return value;\n };\n const createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value);\n const index = R++;\n debug(name, index, value);\n t[name] = index;\n src[index] = value;\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined);\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);\n };\n\n // The following Regular Expressions can be used for tokenizing,\n // validating, and parsing SemVer version strings.\n\n // ## Numeric Identifier\n // A single `0`, or a non-zero digit followed by zero or more digits.\n\n createToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*');\n createToken('NUMERICIDENTIFIERLOOSE', '\\\\d+');\n\n // ## Non-numeric Identifier\n // Zero or more digits, followed by a letter or hyphen, and then zero or\n // more letters, digits, or hyphens.\n\n createToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);\n\n // ## Main Version\n // Three dot-separated numeric identifiers.\n\n createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` + `(${src[t.NUMERICIDENTIFIER]})\\\\.` + `(${src[t.NUMERICIDENTIFIER]})`);\n createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);\n\n // ## Pre-release Version Identifier\n // A numeric identifier, or a non-numeric identifier.\n\n createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);\n createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);\n\n // ## Pre-release Version\n // Hyphen, followed by one or more dot-separated pre-release version\n // identifiers.\n\n createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`);\n createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);\n\n // ## Build Metadata Identifier\n // Any combination of digits, letters, or hyphens.\n\n createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);\n\n // ## Build Metadata\n // Plus sign, followed by one or more period-separated build metadata\n // identifiers.\n\n createToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`);\n\n // ## Full Version String\n // A main version, followed optionally by a pre-release version and\n // build metadata.\n\n // Note that the only major, minor, patch, and pre-release sections of\n // the version string are capturing groups. The build metadata is not a\n // capturing group, because it should not ever be used in version\n // comparison.\n\n createToken('FULLPLAIN', `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);\n createToken('FULL', `^${src[t.FULLPLAIN]}$`);\n\n // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n // common in the npm registry.\n createToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);\n createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);\n createToken('GTLT', '((?:<|>)?=?)');\n\n // Something like \"2.*\" or \"1.2.x\".\n // Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n // Only the first item is strictly required.\n createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`);\n createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`);\n createToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);\n createToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);\n createToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`);\n createToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`);\n\n // Coercion.\n // Extract anything that could conceivably be a part of a valid semver\n createToken('COERCE', `${'(^|[^\\\\d])' + '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:$|[^\\\\d])`);\n createToken('COERCERTL', src[t.COERCE], true);\n\n // Tilde ranges.\n // Meaning is \"reasonably at or greater than\"\n createToken('LONETILDE', '(?:~>?)');\n createToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true);\n exports.tildeTrimReplace = '$1~';\n createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);\n createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);\n\n // Caret ranges.\n // Meaning is \"at least and backwards compatible with\"\n createToken('LONECARET', '(?:\\\\^)');\n createToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true);\n exports.caretTrimReplace = '$1^';\n createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);\n createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);\n\n // A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\n createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`);\n createToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`);\n\n // An expression to strip any whitespace between the gtlt and the thing\n // it modifies, so that `> 1.2.3` ==> `>1.2.3`\n createToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);\n exports.comparatorTrimReplace = '$1$2$3';\n\n // Something like `1.2.3 - 1.2.4`\n // Note that these all use the loose form, because they'll be\n // checked against either the strict or loose comparator form\n // later.\n createToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` + `\\\\s+-\\\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\\\s*$`);\n createToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\\\s+-\\\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\\\s*$`);\n\n // Star ranges basically just allow anything at all.\n createToken('STAR', '(<|>)?=?\\\\s*\\\\*');\n // >=0.0.0 is like a star\n createToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$');\n createToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$');\n})(re$1, re$1.exports);\nvar reExports = re$1.exports;\n\nconst numeric = /^[0-9]+$/;\nconst compareIdentifiers$1 = (a, b) => {\n const anum = numeric.test(a);\n const bnum = numeric.test(b);\n if (anum && bnum) {\n a = +a;\n b = +b;\n }\n return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;\n};\nconst rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);\nvar identifiers = {\n compareIdentifiers: compareIdentifiers$1,\n rcompareIdentifiers\n};\n\nconst debug = debug_1;\nconst {\n MAX_LENGTH,\n MAX_SAFE_INTEGER\n} = constants;\nconst {\n safeRe: re,\n t\n} = reExports;\nconst parseOptions = parseOptions_1;\nconst {\n compareIdentifiers\n} = identifiers;\nlet SemVer$1 = class SemVer {\n constructor(version, options) {\n options = parseOptions(options);\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {\n return version;\n } else {\n version = version.version;\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`);\n }\n if (version.length > MAX_LENGTH) {\n throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);\n }\n debug('SemVer', version, options);\n this.options = options;\n this.loose = !!options.loose;\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease;\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`);\n }\n this.raw = version;\n\n // these are actually numbers\n this.major = +m[1];\n this.minor = +m[2];\n this.patch = +m[3];\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version');\n }\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version');\n }\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version');\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = [];\n } else {\n this.prerelease = m[4].split('.').map(id => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id;\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num;\n }\n }\n return id;\n });\n }\n this.build = m[5] ? m[5].split('.') : [];\n this.format();\n }\n format() {\n this.version = `${this.major}.${this.minor}.${this.patch}`;\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`;\n }\n return this.version;\n }\n toString() {\n return this.version;\n }\n compare(other) {\n debug('SemVer.compare', this.version, this.options, other);\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0;\n }\n other = new SemVer(other, this.options);\n }\n if (other.version === this.version) {\n return 0;\n }\n return this.compareMain(other) || this.comparePre(other);\n }\n compareMain(other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options);\n }\n return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);\n }\n comparePre(other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options);\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1;\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1;\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0;\n }\n let i = 0;\n do {\n const a = this.prerelease[i];\n const b = other.prerelease[i];\n debug('prerelease compare', i, a, b);\n if (a === undefined && b === undefined) {\n return 0;\n } else if (b === undefined) {\n return 1;\n } else if (a === undefined) {\n return -1;\n } else if (a === b) {\n continue;\n } else {\n return compareIdentifiers(a, b);\n }\n } while (++i);\n }\n compareBuild(other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options);\n }\n let i = 0;\n do {\n const a = this.build[i];\n const b = other.build[i];\n debug('prerelease compare', i, a, b);\n if (a === undefined && b === undefined) {\n return 0;\n } else if (b === undefined) {\n return 1;\n } else if (a === undefined) {\n return -1;\n } else if (a === b) {\n continue;\n } else {\n return compareIdentifiers(a, b);\n }\n } while (++i);\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc(release, identifier, identifierBase) {\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0;\n this.patch = 0;\n this.minor = 0;\n this.major++;\n this.inc('pre', identifier, identifierBase);\n break;\n case 'preminor':\n this.prerelease.length = 0;\n this.patch = 0;\n this.minor++;\n this.inc('pre', identifier, identifierBase);\n break;\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0;\n this.inc('patch', identifier, identifierBase);\n this.inc('pre', identifier, identifierBase);\n break;\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase);\n }\n this.inc('pre', identifier, identifierBase);\n break;\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {\n this.major++;\n }\n this.minor = 0;\n this.patch = 0;\n this.prerelease = [];\n break;\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++;\n }\n this.patch = 0;\n this.prerelease = [];\n break;\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++;\n }\n this.prerelease = [];\n break;\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre':\n {\n const base = Number(identifierBase) ? 1 : 0;\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty');\n }\n if (this.prerelease.length === 0) {\n this.prerelease = [base];\n } else {\n let i = this.prerelease.length;\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++;\n i = -2;\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists');\n }\n this.prerelease.push(base);\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base];\n if (identifierBase === false) {\n prerelease = [identifier];\n }\n if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = prerelease;\n }\n } else {\n this.prerelease = prerelease;\n }\n }\n break;\n }\n default:\n throw new Error(`invalid increment argument: ${release}`);\n }\n this.raw = this.format();\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`;\n }\n return this;\n }\n};\nvar semver = SemVer$1;\n\nconst SemVer = semver;\nconst compare$6 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));\nvar compare_1 = compare$6;\n\nconst compare$5 = compare_1;\nconst eq$1 = (a, b, loose) => compare$5(a, b, loose) === 0;\nvar eq_1 = eq$1;\n\nconst compare$4 = compare_1;\nconst neq$1 = (a, b, loose) => compare$4(a, b, loose) !== 0;\nvar neq_1 = neq$1;\n\nconst compare$3 = compare_1;\nconst gt$1 = (a, b, loose) => compare$3(a, b, loose) > 0;\nvar gt_1 = gt$1;\n\nconst compare$2 = compare_1;\nconst gte$1 = (a, b, loose) => compare$2(a, b, loose) >= 0;\nvar gte_1 = gte$1;\n\nconst compare$1 = compare_1;\nconst lt$1 = (a, b, loose) => compare$1(a, b, loose) < 0;\nvar lt_1 = lt$1;\n\nconst compare = compare_1;\nconst lte$1 = (a, b, loose) => compare(a, b, loose) <= 0;\nvar lte_1 = lte$1;\n\nconst eq = eq_1;\nconst neq = neq_1;\nconst gt = gt_1;\nconst gte = gte_1;\nconst lt = lt_1;\nconst lte = lte_1;\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version;\n }\n if (typeof b === 'object') {\n b = b.version;\n }\n return a === b;\n case '!==':\n if (typeof a === 'object') {\n a = a.version;\n }\n if (typeof b === 'object') {\n b = b.version;\n }\n return a !== b;\n case '':\n case '=':\n case '==':\n return eq(a, b, loose);\n case '!=':\n return neq(a, b, loose);\n case '>':\n return gt(a, b, loose);\n case '>=':\n return gte(a, b, loose);\n case '<':\n return lt(a, b, loose);\n case '<=':\n return lte(a, b, loose);\n default:\n throw new TypeError(`Invalid operator: ${op}`);\n }\n};\nvar cmp_1 = cmp;\n\nvar comparator;\nvar hasRequiredComparator;\nfunction requireComparator() {\n if (hasRequiredComparator) return comparator;\n hasRequiredComparator = 1;\n const ANY = Symbol('SemVer ANY');\n // hoisted class for cyclic dependency\n class Comparator {\n static get ANY() {\n return ANY;\n }\n constructor(comp, options) {\n options = parseOptions(options);\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp;\n } else {\n comp = comp.value;\n }\n }\n comp = comp.trim().split(/\\s+/).join(' ');\n debug('comparator', comp, options);\n this.options = options;\n this.loose = !!options.loose;\n this.parse(comp);\n if (this.semver === ANY) {\n this.value = '';\n } else {\n this.value = this.operator + this.semver.version;\n }\n debug('comp', this);\n }\n parse(comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];\n const m = comp.match(r);\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`);\n }\n this.operator = m[1] !== undefined ? m[1] : '';\n if (this.operator === '=') {\n this.operator = '';\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY;\n } else {\n this.semver = new SemVer(m[2], this.options.loose);\n }\n }\n toString() {\n return this.value;\n }\n test(version) {\n debug('Comparator.test', version, this.options.loose);\n if (this.semver === ANY || version === ANY) {\n return true;\n }\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options);\n } catch (er) {\n return false;\n }\n }\n return cmp(version, this.operator, this.semver, this.options);\n }\n intersects(comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required');\n }\n if (this.operator === '') {\n if (this.value === '') {\n return true;\n }\n return new Range(comp.value, options).test(this.value);\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true;\n }\n return new Range(this.value, options).test(comp.semver);\n }\n options = parseOptions(options);\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease && (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false;\n }\n if (!options.includePrerelease && (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false;\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true;\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true;\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (this.semver.version === comp.semver.version && this.operator.includes('=') && comp.operator.includes('=')) {\n return true;\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) && this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true;\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) && this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true;\n }\n return false;\n }\n }\n comparator = Comparator;\n const parseOptions = parseOptions_1;\n const {\n safeRe: re,\n t\n } = reExports;\n const cmp = cmp_1;\n const debug = debug_1;\n const SemVer = semver;\n const Range = requireRange();\n return comparator;\n}\n\nvar range;\nvar hasRequiredRange;\nfunction requireRange() {\n if (hasRequiredRange) return range;\n hasRequiredRange = 1;\n // hoisted class for cyclic dependency\n class Range {\n constructor(range, options) {\n options = parseOptions(options);\n if (range instanceof Range) {\n if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {\n return range;\n } else {\n return new Range(range.raw, options);\n }\n }\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value;\n this.set = [[range]];\n this.format();\n return this;\n }\n this.options = options;\n this.loose = !!options.loose;\n this.includePrerelease = !!options.includePrerelease;\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().split(/\\s+/).join(' ');\n\n // First, split on ||\n this.set = this.raw.split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length);\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`);\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0];\n this.set = this.set.filter(c => !isNullSet(c[0]));\n if (this.set.length === 0) {\n this.set = [first];\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c];\n break;\n }\n }\n }\n }\n this.format();\n }\n format() {\n this.range = this.set.map(comps => comps.join(' ').trim()).join('||').trim();\n return this.range;\n }\n toString() {\n return this.range;\n }\n parseRange(range) {\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);\n const memoKey = memoOpts + ':' + range;\n const cached = cache.get(memoKey);\n if (cached) {\n return cached;\n }\n const loose = this.options.loose;\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease));\n debug('hyphen replace', range);\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);\n debug('comparator trim', range);\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace);\n debug('tilde trim', range);\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace);\n debug('caret trim', range);\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options));\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options);\n return !!comp.match(re[t.COMPARATORLOOSE]);\n });\n }\n debug('range list', rangeList);\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map();\n const comparators = rangeList.map(comp => new Comparator(comp, this.options));\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp];\n }\n rangeMap.set(comp.value, comp);\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('');\n }\n const result = [...rangeMap.values()];\n cache.set(memoKey, result);\n return result;\n }\n intersects(range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required');\n }\n return this.set.some(thisComparators => {\n return isSatisfiable(thisComparators, options) && range.set.some(rangeComparators => {\n return isSatisfiable(rangeComparators, options) && thisComparators.every(thisComparator => {\n return rangeComparators.every(rangeComparator => {\n return thisComparator.intersects(rangeComparator, options);\n });\n });\n });\n });\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test(version) {\n if (!version) {\n return false;\n }\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options);\n } catch (er) {\n return false;\n }\n }\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true;\n }\n }\n return false;\n }\n }\n range = Range;\n const LRU = lruCache;\n const cache = new LRU({\n max: 1000\n });\n const parseOptions = parseOptions_1;\n const Comparator = requireComparator();\n const debug = debug_1;\n const SemVer = semver;\n const {\n safeRe: re,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace\n } = reExports;\n const {\n FLAG_INCLUDE_PRERELEASE,\n FLAG_LOOSE\n } = constants;\n const isNullSet = c => c.value === '<0.0.0-0';\n const isAny = c => c.value === '';\n\n // take a set of comparators and determine whether there\n // exists a version which can satisfy it\n const isSatisfiable = (comparators, options) => {\n let result = true;\n const remainingComparators = comparators.slice();\n let testComparator = remainingComparators.pop();\n while (result && remainingComparators.length) {\n result = remainingComparators.every(otherComparator => {\n return testComparator.intersects(otherComparator, options);\n });\n testComparator = remainingComparators.pop();\n }\n return result;\n };\n\n // comprised of xranges, tildes, stars, and gtlt's at this point.\n // already replaced the hyphen ranges\n // turn into a set of JUST comparators.\n const parseComparator = (comp, options) => {\n debug('comp', comp, options);\n comp = replaceCarets(comp, options);\n debug('caret', comp);\n comp = replaceTildes(comp, options);\n debug('tildes', comp);\n comp = replaceXRanges(comp, options);\n debug('xrange', comp);\n comp = replaceStars(comp, options);\n debug('stars', comp);\n return comp;\n };\n const isX = id => !id || id.toLowerCase() === 'x' || id === '*';\n\n // ~, ~> --> * (any, kinda silly)\n // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n // ~0.0.1 --> >=0.0.1 <0.1.0-0\n const replaceTildes = (comp, options) => {\n return comp.trim().split(/\\s+/).map(c => replaceTilde(c, options)).join(' ');\n };\n const replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr);\n let ret;\n if (isX(M)) {\n ret = '';\n } else if (isX(m)) {\n ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;\n } else if (pr) {\n debug('replaceTilde pr', pr);\n ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;\n }\n debug('tilde return', ret);\n return ret;\n });\n };\n\n // ^ --> * (any, kinda silly)\n // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n // ^1.2.3 --> >=1.2.3 <2.0.0-0\n // ^1.2.0 --> >=1.2.0 <2.0.0-0\n // ^0.0.1 --> >=0.0.1 <0.0.2-0\n // ^0.1.0 --> >=0.1.0 <0.2.0-0\n const replaceCarets = (comp, options) => {\n return comp.trim().split(/\\s+/).map(c => replaceCaret(c, options)).join(' ');\n };\n const replaceCaret = (comp, options) => {\n debug('caret', comp, options);\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];\n const z = options.includePrerelease ? '-0' : '';\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr);\n let ret;\n if (isX(M)) {\n ret = '';\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;\n }\n } else if (pr) {\n debug('replaceCaret pr', pr);\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;\n } else {\n ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;\n }\n } else {\n debug('no pr');\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;\n } else {\n ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;\n }\n } else {\n ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;\n }\n }\n debug('caret return', ret);\n return ret;\n });\n };\n const replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options);\n return comp.split(/\\s+/).map(c => replaceXRange(c, options)).join(' ');\n };\n const replaceXRange = (comp, options) => {\n comp = comp.trim();\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr);\n const xM = isX(M);\n const xm = xM || isX(m);\n const xp = xm || isX(p);\n const anyX = xp;\n if (gtlt === '=' && anyX) {\n gtlt = '';\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : '';\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0';\n } else {\n // nothing is forbidden\n ret = '*';\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0;\n }\n p = 0;\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>=';\n if (xm) {\n M = +M + 1;\n m = 0;\n p = 0;\n } else {\n m = +m + 1;\n p = 0;\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<';\n if (xm) {\n M = +M + 1;\n } else {\n m = +m + 1;\n }\n }\n if (gtlt === '<') {\n pr = '-0';\n }\n ret = `${gtlt + M}.${m}.${p}${pr}`;\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;\n }\n debug('xRange return', ret);\n return ret;\n });\n };\n\n // Because * is AND-ed with everything else in the comparator,\n // and '' means \"any version\", just remove the *s entirely.\n const replaceStars = (comp, options) => {\n debug('replaceStars', comp, options);\n // Looseness is ignored here. star is always as loose as it gets!\n return comp.trim().replace(re[t.STAR], '');\n };\n const replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options);\n return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '');\n };\n\n // This function is passed to string.replace(re[t.HYPHENRANGE])\n // M, m, patch, prerelease, build\n // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n // 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {\n if (isX(fM)) {\n from = '';\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`;\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;\n } else if (fpr) {\n from = `>=${from}`;\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`;\n }\n if (isX(tM)) {\n to = '';\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`;\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`;\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`;\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`;\n } else {\n to = `<=${to}`;\n }\n return `${from} ${to}`.trim();\n };\n const testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false;\n }\n }\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver);\n if (set[i].semver === Comparator.ANY) {\n continue;\n }\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver;\n if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {\n return true;\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false;\n }\n return true;\n };\n return range;\n}\n\nconst Range = requireRange();\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options);\n } catch (er) {\n return false;\n }\n return range.test(version);\n};\nvar satisfies_1 = satisfies;\nvar satisfies$1 = /*@__PURE__*/getDefaultExportFromCjs(satisfies_1);\n\n/**\n * Open editor url in a new window, and pass a message.\n */\nfunction post (window, url, data) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const editor = window.open(url);\n const wait = 10_000;\n const step = 250;\n const {\n origin\n } = new URL(url);\n // eslint-disable-next-line no-bitwise\n let count = ~~(wait / step);\n function listen(evt) {\n if (evt.source === editor) {\n count = 0;\n window.removeEventListener('message', listen, false);\n }\n }\n window.addEventListener('message', listen, false);\n\n // send message\n // periodically resend until ack received or timeout\n function send() {\n if (count <= 0) {\n return;\n }\n editor.postMessage(data, origin);\n setTimeout(send, step);\n count -= 1;\n }\n setTimeout(send, step);\n}\n\n// generated with build-style.sh\nvar embedStyle = `.vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box;\n}\n.vega-embed.has-actions {\n padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: \"\";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n`;\n\nfunction mergeDeep(dest, ...src) {\n for (const s of src) {\n deepMerge_(dest, s);\n }\n return dest;\n}\nfunction deepMerge_(dest, src) {\n for (const property of Object.keys(src)) {\n writeConfig(dest, property, src[property], true);\n }\n}\n\nvar name = \"vega-embed\";\nvar version$1 = \"6.23.0\";\nvar description = \"Publish Vega visualizations as embedded web components.\";\nvar keywords = [\"vega\", \"data\", \"visualization\", \"component\", \"embed\"];\nvar repository = {\n type: \"git\",\n url: \"http://github.com/vega/vega-embed.git\"\n};\nvar author = {\n name: \"UW Interactive Data Lab\",\n url: \"http://idl.cs.washington.edu\"\n};\nvar contributors = [{\n name: \"Dominik Moritz\",\n url: \"https://www.domoritz.de\"\n}];\nvar bugs = {\n url: \"https://github.com/vega/vega-embed/issues\"\n};\nvar homepage = \"https://github.com/vega/vega-embed#readme\";\nvar license = \"BSD-3-Clause\";\nvar main = \"build/vega-embed.js\";\nvar module = \"build/vega-embed.module.js\";\nvar unpkg = \"build/vega-embed.min.js\";\nvar jsdelivr = \"build/vega-embed.min.js\";\nvar types = \"build/vega-embed.module.d.ts\";\nvar files = [\"src\", \"build\", \"patches\"];\nvar devDependencies = {\n \"@babel/core\": \"^7.22.9\",\n \"@babel/plugin-proposal-async-generator-functions\": \"^7.20.7\",\n \"@babel/plugin-proposal-json-strings\": \"^7.18.6\",\n \"@babel/plugin-proposal-object-rest-spread\": \"^7.20.7\",\n \"@babel/plugin-proposal-optional-catch-binding\": \"^7.18.6\",\n \"@babel/plugin-transform-runtime\": \"^7.22.9\",\n \"@babel/preset-env\": \"^7.22.9\",\n \"@babel/preset-typescript\": \"^7.22.5\",\n \"@release-it/conventional-changelog\": \"^7.0.0\",\n \"@rollup/plugin-commonjs\": \"25.0.4\",\n \"@rollup/plugin-json\": \"^6.0.0\",\n \"@rollup/plugin-node-resolve\": \"^15.1.0\",\n \"@rollup/plugin-terser\": \"^0.4.3\",\n \"@types/semver\": \"^7.5.0\",\n \"@typescript-eslint/eslint-plugin\": \"^6.2.0\",\n \"@typescript-eslint/parser\": \"^6.2.0\",\n \"browser-sync\": \"^2.29.3\",\n concurrently: \"^8.2.0\",\n \"del-cli\": \"^5.0.0\",\n eslint: \"^8.46.0\",\n \"eslint-config-prettier\": \"^9.0.0\",\n \"eslint-plugin-jest\": \"^27.2.3\",\n \"eslint-plugin-prettier\": \"^5.0.0\",\n jest: \"^29.6.2\",\n \"jest-canvas-mock\": \"^2.5.2\",\n \"jest-environment-jsdom\": \"^29.6.2\",\n \"patch-package\": \"^8.0.0\",\n \"postinstall-postinstall\": \"^2.1.0\",\n prettier: \"^3.0.0\",\n \"release-it\": \"^16.1.3\",\n rollup: \"3.29.1\",\n \"rollup-plugin-bundle-size\": \"^1.0.3\",\n \"rollup-plugin-ts\": \"^3.2.0\",\n sass: \"^1.64.1\",\n typescript: \"^5.1.6\",\n vega: \"^5.22.1\",\n \"vega-lite\": \"^5.2.0\"\n};\nvar peerDependencies = {\n vega: \"^5.21.0\",\n \"vega-lite\": \"*\"\n};\nvar dependencies = {\n \"fast-json-patch\": \"^3.1.1\",\n \"json-stringify-pretty-compact\": \"^3.0.0\",\n semver: \"^7.5.4\",\n tslib: \"^2.6.1\",\n \"vega-interpreter\": \"^1.0.5\",\n \"vega-schema-url-parser\": \"^2.2.0\",\n \"vega-themes\": \"^2.14.0\",\n \"vega-tooltip\": \"^0.33.0\"\n};\nvar bundledDependencies = [\"yallist\"];\nvar scripts = {\n prebuild: \"yarn clean && yarn build:style\",\n build: \"rollup -c\",\n \"build:style\": \"./build-style.sh\",\n clean: \"del-cli build src/style.ts\",\n prepublishOnly: \"yarn clean && yarn build\",\n preversion: \"yarn lint && yarn test\",\n serve: \"browser-sync start --directory -s -f build *.html\",\n start: \"yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'\",\n pretest: \"yarn build:style\",\n test: \"jest\",\n \"test:inspect\": \"node --inspect-brk ./node_modules/.bin/jest --runInBand\",\n prettierbase: \"prettier '*.{css,scss,html}'\",\n format: \"eslint . --fix && yarn prettierbase --write\",\n lint: \"eslint . && yarn prettierbase --check\",\n release: \"release-it\"\n};\nvar pkg = {\n name: name,\n version: version$1,\n description: description,\n keywords: keywords,\n repository: repository,\n author: author,\n contributors: contributors,\n bugs: bugs,\n homepage: homepage,\n license: license,\n main: main,\n module: module,\n unpkg: unpkg,\n jsdelivr: jsdelivr,\n types: types,\n files: files,\n devDependencies: devDependencies,\n peerDependencies: peerDependencies,\n dependencies: dependencies,\n bundledDependencies: bundledDependencies,\n scripts: scripts\n};\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nconst version = pkg.version;\nconst vega = vegaImport;\nlet vegaLite = vegaLiteImport;\n\n// For backwards compatibility with Vega-Lite before v4.\nconst w = typeof window !== 'undefined' ? window : undefined;\nif (vegaLite === undefined && w?.vl?.compile) {\n vegaLite = w.vl;\n}\nconst DEFAULT_ACTIONS = {\n export: {\n svg: true,\n png: true\n },\n source: true,\n compiled: true,\n editor: true\n};\nconst I18N = {\n CLICK_TO_VIEW_ACTIONS: 'Click to view actions',\n COMPILED_ACTION: 'View Compiled Vega',\n EDITOR_ACTION: 'Open in Vega Editor',\n PNG_ACTION: 'Save as PNG',\n SOURCE_ACTION: 'View Source',\n SVG_ACTION: 'Save as SVG'\n};\nconst NAMES = {\n vega: 'Vega',\n 'vega-lite': 'Vega-Lite'\n};\nconst VERSION = {\n vega: vega.version,\n 'vega-lite': vegaLite ? vegaLite.version : 'not available'\n};\nconst PREPROCESSOR = {\n vega: vgSpec => vgSpec,\n 'vega-lite': (vlSpec, config) => vegaLite.compile(vlSpec, {\n config: config\n }).spec\n};\nconst SVG_CIRCLES = `\n\n \n \n \n`;\nconst CHART_WRAPPER_CLASS = 'chart-wrapper';\nfunction isTooltipHandler(h) {\n return typeof h === 'function';\n}\nfunction viewSource(source, sourceHeader, sourceFooter, mode) {\n const header = `${sourceHeader}
`;\n  const footer = `
${sourceFooter}`;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const win = window.open('');\n win.document.write(header + source + footer);\n win.document.title = `${NAMES[mode]} JSON Source`;\n}\n\n/**\n * Try to guess the type of spec.\n *\n * @param spec Vega or Vega-Lite spec.\n */\nfunction guessMode(spec, providedMode) {\n // Decide mode\n if (spec.$schema) {\n const parsed = schemaParser(spec.$schema);\n if (providedMode && providedMode !== parsed.library) {\n console.warn(`The given visualization spec is written in ${NAMES[parsed.library]}, but mode argument sets ${NAMES[providedMode] ?? providedMode}.`);\n }\n const mode = parsed.library;\n if (!satisfies$1(VERSION[mode], `^${parsed.version.slice(1)}`)) {\n console.warn(`The input spec uses ${NAMES[mode]} ${parsed.version}, but the current version of ${NAMES[mode]} is v${VERSION[mode]}.`);\n }\n return mode;\n }\n\n // try to guess from the provided spec\n if ('mark' in spec || 'encoding' in spec || 'layer' in spec || 'hconcat' in spec || 'vconcat' in spec || 'facet' in spec || 'repeat' in spec) {\n return 'vega-lite';\n }\n if ('marks' in spec || 'signals' in spec || 'scales' in spec || 'axes' in spec) {\n return 'vega';\n }\n return providedMode ?? 'vega';\n}\nfunction isLoader(o) {\n return !!(o && 'load' in o);\n}\nfunction createLoader(opts) {\n return isLoader(opts) ? opts : vega.loader(opts);\n}\nfunction embedOptionsFromUsermeta(parsedSpec) {\n const opts = parsedSpec.usermeta?.embedOptions ?? {};\n if (isString(opts.defaultStyle)) {\n // we don't allow styles set via usermeta since it would allow injection of logic (we set the style via innerHTML)\n opts.defaultStyle = false;\n }\n return opts;\n}\n\n/**\n * Embed a Vega visualization component in a web page. This function returns a promise.\n *\n * @param el DOM element in which to place component (DOM node or CSS selector).\n * @param spec String : A URL string from which to load the Vega specification.\n * Object : The Vega/Vega-Lite specification as a parsed JSON object.\n * @param opts A JavaScript object containing options for embedding.\n */\nasync function embed(el, spec, opts = {}) {\n let parsedSpec;\n let loader;\n if (isString(spec)) {\n loader = createLoader(opts.loader);\n parsedSpec = JSON.parse(await loader.load(spec));\n } else {\n parsedSpec = spec;\n }\n const loadedEmbedOptions = embedOptionsFromUsermeta(parsedSpec);\n const usermetaLoader = loadedEmbedOptions.loader;\n\n // either create the loader for the first time or create a new loader if the spec has new loader options\n if (!loader || usermetaLoader) {\n loader = createLoader(opts.loader ?? usermetaLoader);\n }\n const usermetaOpts = await loadOpts(loadedEmbedOptions, loader);\n const parsedOpts = await loadOpts(opts, loader);\n const mergedOpts = _objectSpread(_objectSpread({}, mergeDeep(parsedOpts, usermetaOpts)), {}, {\n config: mergeConfig(parsedOpts.config ?? {}, usermetaOpts.config ?? {})\n });\n return await _embed(el, parsedSpec, mergedOpts, loader);\n}\nasync function loadOpts(opt, loader) {\n const config = isString(opt.config) ? JSON.parse(await loader.load(opt.config)) : opt.config ?? {};\n const patch = isString(opt.patch) ? JSON.parse(await loader.load(opt.patch)) : opt.patch;\n return _objectSpread(_objectSpread(_objectSpread({}, opt), patch ? {\n patch\n } : {}), config ? {\n config\n } : {});\n}\nfunction getRoot(el) {\n const possibleRoot = el.getRootNode ? el.getRootNode() : document;\n return possibleRoot instanceof ShadowRoot ? {\n root: possibleRoot,\n rootContainer: possibleRoot\n } : {\n root: document,\n rootContainer: document.head ?? document.body\n };\n}\nasync function _embed(el, spec, opts = {}, loader) {\n const config = opts.theme ? mergeConfig(themes[opts.theme], opts.config ?? {}) : opts.config;\n const actions = isBoolean(opts.actions) ? opts.actions : mergeDeep({}, DEFAULT_ACTIONS, opts.actions ?? {});\n const i18n = _objectSpread(_objectSpread({}, I18N), opts.i18n);\n const renderer = opts.renderer ?? 'canvas';\n const logLevel = opts.logLevel ?? vega.Warn;\n const downloadFileName = opts.downloadFileName ?? 'visualization';\n const element = typeof el === 'string' ? document.querySelector(el) : el;\n if (!element) {\n throw new Error(`${el} does not exist`);\n }\n if (opts.defaultStyle !== false) {\n const ID = 'vega-embed-style';\n const {\n root,\n rootContainer\n } = getRoot(element);\n if (!root.getElementById(ID)) {\n const style = document.createElement('style');\n style.id = ID;\n style.innerHTML = opts.defaultStyle === undefined || opts.defaultStyle === true ? (embedStyle ).toString() : opts.defaultStyle;\n rootContainer.appendChild(style);\n }\n }\n const mode = guessMode(spec, opts.mode);\n let vgSpec = PREPROCESSOR[mode](spec, config);\n if (mode === 'vega-lite') {\n if (vgSpec.$schema) {\n const parsed = schemaParser(vgSpec.$schema);\n if (!satisfies$1(VERSION.vega, `^${parsed.version.slice(1)}`)) {\n console.warn(`The compiled spec uses Vega ${parsed.version}, but current version is v${VERSION.vega}.`);\n }\n }\n }\n element.classList.add('vega-embed');\n if (actions) {\n element.classList.add('has-actions');\n }\n element.innerHTML = ''; // clear container\n\n let container = element;\n if (actions) {\n const chartWrapper = document.createElement('div');\n chartWrapper.classList.add(CHART_WRAPPER_CLASS);\n element.appendChild(chartWrapper);\n container = chartWrapper;\n }\n const patch = opts.patch;\n if (patch) {\n vgSpec = patch instanceof Function ? patch(vgSpec) : applyPatch(vgSpec, patch, true, false).newDocument;\n }\n\n // Set locale. Note that this is a global setting.\n if (opts.formatLocale) {\n vega.formatLocale(opts.formatLocale);\n }\n if (opts.timeFormatLocale) {\n vega.timeFormatLocale(opts.timeFormatLocale);\n }\n\n // Set custom expression functions\n if (opts.expressionFunctions) {\n for (const name in opts.expressionFunctions) {\n const expressionFunction = opts.expressionFunctions[name];\n if ('fn' in expressionFunction) {\n vega.expressionFunction(name, expressionFunction.fn, expressionFunction['visitor']);\n } else if (expressionFunction instanceof Function) {\n vega.expressionFunction(name, expressionFunction);\n }\n }\n }\n const {\n ast\n } = opts;\n\n // Do not apply the config to Vega when we have already applied it to Vega-Lite.\n // This call may throw an Error if parsing fails.\n const runtime = vega.parse(vgSpec, mode === 'vega-lite' ? {} : config, {\n ast\n });\n const view = new (opts.viewClass || vega.View)(runtime, _objectSpread({\n loader,\n logLevel,\n renderer\n }, ast ? {\n expr: vega.expressionInterpreter ?? opts.expr ?? expressionInterpreter\n } : {}));\n view.addSignalListener('autosize', (_, autosize) => {\n const {\n type\n } = autosize;\n if (type == 'fit-x') {\n container.classList.add('fit-x');\n container.classList.remove('fit-y');\n } else if (type == 'fit-y') {\n container.classList.remove('fit-x');\n container.classList.add('fit-y');\n } else if (type == 'fit') {\n container.classList.add('fit-x', 'fit-y');\n } else {\n container.classList.remove('fit-x', 'fit-y');\n }\n });\n if (opts.tooltip !== false) {\n const handler = isTooltipHandler(opts.tooltip) ? opts.tooltip :\n // user provided boolean true or tooltip options\n new Handler(opts.tooltip === true ? {} : opts.tooltip).call;\n view.tooltip(handler);\n }\n let {\n hover\n } = opts;\n if (hover === undefined) {\n hover = mode === 'vega';\n }\n if (hover) {\n const {\n hoverSet,\n updateSet\n } = typeof hover === 'boolean' ? {} : hover;\n view.hover(hoverSet, updateSet);\n }\n if (opts) {\n if (opts.width != null) {\n view.width(opts.width);\n }\n if (opts.height != null) {\n view.height(opts.height);\n }\n if (opts.padding != null) {\n view.padding(opts.padding);\n }\n }\n await view.initialize(container, opts.bind).runAsync();\n let documentClickHandler;\n if (actions !== false) {\n let wrapper = element;\n if (opts.defaultStyle !== false || opts.forceActionsMenu) {\n const details = document.createElement('details');\n details.title = i18n.CLICK_TO_VIEW_ACTIONS;\n element.append(details);\n wrapper = details;\n const summary = document.createElement('summary');\n summary.innerHTML = SVG_CIRCLES;\n details.append(summary);\n documentClickHandler = ev => {\n if (!details.contains(ev.target)) {\n details.removeAttribute('open');\n }\n };\n document.addEventListener('click', documentClickHandler);\n }\n const ctrl = document.createElement('div');\n wrapper.append(ctrl);\n ctrl.classList.add('vega-actions');\n\n // add 'Export' action\n if (actions === true || actions.export !== false) {\n for (const ext of ['svg', 'png']) {\n if (actions === true || actions.export === true || actions.export[ext]) {\n const i18nExportAction = i18n[`${ext.toUpperCase()}_ACTION`];\n const exportLink = document.createElement('a');\n const scaleFactor = isObject(opts.scaleFactor) ? opts.scaleFactor[ext] : opts.scaleFactor;\n exportLink.text = i18nExportAction;\n exportLink.href = '#';\n exportLink.target = '_blank';\n exportLink.download = `${downloadFileName}.${ext}`;\n // add link on mousedown so that it's correct when the click happens\n exportLink.addEventListener('mousedown', async function (e) {\n e.preventDefault();\n const url = await view.toImageURL(ext, scaleFactor);\n this.href = url;\n });\n ctrl.append(exportLink);\n }\n }\n }\n\n // add 'View Source' action\n if (actions === true || actions.source !== false) {\n const viewSourceLink = document.createElement('a');\n viewSourceLink.text = i18n.SOURCE_ACTION;\n viewSourceLink.href = '#';\n viewSourceLink.addEventListener('click', function (e) {\n viewSource(stringify(spec), opts.sourceHeader ?? '', opts.sourceFooter ?? '', mode);\n e.preventDefault();\n });\n ctrl.append(viewSourceLink);\n }\n\n // add 'View Compiled' action\n if (mode === 'vega-lite' && (actions === true || actions.compiled !== false)) {\n const compileLink = document.createElement('a');\n compileLink.text = i18n.COMPILED_ACTION;\n compileLink.href = '#';\n compileLink.addEventListener('click', function (e) {\n viewSource(stringify(vgSpec), opts.sourceHeader ?? '', opts.sourceFooter ?? '', 'vega');\n e.preventDefault();\n });\n ctrl.append(compileLink);\n }\n\n // add 'Open in Vega Editor' action\n if (actions === true || actions.editor !== false) {\n const editorUrl = opts.editorUrl ?? 'https://vega.github.io/editor/';\n const editorLink = document.createElement('a');\n editorLink.text = i18n.EDITOR_ACTION;\n editorLink.href = '#';\n editorLink.addEventListener('click', function (e) {\n post(window, editorUrl, {\n config: config,\n mode,\n renderer,\n spec: stringify(spec)\n });\n e.preventDefault();\n });\n ctrl.append(editorLink);\n }\n }\n function finalize() {\n if (documentClickHandler) {\n document.removeEventListener('click', documentClickHandler);\n }\n view.finalize();\n }\n return {\n view,\n spec,\n vgSpec,\n finalize,\n embedOptions: opts\n };\n}\n\nexport { DEFAULT_ACTIONS, embed as default, guessMode, vega, vegaLite, version };\n//# sourceMappingURL=vega-embed.module.js.map\n","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n","import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return Array.from(this.children);\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n// Given some data, this returns an array-like view of it: an object that\n// exposes a length property and allows numeric indexing. Note that unlike\n// selectAll, this isn’t worried about “live” collections because the resulting\n// array will only be used briefly while data is being bound. (It is possible to\n// cause the data to change while iterating by using a key function, but please\n// don’t; we’d rather avoid a gratuitous copy.)\nfunction arraylike(data) {\n return typeof data === \"object\" && \"length\" in data\n ? data // Array, TypedArray, NodeList, array-like\n : Array.from(data); // Map, Set, iterable, string, or anything else\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n","import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n","import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n","import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n return array(select.apply(this, arguments));\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","// Given something array like (or null), returns something that is strictly an\n// array. This is used to ensure that array-like objects passed to d3.selectAll\n// or selection.selectAll are converted into proper arrays when creating a\n// selection; we don’t ever want to create a selection backed by a live\n// HTMLCollection or NodeList. However, note that selection.selectAll will use a\n// static NodeList as a group, since it safely derived from querySelectorAll.\nexport default function array(x) {\n return x == null ? [] : Array.isArray(x) ? x : Array.from(x);\n}\n","import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n if (typeof onenter === \"function\") {\n enter = onenter(enter);\n if (enter) enter = enter.selection();\n } else {\n enter = enter.append(onenter + \"\");\n }\n if (onupdate != null) {\n update = onupdate(update);\n if (update) update = update.selection();\n }\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(context) {\n var selection = context.selection ? context.selection() : context;\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n","import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n","import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n","import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n","import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n","import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n","import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n","import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n","import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n selectChild: selection_prototype.selectChild,\n selectChildren: selection_prototype.selectChildren,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n","import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n","import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n","import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n","import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n","import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n","import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n","function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n","import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n","function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n","function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n","import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n","import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n","import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n","export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n","import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n","import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n","import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolate} from \"d3-interpolate\";\nimport {pointer, select} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport BrushEvent from \"./event.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\nvar MODE_DRAG = {name: \"drag\"},\n MODE_SPACE = {name: \"space\"},\n MODE_HANDLE = {name: \"handle\"},\n MODE_CENTER = {name: \"center\"};\n\nconst {abs, max, min} = Math;\n\nfunction number1(e) {\n return [+e[0], +e[1]];\n}\n\nfunction number2(e) {\n return [number1(e[0]), number1(e[1])];\n}\n\nvar X = {\n name: \"x\",\n handles: [\"w\", \"e\"].map(type),\n input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },\n output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }\n};\n\nvar Y = {\n name: \"y\",\n handles: [\"n\", \"s\"].map(type),\n input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },\n output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }\n};\n\nvar XY = {\n name: \"xy\",\n handles: [\"n\", \"w\", \"e\", \"s\", \"nw\", \"ne\", \"sw\", \"se\"].map(type),\n input: function(xy) { return xy == null ? null : number2(xy); },\n output: function(xy) { return xy; }\n};\n\nvar cursors = {\n overlay: \"crosshair\",\n selection: \"move\",\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n};\n\nvar flipX = {\n e: \"w\",\n w: \"e\",\n nw: \"ne\",\n ne: \"nw\",\n se: \"sw\",\n sw: \"se\"\n};\n\nvar flipY = {\n n: \"s\",\n s: \"n\",\n nw: \"sw\",\n ne: \"se\",\n se: \"ne\",\n sw: \"nw\"\n};\n\nvar signsX = {\n overlay: +1,\n selection: +1,\n n: null,\n e: +1,\n s: null,\n w: -1,\n nw: -1,\n ne: +1,\n se: +1,\n sw: -1\n};\n\nvar signsY = {\n overlay: +1,\n selection: +1,\n n: -1,\n e: null,\n s: +1,\n w: null,\n nw: -1,\n ne: -1,\n se: +1,\n sw: +1\n};\n\nfunction type(t) {\n return {type: t};\n}\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n if (svg.hasAttribute(\"viewBox\")) {\n svg = svg.viewBox.baseVal;\n return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];\n }\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\n// Like d3.local, but with the name “__brush” rather than auto-generated.\nfunction local(node) {\n while (!node.__brush) if (!(node = node.parentNode)) return;\n return node.__brush;\n}\n\nfunction empty(extent) {\n return extent[0][0] === extent[1][0]\n || extent[0][1] === extent[1][1];\n}\n\nexport function brushSelection(node) {\n var state = node.__brush;\n return state ? state.dim.output(state.selection) : null;\n}\n\nexport function brushX() {\n return brush(X);\n}\n\nexport function brushY() {\n return brush(Y);\n}\n\nexport default function() {\n return brush(XY);\n}\n\nfunction brush(dim) {\n var extent = defaultExtent,\n filter = defaultFilter,\n touchable = defaultTouchable,\n keys = true,\n listeners = dispatch(\"start\", \"brush\", \"end\"),\n handleSize = 6,\n touchending;\n\n function brush(group) {\n var overlay = group\n .property(\"__brush\", initialize)\n .selectAll(\".overlay\")\n .data([type(\"overlay\")]);\n\n overlay.enter().append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"cursor\", cursors.overlay)\n .merge(overlay)\n .each(function() {\n var extent = local(this).extent;\n select(this)\n .attr(\"x\", extent[0][0])\n .attr(\"y\", extent[0][1])\n .attr(\"width\", extent[1][0] - extent[0][0])\n .attr(\"height\", extent[1][1] - extent[0][1]);\n });\n\n group.selectAll(\".selection\")\n .data([type(\"selection\")])\n .enter().append(\"rect\")\n .attr(\"class\", \"selection\")\n .attr(\"cursor\", cursors.selection)\n .attr(\"fill\", \"#777\")\n .attr(\"fill-opacity\", 0.3)\n .attr(\"stroke\", \"#fff\")\n .attr(\"shape-rendering\", \"crispEdges\");\n\n var handle = group.selectAll(\".handle\")\n .data(dim.handles, function(d) { return d.type; });\n\n handle.exit().remove();\n\n handle.enter().append(\"rect\")\n .attr(\"class\", function(d) { return \"handle handle--\" + d.type; })\n .attr(\"cursor\", function(d) { return cursors[d.type]; });\n\n group\n .each(redraw)\n .attr(\"fill\", \"none\")\n .attr(\"pointer-events\", \"all\")\n .on(\"mousedown.brush\", started)\n .filter(touchable)\n .on(\"touchstart.brush\", started)\n .on(\"touchmove.brush\", touchmoved)\n .on(\"touchend.brush touchcancel.brush\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n brush.move = function(group, selection, event) {\n if (group.tween) {\n group\n .on(\"start.brush\", function(event) { emitter(this, arguments).beforestart().start(event); })\n .on(\"interrupt.brush end.brush\", function(event) { emitter(this, arguments).end(event); })\n .tween(\"brush\", function() {\n var that = this,\n state = that.__brush,\n emit = emitter(that, arguments),\n selection0 = state.selection,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(this, arguments) : selection, state.extent),\n i = interpolate(selection0, selection1);\n\n function tween(t) {\n state.selection = t === 1 && selection1 === null ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 !== null && selection1 !== null ? tween : tween(1);\n });\n } else {\n group\n .each(function() {\n var that = this,\n args = arguments,\n state = that.__brush,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(that, args) : selection, state.extent),\n emit = emitter(that, args).beforestart();\n\n interrupt(that);\n state.selection = selection1 === null ? null : selection1;\n redraw.call(that);\n emit.start(event).brush(event).end(event);\n });\n }\n };\n\n brush.clear = function(group, event) {\n brush.move(group, null, event);\n };\n\n function redraw() {\n var group = select(this),\n selection = local(this).selection;\n\n if (selection) {\n group.selectAll(\".selection\")\n .style(\"display\", null)\n .attr(\"x\", selection[0][0])\n .attr(\"y\", selection[0][1])\n .attr(\"width\", selection[1][0] - selection[0][0])\n .attr(\"height\", selection[1][1] - selection[0][1]);\n\n group.selectAll(\".handle\")\n .style(\"display\", null)\n .attr(\"x\", function(d) { return d.type[d.type.length - 1] === \"e\" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })\n .attr(\"y\", function(d) { return d.type[0] === \"s\" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })\n .attr(\"width\", function(d) { return d.type === \"n\" || d.type === \"s\" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })\n .attr(\"height\", function(d) { return d.type === \"e\" || d.type === \"w\" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });\n }\n\n else {\n group.selectAll(\".selection,.handle\")\n .style(\"display\", \"none\")\n .attr(\"x\", null)\n .attr(\"y\", null)\n .attr(\"width\", null)\n .attr(\"height\", null);\n }\n }\n\n function emitter(that, args, clean) {\n var emit = that.__brush.emitter;\n return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean);\n }\n\n function Emitter(that, args, clean) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\n this.clean = clean;\n }\n\n Emitter.prototype = {\n beforestart: function() {\n if (++this.active === 1) this.state.emitter = this, this.starting = true;\n return this;\n },\n start: function(event, mode) {\n if (this.starting) this.starting = false, this.emit(\"start\", event, mode);\n else this.emit(\"brush\", event);\n return this;\n },\n brush: function(event, mode) {\n this.emit(\"brush\", event, mode);\n return this;\n },\n end: function(event, mode) {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\", event, mode);\n return this;\n },\n emit: function(type, event, mode) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new BrushEvent(type, {\n sourceEvent: event,\n target: brush,\n selection: dim.output(this.state.selection),\n mode,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function started(event) {\n if (touchending && !event.touches) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = event.target.__data__.type,\n mode = (keys && event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (keys && event.altKey ? MODE_CENTER : MODE_HANDLE),\n signX = dim === Y ? null : signsX[type],\n signY = dim === X ? null : signsY[type],\n state = local(that),\n extent = state.extent,\n selection = state.selection,\n W = extent[0][0], w0, w1,\n N = extent[0][1], n0, n1,\n E = extent[1][0], e0, e1,\n S = extent[1][1], s0, s1,\n dx = 0,\n dy = 0,\n moving,\n shifting = signX && signY && keys && event.shiftKey,\n lockX,\n lockY,\n points = Array.from(event.touches || [event], t => {\n const i = t.identifier;\n t = pointer(t, that);\n t.point0 = t.slice();\n t.identifier = i;\n return t;\n });\n\n interrupt(that);\n var emit = emitter(that, arguments, true).beforestart();\n\n if (type === \"overlay\") {\n if (selection) moving = true;\n const pts = [points[0], points[1] || points[0]];\n state.selection = selection = [[\n w0 = dim === Y ? W : min(pts[0][0], pts[1][0]),\n n0 = dim === X ? N : min(pts[0][1], pts[1][1])\n ], [\n e0 = dim === Y ? E : max(pts[0][0], pts[1][0]),\n s0 = dim === X ? S : max(pts[0][1], pts[1][1])\n ]];\n if (points.length > 1) move(event);\n } else {\n w0 = selection[0][0];\n n0 = selection[0][1];\n e0 = selection[1][0];\n s0 = selection[1][1];\n }\n\n w1 = w0;\n n1 = n0;\n e1 = e0;\n s1 = s0;\n\n var group = select(that)\n .attr(\"pointer-events\", \"none\");\n\n var overlay = group.selectAll(\".overlay\")\n .attr(\"cursor\", cursors[type]);\n\n if (event.touches) {\n emit.moved = moved;\n emit.ended = ended;\n } else {\n var view = select(event.view)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n if (keys) view\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n\n dragDisable(event.view);\n }\n\n redraw.call(that);\n emit.start(event, mode.name);\n\n function moved(event) {\n for (const p of event.changedTouches || [event]) {\n for (const d of points)\n if (d.identifier === p.identifier) d.cur = pointer(p, that);\n }\n if (shifting && !lockX && !lockY && points.length === 1) {\n const point = points[0];\n if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1]))\n lockY = true;\n else\n lockX = true;\n }\n for (const point of points)\n if (point.cur) point[0] = point.cur[0], point[1] = point.cur[1];\n moving = true;\n noevent(event);\n move(event);\n }\n\n function move(event) {\n const point = points[0], point0 = point.point0;\n var t;\n\n dx = point[0] - point0[0];\n dy = point[1] - point0[1];\n\n switch (mode) {\n case MODE_SPACE:\n case MODE_DRAG: {\n if (signX) dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (points[1]) {\n if (signX) w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1;\n if (signY) n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1;\n } else {\n if (signX < 0) dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n }\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX));\n if (signY) n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY));\n break;\n }\n }\n\n if (e1 < w1) {\n signX *= -1;\n t = w0, w0 = e0, e0 = t;\n t = w1, w1 = e1, e1 = t;\n if (type in flipX) overlay.attr(\"cursor\", cursors[type = flipX[type]]);\n }\n\n if (s1 < n1) {\n signY *= -1;\n t = n0, n0 = s0, s0 = t;\n t = n1, n1 = s1, s1 = t;\n if (type in flipY) overlay.attr(\"cursor\", cursors[type = flipY[type]]);\n }\n\n if (state.selection) selection = state.selection; // May be set by brush.move!\n if (lockX) w1 = selection[0][0], e1 = selection[1][0];\n if (lockY) n1 = selection[0][1], s1 = selection[1][1];\n\n if (selection[0][0] !== w1\n || selection[0][1] !== n1\n || selection[1][0] !== e1\n || selection[1][1] !== s1) {\n state.selection = [[w1, n1], [e1, s1]];\n redraw.call(that);\n emit.brush(event, mode.name);\n }\n }\n\n function ended(event) {\n nopropagation(event);\n if (event.touches) {\n if (event.touches.length) return;\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n } else {\n dragEnable(event.view, moving);\n view.on(\"keydown.brush keyup.brush mousemove.brush mouseup.brush\", null);\n }\n group.attr(\"pointer-events\", \"all\");\n overlay.attr(\"cursor\", cursors.overlay);\n if (state.selection) selection = state.selection; // May be set by brush.move (on start)!\n if (empty(selection)) state.selection = null, redraw.call(that);\n emit.end(event, mode.name);\n }\n\n function keydowned(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n shifting = signX && signY;\n break;\n }\n case 18: { // ALT\n if (mode === MODE_HANDLE) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n move(event);\n }\n break;\n }\n case 32: { // SPACE; takes priority over ALT\n if (mode === MODE_HANDLE || mode === MODE_CENTER) {\n if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;\n if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;\n mode = MODE_SPACE;\n overlay.attr(\"cursor\", cursors.selection);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n\n function keyupped(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move(event);\n }\n break;\n }\n case 18: { // ALT\n if (mode === MODE_CENTER) {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n move(event);\n }\n break;\n }\n case 32: { // SPACE\n if (mode === MODE_SPACE) {\n if (event.altKey) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n } else {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n }\n overlay.attr(\"cursor\", cursors[type]);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n }\n\n function touchmoved(event) {\n emitter(this, arguments).moved(event);\n }\n\n function touchended(event) {\n emitter(this, arguments).ended(event);\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = number2(extent.apply(this, arguments));\n state.dim = dim;\n return state;\n }\n\n brush.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant(number2(_)), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), brush) : filter;\n };\n\n brush.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), brush) : touchable;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\n };\n\n brush.keyModifiers = function(_) {\n return arguments.length ? (keys = !!_, brush) : keys;\n };\n\n brush.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? brush : value;\n };\n\n return brush;\n}\n","export function Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nexport var identity = new Transform(1, 0, 0);\n\ntransform.prototype = Transform.prototype;\n\nexport default function transform(node) {\n while (!node.__zoom) if (!(node = node.parentNode)) return identity;\n return node.__zoom;\n}\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { v4 as uuidv4 } from 'uuid';\nimport vegaEmbed, { EmbedOptions } from 'vega-embed';\nimport * as d3 from 'd3';\nimport * as debounce from 'lodash.debounce';\n\n\nexport default class Vega extends Component {\n constructor(props) {\n super(props);\n this.getRef = this.getRef.bind(this);\n this.divId = \"vega-\".concat(uuidv4());\n this.finalize = null;\n }\n\n getRef(el) {\n this.el = el;\n }\n\n componentDidMount() {\n this.update();\n }\n\n componentDidUpdate(prevProps) {\n if (this.props.id !== prevProps.id ||\n this.props.svgRendererScaleFactor !== prevProps.svgRendererScaleFactor ||\n JSON.stringify(this.props.opt) !== JSON.stringify(prevProps.opt) ||\n JSON.stringify(this.props.spec) !== JSON.stringify(prevProps.spec) ||\n JSON.stringify(this.props.style) !== JSON.stringify(prevProps.style) ||\n JSON.stringify(this.props.signalsToObserve) !== JSON.stringify(prevProps.signalsToObserve) ||\n this.props.className !== prevProps.className\n ) {\n this.update();\n }\n }\n\n cleanJson(data) {\n return JSON.parse(JSON.stringify(data))\n }\n\n update() {\n if (!this.props.spec) { return; }\n // Function exists if a view has been rendered before with this component\n // If so, it's better to call finalize before creating a new view to clean up\n // timers, event listeners, etc.\n if (this.finalize) { this.finalize(); }\n\n vegaEmbed(this.el, this.props.spec, this.props.opt).then((result) => {\n this.finalize = result.finalize;\n this.vegaView = result.view;\n let vegaSignals = this.vegaView.getState().signals || {};\n // Ignore the 'unit' signal as it's rather complex,\n // contains references which can't be serialized to JSON, and it's\n // not useful to most users in the Dash context\n if ('unit' in vegaSignals) {\n delete vegaSignals.unit;\n };\n // Only add signals to the props if they are in the signalsToObserve\n // list or if the list is equal to ['all'].\n // If the list is empty, no signals will be added to the props.\n let filteredSignals = {};\n if (this.props.signalsToObserve[0] === 'all') {\n filteredSignals = vegaSignals;\n } else {\n for (let signal in vegaSignals) {\n if (this.props.signalsToObserve.includes(signal)) {\n filteredSignals[signal] = vegaSignals[signal];\n }\n }\n }\n vegaSignals = filteredSignals;\n\n // Initially, set all signals so that the evaluated values are available\n // even if they never change. Else, the code below would only add\n // signals to the props if they change.\n this.props.setProps({ signalData: vegaSignals });\n\n const wait = this.props.debounceWait;\n const maxWait = wait;\n\n // Register signal listeners to update the props when signals change.\n const signalHandler = (name, value) => {\n // Not sure if this is needed but it's in the Jupyterchart\n // implementation in Vega-Altair. Worth to be\n // on the safe side for now.\n const cleanedValue = this.cleanJson(value);\n // Get a shallow copy of the signals. Shallow should be enough\n // as we overwrite the top level values anyway.\n let signalData = { ...this.props.signalData };\n signalData[name] = cleanedValue;\n this.props.setProps({ signalData: signalData });\n };\n for (let signal in vegaSignals) {\n this.vegaView.addSignalListener(signal, debounce(signalHandler, wait, { maxWait: maxWait }));\n }\n\n const options = this.props.opt || {};\n const renderer = options.renderer || 'canvas';\n if (renderer === 'svg' && this.props.svgRendererScaleFactor !== 1) {\n // Adjustment of width and height is based on https://github.com/vega/vega-lite/issues/1758#issuecomment-264677556\n const svg = d3.select(\"#\" + this.divId + \" svg\");\n const scaleFactor = this.props.svgRendererScaleFactor;\n const w = svg.attr(\"width\");\n const h = svg.attr(\"height\");\n svg.attr(\"width\", w * scaleFactor);\n svg.attr(\"height\", h * scaleFactor);\n }\n })\n }\n\n render() {\n return
;\n }\n}\n\nVega.defaultProps = { svgRendererScaleFactor: 1, signalsToObserve: [], signalData: {}, debounceWait: 10 };\n\nVega.propTypes = {\n /**\n * The ID used to identify this component in Dash callbacks.\n */\n id: PropTypes.string,\n\n /**\n * A Vega or Vega-Lite spec. To pass an Altair chart, use chart.to_dict().\n */\n spec: PropTypes.object,\n\n /**\n * Vega-Embed options. See https://github.com/vega/vega-embed#options for more details.\n */\n opt: PropTypes.object,\n\n /**\n * A number which is used to scale the chart in case the svg renderer is used.\n * This is useful when you want to increase the size of the chart keeping\n * the relative proportions of all chart elements to each other the same.\n * Default value is 1.\n */\n svgRendererScaleFactor: PropTypes.number,\n\n /**\n * A list of signal names to observe for changes. If you use Altair, these are the\n * names of the parameters you define. The values of these signals\n * will be available in the signalData property. You can pass [\"all\"] to\n * observe all signals.\n * Defaults to no signals.\n */\n signalsToObserve: PropTypes.arrayOf(PropTypes.string),\n\n /**\n * A read-only dictionary of signals with the key being the name of the signal.\n * The easiest way to make sense of it is to display the whole signalData dictionary\n * in your app layout or print it to the console\n * so that you see what the structure looks like.\n */\n signalData: PropTypes.object,\n\n /**\n * Generic style overrides on the Vega div\n */\n style: PropTypes.object,\n\n /**\n * Additional className of the Vega div\n */\n className: PropTypes.string,\n\n /**\n * Debouncing wait time in milliseconds before signals property is updated\n * Default value is 10.\n */\n debounceWait: PropTypes.number,\n\n /**\n * Dash-assigned callback that should be called to report property changes\n * to Dash, to make them available for callbacks.\n */\n setProps: PropTypes.func\n};\n","import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n","\"use strict\";\n\n// Note: This regex matches even invalid JSON strings, but since we’re\n// working on the output of `JSON.stringify` we know that only valid strings\n// are present (unless the user supplied a weird `options.indent` but in\n// that case we don’t care since the output would be invalid anyway).\nvar stringOrChar = /(\"(?:[^\\\\\"]|\\\\.)*\")|[:,]/g;\n\nmodule.exports = function stringify(passedObj, options) {\n var indent, maxLength, replacer;\n\n options = options || {};\n indent = JSON.stringify(\n [1],\n undefined,\n options.indent === undefined ? 2 : options.indent\n ).slice(2, -3);\n maxLength =\n indent === \"\"\n ? Infinity\n : options.maxLength === undefined\n ? 80\n : options.maxLength;\n replacer = options.replacer;\n\n return (function _stringify(obj, currentIndent, reserved) {\n // prettier-ignore\n var end, index, items, key, keyPart, keys, length, nextIndent, prettified, start, string, value;\n\n if (obj && typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n\n string = JSON.stringify(obj, replacer);\n\n if (string === undefined) {\n return string;\n }\n\n length = maxLength - currentIndent.length - reserved;\n\n if (string.length <= length) {\n prettified = string.replace(\n stringOrChar,\n function (match, stringLiteral) {\n return stringLiteral || match + \" \";\n }\n );\n if (prettified.length <= length) {\n return prettified;\n }\n }\n\n if (replacer != null) {\n obj = JSON.parse(string);\n replacer = undefined;\n }\n\n if (typeof obj === \"object\" && obj !== null) {\n nextIndent = currentIndent + indent;\n items = [];\n index = 0;\n\n if (Array.isArray(obj)) {\n start = \"[\";\n end = \"]\";\n length = obj.length;\n for (; index < length; index++) {\n items.push(\n _stringify(obj[index], nextIndent, index === length - 1 ? 0 : 1) ||\n \"null\"\n );\n }\n } else {\n start = \"{\";\n end = \"}\";\n keys = Object.keys(obj);\n length = keys.length;\n for (; index < length; index++) {\n key = keys[index];\n keyPart = JSON.stringify(key) + \": \";\n value = _stringify(\n obj[key],\n nextIndent,\n keyPart.length + (index === length - 1 ? 0 : 1)\n );\n if (value !== undefined) {\n items.push(keyPart + value);\n }\n }\n }\n\n if (items.length > 0) {\n return [start, indent + items.join(\",\\n\" + nextIndent), end].join(\n \"\\n\" + currentIndent\n );\n }\n }\n\n return string;\n })(passedObj, \"\", 0);\n};\n"],"names":["randomUUID","crypto","bind","getRandomValues","rnds8","Uint8Array","rng","Error","byteToHex","i","push","toString","slice","options","buf","offset","rnds","random","arr","unsafeStringify","extendStatics","__extends","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__","this","constructor","prototype","create","_hasOwnProperty","obj","key","call","_objectKeys","isArray","keys_1","length","k","keys","_deepClone","JSON","parse","stringify","isInteger","str","charCode","len","charCodeAt","escapePathComponent","path","indexOf","replace","unescapePathComponent","hasUndefined","undefined","i_1","objKeys","objKeysLength","patchErrorMessageFormatter","message","args","messageParts","value","join","PatchError","_super","name","index","operation","tree","_newTarget","_this","JsonPatchError","deepClone","objOps","add","document","newDocument","remove","removed","move","getValueByPointer","originalValue","applyOperation","op","from","copy","valueToCopy","test","_areEquals","_get","arrOps","splice","pointer","getOriginalDestination","validateOperation","mutateDocument","banPrototypeModifications","validator","returnValue","split","t","existingPathFragment","validateFunction","TypeError","applyPatch","patch","results","length_1","applyReducer","operationResult","pathLen","existingPathLen","error","sequence","externalValidator","e","a","arrA","arrB","beforeDict","WeakMap","Mirror","observers","Map","ObserverInfo","callback","observer","unobserve","root","observe","mirror","get","getMirror","observerInfo","getObserverFromMirror","set","next","dirtyCheck","generate","fastCheck","clearTimeout","setTimeout","window","addEventListener","patches","object","delete","removeObserverFromMirror","removeEventListener","invertible","_generate","temp","toJSON","newKeys","oldKeys","deleted","oldVal","newVal","compare","tree1","tree2","assign","accessor","fn","fields","fname","accessorName","accessorFields","getter","get1","getN","field","splitAccessPath","n","j","c","q","s","substring","opt","id","_","zero","one","truthy","falsy","log$1","method","level","input","concat","console","apply","None","Error$1","logger","handler","arguments","warn","info","debug","isObject","isLegalKey","mergeConfig","_len","configs","_key","reduce","out","source","signals","mergeNamed","r","layout","writeConfig","output","recurse","o","map","forEach","peek","array","toNumber","exp","sign","x","Math","log","symlog","log1p","abs","symexp","expm1","pow","exponent","pan","domain","delta","lift","ground","d0","d1","dd","panLinear","panLog","panPow","panSymlog","constant","zoom","anchor","scale","da","zoomLinear","zoomLog","zoomPow","zoomSymlog","quarter","date","Date","getMonth","utcquarter","getUTCMonth","clampRange","range","min","max","span","lo","hi","isFunction","DESCENDING","orders","ord","fmap","gen","comparator","f","ascending","u","v","compare1","compareN","order","debounce","delay","tid","extend","extent","extentIndex","hop","has","property","NULL","fastmap","has$1","size","empty","clear","clean","flush","threshold","left","right","center","l","inherits","child","parent","members","proto","defineProperty","writable","enumerable","configurable","inrange","r0","r1","isBoolean","isDate","isIterable","Symbol","iterator","isNumber","isRegExp","isString","flat","lerp","frac","DEFAULT_MAX_SIZE","lruCache","maxsize","curr","prev","update","merge","array0","array1","n0","n1","merged","i0","i1","repeat","reps","pad","padchar","align","ceil","$","toBoolean","defaultParser","toDate","parser","toSet","truncate","ellipsis","visitArray","filter","visitor","EOL","EOF","QUOTE","NEWLINE","RETURN","objectConverter","columns","Function","inferColumns","rows","columnSet","row","column","width","delimiter","reFormat","RegExp","DELIMITER","parseRows","text","N","I","eof","eol","token","preformatBody","formatValue","formatRow","year","hours","getUTCHours","minutes","getUTCMinutes","seconds","getUTCSeconds","milliseconds","getUTCMilliseconds","isNaN","getUTCFullYear","getUTCDate","formatDate","convert","customConverter","format","formatBody","formatRows","topology","objects","type","features","geometries","bbox","properties","geometry","transformPoint","transform","x0","y0","kx","ky","dx","translate","dy","arcs","arc","points","pop","reverse","point","line","ring","polygon","coordinates","stitchedArcs","fragmentByStart","fragmentByEnd","fragments","emptyIndex","start","end","g","p1","p0","dp","ends","fg","unshift","gf","meshArcs","geom","geomsByArc","extract0","extract1","extract2","extract3","geoms","extractArcs","stitch","e10","sqrt","e5","e2","tickSpec","stop","count","step","power","floor","log10","factor","i2","inc","round","ticks","tickIncrement","tickStep","prefixExponent","re","formatSpecifier","specifier","match","exec","FormatSpecifier","fill","symbol","comma","precision","trim","formatDecimalParts","toExponential","coefficient","NaN","toFixed","toLocaleString","toPrecision","formatRounded","toUpperCase","formatPrefix","prefixes","locale","grouping","thousands","group","Number","currencyPrefix","currency","currencySuffix","decimal","numerals","formatNumerals","String","percent","minus","nan","newFormat","formatTypes","prefix","toLowerCase","suffix","formatType","maybeSuffix","valuePrefix","valueSuffix","valueNegative","formatTrim","Infinity","padding","t0","t1","timeInterval","floori","offseti","interval","previous","setTime","every","isFinite","durationSecond","durationMinute","durationHour","durationDay","durationWeek","durationYear","timeDay","setHours","setDate","getDate","getTimezoneOffset","utcDay","setUTCHours","setUTCDate","unixDay","timeWeekday","getDay","timeSunday","timeMonday","timeTuesday","timeWednesday","timeThursday","timeFriday","timeSaturday","utcWeekday","getUTCDay","utcSunday","utcMonday","utcTuesday","utcWednesday","utcThursday","utcFriday","utcSaturday","timeYear","setMonth","setFullYear","getFullYear","utcYear","setUTCMonth","setUTCFullYear","timeMonth","utcMonth","timeHour","getMilliseconds","getSeconds","getMinutes","getHours","utcHour","setUTCMinutes","timeMinute","utcMinute","setUTCSeconds","second","millisecond","descending","bisector","compare2","mid","YEAR","QUARTER","MONTH","WEEK","DATE","DAY","DAYOFYEAR","HOURS","MINUTES","SECONDS","MILLISECONDS","TIME_UNITS","UNITS","timeUnits","units","m","unit","sort","defaultSpecifiers","timeUnitSpecifier","specifiers","fmt","localYear","y","dayofyear","localDayOfYear","week","localWeekNum","localFirst","localDate","H","M","S","L","utcdayofyear","utcDayOfYear","utcweek","utcWeekNum","UTC","utcFirst","utcDate","inv","newDate","phase","getUnit","weekday","day","firstDay","localGet","localInv","w","timeFloor","utcGet","utcInv","utcFloor","timeIntervals","utcIntervals","utcInterval","ival","timeOffset","utcOffset","timeSequence","utcSequence","Milli","Seconds","Minutes","Hours","Day","Month","Year","intervals","bin","ext","maxbins","target","formatLocale","locale_dateTime","dateTime","locale_date","locale_time","time","locale_periods","periods","locale_weekdays","days","locale_shortWeekdays","shortDays","locale_months","months","locale_shortMonths","shortMonths","periodRe","formatRe","periodLookup","formatLookup","weekdayRe","weekdayLookup","shortWeekdayRe","shortWeekdayLookup","monthRe","monthLookup","shortMonthRe","shortMonthLookup","formats","formatDayOfMonth","formatMicroseconds","formatYearISO","formatFullYearISO","formatHour24","formatHour12","formatDayOfYear","formatMilliseconds","formatMonthNumber","formatMinutes","formatUnixTimestamp","formatUnixTimestampSeconds","formatSeconds","formatWeekdayNumberMonday","formatWeekNumberSunday","formatWeekNumberISO","formatWeekdayNumberSunday","formatWeekNumberMonday","formatFullYear","formatZone","formatLiteralPercent","utcFormats","formatUTCDayOfMonth","formatUTCMicroseconds","formatUTCYearISO","formatUTCFullYearISO","formatUTCHour24","formatUTCHour12","formatUTCDayOfYear","formatUTCMilliseconds","formatUTCMonthNumber","formatUTCMinutes","formatUTCSeconds","formatUTCWeekdayNumberMonday","formatUTCWeekNumberSunday","formatUTCWeekNumberISO","formatUTCWeekdayNumberSunday","formatUTCWeekNumberMonday","formatUTCYear","formatUTCFullYear","formatUTCZone","parses","string","parseSpecifier","parseDayOfMonth","parseMicroseconds","parseYear","parseFullYear","parseHour24","parseDayOfYear","parseMilliseconds","parseMonthNumber","parseMinutes","parseQuarter","parseUnixTimestamp","parseUnixTimestampSeconds","parseSeconds","parseWeekdayNumberMonday","parseWeekNumberSunday","parseWeekNumberISO","parseWeekdayNumberSunday","parseWeekNumberMonday","parseZone","parseLiteralPercent","pads","charAt","newParse","Z","Q","V","W","U","X","utcFormat","utcParse","timeFormat","timeParse","numberRe","percentRe","requoteRe","requote","names","dISO","z","dow","UTCdISO","memoize","cache","spec","numberLocale","formatFloat","numberFormat","decimalChar","dec","idx","lastIndexOf","rightmostDigit","trimZeroes","formatSpan","precisionPrefix","precisionRound","precisionFixed","defaultNumberLocale","defaultTimeLocale","resetNumberFormatDefaultLocale","numberFormatLocale","definition","numberFormatDefaultLocale","timeMultiFormat","minute","hour","month","timeLocale","resetTimeFormatDefaultLocale","timeFormatLocale","timeFormatDefaultLocale","createLocale","number","numberSpec","timeSpec","resetDefaultLocale","protocol_re","allowed_re","whitespace_re","fileProtocol","async","load","uri","sanitize","url","href","localFile","file","http","fileAccess","result","isFile","loadFile","base","isAllowed","hasProtocol","baseURL","startsWith","endsWith","mode","defaultProtocol","rel","context","crossOrigin","fileLoader","fs","filename","Promise","accept","reject","readFile","data","fileReject","httpLoader","fetch","response","ok","status","statusText","httpReject","isValid","typeParsers","boolean","integer","unknown","typeTests","typeList","inferType","values","inferTypes","types","delimitedFormat","delim","responseType","header","dsv","json","prop","Buffer","isBuffer","parseJSON","filters","interior","exterior","topojson","feature","mesh","csv","tsv","reader","read","schema","timeParser","utcParser","datum","parsers","parts","pattern","loader","loaderFactory","UniqueList","idFunc","list","ids","asyncCallback","df","err","TUPLE_ID_KEY","TUPLE_ID","isTuple","tupleid","setid","ingest$1","derive","rederive","stableCompare","cmp","isChangeSet","changeset","rem","mod","remp","modp","reflow","insert","modify","tuple","encode","pulse","tuples","cur","modifies","CACHE","Parameters","force","modified","OP_ID","NO_PARAMS","Operator","init","params","react","stamp","rank","qrank","flags","_update","parameters","flag","bit","state","targets","_targets","skip","initonly","argval","_argval","argops","_argops","deps","marshall","item","detach","evaluate","StopPropagation","run","rv","STREAM_ID","EventStream","receive","_filter","_apply","stream","consume","_consume","evt","val","trg","preventDefault","stopPropagation","throttle","pause","now","dataflow","between","active","SKIP","onStream","func","touch","onOperator","updater","connect","Pulse","materialize","visit","addFilter","MultiPulse","pulses","hash","changed","ADD","REM","MOD","changes","reentrant","ADD_REM","ADD_MOD","ALL","REFLOW","SOURCE","NO_SOURCE","NO_FIELDS","fork","clone","addAll","src","addF","remF","modF","srcF","cleans","runAfter","nomod","some","sum","NO_OPT","siftdown","pidx","Dataflow","logLevel","_clock","_rank","_locale","_loader","_touched","_input","_pulse","_heap","nodes","last","ridx","cidx","siftup","Heap","_postrun","logMethod","_log","cleanThreshold","shift","sources","targetRank","rerank","queue","_enqueue","ingest","preload","pending","_pending","requests","done","loadPending","res","request","events","send","querySelectorAll","on","prerun","postrun","_getPulse","then","pr","priority","all","cb","runAsync","_running","enqueue","singlePulse","transforms","Definition","valueof","compareDefined","sd","swap","quantile","Float64Array","numbers","value0","subarray","quantileSorted","median","quantiles","quartiles","estimateBandwidth","mean","variance","deviation","h","maxb","logb","div","divide","minstep","steps","eps","nice","setRandom","bootstrapCI","samples","alpha","mu","dotbin","smooth","thresh","smoothing","seed","dist","sample","pdf","cdf","icdf","SQRT2PI","PI","SQRT2","nextSample","sampleNormal","stdev","rds","densityNormal","cumulativeNormal","cd","quantileNormal","erfinv","gaussian","sigma","kde","support","bandwidth","kernel","sampleLogNormal","densityLogNormal","cumulativeLogNormal","quantileLogNormal","lognormal","mixture","dists","weights","normalize","distributions","sampleUniform","densityUniform","cumulativeUniform","quantileUniform","uniform","coef","predict","rSquared","ols","uX","uY","uXY","uX2","slope","Y","xv","yv","ux","uy","visitPoints","SSE","SST","sse","sst","linear","XY","X2","ly","xy","YL","XYL","X2Y","c0","c1","YS","lx","quad","x2","X3","X4","X2X2","poly","lhs","rhs","matrix","gaussianElimination","uncenter","maxiters","epsilon","loess","bw","yhat","residuals","robustWeights","iter","edge","denom","xk","yk","tricube","xkw","updateInterval","medianResidual","arg","cnt","MIN_RADIANS","sampleCurve","minSteps","maxSteps","minX","maxX","sx","sy","ymin","ymax","scaleY","pm","angleDelta","a0","atan2","a1","groupkey","measureName","as","noop","base_op","AggregateOps","cell","store","num","__count__","missing","valid","product","mean_d","average","req","dev","variancep","stdevp","stderr","distinct","ci0","ci1","q2","q1","q3","argmin","argmax","exponential","exp_r","exponentialb","ValidAggregateOps","createMeasure","param","compareIndex","_ops","aggregate_param","_out","compileMeasures","agg","ops","getreqs","resolve","ctr","TupleStore","reset","measure","prototype$1","Aggregate","_adds","_mods","_alen","_mlen","_drop","_cross","_dims","_dnames","_measures","_countOnly","_counts","_prev","_inputs","_outputs","Bin","SortedList","resort","Collect","Compare","update$5","CountPattern","Cross","_add","_rem","_ext","_q","quartile","ci","_ci","aggr","drop","cross","dims","vals","collect","cells","inputs","outputs","inputMap","inputVisit","groupby","dname","cellkey","aggregate_params","mname","outname","newcell","newtuple","measures","celltuple","counts","adds","mods","band","bins","_bins","b0","b1","process","tokens","tcase","tokenize","case","_parameterCheck","_match","_stop","_finish","stopwords","_tuples","Distributions","normal","FUNCTION","def","Density","fieldNames","partition$1","groups","DotBin","Expression","update$4","expr","Extent","Subflow","Facet","_keys","Field","update$3","Filter","Flatten","Fold","Formula","Generate","distribution","minsteps","maxsteps","autostep","detachSubflow","activate","flow","subflow","flows","sf","_group","detached","initTargets","act","rekey","k0","k1","isMod","revisit","arrays","maxlen","fnames","generator","Methods","Empty","Impute","JoinAggregate","KDE","Key","update$2","Load","Lookup","MultiExtent","update$1","extents","MultiValues","Params","Pivot","PreFacet","Project","Quantile","Relay","Sample","Sequence","Sieve","TimeUnit","gVals","kVal","impute","getValue","getField","fName","kName","gNames","keyvals","gKey","kMap","gMap","partition","_impute","cumulative","density","defaultValue","default","_transform","limit","pivotKeys","aggregateParams","project","lut","dt","probs","cap","OUTPUT","TupleIndex","Values","utc","timezone","_floor","u0","u1","tunits","WindowOps","row_number","dense_rank","drank","percent_rank","cume_dist","cume","ntile","lag","lead","first_value","last_value","nth_value","nth","prev_value","next_value","find","ValidWindowOps","WindowState","windows","countOnly","visitInputs","WindowOp","Window","processPartition","ignorePeers","frame","setWindow","adjustRange","bisect","that","_context","bezierCurveTo","_x0","_x1","_y0","_y1","Basis","BasisClosed","BasisOpen","Bundle","beta","_basis","_beta","wind","areaStart","_line","areaEnd","lineStart","_point","lineEnd","lineTo","closePath","moveTo","_x2","_x3","_x4","_y2","_y3","_y4","_x","_y","custom","bundle","_k","Cardinal","tension","cardinal","CardinalOpen","CardinalClosed","_x5","_y5","cos","sin","pi","halfPi","tau","asin","x1","y1","y2","_l01_a","_l01_2a","_l12_a","_l12_2a","_l23_a","_l23_2a","CatmullRom","_alpha","x23","y23","catmullRom","CatmullRomClosed","CatmullRomOpen","Linear","LinearClosed","slope3","h0","h1","s0","s1","slope2","MonotoneX","MonotoneY","ReflectContext","Natural","controlPoints","Step","_t","_t0","px","py","tauEpsilon","append","strings","Path","digits","_append","appendRound","quadraticCurveTo","arcTo","x21","y21","x01","y01","l01_2","x20","y20","l21_2","l20_2","l21","l01","tan","acos","t01","t21","ccw","cw","rect","withPath","shape","RangeError","arcInnerRadius","innerRadius","arcOuterRadius","outerRadius","arcStartAngle","startAngle","arcEndAngle","endAngle","arcPadAngle","padAngle","cornerTangents","rc","ox","oy","x11","y11","x10","y10","x00","y00","d2","D","cx0","cy0","cx1","cy1","dx0","dy0","dx1","dy1","cx","cy","defined","curve","buffer","defined0","area","x0z","y0z","arealine","lineX0","lineY0","lineY1","lineX1","draw","domCanvas","createElement","getContext","height","domImage","Image","ascendingBisect","bisectRight","bisectLeft","factory","Color","darker","brighter","reI","reN","reP","reHex","reRgbInteger","reRgbPercent","reRgbaInteger","reRgbaPercent","reHslPercent","reHslaPercent","named","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","color_formatHex","rgb","formatHex","color_formatRgb","formatRgb","color","parseInt","rgbn","Rgb","rgba","hsla","rgbConvert","opacity","rgb_formatHex","hex","rgb_formatRgb","clampa","clampi","Hsl","hslConvert","hsl","clamph","clampt","hsl2rgb","m1","m2","v0","v1","v2","v3","t2","t3","channels","displayable","formatHex8","formatHsl","clamp","hue","nogamma","rgbGamma","gamma","rgbSpline","spline","colors","rgbBasis","rgbBasisClosed","isNumberArray","ArrayBuffer","isView","DataView","numberArray","genericArray","nb","na","reA","reB","am","bm","bs","bi","lastIndex","valueOf","bimap","interpolate","polymap","transformer","untransform","piecewise","rescale","clamper","invert","rangeRound","continuous","initRange","initInterpolator","interpolator","tickFormat","linearish","prestep","maxIter","transformLog","transformExp","transformLogn","transformExpn","pow10","reflect","loggish","logs","pows","E","log2","logp","powp","transformPow","transformSqrt","transformSquare","powish","transformSymlog","transformSymexp","symlogish","ticker","tickIntervals","tickInterval","utcTicks","utcTickInterval","timeTicks","timeTickInterval","calendar","formatMillisecond","formatSecond","formatMinute","formatHour","formatDay","formatWeek","formatMonth","formatYear","k10","sequential","sequentialPow","k21","r2","divergingPow","InternMap","entries","keyof","super","defineProperties","_intern","intern_get","intern_set","intern_delete","InternSet","Set","implicit","ordinal","svgNode","translateX","translateY","rotate","skewX","scaleX","atan","interpolateTransform","pxComma","pxParen","degParen","xa","ya","xb","yb","interpolateTransformCss","DOMMatrix","WebKitCSSMatrix","isIdentity","decompose","interpolateTransformSvg","createElementNS","setAttribute","baseVal","consolidate","cosh","zoomRho","rho","rho2","rho4","ux0","uy0","w0","ux1","uy1","w1","coshr0","tanh","sinh","duration","_1","_2","hslLong","Xn","Yn","Zn","labConvert","Lab","Hcl","hcl2lab","rgb2lrgb","xyz2lab","lab","lab2xyz","lrgb2rgb","hcl","hclConvert","hclLong","A","B","C","ED","EB","BC_DA","Cubehelix","bl","cubehelixConvert","cubehelix","cubehelixGamma","cubehelixLong","bandSpace","paddingInner","paddingOuter","space","Log","Pow","Sqrt","Symlog","Time","Sequential","Diverging","Quantize","Threshold","Ordinal","Point","Band","BinOrdinal","Continuous","Discrete","Discretizing","Interpolating","Temporal","ordinalRange","range$1","invertRange","pointish","scales","VEGA_SCALE","registerScale","metadata","invertExtent","invertRangeExtent","isValidScaleType","hasType","isContinuous","isDiscrete","isDiscretizing","isLogarithmic","isInterpolating","isQuantile","sequentialLog","sequentialSymlog","diverging","divergingLog","divergingSymlog","thresholds","quantize","scaleBinOrdinal","scaleProps","interpolateRange","interpolateColors","quantizeInterpolator","scaleFraction","scale$1","interp","palette","scheme","schemes","category10","category20","category20b","category20c","tableau10","tableau20","accent","dark2","paired","pastel1","pastel2","set1","set2","set3","blues","greens","greys","oranges","purples","reds","blueGreen","bluePurple","greenBlue","orangeRed","purpleBlue","purpleBlueGreen","purpleRed","redPurple","yellowGreen","yellowOrangeBrown","yellowOrangeRed","blueOrange","brownBlueGreen","purpleGreen","purpleOrange","redBlue","redGrey","yellowGreenBlue","redYellowBlue","redYellowGreen","pinkYellowGreen","spectral","viridis","magma","inferno","plasma","cividis","rainbow","sinebow","turbo","browns","tealBlues","teals","warmGreys","goldGreen","goldOrange","goldRed","lightGreyRed","lightGreyTeal","lightMulti","lightOrange","lightTealBlue","darkBlue","darkGold","darkGreen","darkMulti","darkRed","SymbolLegend","DiscreteLegend","defaultFormatter","tickCount","minStep","validTicks","endpoints","tickValues","noSkip","varfmt","tickLog","symbols","labelValues","binValues","thresholdValues","isDiscreteRange","labelFormat","thresholdFormat","formatRange","formatDiscrete","formatPoint","dflt","domainCaption","isTemporal","gradient_id","patternPrefix","isGradient","gradient","gradientRef","defs","Gradient","stops","lookup","horizontal","vertical","curves","orientation","entry","paramCounts","commandPattern","numberPattern","spacePattern","flagPattern","commands","cmd","paramCount","segment","ws","parseParams","DegToRad","HalfPi","Tau","HalfSqrt3","segmentCache","bezierCache","bezier","th0","th1","rx","ry","sin_th","cos_th","a00","a01","a10","a11","cos_th0","sin_th0","cos_th1","sin_th1","th_half","sin_th_h2","x3","y3","current","sX","sY","pathRender","tempX","tempY","tempControlX","tempControlY","controlX","controlY","anchorX","anchorY","beginPath","drawArc","coords","seg","large","sweep","rotateX","th","pl","sfactor_sq","sfactor","xc","yc","th_arc","segs","th2","th3","segments","bez","Tan30","builtins","parsed","customSymbol","rectangleX","rectangleY","rectangleWidth","rectangleHeight","vg_rect","crTL","crTR","crBL","crBR","rectangle","tl","tr","br","cornerRadius","vg_trail","ready","w2","ud","hypot","trail","value$1","arcShape","padRadius","da0","da1","ap","rp","rc0","rc1","oc","x32","y32","intersect","ax","ay","bx","by","kc","lc","centroid","areavShape","areahShape","lineShape","rectShape","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomRight","cornerRadiusBottomLeft","symbolShape","circle","trailShape","hasCornerRadius","clip_id","resetSVGClipId","clip$1","renderer","clip","_defs","clipping","Bounds","union","Item","mark","bounds","GroupItem","items","ResourceLoader","customLoader","increment","decrement","boundStroke","miter","stroke","strokeOpacity","sw","strokeWidth","expand","strokeJoin","miterAdjustment","MAX_VALUE","equals","angle","rotatedPoints","encloses","alignsWith","intersects","contains","sanitizeURL","catch","loadImage","img","cors","onload","onerror","complete","poll","circleThreshold","rot","ma","mb","mc","md","addL","addX","addY","addp","addpL","boundContext","deg","context$1","px1","py1","px2","py2","quadExtrema","px3","py3","cubicExtrema","sa","ea","cubic","s2","intersectPath","brush","isPointInPath","intersectPoint","box","intersectRect","intersectRule","intersectBoxLine","blend","globalCompositeOperation","addStops","addColorStop","createRadialGradient","image","ictx","fillStyle","createLinearGradient","fillRect","createPattern","fillOpacity","globalAlpha","lw","strokeStyle","lineWidth","lineCap","strokeCap","lineJoin","miterLimit","strokeMiterLimit","setLineDash","strokeDash","lineDashOffset","strokeDashOffset","zindex","zorder","scene","zdirty","zitems","pickVisit","hit","drawAll","drawPath","drawOne","pick$1","gx","gy","pixelRatio","hitPath","filled","isPointInStroke","pickPath","translateItem","markItemPath","isect","tag","nested","attr","emit","rotateItem","bound","pick","markMultiItemPath","tip","orient","clipGroup","offset$1","strokeOffset","emitRectangle","off","rectanglePath","hitBackground","hitForeground","hitCorner","noBound","markTypes","fore","strokeForeground","save","marktype","includes","restore","dw","dh","ix","interactive","pickMark","content","background","foreground","getImage","imageWidth","aspect","imageHeight","imageXOffset","imageYOffset","baseline","toDataURL","ar0","ar1","imageSmoothingEnabled","drawImage","xOffset","yOffset","path$1","pathCache","path$2","transformItem","draw$2","rule","widthCache","textMetrics","fontSize","measureWidth","estimateWidth","canvas","useCanvas","use","_estimateWidth","textValue","currentFontHeight","_measureWidth","font","currentFont","measureText","lineHeight","textLines","lineBreak","multiLineOffset","widthGetter","rtl","dir","fontFamily","quote","fontStyle","fontVariant","fontWeight","textAlign","tempBounds","anchorPoint","radius","theta","lh","fillText","strokeText","Marks","boundItem","DUMMY","boundMark","hasItems","sceneToJSON","indent","sceneFromJSON","initialize","Scenegraph","createMark","role","aria","description","domCreate","doc","ns","domFind","el","childNodes","tagName","domChild","ownerDocument","insertBefore","domClear","removeChild","cssClass","event","getBoundingClientRect","clientX","clientLeft","clientY","top","clientTop","Handler","customTooltip","_active","_handlers","_tooltip","defaultTooltip","element","Renderer","_el","_bgcolor","markdef","origin","_obj","firstChild","_origin","_scene","_handlerIndex","handlers","eventName","handleHref","MouseEvent","dispatchEvent","handleTooltip","show","tooltip","mdef","resolveItem","getItemBoundingClientRect","bottom","scaleFactor","resize","bgcolor","_width","_height","_scale","dirty","render","_call","_render","renderAsync","_ready","_load","redraw","DragEnterEvent","DragLeaveEvent","DragOverEvent","PointerDownEvent","PointerMoveEvent","PointerOutEvent","PointerOverEvent","MouseDownEvent","MouseMoveEvent","MouseOutEvent","MouseOverEvent","ClickEvent","MouseWheelEvent","TouchStartEvent","TouchMoveEvent","TouchEndEvent","TooltipShowEvent","TooltipHideEvent","HrefEvent","CanvasHandler","_down","_touch","_first","_events","eventListenerCheck","eventBundle","fire","fireAll","moveEvents","overEvents","outEvents","pickEvent","exit","inactive","_canvas","DOMMouseScroll","pointermove","dragover","pointerout","dragleave","pointerdown","mousedown","click","touchstart","changedTouches","touchmove","touchend","vegaType","devicePixelRatio","CanvasRenderer","_options","_redraw","_dirty","_tempb","base$2","SVGHandler","_hrefHandler","listener","_tooltipHandler","externalContext","appendChild","inDOM","HTMLElement","parentNode","ratio","style","setTransform","ctx","db","vb","viewBounds","clipToBounds","clearRect","__data__","svg","_svg","ARIA_HIDDEN","ARIA_LABEL","ARIA_ROLE","ARIA_ROLEDESCRIPTION","GRAPHICS_OBJECT","GRAPHICS_SYMBOL","roledesc","label","AriaIgnore","AriaGuides","desc","caption","title","extractTitle","props","channelCaption","titleCaption","AriaEncode","ariaRole","ariaRoleDescription","ariaItemAttributes","hide","ariaMarkAttributes","ariaGuide","ariaMark","innerText","attrText","markup","outer","inner","stack","open","attrs","close","serializeXML","node","_serialize","hasAttributes","attributes","hasChildNodes","children","nodeType","nodeValue","stylesAttr","stylesCss","rootAttributes","xmlns","svgns","SVGRenderer","_dirtyID","_root","base$1","dirtyParents","updateGradient","grad","pt","setAttributes","viewBox","preserveAspectRatio","fx","fy","fr","updateClipping","mask","sibling","__values__","bg","cg","ownerSVGElement","previousSibling","siblingCheck","nextSibling","_clearDefs","setAttributeNS","RootIndex","setProperty","removeAttribute","_dirtyCheck","_dirtyAll","isDirty","markType","isGroup","lastChild","extra","mark_extras","setStyle","ts","textContent","removeAttributeNS","removeProperty","loc","location","SVGStringRenderer","_text","class","attrList","_hrefs","prefixed","styleList","display","OPTS","svgMarkTypes","svgOnTop","setHybridRendererOptions","HybridRenderer","_svgRenderer","_canvasRenderer","HybridHandler","_root_el","bottomEl","topEl","position","_svgEl","_canvasEl","pointerEvents","canvasMarkTypes","Canvas","Hybrid","RenderType","PNG","SVG","modules","renderModule","hits","intersectMark","intersectGroup","visitMark","intersectItem","marks","headless","clipBounds","boundClip","TOLERANCE","sceneEqual","pathEqual","ka","kb","objectEqual","resetSVGDefIds","Top","Left","Right","Bottom","Start","Middle","End","Group","AxisRole","TitleRole","LegendRole","RowHeader","RowFooter","RowTitle","ColHeader","ColFooter","ColTitle","FitX","FitY","All","Each","Flush","Column","Row","Bound","view","rebound","markBounds","COUNTER_NAME","Identifier","Mark","Overlap","counter","_signals","scenegraph","lookup$1","Init","methods","parity","greedy","sep","hasOverlap","hasBounds","Render","separation","boundScale","boundTolerance","tolerance","boundTest","boundOrient","isYAxis","axisLayout","axis","indices","grid","labels","axisIndices","minExtent","maxExtent","titlePadding","dl","axisTitleLayout","auto","bboxFlush","bboxFull","offsetValue","gridLayout","nodirty","alignCol","alignRow","padCol","padRow","ncols","nrows","xExtent","xMax","yExtent","yMax","boxes","boundFlush","boundFull","layoutHeaders","headers","isX","bf","stride","back","layoutTitle","legendParams","config","legends","offsets","mult","legendLayout","legend","_bounds","ex","ey","tpad","tx","ty","legendTitleOffset","legendGroupLayout","legendBounds","widths","legendEntryLayout","lr","noBar","vgrad","ViewLayout","AxisTicks","DataJoin","defaultItemCreate","Encode","LegendEntries","views","rowheaders","rowfooters","colheaders","colfooters","rowtitle","coltitle","gridLayoutGroups","headerBand","footerBand","titleAnchor","titleBand","trellisLayout","xBounds","yBounds","autosize","pos","subtitle","titleLayout","_autosize","viewWidth","viewHeight","_resizeView","viewSizeLayout","layoutGroup","shouldReflow","newMap","fmod","encoders","reenter","enter","fraction","lskip","perc","adjust","labelFraction","perc2","sourceX","sourceY","targetX","targetY","LinkPath","Paths","rr","iy","sr","ta","sc","ss","tc","mr","Pie","includePad","Scale","domainCheck","adjustScheme","flip","SortItems","isContinuousColor","rawDomain","domainMid","scaleKey","rangeStep","configureRangeStep","scheme$1","schemeExtent","interpolateGamma","schemeCount","configureScheme","configureRange","domainRaw","configureBins","raw","includeZero","padDomain","domainMin","domainMax","domainImplicit","configureDomain","Zero","Center","Normalize","DefOutput","Stack","stackCenter","stackNormalize","stackZero","lastPos","lastNeg","streamGeometry","streamGeometryType","streamObjectType","Feature","FeatureCollection","Sphere","sphere","MultiPoint","LineString","streamLine","MultiLineString","Polygon","streamPolygon","MultiPolygon","GeometryCollection","closed","coordinate","polygonStart","polygonEnd","Adder","_partials","_n","quarterPi","areaSum","areaRingSum","areaStream","areaRingStart","areaRingEnd","areaPointFirst","areaPoint","boundsStream","X0","Y0","Z0","X1","Y1","Z1","Y2","Z2","centroidStream","centroidPoint","centroidLineStart","centroidLineEnd","centroidRingStart","centroidRingEnd","centroidPointFirstLine","centroidPointLine","centroidPointFirstRing","centroidPointRing","PathContext","_radius","pointRadius","lengthRing","lengthSum","lengthStream","lengthPointFirst","lengthPoint","cacheDigits","cacheAppend","cacheRadius","cacheCircle","PathString","projection","projectionStream","contextStream","lines","rejoin","Intersection","other","compareIntersection","startInside","subject","pointEqual","isSubject","spherical","cartesian","lambda","phi","cosPhi","cartesianDot","cartesianCross","cartesianAddInPlace","cartesianScale","vector","cartesianNormalizeInPlace","longitude","flatten","pointVisible","clipLine","sink","ringBuffer","ringSink","polygonStarted","pointRing","ringStart","ringEnd","sinPhi","winding","point0","lambda0","phi0","sinPhi0","cosPhi0","lambda1","sinPhi1","cosPhi1","point1","phi1","absDelta","antimeridian","intersection","phiArc","polygonContains","pointLine","ringSegments","validSegment","sign0","sign1","sinLambda0Lambda1","clipAntimeridianIntersect","to","direction","circleRadius","cosRadius","clipMax","clipMin","clipRectangle","visible","corner","comparePoint","ca","x__","y__","v__","x_","y_","v_","first","activeStream","bufferStream","clipStream","linePoint","polygonInside","cleanInside","compose","rotationIdentity","deltaLambda","deltaPhi","deltaGamma","rotationLambda","rotationPhiGamma","forwardRotationLambda","rotation","cosDeltaPhi","sinDeltaPhi","cosDeltaGamma","sinDeltaGamma","TransformStream","fit","fitBounds","clipExtent","fitExtent","fitSize","fitWidth","fitHeight","maxDepth","cosMinDistance","delta2","resampleLineTo","depth","phi2","lambda2","dx2","dy2","dz","lambda00","b00","c00","resampleStream","ringPoint","resampleNone","transformRadians","scaleTranslateRotate","scaleTranslate","cosAlpha","sinAlpha","ai","fi","projectionMutator","projectAt","projectResample","projectTransform","projectRotateTransform","cacheStream","preclip","postclip","recenter","resample","transformRotate","clipAngle","cr","smallRadius","notHemisphere","two","n2","n2n2","n1n2","determinant","c2","n1xn2","uu","polar","code","v00","point2","sinRadius","circleStream","reflectX","reflectY","conicProjection","parallels","conicEqualAreaRaw","sy0","forward","cylindricalEqualAreaRaw","r0y","conicEqualArea","azimuthalRaw","azimuthalInvert","cc","azimuthalEqualAreaRaw","cxcy","azimuthalEquidistantRaw","mercatorRaw","mercatorProjection","reclip","tany","conicConformalRaw","equirectangularRaw","conicEquidistantRaw","nx","A1","A2","A3","A4","equalEarthRaw","l2","l6","gnomonicRaw","naturalEarth1Raw","phi4","orthographicRaw","stereographicRaw","transverseMercatorRaw","sqrt2","SQRT1_2","mollweideBromleyTheta","cp","cpsinPhi","mollweideRaw","mollweideBromleyRaw","defaultPath","projectionProperties","proj","projections","getProjectionPath","albers","albersusa","lower48Point","alaskaPoint","hawaiiPoint","lower48","alaska","hawaii","pointStream","albersUsa","streams","azimuthalequalarea","azimuthalequidistant","conicconformal","conicequalarea","conicequidistant","equalEarth","equirectangular","gnomonic","identity","mercator","mollweide","naturalEarth1","orthographic","stereographic","transversemercator","graticuleX","graticuleY","cases","contours","smoothLinear","tz","contour","polygons","holes","startIndex","endIndex","isorings","hole","xt","yt","_0","ringContains","xi","yi","pj","xj","yj","segmentContains","collinear","Isocontour","transformPolygon","transformRing","density2D","weight","values0","Float32Array","values1","blurX","blurY","sz","cellSize","LN2","KDE2D","levels","paths","transformPaths","PARAMS","Contour","post","GeoJSON","GeoPath","GeoPoint","GeoShape","Graticule","DX","DY","graticule","outline","extentMajor","extentMinor","stepMajor","stepMinor","Heatmap","dependency","$x","$y","$value","$max","Projection","xm","ym","xp","yp","leaf","defaultX","defaultY","quadtree","Quadtree","leaf_copy","_features","_points","lon","lat","geojson","initPath","shapeGenerator","shared","dep","opacity_","color_","can","getImageData","pix","putImageData","toCanvas","featurize","collectGeoJSON","treeProto","vx","vy","cover","xz","yz","quads","retainer","removeAll","visitAfter","Dispatch","typename","T","taskHead","taskTail","timeout","pokeDelay","clockLast","clockNow","clockSkew","clock","performance","setFrame","requestAnimationFrame","clearNow","Timer","_time","_next","timer","restart","wake","timerFlush","sleep","nap","poke","clearInterval","setInterval","initialAngle","nodeById","nodeId","ForceMap","strength","collide","radii","iterations","ri","ri2","prepare","rj","jiggle","_nodes","_random","nbody","strengths","distanceMin2","distanceMax2","theta2","accumulate","distanceMin","distanceMax","link","links","distances","bias","distance","initializeStrength","initializeDistance","Forces","ForceParams","ForceConfig","ForceOutput","Force","setup","sim","forces","getForce","numForces","setForceParam","hierarchy","mapChildren","objectChildren","childs","Node","eachBefore","computeHeight","copyData","optional","required","constantZero","change","iters","simulation","alphaMin","alphaDecay","alphaTarget","velocityDecay","stepper","tick","initializeNodes","initializeForce","randomSource","closest","stopped","static","finish","eachAfter","each","ancestor","aNodes","ancestors","bNodes","leastCommonAncestor","descendants","leaves","extendBasis","enclosesWeakAll","enclosesNot","encloseBasis2","encloseBasis3","dr","enclosesWeak","encloseBasis","r21","r3","a2","a3","b2","b3","c3","d3","ab","place","score","packSiblingsRandom","circles","aa","sj","sk","pack","shuffle","packEncloseRandom","defaultRadius","radiusLeaf","packChildrenRandom","translateChild","preroot","ambiguous","imputed","defaultId","defaultParentId","parentId","stratify","nodeKey","currentId","currentParentId","nodeByKey","slash","P","parentof","defaultSeparation","nextLeft","nextRight","moveSubtree","wm","wp","nextAncestor","vim","TreeNode","meanXReduce","maxYReduce","squarifyRatio","sumValue","minValue","maxValue","newRatio","minRatio","dice","squarify","resquarify","_squarify","Nest","nest","valuesByKey","keyValue","HierarchyLayout","setParams","setFields","Output$3","Pack","Output$2","Partition","Stratify","positionNode","parentKey","Layouts","tidy","nodeSize","treeRoot","firstWalk","secondWalk","sizeNode","siblings","executeShifts","midpoint","vip","vop","vom","sip","sop","som","apportion","cluster","previousNode","meanX","maxY","leafLeft","leafRight","Output$1","Tree","TreeLinks","Tiles","binary","sums","valueOffset","valueTarget","valueLeft","valueRight","slicedice","Treemap","tile","paddingStack","paddingTop","paddingRight","paddingBottom","paddingLeft","treemap","ALPHA_MASK","getBuffer","Uint32Array","DIV","SIZE","RIGHT0","RIGHT1","outOfBounds","textWidth","textHeight","collision","bm0","bm1","getRange","X_DIR","Y_DIR","Aligns","Baselines","boundary","isInside","anchorCode","TOP","MIDDLE","BOTTOM","placeAreaLabel","bitmaps","avoidBaseMark","markIndex","areaWidth","maxAreaWidth","tryLabel","maxSize","_xMid","_yMid","swapTmp","labelPlaced","labelPlaced2","setRange","bm2","bitmap","labelLayout","texts","avoidMarks","lineAnchor","positions","getOffsets","anchors","Int8Array","getAnchors","grouptype","isGroupArea","markBoundary","infPadding","isNaiveGroupArea","maxTextWidth","maxTextHeight","_set","_clear","indexStart","indexEnd","clearRange","Bitmap","scaler","labelInside","baseMark","border","baseMarkContext","strokeContext","baseMarkBuffer","strokeBuffer","layer1","layer2","strokeAlpha","baseMarkAlpha","markBitmaps","baseBitmaps","sizeFactor","insideFactor","placeMarkLabel","Anchors","Label","Loess","null","Regression","dof","degreesOfFreedom","model","dom","elen","flen","Qnew","hh","bvirt","enow","fnow","eindex","findex","hindex","vec","C1","C2","orient2d","detleft","detright","det","detsum","acxtail","acytail","bcxtail","bcytail","ahi","alo","bhi","blo","_i","_j","u3","acx","bcx","acy","bcy","errbound","C1len","C2len","Dlen","orient2dadapt","EDGE_STACK","Delaunator","getX","defaultGetX","getY","defaultGetY","maxTriangles","_triangles","_halfedges","Int32Array","_hashSize","_hullPrev","_hullNext","_hullTri","_hullHash","_ids","_dists","hullPrev","hullNext","hullTri","hullHash","minY","minDist","i0x","i0y","i1x","i1y","minRadius","circumradius","i2x","i2y","quicksort","hull","triangles","halfedges","cl","circumcenter","_cx","_cy","_hullStart","hullSize","_hashKey","trianglesLen","_addTriangle","_legalize","pseudoAngle","ar","al","inCircle","hbl","_link","bp","tempDist","tmp","Voronoi","delaunay","xmin","xmax","_circumcenters","vectors","_init","circumcenters","inedges","ti","tj","_renderSegment","_project","renderBounds","renderCell","_clip","cellPolygons","cellPolygon","_regioncode","_clipSegment","_step","neighbors","cj","loop","li","aj","lj","_cell","e0","_simplify","_clipInfinite","_clipFinite","e1","sx0","sx1","sy1","_edgecode","_edge","vx0","vy0","vxn","vyn","pointX","pointY","jitter","Delaunay","flatArray","flatIterable","_delaunator","_hullIndex","hullIndex","voronoi","dc","renderHull","renderPoints","hullPolygon","renderTriangle","trianglePolygons","trianglePolygon","defaultExtent","toPathString","cloudRadians","ch","cloudSprite","contextAndRatio","di","sprite","w32","maxh","wcr","wsr","hcr","hsr","xoff","yoff","hasText","pixels","seen","seenRow","cloudCollide","board","msx","cloudBounds","collideRects","archimedeanSpiral","functor","spirals","archimedean","rectangular","Wordcloud","spiral","words","cloud","dxdy","startX","startY","maxDelta","zeroArray","tags","fontSizeRange","fsize","sizeScale","array8","array16","Uint16Array","array32","Dimension","query","onAdd","added","dim","SortedIndex","addi","oldv","oldi","addv","index0","value1","index1","reindex","CrossFilter","lengthen","_index","Bitmaps","_indices","ResolveFilter","reinit","eval","bits","remMap","modMap","indexMap","incrementOne","incrementAll","old","lo1","hi1","lo0","hi0","ignore","pass","Literal","CallExpression","ASTNode","TokenName","lookahead","elements","callee","consequent","alternate","argument","TokenBooleanLiteral","TokenEOF","TokenIdentifier","TokenKeyword","TokenNullLiteral","TokenNumericLiteral","TokenPunctuator","TokenStringLiteral","SyntaxArrayExpression","SyntaxBinaryExpression","SyntaxCallExpression","SyntaxConditionalExpression","SyntaxIdentifier","SyntaxLiteral","SyntaxLogicalExpression","SyntaxMemberExpression","SyntaxObjectExpression","SyntaxProperty","SyntaxUnaryExpression","MessageUnexpectedToken","MessageUnexpectedNumber","MessageUnexpectedString","MessageUnexpectedIdentifier","MessageUnexpectedReserved","MessageUnexpectedEOS","MessageInvalidRegExp","MessageUnterminatedRegExp","MessageStrictOctalLiteral","MessageStrictDuplicateProperty","ILLEGAL","DISABLED","RegexNonAsciiIdentifierStart","RegexNonAsciiIdentifierPart","assert","condition","isDecimalDigit","isHexDigit","isOctalDigit","isWhiteSpace","isLineTerminator","isIdentifierStart","fromCharCode","isIdentifierPart","keywords","skipComment","scanHexEscape","throwError","scanUnicodeCodePointEscape","cu1","cu2","getEscapedIdentifier","substr","scanPunctuator","code2","ch2","ch3","ch4","ch1","scanNumericLiteral","scanHexLiteral","octal","scanOctalLiteral","parseFloat","advance","getIdentifier","scanIdentifier","scanStringLiteral","lex","finishBinaryExpression","operator","finishCallExpression","finishIdentifier","finishLiteral","regex","finishMemberExpression","computed","member","finishProperty","kind","messageFormat","msg","whole","throwUnexpected","expect","matchKeyword","keyword","parseObjectPropertyKey","parseObjectProperty","parseConditionalExpression","legalKeywords","parsePrimaryExpression","parseExpression","parseGroupExpression","finishArrayExpression","parseArrayInitialiser","finishObjectExpression","parseObjectInitialiser","body","classMarker","terminated","literal","scanRegExpBody","search","scanRegExpFlags","$0","$1","exception","testRegExp","scanRegExp","parseArguments","parseNonComputedProperty","isIdentifierName","parseComputedMember","parsePostfixExpression","parseLeftHandSideExpressionAllowCall","parseUnaryExpression","finishUnaryExpression","binaryPrecedence","prec","marker","markers","parseBinaryExpression","finishConditionalExpression","Constants","LN10","LOG2E","LOG10E","MIN_VALUE","Functions","codegen","cast","fncall","STRING","REGEXP","datetime","timezoneoffset","utcdate","utcday","utcyear","utcmonth","utchours","utcminutes","utcseconds","utcmilliseconds","upper","lower","regexp","if","allowed","forbidden","constants","functions","globalvar","fieldvar","outputGlobal","globals","memberDepth","ast","Generators","MemberExpression","stripQuotes","ArrayExpression","BinaryExpression","UnaryExpression","ConditionalExpression","LogicalExpression","ObjectExpression","Property","phi00","deltaSum","ranges","areaRing","dLambda","sdLambda","adLambda","W0","W1","z0","boundsLineStart","boundsLineEnd","boundsRingPoint","boundsRingStart","boundsRingEnd","inflection","phii","lambdai","rangeCompare","rangeContains","centroidPointCartesian","centroidLinePointFirst","centroidLinePoint","centroidRingPointFirst","centroidRingPoint","cz","SELECTION_GETTER","Intersect","Union","SelectionId","$selectionId","UNIT_INDEX","testPoint","dval","others","E_union","E_intersect","R_union","R_intersect","selectionVisitor","scope","indexName","dataName","getData","indataRef","tuplesRef","wrap","dateObj","setYear","ScalePrefix","SignalPrefix","dataVisitor","scaleVisitor","addScaleDependency","scaleName","scaleRef","getScale","nameOrFunction","maybeScale","geoMethod","methodName","globalMethod","geoArea","geoBounds","deltaMax","geoCentroid","channel_luminance_value","channelValue","luminance","equal","equalArray","equalObject","removePredicate","accessors","seq","treeNodes","_window","markname","functionContext","isDefined","indexof","_len2","_key2","lastindexof","_len3","_key3","repl","_len4","_key4","pluck","contrast","color1","color2","lum1","lum2","monthFormat","monthAbbrevFormat","dayFormat","dayAbbrevFormat","inScope","pinchDistance","touches","pinchAngle","screen","containerSize","container","clientWidth","clientHeight","windowSize","innerWidth","innerHeight","bandspace","setdata","pathShape","retval","toggle","predicate","_trigger","lassoAppend","lasso","lassoPath","_ref","intersectLasso","pixelLasso","bb","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","testx","testy","intersections","prevX","prevY","pointInPolygon","eventFunctions","thisPrefix","astVisitors","codegenParams","fnctx","visitors","__bandwidth","_bandwidth","_range","ref","internalScaleFunctions","codeGenerator","expressionFunction","signalName","getSignal","signalRef","$expr","$fields","$params","miss","unitIdx","isMulti","vl5","resUnit","resolved","multiRes","acc","Skip","Swap","canonicalType","expression","expressionCodegen","parameter","adjustSpatial","lt","gt","_compare","parseParameter","PARSERS","$ref","$key","$flat","parseParameters","parameterExpression","$field","$name","$encode","enc","encodeExpression","$output","$compare","$order","$tupleid","$subflow","subctx","operators","Context","Subcontext","ariaLabel","subcontext","$ingest","$format","$request","unresolved","signal","operatorExpression","eventExpression","handlerExpression","eventConfig","parseOperator","parseOperatorParameters","parseStream","updates","parseUpdate","srcid","getState","dataset","setState","substate","Default","setCursor","cursor","globalCursor","dataref","_runtime","_viewWidth","_viewHeight","VIEW","NO_TRAP","trap","trackEventListener","_eventListeners","permit","_eventConfig","itemFilter","markTarget","invoke","vega","RadioClass","Event","wrapper","checked","option","valuesEqual","selected","selectedIndex","prepend","initializeRenderer","querySelector","paddingObject","renderHeadless","module","_scenegraph","Width","Height","dataTest","signalTest","proxy","formatArray","formatTooltip","View","_elBind","_renderType","_renderer","_handler","_globalCursor","_preventDefault","_timers","_resizeListeners","defaults","unpack","initializeEventConfig","runtime","_bind","bindings","_resize","resetSize","_resizeWidth","_resizeHeight","resizePadding","initializeResize","_background","user","hover","lookupSignal","findOperatorHandler","addOperatorListener","removeOperatorListener","_desc","_resetRenderer","rerun","addResizeListener","removeResizeListener","addSignalListener","removeSignalListener","addDataListener","removeDataListener","total","_restart","elapsed","timestamp","prevent","allow","itemGroup","extension","eventExtend","finalize","timers","listeners","hoverSet","leaveSet","elBind","initializeAria","prevHandler","initializeHandler","binding","toImageURL","mime","blob","Blob","URL","createObjectURL","toBlobURL","toSVG","LBRACK","RBRACK","LBRACE","RBRACE","COLON","COMMA","NAME","GT","DEFAULT_MARKS","DEFAULT_SOURCE","MARKS","eventSelector","selector","parseMerge","parseSelector","endChar","pushChar","popChar","parseBetween","parseThrottle","parseAutosize","parsePadding","encoder","addEncode","addEncoders","extendEncode","MarkRole","AxisDomainRole","AxisGridRole","AxisLabelRole","AxisTickRole","AxisTitleRole","LegendBandRole","LegendEntryRole","LegendGradientRole","LegendLabelRole","LegendSymbolRole","LegendTitleRole","TitleTextRole","TitleSubtitleRole","applyDefault","entry$1","_color","resolveField","parseEncode","applyDefaults","parseBlock","block","parse$1","OUTER","OUTER_INVALID","outerError","parseSignal","addSignal","addBinding","Entry","refs","fieldRef$1","keyFieldRef","compareRef","aggrField","Scope$1","isSignal","hasSignal","specValue","deref","mergeStream","nestedStream","eventStream","streamParameters","addStream","markrole","filterMark","OP_VALUE_EXPR","mergeSources","FIELD_REF_ID","MULTIDOMAIN_SORT_OPS","parseScale","parseScaleDomain","parseScaleRange","parseLiteral","parseScaleInterpolate","parseScaleNice","parseArray","objectProperty","parseScaleBins","dataLookupError","explicitDomain","multipleDomain","singularDomain","valuesRef","parseSort","domainRef","extentRef","coll","addDataPipeline","fieldRef","ordinalMultipleDomain","quantileMultipleDomain","numericMultipleDomain","countsRef","sortRef","multidomain","parseParameter$1","Vertical","Index","Offset","Perc","Perc2","Value","GuideLabelStyle","GuideTitleStyle","GroupTitleStyle","GroupSubtitleStyle","Size","LegendScales","GroupMark","RectMark","RuleMark","SymbolMark","TextMark","guideGroup","isVertical","symbolDirection","gradientDirection","gradientLength","gradientWidth","gradientThickness","gradientHeight","entryColumns","getEncoding","anchorExpr","alignExpr$1","extendOffset","guideMark","extras","legendGradient","userEncode","thickness","legendGradientDiscrete","dataRef","vv","alignExpr","baselineExpr","legendGradientLabels","overlap","labelLimit","gradientLabelLimit","labelOffset","gradientLabelOffset","legendSymbolGroups","symbolOffset","valueRef","xSignal","yEncode","baseFill","baseStroke","symbolBaseFillColor","symbolBaseStrokeColor","facet","isL","isR","isLR","isVG","exprAlign","exprAnchor","exprAngle","exprBaseline","getRole","parseTransform","pdef","lookupRef","parseIndexParameter","parseSubParameter","parseSubParameters","projectionRef","parameterValue","isExpr","isField","isCompare","outerExpr","exprRef","outerField","isData","getDataRef","DataScope","aggregate","fieldKey","addSortField","ds","optype","sortKey","parseTrigger","trigger","parseMark","layoutRef","boundRef","keyRef","parseData$1","joinRef","$context","markpath","markRef","generates","encodeRef","pushState","subscope","addData","toRuntime","parseFacet","parseSubflow","popState","tol","parseOverlap","sieve","buildLegendEncode","getChannel","fromEntries","angleExpr","groupEncode","getSign","ifLeftTopExpr","ifX","ifXEnc","ifY","ifYEnc","ifTop","ifTopExpr","ifRight","ifRightExpr","$orient","ifEnc","ifExpr","isSimple","toExpr","ifOrient","fallback","axisConfig","styleProp","flushExpr","parseAxis","or","scaleType","axisBand","xyKeys","axisX","axisY","orientKeys","axisTop","axisBottom","axisLeft","axisRight","axisEncode","tickBand","ticksRef","tickMinStep","vscale","gridScale","tickPos","gridStart","gridEnd","axisGrid","tickSize","axisTicks","flushOffset","labelAlign","labelBaseline","flushOn","offsetExpr","axisLabels","pos0","pos1","axisDomain","titlePos","autoY","autoX","autoLayout","axisTitle","buildAxisEncode","parseScope","preprocessed","addProjection","parseProjection","addScale","initScale","upstream","analyze","parseData","isSubscope","addUpdate","streamSource","parseSignalUpdates","axes","legendEncode","entryLayout","scaleCount","legendType","entryRef","legendSymbolLayout","getStyle","getFontSize","sizeExpression","_anchor","legendTitle","parseLegend","buildTitle","titleEncode","buildSubTitle","parseTitle","parseLambdas","rootEncode","signalObject","Scope","lambdas","_id","_subid","_nextsub","_parent","_encode","_lookup","_markpath","Subscope","propertyLambda","arrayLambda","objectLambda","defaultFont","defaultColor","lightGray","square","subtitlePadding","bandPosition","domainWidth","domainColor","gridWidth","gridColor","labelAngle","labelPadding","tickColor","tickOffset","tickRound","tickWidth","gridAlign","columnPadding","rowPadding","gradientStrokeColor","gradientStrokeWidth","labelOverlap","symbolLimit","symbolType","symbolSize","symbolStrokeWidth","titleLimit","titleOrient","category","heatmap","ramp","pre","collectSignals","parseView","vref","annotate","check","isExpr$1","sig","hasOwnSignal","addScaleProj","projectionType","dataScope","version","Ops","Unary","ms","getTime","EventFunctions","DisallowedMethods","setImmediate","Visitors","interpret","isLogicalOr","isLogicalAnd","and","isLogicalNot","not","forEachLeaf","subop","normalizeLogicalComposition","normalizer","duplicate","structuredClone","never","omit","isNullOrFalse","mergeDeep","dest","deepMerge_","unique","isEqual","dict","dictKeys","otherKeys","setEqual","hasIntersection","prefixGenerator","wrappedWithAccessors","computedPrefixes","fieldIntersection","isEmpty","varName","alphanumericS","logicalExpr","deleteNestedProperty","orderedProps","titleCase","accessPathWithDatum","pieces","flatAccessWithDatum","escapePathAccess","replacePathInField","replaceAll","replacement","removePathFromField","accessPathDepth","getFirstDefined","idCounter","uniqueId","resetIdCounter","internalField","isInternalField","normalizeAngle","isNumeric","clonedProto","getPrototypeOf","deepEqual","ks","_stringify","seenIndex","ROW","COLUMN","FACET","XOFFSET","YOFFSET","RADIUS","RADIUS2","THETA","THETA2","LATITUDE","LONGITUDE","LATITUDE2","LONGITUDE2","COLOR","FILL","STROKE","SHAPE","ANGLE","OPACITY","FILLOPACITY","STROKEOPACITY","STROKEWIDTH","STROKEDASH","TEXT","ORDER","DETAIL","KEY","TOOLTIP","HREF","DESCRIPTION","POLAR_POSITION_CHANNEL_INDEX","radius2","isPolarPositionChannel","GEO_POSIITON_CHANNEL_INDEX","longitude2","latitude","latitude2","getPositionChannelFromLatLong","channel","isGeoPositionChannel","GEOPOSITION_CHANNELS","UNIT_CHANNEL_INDEX","detail","isColorChannel","FACET_CHANNEL_INDEX","FACET_CHANNELS","CHANNEL_INDEX","CHANNELS","_o","_d","_tt1","SINGLE_DEF_CHANNEL_INDEX","_r","_c","_f","SINGLE_DEF_UNIT_CHANNEL_INDEX","isChannel","SECONDARY_RANGE_CHANNEL","isSecondaryRangeChannel","getMainRangeChannel","getVgPositionChannel","getSecondaryRangeChannel","getSizeChannel","getOffsetChannel","getOffsetScaleChannel","getMainChannelFromOffsetChannel","UNIT_CHANNELS","_xo","_yo","_latitude","_longitude","_latitude2","_longitude2","_theta","_theta2","_radius2","NONPOSITION_CHANNEL_INDEX","NONPOSITION_CHANNELS","POSITION_SCALE_CHANNEL_INDEX","POSITION_SCALE_CHANNELS","isXorY","POLAR_POSITION_SCALE_CHANNEL_INDEX","POLAR_POSITION_SCALE_CHANNELS","getPositionScaleChannel","sizeType","OFFSET_SCALE_CHANNEL_INDEX","isXorYOffset","_tt","_hr","_u","_al","_dd","_oo","NONPOSITION_SCALE_CHANNEL_INDEX","NONPOSITION_SCALE_CHANNELS","SCALE_CHANNEL_INDEX","SCALE_CHANNELS","isScaleChannel","ALL_MARKS","bar","geoshape","_g","ALL_MARKS_EXCEPT_GEOSHAPE","rangeType","AGGREGATE_OP_INDEX","MULTIDOMAIN_SORT_OP_INDEX","isArgminDef","isArgmaxDef","isAggregateOp","COUNTING_OPS","isCountingAggregateOp","SUM_OPS","SHARED_DOMAIN_OPS","binToString","normalizeBin","isParameterExtent","isBinning","isBinParams","binned","isBinned","autoMaxBins","isExprRef","replaceExprRef","newIndex","signalRefOrValue","extractTitleConfig","titleConfig","subtitleColor","subtitleFont","subtitleFontSize","subtitleFontStyle","subtitleFontWeight","subtitleLineHeight","rest","nonMarkTitleProperties","titleMarkConfig","subtitleMarkConfig","isText","isSignalRef","isVgRangeStep","isDataRefDomain","VG_MARK_CONFIGS","VG_MARK_INDEX","VG_CORNERRADIUS_CHANNELS","signalOrValueRefWithCondition","conditionalSignalRefOrValue","signalOrValueRef","exprFromSignalRefOrValue","exprFromValueRefOrSignalRef","signalOrStringValue","applyMarkConfig","propsList","getMarkConfig","markDef","getStyles","getMarkPropOrConfig","vgChannel","ignoreVgConfig","getMarkStyleConfig","styleConfigIndex","getStyleConfig","styles","styleConfig","sortParams","orderDef","fieldRefOption","orderChannelDef","vgField","mergeTitleFieldDefs","f1","f2","fdToMerge","fieldDef1","mergeTitle","title1","title2","mergeTitleComponent","v1Val","v2Val","explicit","invalidSpec","FIT_NON_SINGLE","containerSizeNonSingle","containerSizeNotCompatibleWithAutosize","droppingFit","unknownField","cannotProjectOnChannelWithoutField","cannotProjectAggregate","selectionNotSupported","columnsNotSupportByRowCol","differentParse","local","customFormatTypeNotAllowed","offsetNestedInsideContinuousPositionScaleDropped","mainChannel","invalidFieldType","droppingColor","emptyFieldDef","fieldDef","incompatibleChannel","markOrFacet","when","channelShouldBeDiscrete","channelShouldBeDiscreteOrDiscretizing","discreteChannelCannotEncode","unaggregateDomainHasNoEffectForRawField","unaggregateDomainWithNonSharedDomainOp","unaggregatedDomainWithLogScale","scalePropertyNotWorkWithScaleType","propName","stepDropped","MORE_THAN_ONE_SORT","invalidTimeUnit","unitName","errorBand1DNotSupport","channelRequiredForBinned","main","isDateTime","part","TIMEUNIT_PARTS","MONTHS","SHORT_MONTHS","DAYS","SHORT_DAYS","dateTimeParts","lowerM","monthIndex","shortM","shortMonthIndex","normalizeMonth","normalizeQuarter","lowerD","dayIndex","shortD","shortDayIndex","normalizeDay","timeUnit","dateTimeToExpr","LOCAL_SINGLE_TIMEUNIT_INDEX","isBinnedTimeUnit","isBinnedTimeUnitString","isUTCTimeUnit","VEGALITE_TIMEFORMAT","getTimeUnitParts","containsTimeUnit","getSmallestTimeUnitPart","fullTimeUnit","timeUnitSpecifierExpression","normalizeTimeUnit","getLocalTimeUnitFromUTCTimeUnit","durationExpr","normalizedTimeUnit","smallestUnitPart","startDate","getDateTimePartAndStep","DATE_PARTS","isDatePart","isFieldEqualPredicate","isFieldLTPredicate","isFieldLTEPredicate","lte","isFieldGTPredicate","isFieldGTEPredicate","gte","isFieldRangePredicate","isFieldOneOfPredicate","oneOf","in","isFieldPredicate","predicateValueExpr","valueExpr","wrapTime","fieldFilterExpression","useInRange","rawFieldExpr","fieldExpr","lastTimeUnit","dateExpr","dateTimeExprToExpr","predicateValuesExpr","isFieldValidPredicate","fieldValidPredicate","exprs","normalizePredicate","Type","quantitative","temporal","nominal","QUANTITATIVE","ORDINAL","TEMPORAL","NOMINAL","GEOJSON","ScaleType","LINEAR","LOG","POW","SQRT","SYMLOG","IDENTITY","SEQUENTIAL","TIME","QUANTILE","QUANTIZE","THRESHOLD","BIN_ORDINAL","POINT","BAND","SCALE_CATEGORY_INDEX","scaleCompatible","scaleType1","scaleType2","scaleCategory1","scaleCategory2","SCALE_PRECEDENCE_INDEX","scaleTypePrecedence","QUANTITATIVE_SCALES","CONTINUOUS_TO_CONTINUOUS_SCALES","isQuantitative","CONTINUOUS_TO_DISCRETE_SCALES","CONTINUOUS_DOMAIN_SCALES","DISCRETE_DOMAIN_SCALES","hasDiscreteDomain","hasContinuousDomain","isContinuousToContinuous","isContinuousToDiscrete","isParameterDomain","SCALE_PROPERTY_INDEX","rangeMax","rangeMin","NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES","NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX","scaleTypeSupportProperty","channelScalePropertyIncompatability","ARC","AREA","BAR","IMAGE","LINE","RECT","RULE","TICK","TRAIL","CIRCLE","SQUARE","GEOSHAPE","isPathMark","isRectBasedMark","PRIMITIVE_MARKS","isMarkDef","FILL_STROKE_CONFIG","VL_ONLY_MARK_CONFIG_PROPERTIES","invalid","timeUnitBandSize","timeUnitBandPosition","MARK_CONFIGS","isRelativeBandSize","BAR_CORNER_RADIUS_INDEX","midPointRefWithPositionInvalidTest","channelDef","midPoint","isFieldDef","fieldInvalidTestValueRef","wrapPositionInvalidTest","fieldInvalidPredicate","valueRefForFieldOrDatumDef","isDatumDef","interpolatedSignalRef","fieldOrDatumDef","fieldOrDatumDef2","startSuffix","endSuffix","channel2Def","defaultRef","isFieldOrDatumDef","isTypedFieldDef","getBandPosition","fieldDef2","binSuffix","binRequiresRange","isValueDef","offsetMixins","widthHeightValueOrSignalRef","isCustomFormatType","customFormatExpr","formatSignalRef","normalizeStack","formatCustomType","fieldToFormat","channelDefType","customFormatTypes","normalizedNumberFormatType","normalizedNumberFormat","numberFormatType","timeFormatType","isFieldOrDatumDefForTimeFormat","rawTimeFormat","isUTCScale","formatExpression","timeFormatExpression","isScaleFieldDef","specifiedFormat","binFormatExpression","formatExpr","datumDef","datumDefToExpr","guideFormat","omitTimeFormatConfig","isPositionFieldOrDatumDef","guideFormatType","binNumberFormatExpr","startField","endField","DEFAULT_SORT_OP","SORT_BY_CHANNEL_INDEX","isSortByChannel","isSortByEncoding","isSortField","isSortArray","isFacetMapping","isFacetFieldDef","isFacetSpec","toFieldDefBase","isSortableFieldDef","getBandSize","useVlSizeChannel","sizeChannel","discreteBandSize","continuousBandSize","hasBandEnd","isOrderOnlyDef","isConditionalDef","hasConditionalFieldDef","hasConditionalFieldOrDatumDef","isContinuousFieldOrDatumDef","isNumericDataDef","isUnbinnedQuantitativeFieldOrDatumDef","isMarkPropFieldOrDatumDef","isStringFieldOrDatumDef","toStringFieldDef","argAccessor","isCount","nofn","isOpFieldDef","tu","timeUnitToString","forAs","defaultTitleFormatter","fieldTitle","timeUnitParams","functionalTitleFormatter","countTitle","verbalTitleFormatter","titleFormatter","setTitleFormatter","formatter","allowDisabling","includeDefault","guideTitle","getGuide","defaultTitle","getFormatMixins","guide","getFieldDef","getFieldOrDatumDef","initChannelDef","initFieldOrDatumDef","fd","guideType","newGuide","initFieldDef","initDatumDef","compositeMark","fullType","getFullName","newType","defaultType","compatible","warning","COMPATIBLE","channelCompatibility","encoding","sub","labelOrient","isTimeFieldDef","undefinedIfExprNotRequired","isTime","isLocalSingleTimeUnit","valueArray","CONDITIONAL_AXIS_PROP_INDEX","vgProp","labelColor","labelFont","labelFontSize","labelFontStyle","labelFontWeight","labelOpacity","gridDash","gridDashOffset","gridOpacity","tickDash","tickDashOffset","tickOpacity","isConditionalAxisValue","AXIS_PARTS","AXIS_PROPERTY_TYPE","gridCap","domainCap","domainDash","domainDashOffset","domainOpacity","labelBound","labelFlush","labelFlushOffset","labelLineHeight","labelSeparation","tickCap","titleAlign","titleAngle","titleBaseline","titleColor","titleFont","titleFontSize","titleFontStyle","titleFontWeight","titleLineHeight","titleOpacity","titleX","titleY","tickExtra","COMMON_AXIS_PROPERTIES_INDEX","AXIS_PROPERTIES_INDEX","labelExpr","isAxisProperty","AXIS_CONFIGS","axisDiscrete","axisPoint","axisQuantitative","axisTemporal","axisXBand","axisXDiscrete","axisXPoint","axisXQuantitative","axisXTemporal","axisYBand","axisYDiscrete","axisYPoint","axisYQuantitative","axisYTemporal","isUnitSpec","CompositeMarkNormalizer","hasMatchingType","getMarkType","channelHasField","channelHasFieldOrDatum","channelHasNestedOffsetScale","isAggregate","extractTransformsFromEncoding","oldEncoding","aggOp","remaining","isTitleDefined","newField","newFieldDef","aggregateEntry","secondaryChannel","isNonPositionScaleChannel","markChannelCompatible","markSupported","getSupportedMark","supportMark","primaryFieldDef","normalizeEncoding","normalizedEncoding","newChannelDef","mapping","thisArg","pathGroupingFields","details","getCompositeMarkTooltip","tooltipSummary","continuousAxisChannelDef","encodingWithoutContinuousAxis","withFieldName","fiveSummaryTooltip","fieldPrefix","titlePrefix","mainTitle","getTitle","escape","tooltipFieldDefs","channelDefArray","fieldDefs","makeCompositeAggregatePartFactory","compositeMarkDef","continuousAxis","sharedEncoding","compositeMarkConfig","partName","positionPrefix","endPositionPrefix","extraEncoding","partLayerMixins","partBaseSpec","compositeMarkContinuousAxis","continuousAxisChannelDef2","continuousAxisChannelDefError","continuousAxisChannelDefError2","filterAggregateFromChannelDef","continuousAxisWithoutAggregate","compositeMarkOrient","xAggregate","yAggregate","BOXPLOT","boxPlotNormalizer","normalizeBoxPlot","getBoxPlotType","_encoding","_p","outerSpec","boxplot","sizeValue","boxPlotType","ticksOrient","boxOrient","customTooltipWithoutAggregatedField","continuousFieldName","boxplotSpecificAggregate","boxParamsQuartiles","postAggregateCalculates","calculate","oldContinuousAxisChannelDef","oldEncodingWithoutContinuousAxis","filteredEncoding","customTooltipWithAggregatedField","filterTooltipWithAggregatedField","boxParams","encodingWithoutSizeColorAndContinuousAxis","makeBoxPlotPart","makeBoxPlotExtent","makeBoxPlotBox","makeBoxPlotMidTick","fiveSummaryTooltipEncoding","endTick","whiskerTooltipEncoding","whiskerLayers","boxLayers","layer","lowerBoxExpr","upperBoxExpr","iqrExpr","lowerWhiskerExpr","upperWhiskerExpr","joinaggregateTransform","joinaggregate","filteredWhiskerSpec","encodingWithoutSizeColorContinuousAxisAndTooltip","axisWithoutTitle","outlierLayersMixins","filteredLayersMixins","filteredLayersMixinsTransforms","continousAxisField","ERRORBAR","errorBarNormalizer","normalizeErrorBar","tooltipEncoding","errorBarParams","makeErrorBarPart","errorbar","inputType","xError","xError2","yError","yError2","errorBarIsInputTypeRaw","isTypeAggregatedUpperLower","errorBarIsInputTypeAggregatedUpperLower","isTypeAggregatedError","errorBarIsInputTypeAggregatedError","errorBarOrientAndInputType","errorBarSpecificAggregate","tooltipTitleWithFieldName","getTitlePrefix","centerOp","lowerExtentOp","upperExtentOp","postAggregateCalculate","errorBarAggregationAndCalculation","oldContinuousAxisChannelDef2","oldContinuousAxisChannelDefError","oldContinuousAxisChannelDefError2","oldAggregate","oldGroupBy","ERRORBAND","errorBandNormalizer","normalizeErrorBand","errorBandDef","makeErrorBandPart","errorband","is2D","bandMark","bordersMark","compositeMarkRegistry","VL_ONLY_LEGEND_CONFIG","HEADER_TITLE_PROPERTIES_MAP","HEADER_LABEL_PROPERTIES_MAP","labelAnchor","HEADER_TITLE_PROPERTIES","HEADER_LABEL_PROPERTIES","HEADER_CONFIGS","headerRow","headerColumn","headerFacet","LEGEND_SCALE_CHANNELS","COMMON_LEGEND_PROPERTY_INDEX","clipHeight","fillColor","gradientOpacity","legendX","legendY","strokeColor","symbolDash","symbolDashOffset","symbolFillColor","symbolOpacity","symbolStrokeColor","SELECTION_ID","defaultConfig","encodings","isLegendBinding","isLegendStreamBinding","isSelectionParameter","assembleParameterSignals","isConcatSpec","isVConcatSpec","isHConcatSpec","getStepFor","offsetIsDiscrete","for","isStep","isFrameMixins","COMPOSITION_LAYOUT_PROPERTIES","spacing","getViewConfigContinuousSize","viewConfig","getViewConfigDiscreteStep","getViewConfigDiscreteSize","DEFAULT_STEP","continuousWidth","continuousHeight","binSpacing","minBandSize","outliers","borders","pointPadding","barBandPaddingInner","rectBandPaddingInner","bandWithNestedOffsetPaddingInner","bandWithNestedOffsetPaddingOuter","minFontSize","maxFontSize","minOpacity","maxOpacity","minSize","minStrokeWidth","maxStrokeWidth","quantileCount","quantizeCount","gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity","selection","tab10","DEFAULT_FONT_SIZE","guideLabel","groupTitle","groupSubtitle","DEFAULT_COLOR","gray0","gray1","gray2","gray3","gray4","gray5","gray6","gray7","gray8","gray9","gray10","gray11","gray12","gray13","gray14","gray15","getAxisConfigInternal","axisConfigInternal","configPropsWithExpr","initConfig","specifiedConfig","restConfig","mergedConfig","fontConfig","colorSignalConfig","fontSizeSignalConfig","outputConfig","markConfigType","axisConfigType","headerConfigType","styleConfigInternal","getStyleConfigInternal","MARK_STYLES","VL_ONLY_CONFIG_PROPERTIES","VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX","redirectConfigToStyleConfig","toProp","compositeMarkPart","isLayerSpec","SpecMapper","mapFacet","isRepeatSpec","mapRepeat","mapHConcat","mapVConcat","mapConcat","mapLayerOrUnit","mapLayer","mapUnit","subspec","hconcat","vconcat","STACK_OFFSET_INDEX","STACKABLE_MARKS","STACK_BY_DEFAULT_MARKS","isUnbinnedQuantitative","potentialStackedChannel","isCartesianBarOrArea","xDef","yDef","fieldChannel","stackedFieldDef","stackedField","dimensionChannel","getDimensionChannel","groupbyChannels","groupbyFields","dimensionDef","dimensionField","dimensionOffsetChannel","dimensionOffsetDef","dimensionOffsetField","stackBy","cDef","initMarkdef","originalMarkDef","specifiedOrient","xIsMeasure","yIsMeasure","xIsTemporal","yIsTemporal","cornerRadiusEnd","newProps","newProp","dropLineAndPoint","dropLineAndPointFromConfig","getPointOverlay","markConfig","getLineOverlay","PathOverlayNormalizer","normParams","pointOverlay","lineOverlay","stackProps","overlayEncoding","stackFieldChannel","replaceRepeaterInFacet","repeater","replaceRepeaterInMapping","replaceRepeaterInFieldDef","replaceRepeaterInEncoding","replaceRepeatInProp","isRepeatRef","replaceRepeaterInFieldOrDatumDef","replaceRepeaterInChannelDef","channelDefWithoutCondition","RuleForRangedLineNormalizer","mainChannelDef","hasX2","hasY2","mergeEncoding","parentEncoding","parentChannelDef","mergedChannelDef","mergeProjection","parentProjection","isFilter","isImputeSequence","isLookup","isPivot","isDensity","isRegression","isLoess","isSample","isWindow","isJoinAggregate","isFlatten","isCalculate","isBin","isImpute","isTimeUnit","isStack","isFold","isExtent","normalizeTransforms","normalizeBinExtent","normalizeChannelDef","cond","normalizeSelectionComposition","_a","pred","emptySelections","selectionPredicates","TopLevelSelectionsNormalizer","selections","addSpecNameToParams","normalizedSpec","topLevelSelectionNormalizer","coreNormalizer","selectionCompatNormalizer","normalizeGenericSpec","sizeInfo","isFitCompatible","autosizeDefault","_normalizeAutoSize","normalizeAutoSize","nonFacetUnitNormalizers","hasRow","hasColumn","hasFacet","mapFacetedUnit","specWithReplacedEncoding","repeaterPrefix","mapUnitWithParentEncodingOrProjection","normalizeLayerOrUnit","unitNormalizer","isLayerRepeatSpec","mapLayerRepeat","mapNonLayerRepeat","childSpec","layerValue","childRepeater","childName","remainingProperties","repeatValues","repeatValue","rowValue","columnValue","mergedProjection","mergedEncoding","facetMapping","getFacetMappingAndLayout","newEncoding","facets","defWithoutLayout","otherParams","selDef","select","TOP_LEVEL_PROPERTIES","extractTopLevelProperties","includeParams","Split","combine","getWithExplicit","setWithExplicit","copyKeyFromSplit","copyKeyFromObject","copyAll","makeExplicit","makeImplicit","tieBreakByComparing","propertyOf","diff","defaultTieBreaker","mergeValuesWithExplicit","tieBreaker","AncestorParse","parseNothing","isUrlData","isInlineData","isNamedData","isGenerator","isSequenceGenerator","isSphereGenerator","isGraticuleGenerator","DataSourceType","assembleProjection","hasLegend","assembleInit","assembled","dateTimeToTimestamp","assembleUnitSelectionSignals","selCmpt","component","modifyExpr","TUPLE","selectionCompilers","MODIFY","STORE","cleanupEmptyOnArray","assembleFacetSignals","getName","assembleUnitSelectionMarks","DataFlowNode","debugName","_children","addChild","numChildren","oldChild","insertAsParentOf","swapWithParent","newParent","OutputNode","cloneObj","_source","_name","refCounts","dependentFields","producedFields","_hash","getSource","isRequired","setSource","isTimeUnitTransformComponent","timeUnitComponent","offsetAs","TimeUnitNode","makeFromEncoding","formula","reduceFieldDef","isUnitModel","rectBandPosition","makeFromTransform","removeFormulas","newFormula","fieldAs","assemble","startEnd","offsetedRectFormulas","escapedField","endAs","OFFSETTED_RECT_START_SUFFIX","OFFSETTED_RECT_END_SUFFIX","smallestUnit","startExpr","endExpr","interpolateExpr","TUPLE_FIELDS","SelectionProjectionComponent","hasChannel","hasField","hasSelectionId","sg","cfg","initVal","getScaleComponent","geoChannel","allSignals","scaleBindings","topLevelSignals","isTopLevelLayer","namedSg","VL_SELECTION_RESOLVE","isLayerModel","BRUSH","SCALE_TRIGGER","GEO_INIT_TICK","INIT","hasProjection","filterExpr","tupleSg","scaledInterval","vname","visual","projectionName","scaled","getSizeSignalRef","coord","von","hasScales","vinit","initIdx","initSg","channelSignals","centerSg","xvname","yvname","xinit","yinit","sizeSg","visualSignals","triggerSg","scaleTriggers","toNum","dataSignals","vgStroke","fieldsSg","brushes","cmpt","wrapCondition","refFn","vgConditions","conditionValueRef","isConditionalParameter","parseSelectionPredicate","textRef","tooltipRefForEncoding","reactiveGeom","tooltipRefFromChannelDef","markTooltip","tooltipData","formatConfig","tooltipFormat","toSkip","fDef","channel2","keyValues","enableAria","ariaRoleDesc","descriptionValue","nonPosition","transparentIfNeeded","defaultFill","defaultStroke","colorVgChannel","fillStrokeMarkDefAndConfig","positionOffset","baseChannel","offsetType","markDefOffsetValue","pointPosition","defaultPos","pointPositionDefaultRef","positionRef","definedValueOrConfig","domainDefinitelyIncludesZero","ALIGNED_X_CHANNEL","BASELINED_Y_CHANNEL","middle","vgAlignedPositionChannel","defaultAlign","alignChannel","alignExcludingSignal","pointOrRangePosition","defaultPos2","rangePosition","pos2Mixins","vgSizeChannel","position2Ref","position2orSize","pointPosition2OrSize","dimensionSize","rectPosition","channelDef2","hasSizeDef","offsetScaleChannel","isBarBand","offsetScaleName","offsetScale","sizeMixins","hasSizeFromMarkOrEncoding","bandSize","defaultSizeRef","posRef","vgChannel2","sizeRef","sizeOffset","positionAndSize","axisTranslate","offset2","bandSizeExpr","binSpacingOffset","getBinSpacing","binSpacingOffset2","bandPositionForBandSize","useRectOffsetField","rectBinRef","startRef","rectBinPosition","hasFieldDef","bandWidth","scaleRange","bandPaddingInner","isEnd","spacingOffset","reverseExpr","axisTranslateExpr","minBandSizeExpr","spacingAndSizeOffset","ALWAYS_IGNORE","baseEncodeEntry","markDefProperties","wrapAllFieldsInvalid","filterIndex","aggregator","scaleComponent","allFieldsInvalidPredicate","valueIfDefined","VORONOI","nearest","cellDef","isVoronoi","exists","inputBindings","disableDirectManipulation","sgname","TOGGLE","tpl","findIndex","addClear","vIdx","tIdx","legendBindings","projLen","selDef_","legendFilter","selName","markName","sgName","ANCHOR","DELTA","boundScales","onDelta","scaleCmpt","reversed","facetModel","isFacetModel","getFacetModel","requiresSelectionId","identifier","startsWithDatum","getDependentFields","dependents","FilterNode","_dependentFields","dfnode","getSelectionComponent","tunode","parseSelectionExtent","filterOp","isSelectionPredicate","setAxisEncode","vgRef","_b","assembleAxis","axisCmpt","disable","propType","propValue","valueOrSignalRef","conditions","propIndex","valueOrSignalCRef","mainExtracted","hasAxisPart","titleString","assembleTitle","assembleAxisSignals","getAxisConfigFromConfigTypes","configTypes","configType","orient1","orientConfig1","orientConfig2","conditionalOrientAxisConfig","getAxisConfigStyle","axisConfigTypes","toMerge","getAxisConfig","axisConfigs","configFrom","configValue","axisRules","defaultGrid","gridChannel","defaultLabelAlign","defaultLabelBaseline","defaultLabelFlush","hasTimeUnit","defaultLabelOverlap","defaultTickCount","fieldDefTitle","getFieldDefTitle","typedFieldDef","defaultZindex","normalizeAngleExpr","alwaysIncludeMiddle","mainOrient","CalculateNode","parseAllForSortIndex","forEachFieldDef","sortValue","sortArrayIndexField","getHeaderChannel","getHeaderProperty","headerSpecificConfig","getHeaderProperties","HEADER_CHANNELS","HEADER_TYPES","assembleTitleGroup","facetFieldDef","headerChannel","defaultHeaderGuideBaseline","defaultHeaderGuideAlign","assembleHeaderProperties","assembleHeaderGroups","layoutHeader","headerType","headerComponent","assembleHeaderGroup","getSort","assembleLabelTitle","titleTextExpr","isFacetWithoutRowCol","hasAxes","sizeSignal","LAYOUT_TITLE_BAND","getLayoutTitleBand","propertiesMap","assembleLayoutSignals","sizeSignals","layoutSize","stepSignal","sizeExpr","isWidth","safeExpr","cardinality","getSizeTypeFromLayoutSizeType","layoutSizeType","guideEncodeEntry","valueDef","defaultScaleResolve","isConcatModel","parseGuideResolve","channelScaleResolve","LEGEND_COMPONENT_PROPERTY_INDEX","LEGEND_COMPONENT_PROPERTIES","LegendComponent","legendEncodeRules","symbolsSpec","legendCmpt","getMaxValue","getFirstConditionValue","selectedCondition","gradientSpec","specifiedlabelsSpec","labelsSpec","entriesSpec","getConditionValue","conditionalDef","reducer","hasConditionalValueDef","legendRules","legendConfig","gradientLengthSignal","defaultGradientLength","shapeChannelDef","markShape","defaultSymbolType","getDirection","defaultDirection","legendComponent","parseLegendForChannel","parseUnitLegend","mergeLegendComponent","parseNonUnitLegend","isExplicit","getLegendDefWithScale","legendSelections","parseInteractiveLegend","getLegendType","ruleParams","legendEncoding","legendEncodeParams","legendEncodingPart","mergedLegend","childLegend","mergedOrient","childOrient","typeMerged","mergedValueWithExplicit","st1","st2","assembleLegends","legendComponentIndex","legendByDomain","domainHash","mergedLegendComponent","setLegendEncode","assembleLegend","assembleProjectionForModel","fits","lookupDataSource","PROJECTION_PROPERTIES","ProjectionComponent","specifiedProjection","isFit","posssiblePair","requestDataName","Main","gatherFitData","projComp","parseUnitProjection","nonUnitProjection","mergable","allPropertiesShared","mergeIfNoConflict","modelProjection","renameProjection","parseNonUnitProjections","rangeFormula","formulaAs","binKey","getBinSignalName","createBinComponent","isBinTransform","normalizedBin","extentSignal","getSignalsFromModel","binComponent","BinNode","binComponentIndex","renameSignal","flatMap","binAs","remainingAs","binTrans","AggregateNode","dimensions","groupBy","meas","argField","scaleDomain","posChannel","isFieldRange","addDimension","parentMeasures","childMeasures","mergeMeasures","addDimensions","alias","FacetNode","sortField","sortIndexField","childModel","depFields","getChildIndependentFieldsWithStep","childIndependentFieldsWithStep","childScaleComponent","getFieldFromDomain","assembleDomain","assembleRowColumnHeaderData","crossedDataName","childChannel","assembleFacetHeaderData","hasSharedAxis","facetData","unquote","getImplicitFromFilterTransform","ParseNode","_parse","ancestorParse","makeWithAncestors","parsedAs","assembleFormatParse","formatParse","assembleTransforms","onlyNested","IdentifierNode","GraticuleNode","SequenceNode","SourceNode","_data","defaultExtension","_generator","hasName","_Optimizer_modified","receiver","isDataSourceNode","Optimizer","setModified","modifiedFlag","BottomUpOptimizer","getNodeDepths","depths","optimize","topologicalSort","TopDownOptimizer","MergeIdenticalNodes","mergeNodes","mergedNode","hashes","buckets","RemoveUnnecessaryIdentifierNodes","RemoveDuplicateTimeUnits","timeUnitFields","RemoveUnnecessaryOutputNodes","MoveParseUp","MergeParse","originalChildren","parseChildren","commonParse","conflictingParse","parseNode","mergedParseNode","childNode","RemoveUnusedSubtrees","MergeTimeUnits","timeUnitChildren","combination","MergeAggregates","aggChildren","groupedAggregates","groupBys","mergeableAggs","mergedAggs","MergeBins","moveBinsUp","promotableBins","remainingBins","promotedBin","remainingBin","MergeOutputs","otherChildren","mainOutput","lastOutput","theChild","JoinAggregateTransformNode","getDefaultName","joinAggregateFieldDef","StackNode","_stack","stackTransform","sortFields","sortOrder","normalizedAs","isValidAsArray","dimensionFieldDefs","stackField","facetby","stackProperties","groupbyChannel","stackby","_field","getStackByFields","getGroupbyFields","dimensionFieldDef","binStart","binEnd","WindowTransformNode","windowFieldDef","moveFacetDown","facetMain","moveMainDownToFacet","cloner","newName","FACET_SCALE_PREFIX","outputNodes","MAX_OPTIMIZATION_RUNS","checkLinks","runOptimizer","optimizer","optimizationDataflowHelper","dataComponent","firstPass","roots","SignalRefWrapper","exprGenerator","fromName","rename","localScaleComponents","domains","parseDomainForChannel","parseSelectionDomain","isFaceted","facetParent","parseUnitScaleDomain","selectionExtent","childComponent","domainsTieBreaker","se","parseNonUnitScaleDomain","scaleConfig","reason","canUseUnaggregatedDomain","useUnaggregatedDomain","normalizeUnaggregatedDomain","specifiedScales","parseSingleChannelDomain","convertDomainIfItIsDateTime","mapDomainToDataSignal","isDomainUnionWith","defaultDomain","unionWith","stackDimensions","normalizeSortField","fieldDefToSortBy","isStackedMeasure","domainSort","Raw","binSignal","getSignalName","isRectWithOffset","isDataRefUnionedDomain","nonUnionDomain","isFieldRefUnionDomain","uniqueDomains","_s","domainWithoutSort","sorts","filteredSorts","unionDomainSorts","allData","mergeDomains","assembleScales","assembleScalesForModel","otherScaleProps","assembleScaleRange","parsedExtent","assembleSelectionScaleDomain","ScaleComponent","typeWithExplicit","RANGE_PROPERTIES","getBinStepSignal","binCount","updatedName","parseRangeForChannel","specifiedScale","supportedByScaleType","channelIncompatability","parseScheme","getPositionStep","positionChannel","getOffsetStep","positionSize","getDiscretePositionSize","fullWidthOrHeightRange","offsetScaleType","positionScaleCmpt","positionScaleType","positionScaleName","positionDef","bandPositionOffset","bandPositionOffsetExpr","getOffsetRange","sizeRangeMin","xyStepSignals","maxBandSize","minXYStep","pointStep","MAX_SIZE_RANGE_STEP_RATIO","sizeRangeMax","rMax","rMin","defaultContinuousToDiscreteCount","defaultRange","isExtendedScheme","mergedScaleCmpt","offsetChannel","offsetDef","offsetScaleCmpt","stepCount","widthStep","heightStep","parseScaleProperty","localScaleCmpt","specifiedValue","scalePadding","scalePaddingInner","scaleRules","hasNestedOffsetScale","hasSecondaryRangeChannel","parseUnitScaleProperty","parseNonUnitScaleProperty","specifiedDomain","barConfig","continuousPadding","paddingValue","offsetBandPaddingInner","paddingInnerValue","bandPaddingOuter","offsetBandPaddingOuter","xReverse","rangeWithExplicit","parseUnitScaleRange","valueWithExplicit","defaultScaleType","channelSupportScaleType","specifiedType","fieldDefType","parseScaleCore","scaleComponents","sType","parseUnitScaleCore","scaleTypeWithExplicitIndex","explicitScaleType","childScaleType","scaleTypeTieBreaker","childScale","renameScale","parseNonUnitScaleCore","NameMap","nameMap","oldName","Model","parentGivenName","correctDataNames","scaleNameMap","projectionNameMap","signalNameMap","specType","compositionConfig","spacingConfig","extractCompositionLayout","outputNodeRefCounts","parseLayoutSize","renameTopLevelLayoutSizeSignal","parseSelections","parseAxesAndHeaders","parseLegends","parseMarkGroup","ignoreRange","parseScales","assembleEncodeFromView","baseView","assembleGroupEncodeEntry","isTopLevel","encodeEntry","assembleLayout","headerComponentIndex","assembleLayoutTitleBand","assembleDefaultLayout","assembleHeaderMarks","headerMarks","assembleAxes","axisComponents","assembleProjections","assembleProjectionsForModelAndChildren","titleNoEncoding","assembleGroup","assembleSignals","assembleMarks","getDataName","fullName","oldSignalName","originalScaleName","localScaleComponent","variableName","origName","sel","hasAxisOrientSignalRef","hasOrientSignalRef","ModelWithField","getMapping","DensityTransformNode","specifiedAs","ExtentTransformNode","FilterInvalidNode","make","vegaFilters","FlattenTransformNode","FoldTransformNode","fold","GeoJSONNode","parseAll","geoJsonCounter","pair","GeoPointNode","ImputeNode","processSequence","imputeTransform","imputedChannel","keyChannel","LoessTransformNode","LookupNode","secondary","fromOutputNode","isLookupData","fromSource","findSource","fromOutputName","isLookupSelection","materialized","foreign","asName","QuantileTransformNode","RegressionTransformNode","regression","PivotTransformNode","pivot","SampleTransformNode","makeWalkTree","datasetIndex","walkTree","dataSource","parseFacetHeader","makeHeaderComponent","mergeChildAxis","axisComponent","mainAxis","parseChildrenLayoutSize","parseNonUnitLayoutSizeForChannel","layoutSizeCmpt","mergedSize","childSize","scaleResolve","defaultUnitSize","facetSortFieldName","FacetModel","buildModel","initFacet","initFacetFieldDef","normalizedFacet","parseFacetHeaders","assembleSelectionTopLevelSignals","assembleSelectionData","getHeaderLayoutMixins","layoutMixins","layoutHeaderComponent","bandType","columnDistinctSignal","assembleGroupStyle","getCardinalityAggregateForChild","assembleFacet","facetRoot","outputName","facetSortFields","facetSortOrder","ORTHOGONAL_ORIENT","assembleFacetData","otherData","formatMesh","otherFeature","formatFeature","otherMesh","head","existingSource","parseRoot","parentIsLayer","lookupCounter","derivedType","transformNode","parseTransformArray","implicitSelection","getImplicitFromSelection","implicitEncoding","mainFieldDef","dimensionChannelDef","getImplicitFromEncoding","rawName","mainName","lookupName","materializeSelections","facetName","makeJoinAggregateFromFacet","ConcatModel","getChildren","widthType","heightType","parseConcatLayoutSize","parseAxisGroup","layoutSignals","AXIS_COMPONENT_PROPERTIES_INDEX","AXIS_COMPONENT_PROPERTIES","AxisComponent","OPPOSITE_ORIENT","mergeAxisComponents","mergedAxisCmpts","childAxisCmpts","mergeAxisComponent","propsToAlwaysIncludeConfig","defaultOrient","typeBasedConfigTypes","axisChannel","axisOrient","vlOnlyConfigTypes","vgConfigTypes","vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle","getAxisConfigs","getLabelAngle","hasValue","hasConfigValue","axisEncoding","axisEncodingPart","specifiedLabelsSpec","fixedShape","shapeMixins","defaultSize","markPropOrConfig","markCompiler","vgMark","postEncodingTransform","shapeDef","vgThicknessChannel","FACETED_PATH_PREFIX","STACK_GROUP_PREFIX","getMarkGroup","fromPrefix","xScale","yScale","scaleClip","projectionClip","unitCount","parentCount","interactiveFlag","UnitModel","parentGivenSize","specifiedAxes","specifiedLegends","filledConfig","defaultFilled","initEncoding","initLayoutSize","initScales","initAxes","initLegends","isGeoShapeMark","hasGeoPosition","scaleInternal","_axis","axisSpec","initAxis","axisInternal","_legend","supportLegend","specifiedSize","parseUnitLayoutSize","selDefs","selCmpts","selectionConfig","def_","parseUnitSelection","getPathGroups","fieldScale","stackFieldGroup","groupUpdate","innerGroupUpdate","groupByField","getGroupsForStackedBarWithCornerRadius","parseMarkGroups","hasSelections","isPoint","assembleTopLevelSignals","dataCopy","assembleUnitSelectionData","LayerModel","axisCount","oppositeOrient","parseLayerAxes","uniqueStyles","assembleLayerSelectionMarks","unitSize","isAnyConcatSpec","compile","inputSpec","newLogger","firstPassCounter","secondPassCounter","optimizeDataflow","vgSpec","topLevelProperties","datasets","usermeta","vgConfig","vlOnlyMarkSpecificConfigs","redirectTitleConfig","stripAndRedirectConfig","sourceIndex","newData","whereTo","assembleRootData","otherTopLevelProps","$schema","assembleTopLevelModel","autoSizeType","inverseSizeType","getFitType","getTopLevelProperties","normalized","library","lightColor","medColor","darkTheme","markColor$7","excelTheme","markColor$6","axisColor$2","backgroundColor$2","blackTitle","fiveThirtyEightTheme","markColor$5","ggplot2Theme","labelFont$1","markColor$4","colorSchemes$1","latimesTheme","markColor$3","axisColor$1","quartzTheme","markColor$2","voxTheme","markColor$1","axisColor","colorSchemes","urbanInstituteTheme","markColor","defaultFont$1","googlechartsTheme","ptToPx","fontSmallPx","legendFontPx","fontLargePx","fontStandard","fontTitle","firstLevelElementColor","secondLevelElementColor","backgroundColor","paletteColor1","divergentColorMin","divergentPalette","powerbiTheme","darkCategories","lightCategories","genCarbonConfig","viewbg","textColor","carbonwhite","carbong10","carbong90","carbong100","replacer","EL_ID","DEFAULT_OPTIONS","offsetX","offsetY","styleId","theme","disableDefaultStyle","valueToHtml","elementId","tooltipHandler","getElementById","innerHTML","createDefaultStyle","classList","fullscreenElement","tooltipBox","calculatePosition","_typeof","_defineProperty","hint","prim","toPrimitive","_toPrimitive","_toPropertyKey","getDefaultExportFromCjs","__esModule","hasRequiredIterator","yallist","Yallist$1","self","tail","inserted","removeNode","unshiftNode","pushNode","thisp","walker","forEachReverse","getReverse","mapReverse","initial","reduceReverse","toArray","toArrayReverse","ret","sliceReverse","deleteCount","Yallist","er","MAX","LENGTH","LENGTH_CALCULATOR","ALLOW_STALE","MAX_AGE","DISPOSE","NO_DISPOSE_ON_SET","LRU_LIST","UPDATE_AGE_ON_GET","naiveLength","doUse","isStale","del","maxAge","forEachStep","stale","dispose","noDisposeOnSet","updateAgeOnGet","mL","allowStale","mA","lengthCalculator","lC","itemCount","rforEach","dump","dumpLru","expiresAt","prune","looseOption","freeze","loose","emptyOpts","parseOptions_1","re$1","exports","MAX_LENGTH","MAX_SAFE_COMPONENT_LENGTH","MAX_SAFE_BUILD_LENGTH","MAX_LENGTH$1","RELEASE_TYPES","SEMVER_SPEC_VERSION","FLAG_INCLUDE_PRERELEASE","FLAG_LOOSE","debug_1","env","NODE_DEBUG","safeRe","R","LETTERDASHNUMBER","safeRegexReplacements","createToken","isGlobal","safe","makeSafeRegex","NUMERICIDENTIFIER","NUMERICIDENTIFIERLOOSE","NONNUMERICIDENTIFIER","PRERELEASEIDENTIFIER","PRERELEASEIDENTIFIERLOOSE","BUILDIDENTIFIER","MAINVERSION","PRERELEASE","BUILD","FULLPLAIN","MAINVERSIONLOOSE","PRERELEASELOOSE","LOOSEPLAIN","XRANGEIDENTIFIER","XRANGEIDENTIFIERLOOSE","GTLT","XRANGEPLAIN","XRANGEPLAINLOOSE","COERCE","LONETILDE","tildeTrimReplace","LONECARET","caretTrimReplace","comparatorTrimReplace","reExports","numeric","compareIdentifiers$1","anum","bnum","identifiers","compareIdentifiers","rcompareIdentifiers","parseOptions","semver","SemVer","includePrerelease","LOOSE","FULL","major","minor","prerelease","build","compareMain","comparePre","compareBuild","release","identifierBase","compare_1","compare$5","compare$4","compare$3","compare$2","compare$1","eq","neq","hasRequiredComparator","hasRequiredRange","cmp_1","Range","requireRange","Comparator","parseRange","isNullSet","isAny","comps","memoKey","cached","hr","HYPHENRANGELOOSE","HYPHENRANGE","hyphenReplace","COMPARATORTRIM","TILDETRIM","CARETTRIM","rangeList","comp","parseComparator","replaceGTE0","COMPARATORLOOSE","rangeMap","comparators","thisComparators","isSatisfiable","rangeComparators","thisComparator","rangeComparator","testSet","ANY","COMPARATOR","requireComparator","remainingComparators","testComparator","otherComparator","replaceCarets","replaceTildes","replaceXRanges","replaceStars","replaceTilde","TILDELOOSE","TILDE","replaceCaret","CARETLOOSE","CARET","replaceXRange","XRANGELOOSE","XRANGE","gtlt","xM","anyX","STAR","GTE0PRE","GTE0","incPr","fM","fm","fp","fpr","fb","tM","tm","tp","tpr","tb","satisfies_1","satisfies$1","ownKeys","enumerableOnly","getOwnPropertySymbols","sym","getOwnPropertyDescriptor","_objectSpread","getOwnPropertyDescriptors","vegaLite","vl","DEFAULT_ACTIONS","export","png","compiled","editor","I18N","CLICK_TO_VIEW_ACTIONS","COMPILED_ACTION","EDITOR_ACTION","PNG_ACTION","SOURCE_ACTION","SVG_ACTION","NAMES","VERSION","PREPROCESSOR","vlSpec","viewSource","sourceHeader","sourceFooter","footer","win","write","createLoader","opts","loadOpts","none","matches","childMatcher","childFirst","firstElementChild","EnterNode","namespaceURI","bindIndex","groupLength","dataLength","bindKey","nodeByKeyValue","arraylike","xhtml","xlink","xml","namespaces","attrRemove","attrRemoveNS","fullname","attrConstant","attrConstantNS","attrFunction","attrFunctionNS","defaultView","styleRemove","styleConstant","styleFunction","styleValue","getPropertyValue","getComputedStyle","propertyRemove","propertyConstant","propertyFunction","classArray","ClassList","_node","_names","getAttribute","classedAdd","classedRemove","classedTrue","classedFalse","classedFunction","textRemove","textConstant","textFunction","htmlRemove","htmlConstant","htmlFunction","raise","creatorInherit","documentElement","creatorFixed","namespace","constantNull","selection_cloneShallow","cloneNode","selection_cloneDeep","onRemove","__on","contextListener","CustomEvent","createEvent","initEvent","bubbles","cancelable","dispatchConstant","dispatchFunction","Selection","parents","_groups","_parents","subgroups","subnode","subgroup","selectAll","arrayAll","selectorAll","selectChild","childFind","selectChildren","childrenFilter","matcher","enterGroup","updateGroup","_enter","_exit","sparse","onenter","onupdate","onexit","groups0","groups1","m0","merges","group0","group1","compareDocumentPosition","compareNode","sortgroups","sortgroup","getAttributeNS","classed","html","creator","before","deep","typenames","dispatch","emptyOn","emptyTween","CREATED","STARTED","timing","schedules","__transition","tween","ease","schedule","tweenRemove","tween0","tween1","tweenFunction","tweenValue","transition","string00","interpolate0","string1","string0","string10","attrTweenNS","attrInterpolateNS","_value","attrTween","attrInterpolate","delayFunction","delayConstant","durationFunction","durationConstant","Transition","newId","selection_prototype","inherit","id0","id1","on0","on1","sit","onFunction","styleTween","styleNull","listener0","styleMaybeRemove","styleInterpolate","textTween","textInterpolate","removeFunction","easeConstant","easeVarying","cancel","interrupt","defaultTiming","applyX","applyY","invertX","invertY","rescaleX","rescaleY","Vega","_Component","_inherits","_classCallCheck","getRef","_assertThisInitialized","divId","uuidv4","prevProps","svgRendererScaleFactor","signalsToObserve","className","_this2","parsedSpec","loadedEmbedOptions","embedOptions","defaultStyle","embedOptionsFromUsermeta","usermetaLoader","usermetaOpts","parsedOpts","mergedOpts","actions","i18n","Warn","downloadFileName","ID","rootContainer","possibleRoot","getRootNode","ShadowRoot","getRoot","providedMode","guessMode","chartWrapper","expressionFunctions","viewClass","expressionInterpreter","documentClickHandler","updateSet","forceActionsMenu","summary","ev","ctrl","i18nExportAction","exportLink","download","viewSourceLink","compileLink","editorUrl","editorLink","listen","postMessage","_embed","vegaEmbed","vegaView","vegaSignals","filteredSignals","setProps","signalData","wait","debounceWait","maxWait","signalHandler","cleanedValue","cleanJson","React","Component","defaultProps","propTypes","PropTypes","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","freeGlobal","freeSelf","objectToString","nativeMax","nativeMin","isObjectLike","isSymbol","isBinary","lastArgs","lastThis","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","invokeFunc","shouldInvoke","timeSinceLastCall","timerExpired","trailingEdge","remainingWait","debounced","isInvoking","leadingEdge","stringOrChar","passedObj","maxLength","currentIndent","reserved","keyPart","nextIndent","prettified","stringLiteral"],"sourceRoot":""} \ No newline at end of file diff --git a/dash_vega_components/dash_vega_components.min.js b/dash_vega_components/dash_vega_components.min.js index 95fe612..aba1467 100644 --- a/dash_vega_components/dash_vega_components.min.js +++ b/dash_vega_components/dash_vega_components.min.js @@ -1,2 +1,2 @@ -(()=>{"use strict";var e,t,r={64:e=>{e.exports=window.PropTypes},196:e=>{e.exports=window.React}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,r)=>(o.f[r](e,t),t)),[])),o.u=e=>"async-Vega.js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="dash_vega_components:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var s,c;if(void 0!==a)for(var u=document.getElementsByTagName("script"),l=0;l{s.onerror=s.onload=null,clearTimeout(f);var o=e[r];if(delete e[r],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach((e=>e(n))),t)return t(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),c&&document.head.appendChild(s)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&!e;)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})();var a,i=function(){var e=document.currentScript;if(!e){for(var t=document.getElementsByTagName("script"),r=[],n=0;n{var e={179:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=a);var i=o.p+o.u(t),s=new Error;o.l(i,(r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",s.name="ChunkLoadError",s.type=a,s.request=i,n[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,a,[i,s,c]=r,u=0;if(i.some((t=>0!==e[t]))){for(n in s)o.o(s,n)&&(o.m[n]=s[n]);c&&c(o)}for(t&&t(r);u{o.r(c),o.d(c,{Vega:()=>s});var e=o(196),t=o.n(e),r=o(64),n=o.n(r),a=t().lazy((function(){return o.e(736).then(o.bind(o,90))})),i=function(e){return t().createElement(t().Suspense,{fallback:null},t().createElement(a,e))};i.defaultProps={svgRendererScaleFactor:1,signalsToObserve:[],signalData:{},debounceWait:10},i.propTypes={id:n().string,spec:n().object,opt:n().object,svgRendererScaleFactor:n().number,signalsToObserve:n().arrayOf(n().string),signalData:n().object,style:n().object,className:n().string,debounceWait:n().number,setProps:n().func};const s=i})(),window.dash_vega_components=c})(); +(()=>{"use strict";var e,t,r={64:e=>{e.exports=window.PropTypes},196:e=>{e.exports=window.React}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,r)=>(o.f[r](e,t),t)),[])),o.u=e=>"async-Vega.js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="dash_vega_components:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var s,c;if(void 0!==a)for(var u=document.getElementsByTagName("script"),l=0;l{s.onerror=s.onload=null,clearTimeout(f);var o=e[r];if(delete e[r],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach((e=>e(n))),t)return t(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),c&&document.head.appendChild(s)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&!e;)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})();var a,i=function(){var e=document.currentScript;if(!e){for(var t=document.getElementsByTagName("script"),r=[],n=0;n{var e={179:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=a);var i=o.p+o.u(t),s=new Error;o.l(i,(r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",s.name="ChunkLoadError",s.type=a,s.request=i,n[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,a,[i,s,c]=r,u=0;if(i.some((t=>0!==e[t]))){for(n in s)o.o(s,n)&&(o.m[n]=s[n]);c&&c(o)}for(t&&t(r);u{o.r(c),o.d(c,{Vega:()=>s});var e=o(196),t=o.n(e),r=o(64),n=o.n(r),a=t().lazy((function(){return o.e(736).then(o.bind(o,90))})),i=function(e){return t().createElement(t().Suspense,{fallback:null},t().createElement(a,e))};i.defaultProps={svgRendererScaleFactor:1,signalsToObserve:[],signalData:{},debounceWait:10},i.propTypes={id:n().string,spec:n().object,opt:n().object,svgRendererScaleFactor:n().number,signalsToObserve:n().arrayOf(n().string),signalData:n().object,style:n().object,className:n().string,debounceWait:n().number,setProps:n().func};const s=i})(),window.dash_vega_components=c})(); //# sourceMappingURL=dash_vega_components.min.js.map \ No newline at end of file diff --git a/dash_vega_components/dash_vega_components.min.js.map b/dash_vega_components/dash_vega_components.min.js.map index 4d73230..86a06f8 100644 --- a/dash_vega_components/dash_vega_components.min.js.map +++ b/dash_vega_components/dash_vega_components.min.js.map @@ -1 +1 @@ -{"version":3,"file":"dash_vega_components.min.js","mappings":"uBAAIA,EACAC,E,UCDJC,EAAOC,QAAUC,OAAkB,S,UCAnCF,EAAOC,QAAUC,OAAc,K,GCC3BC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaL,QAGrB,IAAID,EAASG,EAAyBE,GAAY,CAGjDJ,QAAS,CAAC,GAOX,OAHAO,EAAoBH,GAAUL,EAAQA,EAAOC,QAASG,GAG/CJ,EAAOC,OACf,CAGAG,EAAoBK,EAAID,ECxBxBJ,EAAoBM,EAAKV,IACxB,IAAIW,EAASX,GAAUA,EAAOY,WAC7B,IAAOZ,EAAiB,QACxB,IAAM,EAEP,OADAI,EAAoBS,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdP,EAAoBS,EAAI,CAACZ,EAASc,KACjC,IAAI,IAAIC,KAAOD,EACXX,EAAoBa,EAAEF,EAAYC,KAASZ,EAAoBa,EAAEhB,EAASe,IAC5EE,OAAOC,eAAelB,EAASe,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDZ,EAAoBkB,EA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,MACtBF,IAAAA,cAACG,EAAkBF,GAG/B,EAEAF,EAAKK,aAAe,CAAEC,uBAAwB,EAAGC,iBAAkB,GAAIC,WAAY,CAAC,EAAGC,aAAc,IAErGT,EAAKU,UAAY,CAIbb,GAAIc,IAAAA,OAKJC,KAAMD,IAAAA,OAKNE,IAAKF,IAAAA,OAQLL,uBAAwBK,IAAAA,OASxBJ,iBAAkBI,IAAAA,QAAkBA,IAAAA,QAQpCH,WAAYG,IAAAA,OAKZG,MAAOH,IAAAA,OAKPI,UAAWJ,IAAAA,OAMXF,aAAcE,IAAAA,OAMdK,SAAUL,IAAAA,MAGd,S","sources":["webpack:///webpack/runtime/load script","webpack:///external window \"PropTypes\"","webpack:///external window \"React\"","webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/ensure chunk","webpack:///webpack/runtime/get javascript chunk filename","webpack:///webpack/runtime/global","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///webpack/runtime/publicPath","webpack:///webpack/runtime/compat","webpack:///webpack/runtime/jsonp chunk loading","webpack:///./src/lib/LazyLoader.js","webpack:///./src/lib/components/Vega.react.js"],"sourcesContent":["var inProgress = {};\nvar dataWebpackPrefix = \"dash_vega_components:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","module.exports = window[\"PropTypes\"];","module.exports = window[\"React\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + \"async-Vega\" + \".js\";\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","var getCurrentScript = function() {\n var script = document.currentScript;\n if (!script) {\n /* Shim for IE11 and below */\n /* Do not take into account async scripts and inline scripts */\n\n var doc_scripts = document.getElementsByTagName('script');\n var scripts = [];\n\n for (var i = 0; i < doc_scripts.length; i++) {\n scripts.push(doc_scripts[i]);\n }\n\n scripts = scripts.filter(function(s) { return !s.async && !s.text && !s.textContent; });\n script = scripts.slice(-1)[0];\n }\n\n return script;\n};\n\nvar isLocalScript = function(script) {\n return /\\/_dash-component-suites\\//.test(script.src);\n};\n\nObject.defineProperty(__webpack_require__, 'p', {\n get: (function () {\n var script = getCurrentScript();\n\n var url = script.src.split('/').slice(0, -1).join('/') + '/';\n\n return function() {\n return url;\n };\n })()\n});\n\nif (typeof jsonpScriptSrc !== 'undefined') {\n var __jsonpScriptSrc__ = jsonpScriptSrc;\n jsonpScriptSrc = function(chunkId) {\n var script = getCurrentScript();\n var isLocal = isLocalScript(script);\n\n var src = __jsonpScriptSrc__(chunkId);\n\n if(!isLocal) {\n return src;\n }\n\n var srcFragments = src.split('/');\n var fileFragments = srcFragments.slice(-1)[0].split('.');\n\n fileFragments.splice(1, 0, \"v0_9_0devm1699467686\");\n srcFragments.splice(-1, 1, fileFragments.join('.'))\n\n return srcFragments.join('/');\n };\n}\n","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t179: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n// no on chunks loaded\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkdash_vega_components\"] = self[\"webpackChunkdash_vega_components\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","import React from 'react';\nexport const Vega = React.lazy(() => import(/* webpackChunkName: \"Vega\" */ './fragments/Vega.react'));","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Vega as RealComponent } from '../LazyLoader';\n\n/**\n * You can use this component to display Altair charts or Vega-Lite/Vega specifications in your Dash app.\n */\nconst Vega = (props) => {\n return (\n \n \n \n );\n};\n\nVega.defaultProps = { svgRendererScaleFactor: 1, signalsToObserve: [], signalData: {}, debounceWait: 10 };\n\nVega.propTypes = {\n /**\n * The ID used to identify this component in Dash callbacks.\n */\n id: PropTypes.string,\n\n /**\n * A Vega or Vega-Lite spec. To pass an Altair chart, use chart.to_dict().\n */\n spec: PropTypes.object,\n\n /**\n * Vega-Embed options. See https://github.com/vega/vega-embed#options for more details.\n */\n opt: PropTypes.object,\n\n /**\n * A number which is used to scale the chart in case the svg renderer is used.\n * This is useful when you want to increase the size of the chart keeping\n * the relative proportions of all chart elements to each other the same.\n * Default value is 1.\n */\n svgRendererScaleFactor: PropTypes.number,\n\n /**\n * A list of signal names to observe for changes. If you use Altair, these are the\n * names of the parameters you define. The values of these signals\n * will be available in the signalData property. You can pass [\"all\"] to\n * observe all signals.\n * Defaults to no signals.\n */\n signalsToObserve: PropTypes.arrayOf(PropTypes.string),\n\n /**\n * A read-only dictionary of signals with the key being the name of the signal.\n * The easiest way to make sense of it is to display the whole signalData dictionary\n * in your app layout or print it to the console\n * so that you see what the structure looks like.\n */\n signalData: PropTypes.object,\n\n /**\n * Generic style overrides on the Vega div\n */\n style: PropTypes.object,\n\n /**\n * Additional className of the Vega div\n */\n className: PropTypes.string,\n\n /**\n * Debouncing wait time in milliseconds before signals property is updated\n * Default value is 10.\n */\n debounceWait: PropTypes.number,\n\n /**\n * Dash-assigned callback that should be called to report property changes\n * to Dash, to make them available for callbacks.\n */\n setProps: PropTypes.func\n};\n\nexport default Vega;\n\nexport const defaultProps = Vega.defaultProps;\nexport const propTypes = Vega.propTypes;\n"],"names":["inProgress","dataWebpackPrefix","module","exports","window","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","m","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","f","e","chunkId","Promise","all","keys","reduce","promises","u","g","globalThis","this","Function","obj","prop","prototype","hasOwnProperty","call","l","url","done","push","script","needAttach","scripts","document","getElementsByTagName","i","length","s","getAttribute","createElement","charset","timeout","nc","setAttribute","src","onScriptComplete","prev","event","onerror","onload","clearTimeout","doneFns","parentNode","removeChild","forEach","fn","setTimeout","bind","type","target","head","appendChild","r","Symbol","toStringTag","value","scriptUrl","importScripts","location","currentScript","Error","replace","p","getCurrentScript","doc_scripts","filter","async","text","textContent","slice","split","join","jsonpScriptSrc","__jsonpScriptSrc__","isLocal","test","srcFragments","fileFragments","splice","installedChunks","j","installedChunkData","promise","resolve","reject","error","errorType","realSrc","message","name","request","webpackJsonpCallback","parentChunkLoadingFunction","data","chunkIds","moreModules","runtime","some","id","chunkLoadingGlobal","self","Vega","React","props","fallback","RealComponent","defaultProps","svgRendererScaleFactor","signalsToObserve","signalData","debounceWait","propTypes","PropTypes","spec","opt","style","className","setProps"],"sourceR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AAI2F,EAAuB,CAACC,EAA4BC,KACvD,IAGIhH,EAAUmB,GAHT8F,EAAUC,EAAaC,GAAWH,EAGhBpE,EAAI,EAC3B,GAAGqE,EAASG,MAAMC,GAAgC,IAAxBnB,EAAgBmB,KAAa,CACtD,IAAIrH,KAAYkH,EACZnH,EAAoBa,EAAEsG,EAAalH,KACrCD,EAAoBK,EAAEJ,GAAYkH,EAAYlH,IAG7CmH,GAAsBA,EAAQpH,EAClC,CAEA,IADGgH,GAA4BA,EAA2BC,GACrDpE,EAAIqE,EAASpE,OAAQD,IACzBzB,EAAU8F,EAASrE,GAChB7C,EAAoBa,EAAEsF,EAAiB/E,IAAY+E,EAAgB/E,IACrE+E,EAAgB/E,GAAS,KAE1B+E,EAAgB/E,GAAW,CAC5B,EAIGmG,EAAqBC,KAAuC,iCAAIA,KAAuC,kCAAK,GAChHD,EAAmBvD,QAAQ+C,EAAqB5C,KAAK,KAAM,IAC3DoD,EAAmBhF,KAAOwE,EAAqB5C,KAAK,KAAMoD,EAAmBhF,KAAK4B,KAAKoD,G,sFCpF1EE,EAAOC,IAAAA,MAAW,kBAAM,2BAA+D,ICM9FD,EAAO,SAACE,GACV,OACID,IAAAA,cAACA,IAAAA,SAAc,CAACE,SAAU,MACtBF,IAAAA,cAACG,EAAkBF,GAG/B,EAEAF,EAAKK,aAAe,CAAEC,uBAAwB,EAAGC,iBAAkB,GAAIC,WAAY,CAAC,EAAGC,aAAc,IAErGT,EAAKU,UAAY,CAIbb,GAAIc,IAAAA,OAKJC,KAAMD,IAAAA,OAKNE,IAAKF,IAAAA,OAQLL,uBAAwBK,IAAAA,OASxBJ,iBAAkBI,IAAAA,QAAkBA,IAAAA,QAQpCH,WAAYG,IAAAA,OAKZG,MAAOH,IAAAA,OAKPI,UAAWJ,IAAAA,OAMXF,aAAcE,IAAAA,OAMdK,SAAUL,IAAAA,MAGd,S","sources":["webpack:///webpack/runtime/load script","webpack:///external window \"PropTypes\"","webpack:///external window \"React\"","webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/ensure chunk","webpack:///webpack/runtime/get javascript chunk filename","webpack:///webpack/runtime/global","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///webpack/runtime/publicPath","webpack:///webpack/runtime/compat","webpack:///webpack/runtime/jsonp chunk loading","webpack:///./src/lib/LazyLoader.js","webpack:///./src/lib/components/Vega.react.js"],"sourcesContent":["var inProgress = {};\nvar dataWebpackPrefix = \"dash_vega_components:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","module.exports = window[\"PropTypes\"];","module.exports = window[\"React\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + \"async-Vega\" + \".js\";\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","var getCurrentScript = function() {\n var script = document.currentScript;\n if (!script) {\n /* Shim for IE11 and below */\n /* Do not take into account async scripts and inline scripts */\n\n var doc_scripts = document.getElementsByTagName('script');\n var scripts = [];\n\n for (var i = 0; i < doc_scripts.length; i++) {\n scripts.push(doc_scripts[i]);\n }\n\n scripts = scripts.filter(function(s) { return !s.async && !s.text && !s.textContent; });\n script = scripts.slice(-1)[0];\n }\n\n return script;\n};\n\nvar isLocalScript = function(script) {\n return /\\/_dash-component-suites\\//.test(script.src);\n};\n\nObject.defineProperty(__webpack_require__, 'p', {\n get: (function () {\n var script = getCurrentScript();\n\n var url = script.src.split('/').slice(0, -1).join('/') + '/';\n\n return function() {\n return url;\n };\n })()\n});\n\nif (typeof jsonpScriptSrc !== 'undefined') {\n var __jsonpScriptSrc__ = jsonpScriptSrc;\n jsonpScriptSrc = function(chunkId) {\n var script = getCurrentScript();\n var isLocal = isLocalScript(script);\n\n var src = __jsonpScriptSrc__(chunkId);\n\n if(!isLocal) {\n return src;\n }\n\n var srcFragments = src.split('/');\n var fileFragments = srcFragments.slice(-1)[0].split('.');\n\n fileFragments.splice(1, 0, \"v0_8_2m1699693262\");\n srcFragments.splice(-1, 1, fileFragments.join('.'))\n\n return srcFragments.join('/');\n };\n}\n","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t179: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n// no on chunks loaded\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkdash_vega_components\"] = self[\"webpackChunkdash_vega_components\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","import React from 'react';\nexport const Vega = React.lazy(() => import(/* webpackChunkName: \"Vega\" */ './fragments/Vega.react'));","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Vega as RealComponent } from '../LazyLoader';\n\n/**\n * You can use this component to display Altair charts or Vega-Lite/Vega specifications in your Dash app.\n */\nconst Vega = (props) => {\n return (\n \n \n \n );\n};\n\nVega.defaultProps = { svgRendererScaleFactor: 1, signalsToObserve: [], signalData: {}, debounceWait: 10 };\n\nVega.propTypes = {\n /**\n * The ID used to identify this component in Dash callbacks.\n */\n id: PropTypes.string,\n\n /**\n * A Vega or Vega-Lite spec. To pass an Altair chart, use chart.to_dict().\n */\n spec: PropTypes.object,\n\n /**\n * Vega-Embed options. See https://github.com/vega/vega-embed#options for more details.\n */\n opt: PropTypes.object,\n\n /**\n * A number which is used to scale the chart in case the svg renderer is used.\n * This is useful when you want to increase the size of the chart keeping\n * the relative proportions of all chart elements to each other the same.\n * Default value is 1.\n */\n svgRendererScaleFactor: PropTypes.number,\n\n /**\n * A list of signal names to observe for changes. If you use Altair, these are the\n * names of the parameters you define. The values of these signals\n * will be available in the signalData property. You can pass [\"all\"] to\n * observe all signals.\n * Defaults to no signals.\n */\n signalsToObserve: PropTypes.arrayOf(PropTypes.string),\n\n /**\n * A read-only dictionary of signals with the key being the name of the signal.\n * The easiest way to make sense of it is to display the whole signalData dictionary\n * in your app layout or print it to the console\n * so that you see what the structure looks like.\n */\n signalData: PropTypes.object,\n\n /**\n * Generic style overrides on the Vega div\n */\n style: PropTypes.object,\n\n /**\n * Additional className of the Vega div\n */\n className: PropTypes.string,\n\n /**\n * Debouncing wait time in milliseconds before signals property is updated\n * Default value is 10.\n */\n debounceWait: PropTypes.number,\n\n /**\n * Dash-assigned callback that should be called to report property changes\n * to Dash, to make them available for callbacks.\n */\n setProps: PropTypes.func\n};\n\nexport default Vega;\n\nexport const defaultProps = Vega.defaultProps;\nexport const propTypes = Vega.propTypes;\n"],"names":["inProgress","dataWebpackPrefix","module","exports","window","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","m","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","f","e","chunkId","Promise","all","keys","reduce","promises","u","g","globalThis","this","Function","obj","prop","prototype","hasOwnProperty","call","l","url","done","push","script","needAttach","scripts","document","getElementsByTagName","i","length","s","getAttribute","createElement","charset","timeout","nc","setAttribute","src","onScriptComplete","prev","event","onerror","onload","clearTimeout","doneFns","parentNode","removeChild","forEach","fn","setTimeout","bind","type","target","head","appendChild","r","Symbol","toStringTag","value","scriptUrl","importScripts","location","currentScript","Error","replace","p","getCurrentScript","doc_scripts","filter","async","text","textContent","slice","split","join","jsonpScriptSrc","__jsonpScriptSrc__","isLocal","test","srcFragments","fileFragments","splice","installedChunks","j","installedChunkData","promise","resolve","reject","error","errorType","realSrc","message","name","request","webpackJsonpCallback","parentChunkLoadingFunction","data","chunkIds","moreModules","runtime","some","id","chunkLoadingGlobal","self","Vega","React","props","fallback","RealComponent","defaultProps","svgRendererScaleFactor","signalsToObserve","signalData","debounceWait","propTypes","PropTypes","spec","opt","style","className","setProps"],"sourceRoot":""} \ No newline at end of file diff --git a/dash_vega_components/package-info.json b/dash_vega_components/package-info.json index 86891aa..735647e 100644 --- a/dash_vega_components/package-info.json +++ b/dash_vega_components/package-info.json @@ -1,6 +1,6 @@ { "name": "dash_vega_components", - "version": "0.9.0dev", + "version": "0.8.2", "description": "Dash Vega Components", "repository": { "type": "git", diff --git a/package-lock.json b/package-lock.json index 1f73091..f92264e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dash_vega_components", - "version": "0.9.0dev", + "version": "0.8.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dash_vega_components", - "version": "0.9.0dev", + "version": "0.8.2", "license": "BSD", "dependencies": { "d3": "^7.8.5", diff --git a/package.json b/package.json index 86891aa..735647e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dash_vega_components", - "version": "0.9.0dev", + "version": "0.8.2", "description": "Dash Vega Components", "repository": { "type": "git",